Chombo + EB + MF  3.2
CoordSys.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 #ifndef _COORDSYS_H_
12 #define _COORDSYS_H_
13 
14 #include <utility>
15 using std::pair;
16 
17 #include "REAL.H"
18 #include "DisjointBoxLayout.H"
19 #include "RealVect.H"
20 #include "IntVect.H"
21 #include "LevelData.H"
22 #include "Vector.H"
23 
24 #include "NamespaceHeader.H"
25 
26 template <class Tcell,class Tface>
27 class CoordSys;
28 
29 
30 
31 /// Virtual base class encapsulating mapped-grid coordinate systems
32 /**
33  The CoordSys class is a virtual base class providing an API
34  for performing operations in a mapped grid coordinate space.
35  Implementations of specific coordinate systems will be provided by
36  derived classes.
37 */
38 template <class T, class Tface>
39 class CoordSys
40 {
41 public:
42  /// default constructor
44  {
45  }
46 
47  /**
48  Destructor.
49  */
50  virtual ~CoordSys()
51  {;}
52 
53  ///
54  virtual void define(const DisjointBoxLayout& a_grids,
55  const ProblemDomain& a_domain,
56  const RealVect& a_cellSpacing,
57  const IntVect& a_ghostVect) = 0;
58 
59  ///
60  virtual void regrid(const DisjointBoxLayout& a_newGrids) = 0;
61 
62  /// given coordinate in mapped space, return its location in real space
63  virtual RealVect realCoord(const RealVect& a_X) const = 0;
64 
65  /// given coordinate in real space, return its location in the mapped space
66  virtual RealVect mappedCoord(const RealVect& a_x) const = 0;
67 
68  /// given coordinates in mapped space, return locations in real space
69  virtual void realCoord(T& a_x, const T& a_X) const = 0;
70 
71  /// given coordinate in real space, return its location in the mapped space
72  virtual void mappedCoord(T& a_X, const T& a_x) const = 0;
73 
74  /// Jacobian evaluated at location X in real space
75  virtual Real pointwiseJ(const RealVect& a_X) const = 0;
76 
77  /// Jacobian evaluated at locations Xi in mapped space
78  virtual void pointwiseJ(T& a_J, const T& a_Xi) const = 0;
79 
80  /// returns integral of divergence over mapped-grid cells
81  virtual void mappedGridDivergence(LevelData<T>& a_divF,
82  const LevelData<Tface>& a_F) const = 0;
83 
84  /// reuturns reference to face-averaged N metric terms
85  virtual const LevelData<Tface>& getFaceMetricTerms() const = 0;
86 
87  // returns reference to cell volumes
88  virtual const LevelData<T>& getCellVolumes() const = 0;
89 
90  /// returns second-order averaged cell-centered J
91  virtual const LevelData<T>& getJ() const = 0;
92 
93  /// returns averaged face-centered 1/J
94  virtual const LevelData<Tface>& getJInverse() const =0;
95 
96  /// returns averaged face-centered N/J
97  virtual const LevelData<Tface>& getNJinverse() const = 0;
98 };
99 
100 
101 /// pure-virtual base class defining factory interface for CoordSys
102 template <class T, class Tface>
103 class
105 {
106 
107 
108 public:
109 
111  {
112  }
113 
115  {
116  }
117 
118  virtual CoordSys<T,Tface>* getCoordSys(const DisjointBoxLayout& grids,
119  const ProblemDomain& levelDomain,
120  const IntVect& a_ghostVect ) const = 0;
121 
122 
123 
124 };
125 
126 #include "NamespaceFooter.H"
127 
128 #endif
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
virtual void regrid(const DisjointBoxLayout &a_newGrids)=0
CoordSysFactory()
Definition: CoordSys.H:110
virtual RealVect realCoord(const RealVect &a_X) const =0
given coordinate in mapped space, return its location in real space
virtual const LevelData< T > & getJ() const =0
returns second-order averaged cell-centered J
virtual Real pointwiseJ(const RealVect &a_X) const =0
Jacobian evaluated at location X in real space.
new code
Definition: BoxLayoutData.H:170
virtual const LevelData< T > & getCellVolumes() const =0
double Real
Definition: REAL.H:33
virtual const LevelData< Tface > & getNJinverse() const =0
returns averaged face-centered N/J
Virtual base class encapsulating mapped-grid coordinate systems.
Definition: CoordSys.H:27
virtual const LevelData< Tface > & getJInverse() const =0
returns averaged face-centered 1/J
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
virtual RealVect mappedCoord(const RealVect &a_x) const =0
given coordinate in real space, return its location in the mapped space
virtual ~CoordSys()
Definition: CoordSys.H:50
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
virtual const LevelData< Tface > & getFaceMetricTerms() const =0
reuturns reference to face-averaged N metric terms
pure-virtual base class defining factory interface for CoordSys
Definition: CoordSys.H:103
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
virtual void define(const DisjointBoxLayout &a_grids, const ProblemDomain &a_domain, const RealVect &a_cellSpacing, const IntVect &a_ghostVect)=0
virtual void mappedGridDivergence(LevelData< T > &a_divF, const LevelData< Tface > &a_F) const =0
returns integral of divergence over mapped-grid cells
virtual ~CoordSysFactory()
Definition: CoordSys.H:114
CoordSys()
default constructor
Definition: CoordSys.H:43