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);
80template <
class MatrixType,
class VectorType>
83 map_p = Teuchos::null;
85 Anf_p = Teuchos::null;
88 Bcrse_p = Teuchos::null;
89 Bfine_p = Teuchos::null;
90 Awf_p = Teuchos::null;
92 for (
int j = 0; j < AMREX_SPACEDIM; ++j)
93 G_p[j] = Teuchos::null;
95 UnCovered_p = Teuchos::null;
97 rho_p = Teuchos::null;
98 phi_p = Teuchos::null;
99 residual_p = Teuchos::null;
100 error_p = Teuchos::null;
104template <
class MatrixType,
class VectorType>
107#if AMREX_SPACEDIM == 3
108 return iv[0] + (iv[1] + nr_m[1] * iv[2]) * nr_m[0];
110 return iv[0] + iv[1] * nr_m[0];
115template <
class MatrixType,
class VectorType>
118 return bc_mp[0]->isBoundary(iv, &nr_m[0]);
122template <
class MatrixType,
class VectorType>
127 bool applied =
false;
128 for (
int d = 0; d < AMREX_SPACEDIM; ++d) {
129 if ( bc_mp[d]->isBoundary(iv, d, &nr_m[0]) ) {
131 bc_mp[d]->apply(iv, d, map, value,
this, &nr_m[0]);
138template <
class MatrixType,
class VectorType>
144 if ( fab(iv) != Mask::PHYSBNDRY )
147 bool applied =
false;
148 for (
int d = 0; d < AMREX_SPACEDIM; ++d) {
149 if ( bc_mp[d]->isBoundary(iv, d, &nr_m[0]) ) {
151 bc_mp[d]->apply(iv, d, map, value,
this, &nr_m[0]);
158template <
class MatrixType,
class VectorType>
164 bc_mp[dir]->apply(iv, dir, map, value,
this, &nr_m[0]);
168template <
class MatrixType,
class VectorType>
170 amrex::Periodicity period(
AmrIntVect_t(D_DECL(0, 0, 0)));
171 mask.reset(
new mask_t(grids, dmap, 1, 1));
172 mask->BuildMask(geom.Domain(), period,
173 Mask::COVERED, Mask::BNDRY,
174 Mask::PHYSBNDRY, Mask::INTERIOR);
175 mask->FillBoundary(period);
179template <
class MatrixType,
class VectorType>
185template <
class MatrixType,
class VectorType>
191template <
class MatrixType,
class VectorType>
197template <
class MatrixType,
class VectorType>
203template <
class MatrixType,
class VectorType>
209template <
class MatrixType,
class VectorType>
212 iv.allLT(
AmrIntVect_t(D_DECL(nr_m[0], nr_m[1], nr_m[2]))) );
216template <
class MatrixType,
class VectorType>
219 Teuchos::Array<go_t> globalindices;
221 for (amrex::MFIter mfi(grids, dmap,
true); mfi.isValid(); ++mfi) {
222 const amrex::Box& tbx = mfi.tilebox();
223 const int* lo = tbx.loVect();
224 const int* hi = tbx.hiVect();
226 for (
int i = lo[0]; i <= hi[0]; ++i) {
227 for (
int j = lo[1]; j <= hi[1]; ++j) {
228#if AMREX_SPACEDIM == 3
229 for (
int k = lo[2]; k <= hi[2]; ++k) {
235 globalindices.push_back(globalidx);
237#if AMREX_SPACEDIM == 3
249 amrex::Box bx = grids.minimalBox();
250 const int* lo = bx.loVect();
257 go_t N = grids.numPts();
259 map_p = Teuchos::rcp(
new dmap_t(N, globalindices, baseIndex, comm) );
void serialize(Param_t params, std::ostringstream &os)
serializes params to a text stream, replaces boost::serialization
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.