38template <
unsigned SPACE_DIM>
45template <
unsigned SPACE_DIM>
55template <
unsigned SPACE_DIM>
59 return std::make_pair(std::min(indexA, indexB), std::max(indexA, indexB));
62template<
unsigned SPACE_DIM>
68template<
unsigned SPACE_DIM>
74template<
unsigned SPACE_DIM>
80template<
unsigned SPACE_DIM>
86template<
unsigned SPACE_DIM>
89 assert(mNodes.size() == 2);
90 const unsigned index0 = mNodes[0]->GetIndex();
91 const unsigned index1 = mNodes[1]->GetIndex();
95template<
unsigned SPACE_DIM>
101template<
unsigned SPACE_DIM>
109 this->mNodes.push_back(pNodeA);
110 this->mNodes.push_back(pNodeB);
113template<
unsigned SPACE_DIM>
117 for (
unsigned i = 0; i < 2; i++)
119 if (this->mNodes[i] == pOldNode)
121 this->mNodes[i] = pNewNode;
127template<
unsigned SPACE_DIM>
130 return mNodes[index];
133template<
unsigned SPACE_DIM>
136 return mNodes.size();
139template<
unsigned SPACE_DIM>
142 for (
auto p_node : mNodes)
144 if (p_node->GetIndex() == pNode->
GetIndex())
152template<
unsigned SPACE_DIM>
155 assert(mNodes.size() == 2);
156 return 0.5*(mNodes[0]->rGetLocation() + mNodes[1]->rGetLocation());
159template<
unsigned SPACE_DIM>
162 assert(mNodes.size() == 2);
163 return norm_2(mNodes[0]->rGetLocation() - mNodes[1]->rGetLocation());
166template<
unsigned SPACE_DIM>
169 std::set<unsigned> otherElements;
170 for (
unsigned elem: mElementIndices)
172 if (elem != elementIndex)
174 otherElements.insert(elem);
177 return otherElements;
180template<
unsigned SPACE_DIM>
183 mElementIndices.insert(elementIndex);
186template<
unsigned SPACE_DIM>
189 mElementIndices.erase(elementIndex);
192template<
unsigned SPACE_DIM>
195 std::set<unsigned> neighbouring_element_indices;
197 auto elem_indices0 = mNodes[0]->rGetContainingElementIndices();
198 auto elem_indices1 = mNodes[1]->rGetContainingElementIndices();
200 std::set_intersection(elem_indices0.begin(), elem_indices0.end(),
201 elem_indices1.begin(), elem_indices1.end(),
202 std::inserter(neighbouring_element_indices, neighbouring_element_indices.begin()));
204 return neighbouring_element_indices;
207template<
unsigned SPACE_DIM>
210 return mElementIndices.size();
213template<
unsigned SPACE_DIM>
216 return mElementIndices.size()<=1;
219template <
unsigned SPACE_DIM>
222 return this->ContainsNode(rEdge.
GetNode(0)) && this->ContainsNode(rEdge.
GetNode(1));
bool ContainsNode(Node< SPACE_DIM > *pNode) const
void SetNodes(Node< SPACE_DIM > *pNodeA, Node< SPACE_DIM > *pNodeB)
void RemoveElement(unsigned elementIndex)
c_vector< double, SPACE_DIM > rGetCentreLocation()
std::set< unsigned > GetNeighbouringElementIndices()
unsigned GetIndex() const
Node< SPACE_DIM > * GetNode(unsigned index) const
static std::pair< unsigned, unsigned > GenerateMapIndex(unsigned index1, unsigned index2)
std::set< unsigned > GetOtherElements(unsigned elementIndex)
bool operator==(const Edge< SPACE_DIM > &rEdge) const
void ReplaceNode(Node< SPACE_DIM > *pOldNode, Node< SPACE_DIM > *pNewNode)
void SetIndex(unsigned index)
unsigned GetNumElements()
bool IsBoundaryEdge() const
void AddElement(unsigned elementIndex)
std::pair< unsigned, unsigned > GetMapIndex()
unsigned GetIndex() const