23#include <DisjointBoxLayout.H>
26#include <EBISLayout.H>
27#include <VoFIterator.H>
38#include <CD_NamespaceHeader.H>
76 define(
const Vector<RefCountedPtr<MFLevelGrid>>& a_levelGrids,
77 const Vector<RefCountedPtr<MFLevelGrid>>& a_levelGridsCoFi,
78 const Vector<RefCountedPtr<MFLevelGrid>>& a_levelGridsFiCo,
79 const Vector<RefCountedPtr<LevelData<BaseFab<bool>>>>& a_validCells,
80 const Vector<RefCountedPtr<LevelData<BaseFab<bool>>>>& a_coarHaloCF,
81 const Vector<RefCountedPtr<LevelData<BaseFab<bool>>>>& a_fineHaloCF,
82 const Vector<int>& a_refinementRatios,
83 const Vector<Real>& a_dx,
84 const int a_finestLevel,
85 const int a_numGhost)
noexcept;
127 virtual const Vector<RefCountedPtr<MFLevelGrid>>&
136 virtual const Vector<RefCountedPtr<MFLevelGrid>>&
145 virtual const Vector<RefCountedPtr<MFLevelGrid>>&
153 virtual const Vector<int>&
161 virtual const Vector<RefCountedPtr<LevelData<BaseFab<PetscAMRCell>>>>&
169 virtual const Vector<RefCountedPtr<LevelData<BaseFab<PetscAMRCell>>>>&
177 virtual const Vector<RefCountedPtr<LevelData<BaseFab<PetscAMRCell>>>>&
186 virtual Vector<RefCountedPtr<LayoutData<VoFIterator>>>&
196 virtual Vector<PetscInt>
214 const DataIndex& a_din,
215 const int a_phase)
const noexcept;
233 const VoFStencil& a_fineStencil,
235 const DataIndex& a_din,
236 const int a_phase)
const noexcept;
254 const VoFStencil& a_coarStencil,
256 const DataIndex& a_din,
257 const int a_phase)
const noexcept;
274 VoFStencil& a_stencilCoar,
275 const RefCountedPtr<EBMultigridInterpolator>& a_interpolator,
277 const DataIndex& a_din)
const noexcept;
297 const VoFStencil& a_stencil,
298 const VoFStencil& a_stencilFine,
299 const RefCountedPtr<EBMultigridInterpolator>& a_interpolator,
301 const DataIndex& a_din,
302 const int a_phase)
const noexcept;
310 create(Vec& a_x)
noexcept;
327 setValue(Vec& a_x,
const PetscScalar a_value)
const noexcept;
519 const VoFStencil& a_stencil,
522 const std::
string& a_what) const noexcept;
535 const std::
string& a_what) const noexcept;
544#include <CD_NamespaceFooter.H>
Silly, but useful functions that override standard Chombo HDF5 IO.
Class for holding data across EBAMR hierarchies.
Parent base class for multigrid interpolation.
Declaration of a wrapper for wrapping multifluid EBLevelGrids.
Declaration of a cell type for indicating if a cell is covered, ghost, etc.
Declaration of a simple mapping between a PETSc index and an AMR cell.
Declaration of a simple stencil class for PETSc.
Class for storing grid information and corresponding PETSc rows. Used for mapping between Chombo and ...
Definition CD_PetscAMRCell.H:38
virtual const Vector< RefCountedPtr< MFLevelGrid > > & getMFLevelGridsCoFi() const noexcept
Get the coarsened fine grids.
Definition CD_PetscGrid.cpp:198
virtual void defineAMRCells() noexcept
Define basic cell information for PetscGrid.
Definition CD_PetscGrid.cpp:563
virtual Vector< PetscInt > getLocalRows(const int a_iphase) const noexcept
Get the global PETSc rows of a phase that this rank owns.
Definition CD_PetscGrid.cpp:290
Vector< Real > m_dx
Grid resolutions.
Definition CD_PetscGrid.H:451
virtual Vector< RefCountedPtr< LayoutData< VoFIterator > > > & getVoFIterator(const int a_iphase) const noexcept
Get iterators over the cut cells that are PETSc rows on a phase.
Definition CD_PetscGrid.cpp:276
virtual PetscStencil getPetscStencilWithCoarserLevel(const VoFStencil &a_stencil, const VoFStencil &a_coarStencil, const int a_level, const DataIndex &a_din, const int a_phase) const noexcept
Rewrite a two-level stencil, over cells on a level and the next coarser level, as a stencil over glob...
Definition CD_PetscGrid.cpp:372
virtual PetscStencil getPetscStencilWithGhostCells(const VoFStencil &a_stencilCoar, const VoFStencil &a_stencil, const VoFStencil &a_stencilFine, const RefCountedPtr< EBMultigridInterpolator > &a_interpolator, const int a_level, const DataIndex &a_din, const int a_phase) const noexcept
Rewrite a stencil over three levels, whose part on the middle level may contain coarse-fine ghost cel...
Definition CD_PetscGrid.cpp:451
PetscInt m_numLocalRows
Number of rows owned locally.
Definition CD_PetscGrid.H:391
virtual void addRows(PetscStencil &a_petscStencil, const VoFStencil &a_stencil, const BaseFab< PetscAMRCell > &a_map, const int a_phase, const std::string &a_what) const noexcept
Add the rows of a stencil's cells to a PETSc stencil.
Definition CD_PetscGrid.cpp:498
virtual const Vector< RefCountedPtr< MFLevelGrid > > & getMFLevelGrids() const noexcept
Get the grids on each level.
Definition CD_PetscGrid.cpp:185
virtual bool isDefined() const noexcept
Is defined or not.
Definition CD_PetscGrid.cpp:135
Vector< RefCountedPtr< LayoutData< Vector< PetscDOF > > > > m_petscToAMR[2]
Mapping of PETSc local row index back to AMR.
Definition CD_PetscGrid.H:481
virtual void setValue(Vec &a_x, const PetscScalar a_value) const noexcept
Set values in a PETSc vector.
Definition CD_PetscGrid.cpp:880
virtual void abortInvalidEntry(const IntVect &a_iv, const BaseFab< PetscAMRCell > &a_map, const int a_phase, const std::string &a_what) const noexcept
Abort because a stencil entry lies outside the map or is not a PETSc row, naming the cell and the rea...
Definition CD_PetscGrid.cpp:532
int m_numPhases
Number of phases.
Definition CD_PetscGrid.H:386
virtual void putPetscInChombo(MFAMRCellData &a_y, const Vec &a_x) const noexcept
Pull data from a PETSc vector into a chombo-discharge data holder.
Definition CD_PetscGrid.cpp:967
virtual const Vector< RefCountedPtr< LevelData< BaseFab< PetscAMRCell > > > > & getAMRToPetscCoFi() const noexcept
Get the map from AMR cells to PETSc rows, on the coarsened fine grids.
Definition CD_PetscGrid.cpp:250
virtual PetscInt getNumGlobalRows() const noexcept
Get the total number of PETSc rows over all ranks.
Definition CD_PetscGrid.cpp:172
virtual const Vector< RefCountedPtr< MFLevelGrid > > & getMFLevelGridsFiCo() const noexcept
Get the refined coarse grids.
Definition CD_PetscGrid.cpp:211
Vector< RefCountedPtr< LevelData< BaseFab< PetscAMRCell > > > > m_amrToPetscFiCo
Mapping structure for moving between AMR cells and PETSc rows.
Definition CD_PetscGrid.H:475
virtual void clear() noexcept
Clear the object.
Definition CD_PetscGrid.cpp:119
Vector< RefCountedPtr< MFLevelGrid > > m_levelGridsFiCo
Refined grids.
Definition CD_PetscGrid.H:426
virtual void definePetscRows() noexcept
Build the Chombo <--> Petsc index mapping for the valid cells.
Definition CD_PetscGrid.cpp:658
virtual void define(const Vector< RefCountedPtr< MFLevelGrid > > &a_levelGrids, const Vector< RefCountedPtr< MFLevelGrid > > &a_levelGridsCoFi, const Vector< RefCountedPtr< MFLevelGrid > > &a_levelGridsFiCo, const Vector< RefCountedPtr< LevelData< BaseFab< bool > > > > &a_validCells, const Vector< RefCountedPtr< LevelData< BaseFab< bool > > > > &a_coarHaloCF, const Vector< RefCountedPtr< LevelData< BaseFab< bool > > > > &a_fineHaloCF, const Vector< int > &a_refinementRatios, const Vector< Real > &a_dx, const int a_finestLevel, const int a_numGhost) noexcept
Main define function. Puts object in usable state.
Definition CD_PetscGrid.cpp:58
virtual PetscInt getNumLocalRows() const noexcept
Get the number of PETSc rows owned by this rank.
Definition CD_PetscGrid.cpp:159
virtual ~PetscGrid() noexcept
Destructor. Does nothing.
Definition CD_PetscGrid.cpp:49
Vector< RefCountedPtr< LayoutData< VoFIterator > > > m_vofIterators[2]
Iterators over the cut cells that are PETSc rows, per phase and level.
Definition CD_PetscGrid.H:487
bool m_debug
Run-time debug or not.
Definition CD_PetscGrid.H:366
Vector< int > m_refRat
Refinement ratios between levels.
Definition CD_PetscGrid.H:446
Vector< RefCountedPtr< LevelData< BaseFab< bool > > > > m_validCells
Data holder which is true for cells not covered by a finer grid.
Definition CD_PetscGrid.H:431
bool m_profile
Run-time profile or not.
Definition CD_PetscGrid.H:371
int m_numGhost
Number of ghost cells.
Definition CD_PetscGrid.H:381
virtual void create(Vec &a_x) noexcept
Create a PETSc vector.
Definition CD_PetscGrid.cpp:851
PetscInt m_numGlobalRows
Number of global rows.
Definition CD_PetscGrid.H:396
virtual const Vector< RefCountedPtr< LevelData< BaseFab< PetscAMRCell > > > > & getAMRToPetsc() const noexcept
Get the map from AMR cells to PETSc rows, on the grids of each level.
Definition CD_PetscGrid.cpp:237
virtual const Vector< RefCountedPtr< LevelData< BaseFab< PetscAMRCell > > > > & getAMRToPetscFiCo() const noexcept
Get the map from AMR cells to PETSc rows, on the refined coarse grids.
Definition CD_PetscGrid.cpp:263
Vector< PetscInt > m_numRowsPerRank
Number of rows per MPI rank. Visible to all ranks.
Definition CD_PetscGrid.H:411
virtual void destroy(Vec &a_x) noexcept
Destroy a PETSc vector.
Definition CD_PetscGrid.cpp:867
Vector< RefCountedPtr< MFLevelGrid > > m_levelGridsCoFi
Coarsened grids.
Definition CD_PetscGrid.H:421
Vector< RefCountedPtr< LevelData< BaseFab< bool > > > > m_coarHaloCF
Coarse-side cells on refinement interface.
Definition CD_PetscGrid.H:436
virtual void putChomboInPetsc(Vec &a_x, const MFAMRCellData &a_y) const noexcept
Push data form a chombo-discharge data holder into PETSc.
Definition CD_PetscGrid.cpp:909
Vector< RefCountedPtr< LevelData< BaseFab< PetscAMRCell > > > > m_amrToPetscCoFi
Mapping structure for moving between AMR cells and PETSc rows.
Definition CD_PetscGrid.H:467
virtual void defineCoFiBuffers() noexcept
Define the coarsened/refined views of m_amrToPetsc.
Definition CD_PetscGrid.cpp:786
virtual int getNumPhases() const noexcept
Get the number of phases.
Definition CD_PetscGrid.cpp:146
bool m_verbose
Verbose or not.
Definition CD_PetscGrid.H:361
PetscGrid() noexcept
Default constructor. Must subsequently call define.
Definition CD_PetscGrid.cpp:31
Vector< RefCountedPtr< MFLevelGrid > > m_levelGrids
Grids on each level.
Definition CD_PetscGrid.H:416
Vector< RefCountedPtr< LevelData< BaseFab< bool > > > > m_fineHaloCF
Fine-side cells on refinement interface.
Definition CD_PetscGrid.H:441
virtual const Vector< int > & getRefinementRatios() const noexcept
Get the refinement ratios.
Definition CD_PetscGrid.cpp:224
Vector< RefCountedPtr< LevelData< BaseFab< PetscAMRCell > > > > m_amrToPetsc
Mapping structure for moving between AMR cells and PETSc rows.
Definition CD_PetscGrid.H:459
virtual PetscStencil getPetscStencil(const VoFStencil &a_stencil, const int a_level, const DataIndex &a_din, const int a_phase) const noexcept
Rewrite a stencil over cells on one level as a stencil over global PETSc rows.
Definition CD_PetscGrid.cpp:321
ISLocalToGlobalMapping m_localToGlobalIS
Local index to global index mapping for PETSc.
Definition CD_PetscGrid.H:406
bool m_isDefined
Is defined or not.
Definition CD_PetscGrid.H:356
virtual void replaceGhostCells(VoFStencil &a_stencil, VoFStencil &a_stencilCoar, const RefCountedPtr< EBMultigridInterpolator > &a_interpolator, const int a_level, const DataIndex &a_din) const noexcept
Replace the coarse-fine ghost cells in a stencil over level a_level cells by their interpolation sten...
Definition CD_PetscGrid.cpp:399
virtual void dumpPetscGrid(const std::string &a_filename) const noexcept
Write the PETSc grid to an output HDF5 file.
Definition CD_PetscGrid.cpp:1017
int m_finestLevel
Finest grid level.
Definition CD_PetscGrid.H:376
virtual PetscStencil getPetscStencilWithFinerLevel(const VoFStencil &a_stencil, const VoFStencil &a_fineStencil, const int a_level, const DataIndex &a_din, const int a_phase) const noexcept
Rewrite a two-level stencil, over cells on a level and the next finer level, as a stencil over global...
Definition CD_PetscGrid.cpp:345
PetscInt m_localRowBegin
Global row corresponding to the first local row.
Definition CD_PetscGrid.H:401
A linear stencil over global PETSc rows, i.e. a list of (row, weight) pairs.
Definition CD_PetscStencil.H:43