Chombo + EB  3.0
GeometryService.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 // ANAG, LBNL, DTG
12 
13 #ifndef _GEOMETRYSERVICE_H_
14 #define _GEOMETRYSERVICE_H_
15 
16 #include <cmath>
17 #include <cstdlib>
18 
19 #include "REAL.H"
20 #include "LoHiSide.H"
21 #include "RealVect.H"
22 #include "Box.H"
23 #include "IntVect.H"
24 
25 #include "EBISBox.H"
26 #include "VolIndex.H"
27 #include "FaceIndex.H"
28 #include "IrregNode.H"
29 #include "DisjointBoxLayout.H"
30 #include "NamespaceHeader.H"
31 
32 ///
33 /**
34  This is a pure base class that EBIndexSpace uses
35  to interface with geometry-generation classes.
36  */
38 {
39 public:
40 
41  enum InOut
42  {
46  };
47 
49 
50  virtual ~GeometryService();
51 
52  ///
53  /**
54  Return true if every cell in region is regular at the
55  refinement described by dx.
56  */
57  virtual bool isRegular(const Box& a_region,
58  const ProblemDomain& a_domain,
59  const RealVect& a_origin,
60  const Real& a_dx) const = 0;
61 
62  ///
63  /**
64  Return true if every cell in region is covered at the
65  refinement described by dx.
66  */
67  virtual bool isCovered(const Box& a_region,
68  const ProblemDomain& a_domain,
69  const RealVect& a_origin,
70  const Real& a_dx) const = 0;
71 
72  virtual bool isIrregular(const Box& a_region,
73  const ProblemDomain& a_domain,
74  const RealVect& a_origin,
75  const Real& a_dx) const ;
76  ///
77  /**
78  irregGraph contains a complete list of irregular vofs. \\
79  validRegion is the the region of the graph \\
80  domain is the domain of compuation \\
81  regIrregCovered = 1 for regular, 0 for irregular, -1 for covered.
82  regIrregCovered must contain the valid region grown by 1. \\
83  In chombospeak, \\
84  ghostregion = (grow(validRegion, 1) & domain);
85  */
86  virtual void fillGraph(BaseFab<int>& a_regIrregCovered,
87  Vector<IrregNode>& a_nodes,
88  const Box& a_validRegion,
89  const Box& a_ghostRegion,
90  const ProblemDomain& a_domain,
91  const RealVect& a_origin,
92  const Real& a_dx) const = 0;
93 
94  ///
95  /**
96  This overloaded method will be called when the GeometryService
97  was asked to make the grids with makeGrids()
98  */
99  virtual void fillGraph(BaseFab<int>& a_regIrregCovered,
100  Vector<IrregNode>& a_nodes,
101  const Box& a_validRegion,
102  const Box& a_ghostRegion,
103  const ProblemDomain& a_domain,
104  const RealVect& a_origin,
105  const Real& a_dx,
106  const DataIndex& a_di ) const
107  {
108  return fillGraph( a_regIrregCovered, a_nodes, a_validRegion, a_ghostRegion,
109  a_domain, a_origin, a_dx );
110  }
111 
112 
113  virtual bool canGenerateMultiCells() const;
114 
115  virtual InOut InsideOutside(const Box& a_region,
116  const ProblemDomain& a_domain,
117  const RealVect& a_origin,
118  const Real& a_dx) const ;
119 
120  ///
121  /**
122  This overloaded method will be called when the GeometryService
123  was asked to make the grids with makeGrids()
124  */
125 
126  virtual InOut InsideOutside(const Box& a_region,
127  const ProblemDomain& a_domain,
128  const RealVect& a_origin,
129  const Real& a_dx,
130  const DataIndex& a_di ) const
131  {
132  return InsideOutside( a_region, a_domain, a_origin, a_dx );
133  }
134 
135  ///handy functions to do rectangle intersections in real space
136  static bool intersection(const RealVect& a_lo1, const RealVect& a_hi1,
137  const RealVect& a_lo2, const RealVect& a_hi2);
138 
139  static bool intersection(const Box& a_region,
140  const RealVect& a_origin,
141  const Real& a_dx,
142  const RealVect& a_lower,
143  const RealVect& a_upper);
144 
145 
146  /** Perform any adjustments needed after box layout is created during EBISLevel construction
147  This function is used because subclasses may have distributed data that they will
148  want to adjust based on the new layout. The default implementation is empty.
149  */
150  virtual void postMakeBoxLayout(const DisjointBoxLayout& a_dbl,
151  const RealVect& a_dx);
152 
153 
154  ///
155  /**
156  Allow the geometry service to determine the DisjointBoxLayout that will
157  dictate InsideOutside queries.
158  */
159  virtual void makeGrids( const ProblemDomain& a_domain,
160  DisjointBoxLayout& a_grids,
161  const int& a_maxGridSize,
162  const int& a_maxIrregGridSize )
163  { MayDay::Error("GeometryService::makeGrids not defined"); }
164 
165 protected:
166 
167 };
168 #include "NamespaceFooter.H"
169 #endif
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:130
virtual bool canGenerateMultiCells() const
one dimensional dynamic array
Definition: Vector.H:52
virtual void fillGraph(BaseFab< int > &a_regIrregCovered, Vector< IrregNode > &a_nodes, const Box &a_validRegion, const Box &a_ghostRegion, const ProblemDomain &a_domain, const RealVect &a_origin, const Real &a_dx, const DataIndex &a_di) const
Definition: GeometryService.H:99
Definition: GeometryService.H:43
virtual ~GeometryService()
virtual bool isIrregular(const Box &a_region, const ProblemDomain &a_domain, const RealVect &a_origin, const Real &a_dx) const
InOut
Definition: GeometryService.H:41
Definition: GeometryService.H:44
virtual bool isRegular(const Box &a_region, const ProblemDomain &a_domain, const RealVect &a_origin, const Real &a_dx) const =0
virtual bool isCovered(const Box &a_region, const ProblemDomain &a_domain, const RealVect &a_origin, const Real &a_dx) const =0
double Real
Definition: REAL.H:33
Definition: GeometryService.H:37
static bool intersection(const RealVect &a_lo1, const RealVect &a_hi1, const RealVect &a_lo2, const RealVect &a_hi2)
handy functions to do rectangle intersections in real space
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:31
static void Error(const char *const a_msg=m_nullString, int m_exitCode=CH_DEFAULT_ERROR_CODE)
Print out message to cerr and exit with the specified exit code.
virtual void fillGraph(BaseFab< int > &a_regIrregCovered, Vector< IrregNode > &a_nodes, const Box &a_validRegion, const Box &a_ghostRegion, const ProblemDomain &a_domain, const RealVect &a_origin, const Real &a_dx) const =0
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
Definition: GeometryService.H:45
Definition: DataIndex.H:112
virtual InOut InsideOutside(const Box &a_region, const ProblemDomain &a_domain, const RealVect &a_origin, const Real &a_dx) const
virtual InOut InsideOutside(const Box &a_region, const ProblemDomain &a_domain, const RealVect &a_origin, const Real &a_dx, const DataIndex &a_di) const
Definition: GeometryService.H:126
virtual void makeGrids(const ProblemDomain &a_domain, DisjointBoxLayout &a_grids, const int &a_maxGridSize, const int &a_maxIrregGridSize)
Definition: GeometryService.H:159
virtual void postMakeBoxLayout(const DisjointBoxLayout &a_dbl, const RealVect &a_dx)