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 class LocalCoordMoveSwitch
00036 {
00037 public:
00038
00039 static bool s_turnOffMoveLocalCoords;
00040 };
00041
00042 template <int dim> class IFData
00043 {
00044 public:
00045
00046 typedef IndexTM<int,dim> EdgeIndex;
00047 typedef map<EdgeIndex,Real > EdgeIntersections;
00048
00049 typedef IndexTM<int,dim> Vertex;
00050 typedef map<Vertex,int > CornerSigns;
00051
00052 typedef IndexTM<int,dim> IvDim;
00053 typedef IndexTM<Real,dim> RvDim;
00054
00055 typedef map<IvDim,RvDim > NormalDerivatives;
00056
00057
00058 CornerSigns m_cornerSigns;
00059 EdgeIntersections m_intersections;
00060 IFSlicer<dim>* m_function;
00061
00062 CoordinateSystem<dim> m_globalCoord;
00063 CoordinateSystem<dim> m_cellCenterCoord;
00064 CoordinateSystem<dim> m_parentCoord;
00065 CoordinateSystem<dim> m_localCoord;
00066
00067 int m_maxOrder;
00068 NormalDerivatives m_normalDerivatives;
00069 bool m_badNormal;
00070
00071 bool m_allVerticesIn;
00072 bool m_allVerticesOut;
00073 bool m_allVerticesOn;
00074
00075
00076 IFData();
00077
00078
00079 IFData(const IFData<dim>& a_IFData);
00080
00081
00082 IFData(const BaseIF & a_function,
00083 const RvDim & a_dx,
00084 const RvDim & a_origin,
00085 const int & a_maxOrder);
00086
00087
00088 IFData(IFSlicer<dim> * a_function,
00089 const RvDim & a_dx,
00090 const RvDim & a_origin,
00091 const int & a_maxOrder);
00092
00093
00094
00095
00096 IFData(const IFData<dim+1> & a_hInfo,
00097 const int & a_maxOrder,
00098 const int & a_idir,
00099 const int & a_hilo);
00100
00101
00102 ~IFData();
00103
00104 void setNormalDerivatives();
00105 void makeCornerSigns();
00106 void findIntersectionPts();
00107 void defineLocalCoords();
00108
00109
00110 bool isConnected(int & a_edgeDir,
00111 const Vertex & a_vertex1,
00112 const Vertex & a_vertex2);
00113
00114 void makeEdgeKey(const int & a_edgeDir,
00115 const Vertex & a_vertex1,
00116 const Vertex & a_vertex2);
00117
00118
00119 Real rootFinder(const EdgeIndex & a_thisEdge);
00120
00121 Real BrentRootFinder(const RvDim & a_loPt,
00122 const RvDim & a_hiPt,
00123 const int & a_edgeDir) const;
00124
00125
00126
00127 void checkIntersection(bool & a_hiOn,
00128 bool & a_loOn,
00129 const Real & a_pt) const;
00130
00131 void remakeCornerSigns();
00132
00133
00134 void print(ostream& out) const;
00135
00136
00137 void operator=(const IFData & a_ifData);
00138
00139
00140 void setChangingDirection();
00141
00142 bool searchNormalDir(const int i) const;
00143 };
00144
00145 template<> class IFData<1>
00146 {
00147 public:
00148
00149 typedef Real EdgeIntersection;
00150
00151 typedef int Vertex;
00152 typedef map<Vertex,int> CornerSigns;
00153
00154 typedef int IvDim;
00155 typedef Real RvDim;
00156
00157
00158 CornerSigns m_cornerSigns;
00159 EdgeIntersection m_intersection;
00160
00161 CoordinateSystem<1> m_globalCoord;
00162 CoordinateSystem<1> m_cellCenterCoord;
00163 CoordinateSystem<1> m_parentCoord;
00164
00165 bool m_allVerticesIn;
00166 bool m_allVerticesOut;
00167 bool m_allVerticesOn;
00168 bool m_badNormal;
00169
00170 IFData();
00171
00172 IFData(const IFData<1> & a_ifData);
00173
00174 IFData(const IFData<2> & a_hIFData,
00175 const int & a_maxOrder,
00176 const int & a_idir,
00177 const int & a_hilo);
00178
00179 ~IFData();
00180
00181 void print(ostream& a_out) const;
00182
00183 void operator=(const IFData<1> & a_ifData);
00184 };
00185
00186 #include "NamespaceFooter.H"
00187
00188 #include "IFDataImplem.H"
00189
00190 #endif