Skip to content

Libs/Optimize/Function/VectorFunction.h

Namespaces

Name
shapeworks
User usage reporting (telemetry)

Classes

Name
class shapeworks::VectorFunction

Source code

```cpp

pragma once

include

include "Libs/Optimize/ParticleSystem.h"

include "vnl/vnl_vector_fixed.h"

namespace shapeworks {

class VectorFunction { public: constexpr static unsigned int Dimension = 3;

using VectorType = vnl_vector_fixed;

virtual VectorType evaluate(unsigned int, unsigned int, const ParticleSystem, double& maxtimestep) const = 0; virtual VectorType evaluate(unsigned int, unsigned int, const ParticleSystem, double& maxtimestep, double& energy) const = 0; virtual double energy(unsigned int, unsigned int, const ParticleSystem*) const = 0;

virtual void reset_buffers() {}

virtual void after_iteration() {}

virtual void before_iteration() {}

virtual void before_evaluate(unsigned int, unsigned int, const ParticleSystem*) {}

virtual void set_particle_system(ParticleSystem p) { particle_system_ = p; } virtual ParticleSystem get_particle_system() const { return particle_system_; } virtual void set_domain_number(unsigned int i) { domain_number_ = i; } virtual int get_domain_number() const { return domain_number_; }

virtual std::shared_ptr clone() { std::cerr << "Error: base class VectorFunction clone method called!\n"; std::cerr << "Threaded run of current parameters not supported!\n"; return nullptr; }

virtual double get_relative_energy_scaling() const { return 1.0; } virtual void set_relative_energy_scaling(double r) { return; }

virtual ~VectorFunction() = default;

protected: VectorFunction() : particle_system_(nullptr), domain_number_(0) {} VectorFunction(const VectorFunction&) = delete; VectorFunction& operator=(const VectorFunction&) = delete;

ParticleSystem* particle_system_; unsigned int domain_number_; };

} // namespace shapeworks ```


Updated on 2026-03-31 at 16:02:11 +0000