stationary_box.cpp
1 #include "stationary_box.hpp"
2 
3 StationaryBox::StationaryBox(void) {}
4 
5 namespace {
6  bool is_outer_edge
7  (const Tessellation& tess,
8  const Edge& edge)
9  {
10  const int n1 =
11  tess.GetOriginalIndex
12  (edge.neighbors.first);
13  const int n2 =
14  tess.GetOriginalIndex
15  (edge.neighbors.second);
16  return n1==n2;
17  }
18 }
19 
20 vector<Vector2D> StationaryBox::operator()
21 (const Tessellation& tess,
22  const vector<Vector2D>& point_velocities) const
23 {
24  const vector<Edge>& edge_list = tess.getAllEdges();
25  vector<Vector2D> res(edge_list.size());
26  const size_t nloop = res.size();
27  for(size_t i=0;i<nloop;++i)
28  {
29  const Edge& edge = edge_list[i];
30  res[i] = is_outer_edge(tess,edge) ?
31  Vector2D() :
32  tess.CalcFaceVelocity
33  (point_velocities.at(static_cast<size_t>(edge.neighbors.first)),
34  point_velocities.at(static_cast<size_t>(edge.neighbors.second)),
35  tess.GetMeshPoint(edge.neighbors.first),
36  tess.GetMeshPoint(edge.neighbors.second),
37  calc_centroid(edge));
38  }
39  return res;
40 }
Abstract class for tessellation.
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
virtual Vector2D GetMeshPoint(int index) const =0
Returns Position of mesh generating point.
virtual const vector< Edge > & getAllEdges(void) const =0
Returns reference to the list of all edges.
std::pair< int, int > neighbors
Neighboring cells.
Definition: Edge.hpp:21
Vector3D calc_centroid(const Face &face)
Calculates the centroid of aa face.
Definition: Face.cpp:32
virtual Vector2D CalcFaceVelocity(Vector2D wl, Vector2D wr, Vector2D rL, Vector2D rR, Vector2D f) const =0
Calculates the velocity of a single edge.
2D Mathematical vector
Definition: geometry.hpp:15