PeriodicGhostGenerator.cpp
2 
3 boost::container::flat_map<size_t, ComputationalCell> PeriodicGhostGenerator::operator() (const Tessellation& tess,
4  const vector<ComputationalCell>& cells, double /*time*/, TracerStickerNames const& /*tracerstickernames*/) const
5 {
6  boost::container::flat_map<size_t, ComputationalCell> res;
7  vector<std::pair<size_t, size_t> > ghosts = GetOuterEdgesIndeces(tess);
8  for (size_t i = 0; i < ghosts.size(); ++i)
9  {
10 
11  Edge const& edge = tess.GetEdge(static_cast<int>(ghosts[i].first));
12  ComputationalCell ctemp = cells[static_cast<size_t>(ghosts[i].second == 2 ?
13  tess.GetOriginalIndex(edge.neighbors.second) : tess.GetOriginalIndex(edge.neighbors.first))];
14  res.insert(std::pair<size_t, ComputationalCell>(ghosts[i].second == 1 ? static_cast<size_t> (edge.neighbors.first)
15  : static_cast<size_t>(edge.neighbors.second), ctemp));
16  }
17  return res;
18 }
19 
21  const vector<ComputationalCell>& /*cells*/, const vector<Slope>& gradients,
22  size_t ghost_index, double /*time*/, Edge const& /*edge*/, TracerStickerNames const& /*tracerstickernames*/) const
23 {
24  return gradients[static_cast<size_t>(tess.GetOriginalIndex(static_cast<int>(ghost_index)))];
25 }
26 
Abstract class for tessellation.
virtual int GetOriginalIndex(int point) const
Returns the original index of the duplicated point.
Definition: tessellation.cpp:5
boost::container::flat_map< size_t, ComputationalCell > operator()(const Tessellation &tess, const vector< ComputationalCell > &cells, double time, TracerStickerNames const &tracerstickernames) const
Calculates the ghost points.
Slope GetGhostGradient(const Tessellation &tess, const vector< ComputationalCell > &cells, const vector< Slope > &gradients, size_t ghost_index, double time, const Edge &edge, TracerStickerNames const &tracerstickernames) const
Calculates the gradients for the ghost cells.
Interface between two cells.
Definition: Edge.hpp:13
Class for spatial interpolations.
virtual Edge const & GetEdge(int index) const =0
Returns edge (interface between cells)
vector< std::pair< size_t, size_t > > GetOuterEdgesIndeces(Tessellation const &tess) const
Finds the indeces of the outer edges points.
Class for creating computationalcells of ghost points for periodic boundaries.
Class for keeping the names of the tracers and stickers.
std::pair< int, int > neighbors
Neighboring cells.
Definition: Edge.hpp:21
Computational cell.