chombo-discharge
Loading...
Searching...
No Matches
CD_PetscAMRCell.H
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021-2026 SINTEF Energy Research
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
12
13#ifndef CD_PETSCAMRCELL_H
14#define CD_PETSCAMRCELL_H
15
16#ifdef CH_USE_PETSC
17
18// Petsc includes
19#include "petsc.h"
20
21// Chombo includes
22#include <SPMD.H>
23
24// Our includes
25#include <CD_NamespaceHeader.H>
26
38{
39public:
43 PetscAMRCell() noexcept;
44
48 ~PetscAMRCell() noexcept;
49
53 PetscAMRCell(const PetscAMRCell&) = default;
54
59
65 operator=(const PetscAMRCell&) = default;
66
72 operator=(PetscAMRCell&&) = default;
73
84 void
85 define(const PetscInt a_petscRowPhase0,
86 const PetscInt a_petscRowPhase1,
87 const bool a_isCoveredByFinerGrid,
88 const bool a_isCoarCF,
89 const bool a_isFineCF,
90 const bool a_isGhostCF,
91 const bool a_isDomainBoundaryCell) noexcept;
92
98 void
99 setPetscRow(const int a_phase, const PetscInt a_row) noexcept;
100
105 void
106 setCoveredByFinerGrid(const bool a_coveredByFinerGrid) noexcept;
107
112 void
113 setCoarCF(const bool a_isCoarCF) noexcept;
114
119 void
120 setFineCF(const bool a_isFineCF) noexcept;
121
126 void
127 setGhostCF(const bool a_isGhostCF) noexcept;
128
133 void
134 setDomainBoundaryCell(const bool a_isDomainBoundaryCell) noexcept;
135
141 PetscInt
142 getPetscRow(const int a_iphase) const noexcept;
143
148 bool
149 isCoveredByFinerGrid() const noexcept;
150
155 bool
156 isCoarCF() const noexcept;
157
162 bool
163 isFineCF() const noexcept;
164
169 bool
170 isGhostCF() const noexcept;
171
176 bool
177 isDomainBoundaryCell() const noexcept;
178
182 PetscInt m_petscRows[2];
183
188
193
198
203
208};
209
215constexpr int
216linearSize(const PetscAMRCell& a_amrCell);
217
223void
224linearIn(PetscAMRCell& a_amrCell, const void* const a_buffer);
225
231void
232linearOut(void* const a_buffer, const PetscAMRCell& a_amrCell);
233
234#include <CD_NamespaceFooter.H>
235
236#endif
237
238#endif
void linearOut(void *const a_buffer, const PetscAMRCell &a_amrCell)
PetscAMRCell specialization of the linearization function used by LevelData.
Definition CD_PetscAMRCell.cpp:194
constexpr int linearSize(const PetscAMRCell &a_amrCell)
PetscAMRCell specialization of the linearization size function used by LevelData.
Definition CD_PetscAMRCell.cpp:165
void linearIn(PetscAMRCell &a_amrCell, const void *const a_buffer)
PetscAMRCell specialization of the linearization function used by LevelData.
Definition CD_PetscAMRCell.cpp:180
bool m_isGhostCF
If true, the cell lies outside the grid level.
Definition CD_PetscAMRCell.H:192
bool m_isCoveredByFinerGrid
If true, the cell is covered by a finer grid.
Definition CD_PetscAMRCell.H:187
void setCoarCF(const bool a_isCoarCF) noexcept
Set coarse-side CF flag.
Definition CD_PetscAMRCell.cpp:105
void define(const PetscInt a_petscRowPhase0, const PetscInt a_petscRowPhase1, const bool a_isCoveredByFinerGrid, const bool a_isCoarCF, const bool a_isFineCF, const bool a_isGhostCF, const bool a_isDomainBoundaryCell) noexcept
Define operator. Sets all parameters.
Definition CD_PetscAMRCell.cpp:73
void setDomainBoundaryCell(const bool a_isDomainBoundaryCell) noexcept
Set domain boundary flag.
Definition CD_PetscAMRCell.cpp:123
PetscAMRCell(PetscAMRCell &&)=default
Move constructor – can use default.
~PetscAMRCell() noexcept
Destructor - does nothing.
Definition CD_PetscAMRCell.cpp:69
void setCoveredByFinerGrid(const bool a_coveredByFinerGrid) noexcept
Set covered by finer grid flag.
Definition CD_PetscAMRCell.cpp:99
PetscAMRCell & operator=(const PetscAMRCell &)=default
Copy assignment, can use default.
void setGhostCF(const bool a_isGhostCF) noexcept
Set ghosted coarse-fined flag.
Definition CD_PetscAMRCell.cpp:117
PetscInt m_petscRows[2]
If >= 0, this contains the PETSc row corresponding to the grid cell on phase 0.
Definition CD_PetscAMRCell.H:182
bool isFineCF() const noexcept
Check if the cell lies on the fine-side of the refinement interface.
Definition CD_PetscAMRCell.cpp:147
bool m_isCoarCF
If true, the cell lies on the coarse side of the coarse-fine boundary.
Definition CD_PetscAMRCell.H:197
void setFineCF(const bool a_isFineCF) noexcept
Set fine-side CF flag.
Definition CD_PetscAMRCell.cpp:111
PetscAMRCell() noexcept
Constructor - does nothing.
Definition CD_PetscAMRCell.cpp:58
PetscAMRCell & operator=(PetscAMRCell &&)=default
Move assignment, can use default.
PetscAMRCell(const PetscAMRCell &)=default
Copy constructor – can use default.
bool isCoarCF() const noexcept
Check if the cell lies on the coarse-side of the refinement interface.
Definition CD_PetscAMRCell.cpp:141
bool isCoveredByFinerGrid() const noexcept
Check if the cell is covered by a finer grid.
Definition CD_PetscAMRCell.cpp:135
void setPetscRow(const int a_phase, const PetscInt a_row) noexcept
Set corresponding row in PETSc for specific phase.
Definition CD_PetscAMRCell.cpp:91
bool isGhostCF() const noexcept
Check if the cell is a ghost cell outside this grid level.
Definition CD_PetscAMRCell.cpp:153
bool isDomainBoundaryCell() const noexcept
Check if the cell is a domain boundary cell.
Definition CD_PetscAMRCell.cpp:159
PetscInt getPetscRow(const int a_iphase) const noexcept
Get the PETSc row corresponding to this cell and phase.
Definition CD_PetscAMRCell.cpp:129
bool m_isFineCF
If true, the cell lies on the fine side of the coarse-fine boundary.
Definition CD_PetscAMRCell.H:202
bool m_isDomainBoundaryCell
If true, the cell is a domain boundary cell.
Definition CD_PetscAMRCell.H:207