00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011
00012
00013 #ifndef _GRAPHNODE_H_
00014 #define _GRAPHNODE_H_
00015
00016 #include "REAL.H"
00017 #include "ProblemDomain.H"
00018 #include "IntVect.H"
00019 #include "VolIndex.H"
00020 #include "FaceIndex.H"
00021 #include "Vector.H"
00022 #include "NamespaceHeader.H"
00023
00025
00029 class GraphNodeImplem
00030 {
00031 public:
00033 inline
00034 GraphNodeImplem();
00035
00037 inline
00038 ~GraphNodeImplem();
00039
00041 GraphNodeImplem& operator=(const GraphNodeImplem& a_impin);
00042
00044 GraphNodeImplem(const GraphNodeImplem& a_impin);
00045
00047
00049
00053 Vector<int> m_arc[2*SpaceDim];
00054
00056
00058 int m_coarserNode;
00059
00060
00061 int m_nodeInd;
00062
00064 Vector<VolIndex> m_finerNodes;
00065
00067 inline int index(int a_idir, Side::LoHiSide a_side) const;
00068
00070 int linearSize() const;
00071
00073 void linearOut(void* buffer ) const;
00074
00076 void linearIn(void* buffer );
00077
00078 };
00079
00081
00088 class GraphNode
00089 {
00090 public:
00092
00095 inline GraphNode();
00096
00098
00100 inline ~GraphNode();
00101
00103 int size() const;
00104
00106
00110 inline void clear();
00112
00115 inline bool isRegular() const;
00116
00118
00121 inline bool isCovered() const;
00122
00124
00127 inline bool isIrregular() const;
00128
00130
00134 inline void defineAsRegular();
00135
00137
00141 inline void defineAsCovered();
00142
00144
00151 Vector<FaceIndex>
00152 getFaces(const VolIndex& a_vof,
00153 const int& a_idir,
00154 const Side::LoHiSide& a_sd,
00155 const ProblemDomain& a_domain) const;
00156
00158 Vector<FaceIndex>
00159 getFaces(const IntVect& a_iv,
00160 const int& a_idir,
00161 const Side::LoHiSide& a_sd,
00162 const ProblemDomain& a_domain) const;
00163
00165
00169 Vector<VolIndex>
00170 getVoFs(const IntVect& a_iv) const;
00171
00173 const GraphNode& operator=(const GraphNode& ebiin);
00174
00176 GraphNode(const GraphNode& ebiin);
00177
00179
00184 Vector<VolIndex> refine(const VolIndex& a_coarVoF) const;
00185
00187
00192 VolIndex coarsen(const VolIndex& a_fineVoF) const;
00193
00195
00197 void addIrregularNode(const GraphNodeImplem& a_nodein, int cellIndex);
00199
00201 void addIrregularNode(const GraphNodeImplem& a_nodein);
00202
00204
00208 Vector<Vector<VolIndex> > getVoFSets(const Box& a_box) const;
00209
00211 int linearSize() const;
00212
00214 void linearOut(void* buffer ) const;
00215
00217 void linearIn(void* buffer );
00218
00220 inline void setDefaults();
00221
00223
00229 Vector<GraphNodeImplem>* m_cellList;
00230
00231 };
00232
00233
00234
00235 inline GraphNode::
00236 ~GraphNode()
00237 {
00238 clear();
00239 }
00240
00241 inline bool GraphNode::
00242 isRegular() const
00243 {
00244 return (m_cellList==((Vector<GraphNodeImplem>*) 1));
00245 }
00246
00247 inline bool GraphNode::
00248 isCovered() const
00249 {
00250 return (m_cellList==((Vector<GraphNodeImplem>*) 0));
00251 }
00252
00253 inline bool GraphNode::
00254 isIrregular() const
00255 {
00256 return ((!isRegular()) && (!isCovered()));
00257 }
00258
00259 inline void GraphNode::
00260 setDefaults()
00261 {
00262 m_cellList = (Vector<GraphNodeImplem>*)1;
00263 }
00264
00265
00266 inline GraphNode::
00267 GraphNode()
00268 {
00269 setDefaults();
00270 }
00271
00272
00273 inline void GraphNode::
00274 clear()
00275 {
00276 if(isIrregular())
00277 {
00278 delete m_cellList;
00279 }
00280 setDefaults();
00281 }
00282
00283
00284
00285 inline void GraphNode::
00286 defineAsRegular()
00287 {
00288 clear();
00289 m_cellList = (Vector<GraphNodeImplem>*) 1;
00290 }
00291
00292
00293 inline void GraphNode::
00294 defineAsCovered()
00295 {
00296 clear();
00297 m_cellList = (Vector<GraphNodeImplem>*) 0;
00298 }
00299
00300
00301 inline GraphNodeImplem::
00302 GraphNodeImplem()
00303 : m_coarserNode(-1), m_nodeInd(-1)
00304 {
00305 }
00306
00307 inline GraphNodeImplem::
00308 ~GraphNodeImplem()
00309 {
00310 }
00311
00312
00313 inline int GraphNodeImplem::
00314 index(int a_idir, Side::LoHiSide a_sd) const
00315 {
00316 CH_assert(a_idir >= 0 && a_idir < SpaceDim);
00317 return a_idir + a_sd*CH_SPACEDIM;
00318 }
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331 #include "NamespaceFooter.H"
00332 #endif