Construct a buildings implicit function from an STL file.
181 using namespace amrex;
186 m_stl_tools.read_stl_file(stl_file, scale, center, reverse_normal);
191 Box
const& domain = geom.Domain();
192 IntVect ngrow_vec(2);
194 Box sampled_box = domain;
195 sampled_box.grow(ngrow_vec);
199 BoxArray ba(sampled_box);
201 DistributionMapping dm(ba);
205 MultiFab mf_distributed(ba, dm, 1, ngrow_vec);
210 m_stl_tools.fillSignedDistance(mf_distributed, ngrow_vec, geom);
216 int nprocs = ParallelDescriptor::NProcs();
217 Vector<Box> boxes(nprocs, sampled_box);
219 for (
const auto& bx : boxes) {
222 BoxArray ba_replicated(std::move(bl));
225 Vector<int> pmap(nprocs);
226 std::iota(pmap.begin(), pmap.end(), 0);
227 DistributionMapping dm_replicated(std::move(pmap));
230 m_levelset_mf = std::make_shared<MultiFab>(ba_replicated, dm_replicated, 1, 0);
235 IntVect dst_nghost(0);
236 m_levelset_mf->ParallelCopy(mf_distributed, 0, 0, 1, ngrow_vec, dst_nghost);
242 const Real* problo_ptr = geom.ProbLo();
243 const Real* dx_ptr = geom.CellSize();
244 for (
int d = 0; d < AMREX_SPACEDIM; ++d) {
BuildingsLevelsetIF m_if
Definition: ERF_EBIFBuildings.H:278
amrex::STLtools m_stl_tools
STL tools object (for loading and processing STL files)
Definition: ERF_EBIFBuildings.H:273
amrex::Geometry m_geom
Domain geometry (for coordinate transformations)
Definition: ERF_EBIFBuildings.H:270
std::shared_ptr< amrex::MultiFab > m_levelset_mf
Owns the replicated levelset referenced by m_if on each rank.
Definition: ERF_EBIFBuildings.H:276
amrex::Array4< const amrex::Real > m_local_array
Local array view for GPU-compatible operator() access.
Definition: ERF_EBIFBuildings.H:135
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > m_problo
Cached geometry data for GPU-compatible access.
Definition: ERF_EBIFBuildings.H:131
amrex::Box m_data_box
Bounding box of sampled data.
Definition: ERF_EBIFBuildings.H:128
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > m_dx
Definition: ERF_EBIFBuildings.H:132
Definition: ERF_ConsoleIO.cpp:17