GhostPointGenerator.cpp
2 
3 namespace
4 {
5  size_t IsBoundaryEdge(Edge const& edge, int npoints)
6  {
7  if (edge.neighbors.first >= npoints)
8  return 1;
9  if (edge.neighbors.second >= npoints)
10  return 2;
11  else
12  return 0;
13  }
14 }
15 
17 
18 vector<std::pair<size_t, size_t> > GhostPointGenerator::GetOuterEdgesIndeces(Tessellation const& tess)const
19 {
20  vector<Edge> const& edges = tess.getAllEdges();
21  vector<std::pair<size_t, size_t> > res;
22  int npoints = tess.GetPointNo();
23  for (size_t i = 0; i < edges.size(); ++i)
24  {
25  const size_t ghostindex = IsBoundaryEdge(edges[i], npoints);
26  if (ghostindex == 1)
27  {
28  if(tess.GetOriginalIndex(edges[i].neighbors.first)<npoints)
29  res.push_back(std::pair<size_t, size_t>(i, 1));
30  }
31  if (ghostindex == 2)
32  {
33  if (tess.GetOriginalIndex(edges[i].neighbors.second)<npoints)
34  res.push_back(std::pair<size_t, size_t>(i, 2));
35  }
36  }
37  return res;
38 }
39 
Abstract class for tessellation.
virtual int GetPointNo(void) const =0
Get Total number of mesh generating points.
virtual int GetOriginalIndex(int point) const
Returns the original index of the duplicated point.
Definition: tessellation.cpp:5
Interface between two cells.
Definition: Edge.hpp:13
Abstract class for creating computationalcells of ghost points.
vector< std::pair< size_t, size_t > > GetOuterEdgesIndeces(Tessellation const &tess) const
Finds the indeces of the outer edges points.
virtual const vector< Edge > & getAllEdges(void) const =0
Returns reference to the list of all edges.
virtual ~GhostPointGenerator(void)
Virtual destructor.
std::pair< int, int > neighbors
Neighboring cells.
Definition: Edge.hpp:21
Checks if a certain edge is a boundary edge.