ConstantPrimitiveGenerator.cpp
2 
4 
6  vector<ComputationalCell> const& /*cells*/, vector<Slope> const& gradients,
7  size_t ghost_index, double /*time*/,Edge const& /*edge*/,TracerStickerNames const& /*tracerstickernames*/)const
8 {
9  if (tess.GetOriginalIndex(static_cast<int>(ghost_index)) < tess.GetPointNo())
10  {
11  Slope res;
12  res.xderivative.tracers.resize(cell_.tracers.size(), 0);
13  res.yderivative.tracers.resize(cell_.tracers.size(), 0);
14  res.xderivative.stickers.resize(cell_.stickers.size(), 0);
15  res.yderivative.stickers.resize(cell_.stickers.size(), 0);
16  return res;
17  }
18  else
19  return gradients[ghost_index];
20 }
21 
22 boost::container::flat_map<size_t, ComputationalCell> ConstantPrimitiveGenerator::operator() (const Tessellation& tess,
23  const vector<ComputationalCell>& cells, double /*time*/,TracerStickerNames const& /*tracerstickernames*/) const
24 {
25  vector<std::pair<size_t, size_t> > outer_edges = GetOuterEdgesIndeces(tess);
26  boost::container::flat_map<size_t, ComputationalCell> res;
27  for (size_t i = 0; i < outer_edges.size(); ++i)
28  {
29  Edge const& edge = tess.GetEdge(static_cast<int>(outer_edges[i].first));
30  size_t ghost_index = static_cast<size_t>(outer_edges[i].second == 1 ? edge.neighbors.first : edge.neighbors.second);
31  if (tess.GetOriginalIndex(static_cast<int>(ghost_index)) < tess.GetPointNo())
32  res[ghost_index] = cell_;
33  else
34  res[ghost_index] = cells[ghost_index];
35  }
36  return res;
37 }
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
Class for creating computationalcells of ghost points for free flow.
Interface between two cells.
Definition: Edge.hpp:13
Class for spatial interpolations.
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.
tvector tracers
Tracers (can transfer from one cell to another)
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.
ComputationalCell xderivative
Slope in the x direction.
svector stickers
Stickers (stick to the same cell)
Class for keeping the names of the tracers and stickers.
std::pair< int, int > neighbors
Neighboring cells.
Definition: Edge.hpp:21
ConstantPrimitiveGenerator(ComputationalCell const &cell)
Class constructor.
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.
Computational cell.
ComputationalCell yderivative
Slope in the y direction.