coarseaverage.h

来自「自适应网格划分通用程序包」· C头文件 代码 · 共 107 行

H
107
字号
// 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 _COARSE_AVERAGE_H_
#define _COARSE_AVERAGE_H_

#include "REAL.H"
#include "BaseFab.H"
#include "FArrayBox.H"
#include "LevelData.H"

class DisjointBoxLayout;


class CoarseAverage
{
public:

  CoarseAverage();


  ~CoarseAverage();


  CoarseAverage(const DisjointBoxLayout& a_fine_domain,
                int a_numcomps,
                int a_ref_ratio);


  CoarseAverage(const DisjointBoxLayout& a_fine_domain,
                const DisjointBoxLayout& a_crse_domain,
                int a_numcomps,
                int a_ref_ratio);


  void
  define(const DisjointBoxLayout& a_fine_domain, // the fine level domain
         int a_numcomps,                         // the number of components
         int a_ref_ratio);                       // the refinement ratio



  void
  define(const DisjointBoxLayout& a_fine_domain, // the fine level domain
         const DisjointBoxLayout& a_crse_domain, // the crse level domain
         int a_numcomps,                         // the number of components
         int a_ref_ratio);                       // the refinement ratio



  bool 
  isDefined() const;


  //     this method would like to be const, but the work array is changed.
  //     this suggests that the work array should not be persistent.
  void
  averageToCoarse(LevelData<FArrayBox>& a_coarse_data,
                  const LevelData<FArrayBox>& a_fine_data);

protected:
  void
  averageGridData(BaseFab<Real>& a_coarse,
                  const BaseFab<Real>& a_fine,
                  int a_ref_ratio)
    const;

protected:
  bool is_defined;

  // the refinement ratio
  int m_ref_ratio;
  // work array for the coarsening of the fine data, of the same "shape"
  // as the fine data.
  LevelData<FArrayBox> m_coarsened_fine_data;

  // has a copier been defined to transfer data to coarse-grid layout?
  bool m_is_copier_defined;

  // cached copier to handle transfer to coarse-grid layout.
  Copier m_copier;
  
  

};

#endif

⌨️ 快捷键说明

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