19 #include "itkPSMCostFunction.h" 24 template <
unsigned int VDimension>
30 typedef SmartPointer<Self> Pointer;
31 typedef SmartPointer<const Self> ConstPointer;
52 virtual VectorType
Evaluate(
unsigned int,
unsigned int,
53 const ParticleSystemType *,
double &maxtimestep,
62 virtual VectorType
Evaluate(
unsigned int a,
unsigned int b,
63 const ParticleSystemType *c,
double &d)
const 68 virtual double Energy(
unsigned int a,
unsigned int b,
69 const ParticleSystemType *c)
const 94 int itkPSMCostFunctionTest(
int,
char* [] )
97 std::string errstring =
"";
103 double maxtimestep = 0.0f;
104 double energy = 0.0f;
109 if (a != p->
Evaluate(0,0,ps,maxtimestep,energy) || maxtimestep != 1.0f || energy != 1.0f)
112 errstring =
"Problem calling the Evaluate function";
115 catch(itk::ExceptionObject &e)
117 errstring =
"ITK exception with description: " + std::string(e.GetDescription())
118 + std::string(
"\n at location:") + std::string(e.GetLocation())
119 + std::string(
"\n in file:") + std::string(e.GetFile());
124 errstring =
"Unknown exception thrown";
130 std::cout <<
"All tests passed" << std::endl;
135 std::cout <<
"Test failed with the following error:" << std::endl;
136 std::cout << errstring << std::endl;
virtual VectorType Evaluate(unsigned int, unsigned int, const ParticleSystemType *, double &maxtimestep, double &energy) const
Superclass::ParticleSystemType ParticleSystemType
virtual VectorType Evaluate(unsigned int a, unsigned int b, const ParticleSystemType *c, double &d) const
A facade class that manages interactions with a particle system.
virtual void AfterIteration()
Superclass::VectorType VectorType
vnl_vector_fixed< double, VDimension > VectorType
itkStaticConstMacro(Dimension, unsigned int, VDimension)
PSMParticleSystem< VDimension > ParticleSystemType
virtual void BeforeIteration()