Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

BRMeshRefine.H

Go to the documentation of this file.
00001 /* _______              __
00002   / ___/ /  ___  __ _  / /  ___
00003  / /__/ _ \/ _ \/  ' \/ _ \/ _ \
00004  \___/_//_/\___/_/_/_/_.__/\___/ 
00005 */
00006 //
00007 // This software is copyright (C) by the Lawrence Berkeley
00008 // National Laboratory.  Permission is granted to reproduce
00009 // this software for non-commercial purposes provided that
00010 // this notice is left intact.
00011 // 
00012 // It is acknowledged that the U.S. Government has rights to
00013 // this software under Contract DE-AC03-765F00098 between
00014 // the U.S.  Department of Energy and the University of
00015 // California.
00016 //
00017 // This software is provided as a professional and academic
00018 // contribution for joint exchange. Thus it is experimental,
00019 // is provided ``as is'', with no warranties of any kind
00020 // whatsoever, no support, no promise of updates, or printed
00021 // documentation. By using this software, you acknowledge
00022 // that the Lawrence Berkeley National Laboratory and
00023 // Regents of the University of California shall have no
00024 // liability with respect to the infringement of other
00025 // copyrights by any part of this software.
00026 
00027 #ifndef _BR_MESH_REFINE_H_
00028 #define _BR_MESH_REFINE_H_
00029 // Include files:
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 // Constants:
00042 
00043 // Minimum acceptable ratio of tagged cells to total cells for 
00044 // the Berger-Rigoutsos algorithm in \func{makeBoxes}.
00045 // Used as default for \var{FillRatio} optional argument.
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

Generated on Wed Jun 2 13:53:32 2004 for Chombo&INSwithParticles by doxygen 1.3.2