Skip to content

Libs/Optimize/ParticleSystem/itkParticleVectorFunction.h

Namespaces

Name
itk

Classes

Name
class itk::ParticleVectorFunction

Source code

#pragma once

#include "itkLightObject.h"
#include "itkObjectFactory.h"
#include "itkParticleSystem.h"
#include "itkWeakPointer.h"
#include "vnl/vnl_vector_fixed.h"

namespace itk {

template <unsigned int VDimension>
class ParticleVectorFunction : public LightObject {
 public:
  typedef ParticleVectorFunction Self;
  typedef SmartPointer<Self> Pointer;
  typedef SmartPointer<const Self> ConstPointer;
  typedef LightObject Superclass;
  itkTypeMacro(ParticleVectorFunction, LightObject);

  typedef ParticleSystem ParticleSystemType;

  typedef vnl_vector_fixed<double, VDimension> VectorType;

  //  itkNewMacro(Self);

  itkStaticConstMacro(Dimension, unsigned int, VDimension);

  virtual VectorType Evaluate(unsigned int, unsigned int, const ParticleSystemType *, double &maxtimestep) const = 0;
  virtual VectorType Evaluate(unsigned int, unsigned int, const ParticleSystemType *, double &maxtimestep,
                              double &energy) const = 0;
  virtual double Energy(unsigned int, unsigned int, const ParticleSystemType *) const = 0;

  virtual void ResetBuffers() {}

  virtual void AfterIteration() {}

  virtual void BeforeIteration() {}

  virtual void BeforeEvaluate(unsigned int, unsigned int, const ParticleSystemType *) {}

  virtual void SetParticleSystem(ParticleSystemType *p) { m_ParticleSystem = p; }
  virtual ParticleSystemType *GetParticleSystem() const { return m_ParticleSystem; }
  virtual void SetDomainNumber(unsigned int i) { m_DomainNumber = i; }
  virtual int GetDomainNumber() const { return m_DomainNumber; }

  virtual typename ParticleVectorFunction<VDimension>::Pointer Clone() {
    std::cerr << "Error: base class ParticleVectorFunction Clone method called!\n";
    std::cerr << "Threaded run of current parameters not supported!\n";
    return nullptr;
  }

 protected:
  ParticleVectorFunction() : m_ParticleSystem(0), m_DomainNumber(0) {}
  virtual ~ParticleVectorFunction() {}
  void operator=(const ParticleVectorFunction &);
  ParticleVectorFunction(const ParticleVectorFunction &);

  ParticleSystemType *m_ParticleSystem;
  unsigned int m_DomainNumber;
};

}  // namespace itk

Updated on 2022-07-23 at 17:50:04 -0600