FreeFlowGhostGenerator.cpp
2 
3 boost::container::flat_map<size_t, ComputationalCell> FreeFlowGenerator::operator() (const Tessellation& tess,
4  const vector<ComputationalCell>& cells, double /*time*/, TracerStickerNames const& /*tracerstickernames*/) const
5 {
6  vector<std::pair<size_t, size_t> > outer_edges = GetOuterEdgesIndeces(tess);
7  boost::container::flat_map<size_t, ComputationalCell> res;
8  for (size_t i = 0; i < outer_edges.size(); ++i)
9  {
10  Edge const& edge = tess.GetEdge(static_cast<int>(outer_edges[i].first));
11  size_t ghost_index = static_cast<size_t>(outer_edges[i].second == 1 ? edge.neighbors.first : edge.neighbors.second);
12  if (tess.GetOriginalIndex(static_cast<int>(ghost_index)) < tess.GetPointNo())
13  {
14  int real_cell = outer_edges[i].second == 1 ? edge.neighbors.second : edge.neighbors.first;
15  res[ghost_index] = cells[static_cast<size_t>(real_cell)];
16  }
17  else
18  res.insert(std::pair<size_t, ComputationalCell>(ghost_index, cells[ghost_index]));
19  }
20  return res;
21 }
22 
24  vector<ComputationalCell> const& cells, vector<Slope> const& /*gradients*/,
25  size_t ghost_index, double /*time*/, Edge const& /*edge*/, TracerStickerNames const&
26  /*tracerstickernames*/)const
27 {
28  ComputationalCell cell(cells[static_cast<size_t>(tess.GetOriginalIndex(static_cast<int>(ghost_index)))]);
29  cell.density = 0;
30  cell.pressure = 0;
31  cell.velocity = Vector2D(0, 0);
32  cell.tracers = cells[0].tracers;
33  size_t N = cell.tracers.size();
34  for (size_t i = 0; i < N; ++i)
35  cell.tracers[i] = 0;
36  return Slope(cell, cell);
37 }
Abstract class for tessellation.
virtual int GetPointNo(void) const =0
Get Total number of mesh generating points.
Class for creating computationalcells of ghost points for free flow that allows only outflow...
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
Class for spatial interpolations.
tvector tracers
Tracers (can transfer from one cell to another)
virtual Edge const & GetEdge(int index) const =0
Returns edge (interface between cells)
double pressure
Pressure.
vector< std::pair< size_t, size_t > > GetOuterEdgesIndeces(Tessellation const &tess) const
Finds the indeces of the outer edges points.
Class for keeping the names of the tracers and stickers.
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.
std::pair< int, int > neighbors
Neighboring cells.
Definition: Edge.hpp:21
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.
Vector2D velocity
Velocity.
2D Mathematical vector
Definition: geometry.hpp:15
Computational cell.