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)
41 Bcrse_p(Teuchos::null),
42 Bfine_p(Teuchos::null),
46 residual_p(Teuchos::null),
47 error_p(Teuchos::null),
48 UnCovered_p(Teuchos::null),
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;
89 Bcrse_p = Teuchos::null;
90 Bfine_p = Teuchos::null;
91 Awf_p = Teuchos::null;
93 for (
int j = 0; j < AMREX_SPACEDIM; ++j)
94 G_p[j] = Teuchos::null;
96 UnCovered_p = Teuchos::null;
98 rho_p = Teuchos::null;
99 phi_p = Teuchos::null;
100 residual_p = Teuchos::null;
101 error_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) {
130 if ( bc_mp[d]->isBoundary(iv, d, &nr_m[0]) ) {
132 bc_mp[d]->apply(iv, d, map, value,
this, &nr_m[0]);
139template <
class MatrixType,
class VectorType>
145 if ( fab(iv) != Mask::PHYSBNDRY )
148 bool applied =
false;
149 for (
int d = 0; d < AMREX_SPACEDIM; ++d) {
150 if ( bc_mp[d]->isBoundary(iv, d, &nr_m[0]) ) {
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)));
172 mask.reset(
new mask_t(grids, dmap, 1, 1));
173 mask->BuildMask(geom.Domain(), period,
174 Mask::COVERED, Mask::BNDRY,
175 Mask::PHYSBNDRY, Mask::INTERIOR);
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>
213 iv.allLT(
AmrIntVect_t(D_DECL(nr_m[0], nr_m[1], nr_m[2]))) );
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();
262 go_t N = grids.numPts();
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
Tpetra::Map< local_ordinal_t, global_ordinal_t, node_t > dmap_t
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
scalar_t invdx_m[AMREX_SPACEDIM]
inverse cell size in particle rest frame
bool isValid(const AmrIntVect_t &iv) const
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
Teuchos::RCP< vector_t > error_p
error over all cells
amr::AmrIntVect_t AmrIntVect_t
bool isBoundary(const AmrIntVect_t &iv) const
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
boundary_t bc_mp[AMREX_SPACEDIM]
boundary conditions
std::shared_ptr< AmrBoundary< AmrMultiGridLevel< MatrixType, VectorType > > > boundary_t
const scalar_t * cellSize() const
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.