22#define AMR_NO_SCALE false
25template <
class MatrixType,
class VectorType>
28 const amrex::BoxArray& _grids,
29 const amrex::DistributionMapping& _dmap,
33 const Teuchos::RCP<comm_t>& comm)
53 for (
int j = 0; j < AMREX_SPACEDIM; ++j) {
54 G_p[j] = Teuchos::null;
56 nr_m[j] = _geom.Domain().length(j);
64 dx_m[j] = meshScaling[j] *
geom.CellSize(j);
81template <
class MatrixType,
class VectorType>
84 map_p = Teuchos::null;
86 Anf_p = Teuchos::null;
91 Awf_p = Teuchos::null;
93 for (
int j = 0; j < AMREX_SPACEDIM; ++j)
94 G_p[j] = Teuchos::null;
98 rho_p = Teuchos::null;
99 phi_p = Teuchos::null;
105template <
class MatrixType,
class VectorType>
108#if AMREX_SPACEDIM == 3
109 return iv[0] + (iv[1] +
nr_m[1] * iv[2]) *
nr_m[0];
111 return iv[0] + iv[1] *
nr_m[0];
116template <
class MatrixType,
class VectorType>
119 return bc_mp[0]->isBoundary(iv, &
nr_m[0]);
123template <
class MatrixType,
class VectorType>
128 bool applied =
false;
129 for (
int d = 0; d < AMREX_SPACEDIM; ++d) {
132 bc_mp[d]->apply(iv, d, map, value,
this, &
nr_m[0]);
139template <
class MatrixType,
class VectorType>
148 bool applied =
false;
149 for (
int d = 0; d < AMREX_SPACEDIM; ++d) {
152 bc_mp[d]->apply(iv, d, map, value,
this, &
nr_m[0]);
159template <
class MatrixType,
class VectorType>
165 bc_mp[dir]->apply(iv, dir, map, value,
this, &
nr_m[0]);
169template <
class MatrixType,
class VectorType>
171 amrex::Periodicity period(
AmrIntVect_t(D_DECL(0, 0, 0)));
173 mask->BuildMask(
geom.Domain(), period,
176 mask->FillBoundary(period);
180template <
class MatrixType,
class VectorType>
186template <
class MatrixType,
class VectorType>
192template <
class MatrixType,
class VectorType>
198template <
class MatrixType,
class VectorType>
204template <
class MatrixType,
class VectorType>
210template <
class MatrixType,
class VectorType>
217template <
class MatrixType,
class VectorType>
221 go_t localNumElements = 0;
223 Teuchos::Array<go_t> globalindices;
225 for (amrex::MFIter mfi(
grids,
dmap,
true); mfi.isValid(); ++mfi) {
226 const amrex::Box& tbx = mfi.tilebox();
227 const int* lo = tbx.loVect();
228 const int* hi = tbx.hiVect();
230 for (
int i = lo[0]; i <= hi[0]; ++i) {
231 for (
int j = lo[1]; j <= hi[1]; ++j) {
232#if AMREX_SPACEDIM == 3
233 for (
int k = lo[2]; k <= hi[2]; ++k) {
239 globalindices.push_back(globalidx);
242#if AMREX_SPACEDIM == 3
254 amrex::Box bx =
grids.minimalBox();
255 const int* lo = bx.loVect();
264 map_p = Teuchos::rcp(
new dmap_t(N, globalindices, baseIndex, comm) );
void serialize(Param_t params, std::ostringstream &os)
serializes params using Boost archive
amrex::IntVect AmrIntVect_t
Teuchos::RCP< matrix_t > G_p[AMREX_SPACEDIM]
gradient matrices in x, y, and z to compute electric field
std::unordered_map< go_t, scalar_t > umap_t
amrex::FabArray< basefab_t > mask_t
amr::local_ordinal_t lo_t
Teuchos::RCP< vector_t > rho_p
charge density
scalar_t invdx_m[AMREX_SPACEDIM]
inverse cell size in particle rest frame
std::unique_ptr< mask_t > mask
interior, phys boundary, interface, covered
bool isValid(const AmrIntVect_t &iv) const
Teuchos::RCP< matrix_t > UnCovered_p
uncovered cells
bool applyBoundary(const AmrIntVect_t &iv, umap_t &map, const scalar_t &value)
amrex::BaseFab< int > basefab_t
Teuchos::RCP< vector_t > residual_p
residual over all cells
AmrIntVect_t rr_m
refinement
Teuchos::RCP< matrix_t > Awf_p
composite Poisson matrix
Teuchos::RCP< vector_t > phi_p
potential vector
std::unique_ptr< mask_t > crsemask
Teuchos::RCP< matrix_t > Bfine_p
boundary from fine cells
Teuchos::RCP< vector_t > error_p
error over all cells
const amrex::BoxArray & grids
boxes of this level
std::unique_ptr< mask_t > refmask
covered (i.e. refined) or not-covered
amr::AmrIntVect_t AmrIntVect_t
const amrex::DistributionMapping & dmap
AMReX core distribution map.
Teuchos::RCP< matrix_t > Bcrse_p
boundary from coarse cells
bool isBoundary(const AmrIntVect_t &iv) const
Teuchos::RCP< matrix_t > Anf_p
no fine Poisson matrix
amr::AmrGeometry_t AmrGeometry_t
const AmrIntVect_t & refinement() const
go_t nr_m[AMREX_SPACEDIM]
number of grid points
const AmrGeometry_t & geom
geometry of this problem
const scalar_t * invCellSize() const
amr::global_ordinal_t go_t
Teuchos::RCP< matrix_t > R_p
restriction matrix
boundary_t bc_mp[AMREX_SPACEDIM]
boundary conditions
std::shared_ptr< AmrBoundary< AmrMultiGridLevel< MatrixType, VectorType > > > boundary_t
const scalar_t * cellSize() const
Teuchos::RCP< matrix_t > I_p
interpolation matrix
AmrMultiGridLevel(const Vector_t &meshScaling, const amrex::BoxArray &_grids, const amrex::DistributionMapping &_dmap, const AmrGeometry_t &_geom, const AmrIntVect_t &rr, const boundary_t *bc, const Teuchos::RCP< comm_t > &comm)
scalar_t dx_m[AMREX_SPACEDIM]
cell size in particle rest frame
go_t serialize(const AmrIntVect_t &iv) const
void buildMap(const Teuchos::RCP< comm_t > &comm)
Teuchos::RCP< dmap_t > map_p
Tpetra core map.
Vektor< double, 3 > Vector_t