18 #ifndef __itkPSMTwoCostFunction_hxx 19 #define __itkPSMTwoCostFunction_hxx 20 #include "itkPSMTwoCostFunction.h" 25 template <
unsigned int VDimension>
30 double &maxmove)
const 45 ansA = m_FunctionA->
Evaluate(idx, d, system, maxA);
46 const_cast<PSMTwoCostFunction *
>(
this)->m_AverageGradMagA = m_AverageGradMagA + ansA.magnitude();
52 ansB = m_FunctionB->
Evaluate(idx, d, system, maxB);
53 const_cast<PSMTwoCostFunction *
>(
this)->m_AverageGradMagB = m_AverageGradMagB + ansB.magnitude();
61 if (maxA > maxB) maxmove = maxB;
63 return (ansA + m_RelativeGradientScaling * ansB);
83 template <
unsigned int VDimension>
88 double &maxmove,
double &energy)
const 102 ansA = m_FunctionA->
Evaluate(idx, d, system, maxA, energyA);
104 const_cast<PSMTwoCostFunction *
>(
this)->m_AverageGradMagA = m_AverageGradMagA + ansA.magnitude();
105 const_cast<PSMTwoCostFunction *
>(
this)->m_AverageEnergyA = m_AverageEnergyA + energyA;
110 ansB = m_FunctionB->
Evaluate(idx, d, system, maxB, energyB);
112 const_cast<PSMTwoCostFunction *
>(
this)->m_AverageGradMagB = m_AverageGradMagB + ansB.magnitude();
113 const_cast<PSMTwoCostFunction *
>(
this)->m_AverageEnergyB = m_AverageEnergyB + energyB;
122 if (maxA > maxB) maxmove = maxB;
124 energy = energyA + m_RelativeEnergyScaling * energyB;
125 return (ansA + m_RelativeGradientScaling * ansB);
147 template <
unsigned int VDimension>
150 ::Energy(
unsigned int idx,
unsigned int d,
156 if (m_AOn ) ansA = m_FunctionA->Energy(idx, d, system);
157 if (m_BOn ) ansB = m_FunctionB->Energy(idx, d, system);
164 {
return ansA + m_RelativeEnergyScaling * ansB; }
virtual VectorType Evaluate(unsigned int idx, unsigned int d, const ParticleSystemType *system, double &maxmove) const
A facade class that manages interactions with a particle system.
vnl_vector_fixed< double, VDimension > VectorType
Superclass::VectorType VectorType