00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011 #ifndef _IFDATA_H_
00012 #define _IFDATA_H_
00013
00014 #if defined(CH_Darwin) && defined(__GNUC__) && ( __GNUC__ == 3 )
00015
00016 #include <unistd.h>
00017 #define _GLIBCPP_USE_C99 1
00018 #endif
00019
00020
00021 #include <map>
00022 using std::map;
00023 #include "Vector.H"
00024 #include "REAL.H"
00025 #include "IndexTM.H"
00026
00027 #include "Notation.H"
00028 #include "IFSlicer.H"
00029 #include "CoordinateSystem.H"
00030
00031 using std::endl;
00032 using std::cerr;
00033 #include "NamespaceHeader.H"
00034
00035 template <int dim> class IFData
00036 {
00037 public:
00038
00039 typedef IndexTM<int,dim> EdgeIndex;
00040 typedef map<EdgeIndex,Real,LexLT<EdgeIndex> > EdgeIntersections;
00041
00042 typedef IndexTM<int,dim> Vertex;
00043 typedef map<Vertex,int,LexLT<Vertex> > CornerSigns;
00044
00045 typedef IndexTM<int,dim> IvDim;
00046 typedef IndexTM<Real,dim> RvDim;
00047
00048 typedef map<IvDim,RvDim,LexLT<IvDim> > NormalDerivatives;
00049
00050
00051 CornerSigns m_cornerSigns;
00052 EdgeIntersections m_intersections;
00053 IFSlicer<dim>* m_function;
00054
00055 CoordinateSystem<dim> m_globalCoord;
00056 CoordinateSystem<dim> m_cellCenterCoord;
00057 CoordinateSystem<dim> m_parentCoord;
00058 CoordinateSystem<dim> m_localCoord;
00059
00060 int m_maxOrder;
00061 NormalDerivatives m_normalDerivatives;
00062 bool m_badNormal;
00063
00064 bool m_allVerticesIn;
00065 bool m_allVerticesOut;
00066 bool m_allVerticesOn;
00067
00068
00069 IFData();
00070
00071
00072 IFData(const IFData<dim>& a_IFData);
00073
00074
00075 IFData(const BaseIF & a_function,
00076 const RvDim & a_dx,
00077 const RvDim & a_origin,
00078 const int & a_maxOrder);
00079
00080
00081 IFData(IFSlicer<dim> * a_function,
00082 const RvDim & a_dx,
00083 const RvDim & a_origin,
00084 const int & a_maxOrder);
00085
00086
00087 IFData(const IFData<dim+1> & a_hInfo,
00088 #if RECURSIVE_GEOMETRY_GENERATION != 0
00089 const int & a_maxOrder,
00090 #endif
00091 const int & a_idir,
00092 const int & a_hilo);
00093
00094
00095 ~IFData();
00096
00097 void setNormalDerivatives();
00098 void makeCornerSigns();
00099 void findIntersectionPts();
00100 void defineLocalCoords();
00101
00102
00103 bool isConnected(int & a_edgeDir,
00104 const Vertex & a_vertex1,
00105 const Vertex & a_vertex2);
00106
00107 void makeEdgeKey(const int & a_edgeDir,
00108 const Vertex & a_vertex1,
00109 const Vertex & a_vertex2);
00110
00111
00112 Real rootFinder(const EdgeIndex & a_thisEdge);
00113
00114 Real BrentRootFinder(const RvDim & a_loPt,
00115 const RvDim & a_hiPt,
00116 const int & a_edgeDir) const;
00117
00118
00119
00120 void checkIntersection(bool & a_hiOn,
00121 bool & a_loOn,
00122 const Real & a_pt) const;
00123
00124 void remakeCornerSigns();
00125
00126
00127 void print(ostream& out) const;
00128
00129
00130 void operator=(const IFData & a_ifData);
00131
00132
00133 void setChangingDirection();
00134
00135 bool searchNormalDir(const int i) const;
00136 };
00137
00138 template<> class IFData<1>
00139 {
00140 public:
00141
00142 typedef Real EdgeIntersection;
00143
00144 typedef int Vertex;
00145 typedef map<Vertex,int> CornerSigns;
00146
00147 typedef int IvDim;
00148 typedef Real RvDim;
00149
00150
00151 CornerSigns m_cornerSigns;
00152 EdgeIntersection m_intersection;
00153
00154 CoordinateSystem<1> m_globalCoord;
00155 CoordinateSystem<1> m_cellCenterCoord;
00156 CoordinateSystem<1> m_parentCoord;
00157
00158 bool m_allVerticesIn;
00159 bool m_allVerticesOut;
00160 bool m_allVerticesOn;
00161 bool m_badNormal;
00162
00163 IFData();
00164
00165 IFData(const IFData<1> & a_ifData);
00166
00167 IFData(const IFData<2> & a_hIFData,
00168 #if RECURSIVE_GEOMETRY_GENERATION != 0
00169 const int & a_maxOrder,
00170 #endif
00171 const int & a_idir,
00172 const int & a_hilo);
00173
00174 ~IFData();
00175
00176 void print(ostream& a_out) const;
00177
00178 void operator=(const IFData<1> & a_ifData);
00179 };
00180
00181 #include "NamespaceFooter.H"
00182
00183 #include "IFDataImplem.H"
00184
00185 #endif