00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011 #ifndef _DISJOINTBOXLAYOUT_H_
00012 #define _DISJOINTBOXLAYOUT_H_
00013
00014 #include "Vector.H"
00015 #include "BoxLayout.H"
00016 #include "ProblemDomain.H"
00017 #include "NamespaceHeader.H"
00018
00019
00020 class SliceSpec;
00021
00023
00031 class DisjointBoxLayout: public BoxLayout
00032 {
00033
00034 public:
00035
00036 friend class Copier;
00037
00042
00044
00047 DisjointBoxLayout();
00048
00050
00055 DisjointBoxLayout(const Vector<Box>& a_boxes,
00056 const Vector<int>& a_procIDs);
00057
00059
00064 DisjointBoxLayout(const Vector<Box>& a_boxes,
00065 const Vector<int>& a_procIDs,
00066 const ProblemDomain& a_physDomain);
00067
00068
00069
00071
00076 virtual
00077 ~DisjointBoxLayout()
00078 {}
00079
00081
00086 virtual void
00087 define(const Vector<Box>& a_boxes,
00088 const Vector<int>& a_procIDs);
00089
00090
00091
00093
00098 void
00099 defineAndLoadBalance(const Vector<Box>& a_boxes,
00100 Vector<int>* a_procIDs);
00101
00102
00104
00109 void
00110 defineAndLoadBalance(const Vector<Box>& a_boxes,
00111 Vector<int>* a_procIDs,
00112 const ProblemDomain& a_physDomain);
00113
00115
00120 void
00121 define(const BoxLayout& a_layout);
00122
00124
00129 void
00130 define(const BoxLayout& a_layout, const ProblemDomain& a_physDomain);
00131
00133
00138 virtual void
00139 define(const Vector<Box>& a_boxes,
00140 const Vector<int>& a_procIDs,
00141 const ProblemDomain& a_physDomain);
00142
00144
00147 virtual void
00148 define_pd(const Vector<Box>& a_boxes,
00149 const Vector<int>& a_procIDs,
00150 const ProblemDomain& a_physDomain)
00151 {define(a_boxes, a_procIDs, a_physDomain);}
00152
00159
00161
00168 bool
00169 isDisjoint() const;
00170
00172
00183 bool checkPeriodic(const ProblemDomain& a_domain) const;
00184
00191 bool checkDomains(const DisjointBoxLayout& a_dbl) const;
00192
00199
00201
00203 virtual void
00204 close();
00205
00207
00209 void setDomain(const ProblemDomain& a_domain)
00210 {
00211 if(*m_closed)
00212 {
00213 MayDay::Error("attempt to setDomain on closed DisjointBoxLayout");
00214 }
00215 m_physDomain = a_domain;
00216 }
00217
00219
00224 virtual void
00225 deepCopy(const DisjointBoxLayout& a_source);
00226
00228
00232 virtual void
00233 deepCopy(const BoxLayout& a_source);
00234
00236
00240 virtual void
00241 deepCopy(const BoxLayout& a_source, const ProblemDomain& a_physDomain);
00242
00248 void degenerate( DisjointBoxLayout& a_to, const SliceSpec& a_ss ) const;
00249
00251
00268 friend void coarsen(DisjointBoxLayout& output,
00269 const DisjointBoxLayout& input,
00270 int refinement);
00271
00273
00289 friend void refine(DisjointBoxLayout& output,
00290 const DisjointBoxLayout& input,
00291 int refinement);
00292
00299
00301
00306 friend void adjCellLo(DisjointBoxLayout& a_output,
00307 const DisjointBoxLayout& a_input,
00308 int a_dir, int a_len=1);
00309
00311
00316 friend void adjCellHi(DisjointBoxLayout& a_output,
00317 const DisjointBoxLayout& a_input,
00318 int a_dir, int a_len=1);
00319
00322 const ProblemDomain& physDomain() const;
00323
00324 protected:
00326 friend class NeighborIterator;
00327 ProblemDomain m_physDomain;
00328
00329
00330
00331 RefCountedPtr<Vector<Vector<std::pair<int, unsigned int> > > > m_neighbors;
00332
00333 void computeNeighbors();
00334 virtual void closeN( RefCountedPtr<Vector<Vector<std::pair<int, unsigned int> > > > neighbors);
00335 virtual void closeNO();
00336
00337 };
00338 void adjCellLo_dbl(DisjointBoxLayout& a_output,
00339 const DisjointBoxLayout& a_input,
00340 int a_dir, int a_len);
00341 void adjCellHi_dbl(DisjointBoxLayout& a_output,
00342 const DisjointBoxLayout& a_input,
00343 int a_dir, int a_len);
00344 void coarsen_dbl(DisjointBoxLayout& output,
00345 const DisjointBoxLayout& input,
00346 int refinement);
00347 void refine_dbl(DisjointBoxLayout& output,
00348 const DisjointBoxLayout& input,
00349 int refinement);
00350
00351 inline
00352 void adjCellLo_dbl(DisjointBoxLayout& a_output,
00353 const DisjointBoxLayout& a_input,
00354 int a_dir, int a_len)
00355 { adjCellLo(a_output,a_input,a_dir,a_len);}
00356 inline
00357 void adjCellHi_dbl(DisjointBoxLayout& a_output,
00358 const DisjointBoxLayout& a_input,
00359 int a_dir, int a_len)
00360 { adjCellHi(a_output,a_input,a_dir,a_len);}
00361 inline
00362 void coarsen_dbl(DisjointBoxLayout& output,
00363 const DisjointBoxLayout& input,
00364 int refinement)
00365 { coarsen(output, input, refinement);}
00366 inline
00367 void refine_dbl(DisjointBoxLayout& output,
00368 const DisjointBoxLayout& input,
00369 int refinement)
00370 { refine(output, input, refinement);}
00371
00372 #include "NamespaceFooter.H"
00373 #endif