00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef _BR_MESH_REFINE_H_
00028 #define _BR_MESH_REFINE_H_
00029
00030
00031 #include <climits>
00032
00033 #include "Vector.H"
00034 #include "Box.H"
00035 #include "IntVectSet.H"
00036 #include "REAL.H"
00037 #include "MeshRefine.H"
00038 #include "Interval.H"
00039 #include <list>
00040
00041
00042
00043
00044
00045
00046 #ifndef _BR_MIN_BOX_FILL_RATIO_
00047 #define _BR_MIN_BOX_FILL_RATIO_ ( 0.75 )
00048 #endif
00049
00050
00052
00111 class BRMeshRefine : public MeshRefine
00112 {
00113
00114 public:
00116 BRMeshRefine();
00117
00119 BRMeshRefine(
00120 const Box& a_baseDomain,
00122 const Vector<int>& a_refRatios,
00124 const Real a_fillRatio,
00126 const int a_blockFactor,
00128 const int a_bufferSize,
00130 const int a_maxSize);
00131
00133 BRMeshRefine(
00134 const ProblemDomain& a_baseDomain,
00136 const Vector<int>& a_refRatios,
00138 const Real a_fillRatio,
00140 const int a_blockFactor,
00142 const int a_bufferSize,
00144 const int a_maxSize);
00145
00146
00148 virtual ~BRMeshRefine();
00149
00151 void define(
00152 const Box& a_baseDomain,
00154 const Vector<int>& a_refRatios,
00156 const Real a_fillRatio,
00158 const int a_blockFactor,
00160 const int a_bufferSize,
00162 const int a_maxSize);
00163
00164
00166 void define(
00167 const ProblemDomain& a_baseDomain,
00169 const Vector<int>& a_refRatios,
00171 const Real a_fillRatio,
00173 const int a_blockFactor,
00175 const int a_bufferSize,
00177 const int a_maxSize);
00178
00179
00181
00188 void
00189 makeBoxes(
00190 Vector<Box>& a_mesh,
00192 const IntVectSet& a_tags,
00194 const IntVectSet& a_pnd,
00196 const ProblemDomain& a_domain,
00198 const int a_maxSize) const;
00199
00200
00201 protected:
00205 void
00206 makeBoxes(
00207 std::list<Box>& a_mesh,
00209 const IntVectSet& a_tags,
00211 const IntVectSet& a_pnd,
00213 const ProblemDomain& a_domain,
00215 const int a_maxSize,
00217 const int a_depth
00218 ) const;
00221 void
00222 splitBox(std::list<Box> & a_boxes ,
00223 const std::list<Box>::iterator& a_boxindex,
00224 const int a_dimension ,const int a_maxboxsize ) const;
00225
00227 Vector<int>
00228 makeTrace( const IntVectSet& a_Ivs ,int a_dir ) const;
00229
00231 void
00232 makeTraces( const IntVectSet& a_Ivs ,Vector<int>* a_traces ) const;
00234 int
00235 findSplit( const Vector<int>& a_trace ) const;
00236
00238 int
00239 findMaxInflectionPoint( const Vector<int>& a_trace ,int& a_maxVal ) const;
00240
00242 void
00243 splitTags( const IntVectSet& a_tags,
00244 const int a_split_dir ,const int a_split_indx,
00245 IntVectSet& a_tags_lo ,IntVectSet& a_tags_hi ) const;
00246
00248 void
00249 breakBoxes(Vector<Box>& a_vboxin, const int& a_maxSize,
00250 const int& a_idir) const;
00251
00253 int
00254 maxloc( const int* a_V ,const int a_Size ) const;
00255
00256
00257 void makeBoxesParallel(std::list<Box>& a_mesh,
00258 const IntVectSet& a_tags,
00259 const IntVectSet& a_pnd,
00260 const ProblemDomain& a_domain,
00261 const int a_maxSize,
00262 const int a_depth,
00263 const int a_minSize,
00264 const Interval& a_procInterval
00265 ) const;
00266
00267 void sendBoxesParallel( const std::list<Box>& a_mesh,
00268 int tag) const;
00269
00270
00271 void receiveBoxesParallel(const Interval& a_from,
00272 const Interval& a_to,
00273 std::list<Box>& a_mesh,
00274 int tag) const;
00275
00276
00277 };
00278
00280
00288 extern void domainSplit(const ProblemDomain& a_domain, Vector<Box>& a_vbox,
00289 int a_maxSize, int a_blockfactor=1);
00290
00291
00293
00303 extern void domainSplit(const Box& a_domain, Vector<Box>& a_vbox,
00304 int a_maxSize, int a_blockfactor=1);
00305
00306
00308
00312 extern void
00313 breakBoxes(Vector<Box>& a_vboxin, const int& a_maxSize, const int& a_idir);
00314
00315 #endif