00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011 #ifndef _BRMESHREFINE_H_
00012 #define _BRMESHREFINE_H_
00013
00014 #include <climits>
00015
00016 #include "Vector.H"
00017 #include "Box.H"
00018 #include "IntVectSet.H"
00019 #include "REAL.H"
00020 #include "MeshRefine.H"
00021 #include "Interval.H"
00022 #include <list>
00023 #include "NamespaceHeader.H"
00024
00025
00026
00027
00028
00029
00030 #ifndef _BR_MIN_BOX_FILL_RATIO_
00031 #define _BR_MIN_BOX_FILL_RATIO_ ( 0.75 )
00032 #endif
00033
00035
00092 class BRMeshRefine : public MeshRefine
00093 {
00094 public:
00096 BRMeshRefine();
00097
00099 BRMeshRefine(
00100 const Box& a_baseDomain,
00102 const Vector<int>& a_refRatios,
00104 const Real a_fillRatio,
00106 const int a_blockFactor,
00108 const int a_bufferSize,
00110 const int a_maxSize);
00111
00113 BRMeshRefine(
00114 const ProblemDomain& a_baseDomain,
00116 const Vector<int>& a_refRatios,
00118 const Real a_fillRatio,
00120 const int a_blockFactor,
00122 const int a_bufferSize,
00124 const int a_maxSize);
00125
00127 virtual ~BRMeshRefine();
00128
00130 void define(
00131 const Box& a_baseDomain,
00133 const Vector<int>& a_refRatios,
00135 const Real a_fillRatio,
00137 const int a_blockFactor,
00139 const int a_bufferSize,
00141 const int a_maxSize);
00142
00144 void define(
00145 const ProblemDomain& a_baseDomain,
00147 const Vector<int>& a_refRatios,
00149 const Real a_fillRatio,
00151 const int a_blockFactor,
00153 const int a_bufferSize,
00155 const int a_maxSize);
00156
00158
00165 void
00166 makeBoxes(
00167 Vector<Box>& a_mesh,
00169 const IntVectSet& a_tags,
00171 const IntVectSet& a_pnd,
00173 const ProblemDomain& a_domain,
00175 const int a_maxSize,
00176 const int a_totalBufferSize) const;
00177
00178
00179 protected:
00183 void
00184 makeBoxes(
00185 std::list<Box>& a_mesh,
00187 IntVectSet& a_tags,
00189 const IntVectSet& a_pnd,
00191 const ProblemDomain& a_domain,
00193 const int a_maxSize,
00195 const int a_depth,
00196 const int a_totalBufferSize
00197 ) const;
00200 void
00201 splitBox(std::list<Box> & a_boxes ,
00202 const std::list<Box>::iterator& a_boxindex,
00203 const int a_dimension ,const int a_maxboxsize ) const;
00204
00205 void
00206 splitBox(std::list<Box> & a_boxes ,
00207 const std::list<Box>::iterator& a_boxindex,
00208 const int a_maxboxsize ) const;
00209
00211 Vector<int>
00212 makeTrace( const IntVectSet& a_Ivs ,int a_dir ) const;
00213
00215 void
00216 makeTraces( const IntVectSet& a_Ivs ,Vector<int>* a_traces ) const;
00218 int
00219 findSplit( const Vector<int>& a_trace ) const;
00220
00221 int
00222 findSplit( const Vector<int>& a_trace, const int a_maxSize ) const;
00223
00225 int
00226 findMaxInflectionPoint( const Vector<int>& a_trace ,int& a_maxVal ) const;
00227 int
00228 findMaxInflectionPoint( const Vector<int>& a_trace ,int& a_maxVal, const int a_maxSize ) const;
00229
00231 void
00232 splitTags( const IntVectSet& a_tags,
00233 const int a_split_dir ,const int a_split_indx,
00234 IntVectSet& a_tags_lo ,IntVectSet& a_tags_hi ) const;
00235
00236 void splitTagsInPlace(const int a_split_dir, const int a_split_indx,
00237 IntVectSet& a_tags_inout_lo,
00238 IntVectSet& a_tags_hi) const;
00239
00240 void splitTagsInBestDimension(IntVectSet& a_tags_inout_lo,
00241 IntVectSet& a_tags_hi,
00242 const int a_maxSize) const;
00244 void
00245 breakBoxes(Vector<Box>& a_vboxin, const int& a_maxSize,
00246 const int& a_idir) const;
00247
00249 int
00250 maxloc( const int* a_V ,const int a_Size ) const;
00251
00252 void makeBoxesParallel(std::list<Box>& a_mesh,
00253 IntVectSet& a_tags,
00254 const IntVectSet& a_pnd,
00255 const ProblemDomain& a_domain,
00256 const int a_maxSize,
00257 const int a_depth,
00258 const int a_totalBufferSize,
00259 const int a_minSize,
00260 const Interval& a_procInterval
00261 ) const;
00262
00263 void sendBoxesParallel( const std::list<Box>& a_mesh,
00264 int tag) const;
00265
00266 void receiveBoxesParallel(const Interval& a_from,
00267 const Interval& a_to,
00268 std::list<Box>& a_mesh,
00269 int tag) const;
00270 };
00271
00273
00281 extern void domainSplit(const ProblemDomain& a_domain, Vector<Box>& a_vbox,
00282 int a_maxSize, int a_blockfactor=1);
00283
00285
00295 extern void domainSplit(const Box& a_domain, Vector<Box>& a_vbox,
00296 int a_maxSize, int a_blockfactor=1);
00297
00299
00303 extern void
00304 breakBoxes(Vector<Box>& a_vboxin, const int& a_maxSize, const int& a_idir);
00305
00306 #include "NamespaceFooter.H"
00307 #endif