36 #include "AdhesionPottsUpdateRule.hpp" 38 template<
unsigned DIM>
41 mCellCellAdhesionEnergyParameter(0.1),
42 mCellBoundaryAdhesionEnergyParameter(0.2)
46 template<
unsigned DIM>
51 template<
unsigned DIM>
53 unsigned targetNodeIndex,
56 std::set<unsigned> containing_elements = rCellPopulation.
GetNode(currentNodeIndex)->rGetContainingElementIndices();
57 std::set<unsigned> new_location_containing_elements = rCellPopulation.
GetNode(targetNodeIndex)->rGetContainingElementIndices();
59 bool current_node_contained = !containing_elements.empty();
60 bool target_node_contained = !new_location_containing_elements.empty();
63 assert(new_location_containing_elements.size() < 2);
65 if (!current_node_contained && !target_node_contained)
67 EXCEPTION(
"At least one of the current node or target node must be in an element.");
70 if (current_node_contained && target_node_contained)
72 if (*(new_location_containing_elements.begin()) == *(containing_elements.begin()))
74 EXCEPTION(
"The current node and target node must not be in the same element.");
80 std::set<unsigned> target_neighbouring_node_indices = rCellPopulation.
rGetMesh().GetVonNeumannNeighbouringNodeIndices(targetNodeIndex);
81 for (std::set<unsigned>::iterator iter = target_neighbouring_node_indices.begin();
82 iter != target_neighbouring_node_indices.end();
85 std::set<unsigned> neighbouring_node_containing_elements = rCellPopulation.
rGetMesh().GetNode(*iter)->rGetContainingElementIndices();
88 assert(neighbouring_node_containing_elements.size() < 2);
90 bool neighbouring_node_contained = !neighbouring_node_containing_elements.empty();
98 if (neighbouring_node_contained && target_node_contained)
100 unsigned neighbour_element = (*neighbouring_node_containing_elements.begin());
101 unsigned target_element = (*new_location_containing_elements.begin());
102 if (target_element != neighbour_element)
108 else if (neighbouring_node_contained && !target_node_contained)
111 unsigned neighbour_element = (*neighbouring_node_containing_elements.begin());
114 else if (!neighbouring_node_contained && target_node_contained)
117 unsigned target_element = (*new_location_containing_elements.begin());
127 if (neighbouring_node_contained && current_node_contained)
129 unsigned neighbour_element = (*neighbouring_node_containing_elements.begin());
130 unsigned current_element = (*containing_elements.begin());
131 if (current_element != neighbour_element)
137 else if (neighbouring_node_contained && !current_node_contained)
140 unsigned neighbour_element = (*neighbouring_node_containing_elements.begin());
143 else if (!neighbouring_node_contained && current_node_contained)
146 unsigned current_element = (*containing_elements.begin());
154 template<
unsigned DIM>
160 template<
unsigned DIM>
166 template<
unsigned DIM>
172 template<
unsigned DIM>
178 template<
unsigned DIM>
184 template<
unsigned DIM>
190 template<
unsigned DIM>
double GetCellCellAdhesionEnergyParameter()
virtual void OutputUpdateRuleParameters(out_stream &rParamsFile)
double GetCellBoundaryAdhesionEnergyParameter()
virtual CellPtr GetCellUsingLocationIndex(unsigned index)
double mCellCellAdhesionEnergyParameter
Node< DIM > * GetNode(unsigned index)
virtual double GetCellCellAdhesionEnergy(CellPtr pCellA, CellPtr pCellB)
PottsMesh< DIM > & rGetMesh()
#define EXCEPTION(message)
void OutputUpdateRuleParameters(out_stream &rParamsFile)
virtual double GetCellBoundaryAdhesionEnergy(CellPtr pCell)
double mCellBoundaryAdhesionEnergyParameter
double EvaluateHamiltonianContribution(unsigned currentNodeIndex, unsigned targetNodeIndex, PottsBasedCellPopulation< DIM > &rCellPopulation)
#define EXPORT_TEMPLATE_CLASS_SAME_DIMS(CLASS)
void SetCellBoundaryAdhesionEnergyParameter(double cellBoundaryAdhesionEnergyParameter)
void SetCellCellAdhesionEnergyParameter(double cellCellAdhesionEnergyEnergyParameter)
virtual ~AdhesionPottsUpdateRule()
AdhesionPottsUpdateRule()