36#include "EdgeHelper.hpp"
38template<
unsigned SPACE_DIM>
43template<
unsigned SPACE_DIM>
52 auto edge_iter = mEdgesMap.find(edge_map_indices);
53 if (edge_iter == mEdgesMap.end() || edge_iter->second->IsDeleted())
55 mEdges.push_back(std::make_unique<
Edge<SPACE_DIM>> (mEdges.size(), pNodeA, pNodeB));
56 p_edge = mEdges.back().get();
57 mEdgesMap[edge_map_indices] = p_edge;
61 p_edge = edge_iter->second;
68template<
unsigned SPACE_DIM>
74 auto p_edge = GetEdgeFromNodes(pNodeA, pNodeB);
75 p_edge->AddElement(elementIndex);
79template<
unsigned SPACE_DIM>
82 assert(index < mEdges.size());
83 return mEdges[index].get();
86template<
unsigned SPACE_DIM>
89 assert(index < mEdges.size());
90 return mEdges[index].get();
93template<
unsigned SPACE_DIM>
100 std::vector<std::unique_ptr<Edge<SPACE_DIM> > > live_edges;
102 for (
auto& p_edge : mEdges)
105 if (p_edge->GetNumElements() != 0)
107 live_edges.push_back(std::move(p_edge));
119 mEdges = std::move(live_edges);
122 for (
unsigned i = 0; i < this->mEdges.size(); ++i)
124 mEdges[i]->SetIndex(i);
130template<
unsigned SPACE_DIM>
135 for (
auto& p_edge : mEdges)
137 mEdgesMap[p_edge->GetMapIndex()] = p_edge.get();
141template<
unsigned SPACE_DIM>
144 return mEdges.size();
unsigned GetNumEdges() const
Edge< SPACE_DIM > * operator[](unsigned index) const
Edge< SPACE_DIM > * GetEdge(unsigned index) const
Edge< SPACE_DIM > * GetEdgeFromNodes(Node< SPACE_DIM > *pNodeA, Node< SPACE_DIM > *pNodeB)
void RemoveDeletedEdges()
void SetNodes(Node< SPACE_DIM > *pNodeA, Node< SPACE_DIM > *pNodeB)
static std::pair< unsigned, unsigned > GenerateMapIndex(unsigned index1, unsigned index2)
unsigned GetIndex() const