53 unsigned targetNodeIndex,
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());