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 "BaseIF.H"
00029
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 typedef IndexTM<int,dim> Vertex;
00042 typedef map<Vertex,int,LexLT<Vertex> > CornerSigns;
00043 typedef IndexTM<Real,dim> Rvect;
00044
00045
00046 CornerSigns m_cornerSigns;
00047 EdgeIntersections m_intersections;
00048 BaseIF* m_function;
00049 Rvect m_dx;
00050 RvgDim m_globalCellCenter;
00051 Vector<int> m_normalDir;
00052 Vector<int> m_changingDir;
00053 Rvect m_normal;
00054 Vector<IndexTM<Real,dim> > m_gradNormal;
00055 bool m_allVerticesIn;
00056 bool m_allVerticesOut;
00057 bool m_allVerticesOn;
00058
00059
00060 inline IFData();
00061
00062
00063 inline IFData(const IFData<dim>& a_info);
00064
00065
00066 inline IFData(const BaseIF & a_function,
00067 const Rvect & a_dx,
00068 const RvgDim & a_globalCellCenter,
00069 const Vector<int> & a_normalDir = Vector<int>());
00070
00071
00072 inline IFData(const IFData<dim+1> & a_hInfo,
00073 const int & a_idir,
00074 const int & a_hilo);
00075
00076
00077 inline ~IFData();
00078
00079 inline void reduceGradNormal(const Vector< IndexTM<Real,GLOBALDIM> > & a_gradNormal,
00080 const IndexTM<Real,GLOBALDIM> & a_normal);
00081
00082 inline void setNormal();
00083
00084 inline void makeCornerSigns();
00085 inline void findIntersectionPts();
00086
00087
00088 inline bool isConnected(int & a_edgeDir,
00089 const Vertex & a_vertex1,
00090 const Vertex & a_vertex2);
00091
00092 inline void makeEdgeKey(const int & a_edgeDir,
00093 const Vertex & a_vertex1,
00094 const Vertex & a_vertex2);
00095
00096
00097 inline Real rootFinder(const EdgeIndex & a_thisEdge);
00098
00099 inline Real midPtRootFinder(const Rvect & a_loPt,
00100 const Rvect & a_hiPt) const;
00101
00102 inline Real BrentRootFinder(const RvgDim & a_loPt,
00103 const RvgDim & a_hiPt,
00104 const int & a_edgeDir) const;
00105
00106 inline void checkIntersection(bool & a_hiOn,
00107 bool & a_loOn,
00108 const Real & a_pt) const;
00109
00110 inline void remakeCornerSigns();
00111
00112
00113 inline void print(ostream& out) const;
00114
00115 inline void dump() const;
00116
00117
00118 inline void operator=(const IFData & a_ifData);
00119
00120
00121 inline RvgDim relCoord(const Vertex & a_vertex);
00122
00123
00124 inline void setChangingDirection();
00125
00126 inline bool searchNormalDir(const int i) const;
00127 };
00128
00129 template<> class IFData<1>
00130 {
00131 public:
00132
00133 typedef Real EdgeIntersection;
00134 typedef int Vertex;
00135 typedef map<int,int> CornerSigns;
00136 typedef Real Rvect;
00137
00138
00139 CornerSigns m_cornerSigns;
00140 EdgeIntersection m_intersection;
00141 Rvect m_dx;
00142 Rvect m_normal;
00143 bool m_allVerticesIn;
00144 bool m_allVerticesOut;
00145 bool m_allVerticesOn;
00146
00147 inline IFData();
00148
00149 inline IFData(const IFData<1> & a_ifData);
00150
00151 inline IFData(const IFData<2> & a_hIFData,
00152 const int & a_idir,
00153 const int & a_hilo);
00154
00155 inline ~IFData();
00156
00157 inline void print(ostream& a_out) const;
00158
00159 inline void operator=(const IFData<1> & a_ifData);
00160 };
00161
00162 #include "IFDataImplem.H"
00163
00164 #include "NamespaceFooter.H"
00165
00166 #endif