PCM.cpp
1 #include "PCM.hpp"
2 
3 PCM::PCM(GhostPointGenerator const & ghost) :ghost_(ghost){}
4 
5 void PCM::operator()(const Tessellation & tess, const vector<ComputationalCell>& cells, double time,
6  vector<pair<ComputationalCell, ComputationalCell> >& res, TracerStickerNames const & tracerstickersnames,
7  CacheData const& /*cd*/) const
8 {
9  res.resize(static_cast<size_t>(tess.GetTotalSidesNumber()));
10  boost::container::flat_map<size_t, ComputationalCell> ghost_cells = ghost_.operator()(tess,
11  cells, time, tracerstickersnames);
12  int Npoints = tess.GetPointNo();
13  size_t Nedges = res.size();
14  for (size_t i = 0; i < Nedges; ++i)
15  {
16  Edge const& edge = tess.GetEdge(static_cast<int>(i));
17  if (edge.neighbors.first < Npoints)
18  res[i].first = cells[static_cast<size_t>(edge.neighbors.first)];
19  else
20 #ifdef RICH_MPI
21  if (tess.GetOriginalIndex(edge.neighbors.second) != tess.GetOriginalIndex(edge.neighbors.first))
22  res[i].first = cells.at(static_cast<size_t>(edge.neighbors.first));
23  else
24 #endif
25  res[i].first = ghost_cells[static_cast<size_t>(edge.neighbors.first)];
26  if (edge.neighbors.second < Npoints)
27  res[i].second = cells[static_cast<size_t>(edge.neighbors.second)];
28  else
29 #ifdef RICH_MPI
30  if (tess.GetOriginalIndex(edge.neighbors.second) != tess.GetOriginalIndex(edge.neighbors.first))
31  res[i].second = cells.at(static_cast<size_t>(edge.neighbors.second));
32  else
33 #endif
34  res[i].second = ghost_cells[static_cast<size_t>(edge.neighbors.second)];
35 
36  }
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
Interface between two cells.
Definition: Edge.hpp:13
Abstract class for creating ghost points.
Class for pcm interpolation of the hydrodynamic variables.
PCM(GhostPointGenerator const &ghost)
Class constructor.
Definition: PCM.cpp:3
virtual Edge const & GetEdge(int index) const =0
Returns edge (interface between cells)
Container for cache data.
Definition: cache_data.hpp:14
Class for keeping the names of the tracers and stickers.
virtual int GetTotalSidesNumber(void) const =0
Returns the total number of faces.
std::pair< int, int > neighbors
Neighboring cells.
Definition: Edge.hpp:21
void operator()(const Tessellation &tess, const vector< ComputationalCell > &cells, double time, vector< pair< ComputationalCell, ComputationalCell > > &res, TracerStickerNames const &tracerstikersnames, CacheData const &cd) const
interpolates values on both sides of each interface
Definition: PCM.cpp:5