36 #include "AbstractTwoBodyInteractionForce.hpp" 38 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
41 mUseCutOffLength(false),
42 mMechanicsCutOffLength(DBL_MAX)
46 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
52 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
55 assert(cutOffLength > 0.0);
60 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
66 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
72 EXCEPTION(
"Subclasses of AbstractTwoBodyInteractionForce are to be used with subclasses of AbstractCentreBasedCellPopulation only");
82 spring_iterator != p_static_cast_cell_population->
SpringsEnd();
85 unsigned nodeA_global_index = spring_iterator.GetNodeA()->GetIndex();
86 unsigned nodeB_global_index = spring_iterator.GetNodeB()->GetIndex();
92 c_vector<double, SPACE_DIM> negative_force = -1.0*force;
93 spring_iterator.GetNodeB()->AddAppliedForceContribution(negative_force);
94 spring_iterator.GetNodeA()->AddAppliedForceContribution(force);
104 iter != r_node_pairs.end();
109 unsigned node_a_index = pair.first->
GetIndex();
110 unsigned node_b_index = pair.second->GetIndex();
114 for (
unsigned j=0; j<SPACE_DIM; j++)
116 assert(!std::isnan(force[j]));
120 c_vector<double, SPACE_DIM> negative_force = -1.0*force;
121 pair.first->AddAppliedForceContribution(force);
122 pair.second->AddAppliedForceContribution(negative_force);
127 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
130 *rParamsFile <<
"\t\t\t<UseCutOffLength>" <<
mUseCutOffLength <<
"</UseCutOffLength>\n";
137 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
virtual void OutputForceParameters(out_stream &rParamsFile)
SpringIterator SpringsEnd()
SpringIterator SpringsBegin()
void SetCutOffLength(double cutOffLength)
bool GetUseCutOffLength()
AbstractTwoBodyInteractionForce()
#define EXCEPTION(message)
virtual void WriteDataToVisualizerSetupFile(out_stream &pVizSetupFile)
virtual c_vector< double, SPACE_DIM > CalculateForceBetweenNodes(unsigned nodeAGlobalIndex, unsigned nodeBGlobalIndex, AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM > &rCellPopulation)=0
void AddForceContribution(AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM > &rCellPopulation)
virtual std::vector< std::pair< Node< SPACE_DIM > *, Node< SPACE_DIM > * > > & rGetNodePairs()=0
double mMechanicsCutOffLength
unsigned GetIndex() const
virtual void OutputForceParameters(out_stream &rParamsFile)=0