⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 brmeshrefine.h

📁 自适应网格划分通用程序包
💻 H
字号:
// This software is copyright (C) by the Lawrence Berkeley
// National Laboratory.  Permission is granted to reproduce
// this software for non-commercial purposes provided that
// this notice is left intact.
// 
// It is acknowledged that the U.S. Government has rights to
// this software under Contract DE-AC03-765F00098 between
// the U.S.  Department of Energy and the University of
// California.
//
// This software is provided as a professional and academic
// contribution for joint exchange. Thus it is experimental,
// is provided ``as is'', with no warranties of any kind
// whatsoever, no support, no promise of updates, or printed
// documentation. By using this software, you acknowledge
// that the Lawrence Berkeley National Laboratory and
// Regents of the University of California shall have no
// liability with respect to the infringement of other
// copyrights by any part of this software.

#ifndef _BR_MESH_REFINE_H_
#define _BR_MESH_REFINE_H_
// Include files:

#include <climits>

#include "Vector.H"
#include "Box.H"
#include "IntVectSet.H"
#include "REAL.H"
#include "MeshRefine.H"
#include "Interval.H"
#include <list>

// Constants:

// Minimum acceptable ratio of tagged cells to total cells for 
// the Berger-Rigoutsos algorithm in \func{makeBoxes}.
// Used as default for \var{FillRatio} optional argument.
#ifndef _BR_MIN_BOX_FILL_RATIO_
#define _BR_MIN_BOX_FILL_RATIO_ ( 0.75 )
#endif



class BRMeshRefine : public MeshRefine
{
  
public:
  BRMeshRefine();
  
  BRMeshRefine(
               const Box& a_baseDomain,
               const Vector<int>& a_refRatios,
               const Real a_fillRatio,
               const int a_blockFactor,
               const int a_bufferSize,
               const int a_maxSize);

  BRMeshRefine(
               const ProblemDomain& a_baseDomain,
               const Vector<int>& a_refRatios,
               const Real a_fillRatio,
               const int a_blockFactor,
               const int a_bufferSize,
               const int a_maxSize);
  

  virtual ~BRMeshRefine();
  
  void define(
              const Box& a_baseDomain,
              const Vector<int>& a_refRatios,
              const Real a_fillRatio,
              const int a_blockFactor,
              const int a_bufferSize,
              const int a_maxSize);


  void define(
              const ProblemDomain& a_baseDomain,
              const Vector<int>& a_refRatios,
              const Real a_fillRatio,
              const int a_blockFactor,
              const int a_bufferSize,
              const int a_maxSize);
  


  void 
  makeBoxes(
            Vector<Box>&      a_mesh,        
            const IntVectSet& a_tags,        
            const IntVectSet& a_pnd,         
            const ProblemDomain& a_domain,
            const int         a_maxSize) const;
  

protected:
  void 
  makeBoxes(
            std::list<Box>&      a_mesh,        
            const IntVectSet& a_tags,        
            const IntVectSet& a_pnd,         
            const ProblemDomain& a_domain,
            const int         a_maxSize,
            const int         a_depth
            ) const;
  void
  splitBox(std::list<Box> & a_boxes ,
           const std::list<Box>::iterator& a_boxindex,
           const int a_dimension ,const int a_maxboxsize ) const;
  
  Vector<int>
  makeTrace( const IntVectSet& a_Ivs ,int a_dir ) const;
  
  void
  makeTraces( const IntVectSet& a_Ivs ,Vector<int>* a_traces ) const;
  int
  findSplit( const Vector<int>& a_trace ) const;
  
  int
  findMaxInflectionPoint( const Vector<int>& a_trace ,int& a_maxVal ) const;
  
  void
  splitTags( const IntVectSet& a_tags,
             const int a_split_dir ,const int a_split_indx,
             IntVectSet& a_tags_lo ,IntVectSet& a_tags_hi ) const;
  
  void 
  breakBoxes(Vector<Box>& a_vboxin,  const int& a_maxSize, 
             const int& a_idir) const;
  
  int
  maxloc( const int* a_V ,const int a_Size ) const;
  

  void makeBoxesParallel(std::list<Box>&      a_mesh,
                                                 const IntVectSet&    a_tags,
                                                 const IntVectSet&    a_pnd,
                                                 const ProblemDomain& a_domain,
                                                 const int            a_maxSize,
                                                 const int            a_depth,
                                                 const int            a_minSize,
                                                 const Interval&      a_procInterval
                                                 ) const;

  void sendBoxesParallel(   const std::list<Box>& a_mesh,
                            int tag) const;


  void receiveBoxesParallel(const Interval& a_from,
                                            const Interval& a_to,
                                                    std::list<Box>& a_mesh,
                            int tag) const;

  
};


extern void domainSplit(const ProblemDomain& a_domain, Vector<Box>& a_vbox, 
                        int a_maxSize, int a_blockfactor=1);


extern void domainSplit(const Box& a_domain, Vector<Box>& a_vbox, 
                        int a_maxSize, int a_blockfactor=1);

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -