Chombo + EB  3.0
IFData.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 _IFDATA_H_
12 #define _IFDATA_H_
13 
14 #if defined(CH_Darwin) && defined(__GNUC__) && ( __GNUC__ == 3 )
15 // deal with the broken isnan()/isinf() in GCC on MacOS
16 #include <unistd.h>
17 #define _GLIBCPP_USE_C99 1
18 #endif
19 
20 
21 #include <map>
22 using std::map;
23 #include "Vector.H"
24 #include "REAL.H"
25 #include "IndexTM.H"
26 
27 #include "Notation.H"
28 #include "IFSlicer.H"
29 #include "CoordinateSystem.H"
30 
31 using std::endl;
32 using std::cerr;
33 #include "NamespaceHeader.H"
34 
35 template <int dim> class IFData
36 {
37 public:
38  // data types to record vertex signs and edge intersections
40  typedef map<EdgeIndex,Real,LexLT<EdgeIndex> > EdgeIntersections;
41 
43  typedef map<Vertex,int,LexLT<Vertex> > CornerSigns;
44 
47 
48  typedef map<IvDim,RvDim,LexLT<IvDim> > NormalDerivatives;
49 
50  // member data
54 
59 
63 
67 
68  // empty constructor
69  IFData();
70 
71  // copy constructor
72  IFData(const IFData<dim>& a_IFData);
73 
74  // makes an initial IFData from a BaseIF
75  IFData(const BaseIF & a_function,
76  const RvDim & a_dx,
77  const RvDim & a_origin,
78  const int & a_maxOrder);
79 
80  // makes an lower dimensional IFData from a IFSlicer; used for refinement
81  IFData(IFSlicer<dim> * a_function,
82  const RvDim & a_dx,
83  const RvDim & a_origin,
84  const int & a_maxOrder);
85 
86  // makes a reduced IFData
87  IFData(const IFData<dim+1> & a_hInfo,
89  const int & a_maxOrder,
90 #endif
91  const int & a_idir,
92  const int & a_hilo);
93 
94  // destructor
95  ~IFData();
96 
97  void setNormalDerivatives();
98  void makeCornerSigns();
99  void findIntersectionPts();
100  void defineLocalCoords();
101 
102  // used by the constructor
103  bool isConnected(int & a_edgeDir,
104  const Vertex & a_vertex1,
105  const Vertex & a_vertex2);
106 
107  void makeEdgeKey(const int & a_edgeDir,
108  const Vertex & a_vertex1,
109  const Vertex & a_vertex2);
110 
111  //this function calls the midPtRootFinder
112  Real rootFinder(const EdgeIndex & a_thisEdge);
113 
114  Real BrentRootFinder(const RvDim & a_loPt,
115  const RvDim & a_hiPt,
116  const int & a_edgeDir) const;
117 // const Real & a_smallestRoot,
118 // const Real & a_biggestRoot) const;
119 
120  void checkIntersection(bool & a_hiOn,
121  bool & a_loOn,
122  const Real & a_pt) const;
123 
124  void remakeCornerSigns();
125 
126  // output functions
127  void print(ostream& out) const;
128 
129  // operators
130  void operator=(const IFData & a_ifData);
131 
132  // this function sets the changing direction given the normal direction
133  void setChangingDirection();
134 
135  bool searchNormalDir(const int i) const;
136 };
137 
138 template<> class IFData<1>
139 {
140 public:
141  // true is in the fluid
143 
144  typedef int Vertex;
145  typedef map<Vertex,int> CornerSigns;
146 
147  typedef int IvDim;
148  typedef Real RvDim;
149 
150  // member data
153 
157 
162 
163  IFData();
164 
165  IFData(const IFData<1> & a_ifData);
166 
167  IFData(const IFData<2> & a_hIFData,
169  const int & a_maxOrder,
170 #endif
171  const int & a_idir,
172  const int & a_hilo);
173 
174  ~IFData();
175 
176  void print(ostream& a_out) const;
177 
178  void operator=(const IFData<1> & a_ifData);
179 };
180 
181 #include "NamespaceFooter.H"
182 
183 #include "IFDataImplem.H"
184 
185 #endif
NormalDerivatives m_normalDerivatives
Definition: IFData.H:61
map< Vertex, int, LexLT< Vertex > > CornerSigns
Definition: IFData.H:43
CoordinateSystem< 1 > m_cellCenterCoord
Definition: IFData.H:155
Definition: CoordinateSystem.H:34
void makeEdgeKey(const int &a_edgeDir, const Vertex &a_vertex1, const Vertex &a_vertex2)
Definition: IFDataImplem.H:464
map< IvDim, RvDim, LexLT< IvDim > > NormalDerivatives
Definition: IFData.H:48
~IFData()
Definition: IFDataImplem.H:265
CoordinateSystem< 1 > m_globalCoord
Definition: IFData.H:154
void setChangingDirection()
map< Vertex, int > CornerSigns
Definition: IFData.H:145
CornerSigns m_cornerSigns
Definition: IFData.H:151
EdgeIntersection m_intersection
Definition: IFData.H:152
bool m_badNormal
Definition: IFData.H:161
Definition: IFData.H:138
bool isConnected(int &a_edgeDir, const Vertex &a_vertex1, const Vertex &a_vertex2)
Definition: IFDataImplem.H:432
void print(ostream &out) const
Definition: IFDataImplem.H:788
int IvDim
Definition: IFData.H:147
CoordinateSystem< dim > m_parentCoord
Definition: IFData.H:57
Real EdgeIntersection
Definition: IFData.H:142
IndexTM< int, dim > Vertex
Definition: IFData.H:42
IFSlicer< dim > * m_function
Definition: IFData.H:53
Definition: IndexTM.H:36
IFData()
Definition: IFDataImplem.H:30
Real BrentRootFinder(const RvDim &a_loPt, const RvDim &a_hiPt, const int &a_edgeDir) const
Definition: IFDataImplem.H:606
CoordinateSystem< dim > m_localCoord
Definition: IFData.H:58
Real RvDim
Definition: IFData.H:148
void operator=(const IFData &a_ifData)
Definition: IFDataImplem.H:900
bool m_allVerticesIn
Definition: IFData.H:158
Definition: BaseIF.H:30
IndexTM< int, dim > EdgeIndex
Definition: IFData.H:39
void setNormalDerivatives()
Definition: IFDataImplem.H:273
CoordinateSystem< 1 > m_parentCoord
Definition: IFData.H:156
Definition: IFData.H:35
IndexTM< Real, dim > RvDim
Definition: IFData.H:46
CoordinateSystem< dim > m_globalCoord
Definition: IFData.H:55
bool m_allVerticesOn
Definition: IFData.H:66
bool m_allVerticesOn
Definition: IFData.H:160
double Real
Definition: REAL.H:33
void makeCornerSigns()
Definition: IFDataImplem.H:308
bool m_allVerticesIn
Definition: IFData.H:64
CoordinateSystem< dim > m_cellCenterCoord
Definition: IFData.H:56
bool searchNormalDir(const int i) const
IndexTM< int, dim > IvDim
Definition: IFData.H:45
map< EdgeIndex, Real, LexLT< EdgeIndex > > EdgeIntersections
Definition: IFData.H:40
Definition: IFSlicer.H:27
bool m_allVerticesOut
Definition: IFData.H:65
CornerSigns m_cornerSigns
Definition: IFData.H:51
int Vertex
Definition: IFData.H:144
void remakeCornerSigns()
Definition: IFDataImplem.H:762
void defineLocalCoords()
Definition: IFDataImplem.H:383
int m_maxOrder
Definition: IFData.H:60
EdgeIntersections m_intersections
Definition: IFData.H:52
void findIntersectionPts()
Definition: IFDataImplem.H:365
void checkIntersection(bool &a_hiOn, bool &a_loOn, const Real &a_pt) const
Definition: IFDataImplem.H:745
Real rootFinder(const EdgeIndex &a_thisEdge)
Definition: IFDataImplem.H:553
bool m_allVerticesOut
Definition: IFData.H:159
bool m_badNormal
Definition: IFData.H:62
#define RECURSIVE_GEOMETRY_GENERATION
Definition: Notation.H:40