27 BMP (amrex::Vector<amrex::Geometry> &_geom) :
IC(_geom) {}
43 amrex::Box domain =
geom[lev].Domain();
53 amrex::IndexType type = a_field[lev]->ixType();
59 for (amrex::MFIter mfi(*a_field[lev],amrex::TilingIfNotGPU()); mfi.isValid(); ++mfi)
62 if (type == amrex::IndexType::TheNodeType()) bx = mfi.grownnodaltilebox();
63 if (type == amrex::IndexType::TheCellType()) bx = mfi.growntilebox();
67 amrex::Array4<Set::Scalar>
const& field = a_field[lev]->array(mfi);
68 amrex::ParallelFor (bx,[=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
72 if (type == amrex::IndexType::TheNodeType())
74 x(0) = domlo(0) + ((amrex::Real)(i)) *
geom[lev].CellSize()[0];
75 x(1) = domlo(1) + ((amrex::Real)(j)) *
geom[lev].CellSize()[1];
77 else if (type == amrex::IndexType::TheCellType())
79 x(0) = domlo(0) + ((amrex::Real)(i) + 0.5) *
geom[lev].CellSize()[0];
80 x(1) = domlo(1) + ((amrex::Real)(j) + 0.5) *
geom[lev].CellSize()[1];
86 if (
fit == Fit::Stretch)
88 ximg(0) = (x(0) - domlo(0)) / (domhi(0) - domlo(0));
89 ximg(1) = (x(1) - domlo(1)) / (domhi(1) - domlo(1));
91 else if (
fit == Fit::FitWidth)
94 ximg(0) = (x(0) - domlo(0)) / (domhi(0) - domlo(0));
95 ximg(1) = (x(1) - domlo(1)) / (domhi(1) - domlo(1));
96 ximg(1) -= 0.5 - 0.5 / aspect_ratio;
97 ximg(1) *= aspect_ratio;
99 else if (
fit == Fit::FitHeight)
102 ximg(0) = (x(0) - domlo(0)) / (domhi(0) - domlo(0));
103 ximg(1) = (x(1) - domlo(1)) / (domhi(1) - domlo(1));
104 ximg(0) -= 0.5 - 0.5 / aspect_ratio;
105 ximg(0) *= aspect_ratio;
107 else if (
fit == Fit::Coord)
113 ximg(0) = std::min(ximg(0),1.0); ximg(1) = std::min(ximg(1),1.0);
114 ximg(0) = std::max(ximg(0),0.0); ximg(1) = std::max(ximg(1),0.0);
116 ximg(0) *= img_width;
117 ximg(1) *= img_height;
119 int I = (int)(ximg(0));
120 int J = (int)(ximg(1));
133 (fQ11*(x2-ximg(0))*(y2-ximg(1)) + fQ21*(ximg(0)-x1)*(y2-ximg(1)) + fQ12*(x2-ximg(0))*(ximg(1)-y1) + fQ22*(ximg(0)-x1)*(ximg(1)-y1)) / (img_dx * img_dy);
139 field(i,j,k) = fQ11 + (fQ12-fQ11) * (ximg(1) - y1);
145 field(i,j,k) = fQ11 + (fQ21-fQ11) * (ximg(0) - x1);
157 if (field.nComp() > 1) field(i,j,k,1) = 1.0 - field(i,j,k,0);
161 a_field[lev]->FillBoundary();
183 if (
fit==
"stretch") value.
fit = Fit::Stretch;
184 else if (
fit==
"fitheight") value.
fit = Fit::FitHeight;
185 else if (
fit==
"fitwidth") value.
fit = Fit::FitWidth;
186 else if (
fit==
"coord")
188 value.
fit = Fit::Coord;
192 else Util::Abort(
INFO,
"Invalid value for bmp fit - should be stretch/fitheight/fitwidth but received '",
fit,
"'");