Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Src/Amr/AMReX_Amr.H
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,16 @@ public:
Real time,
int lev,
int ngrow);
//! Compute derived data on all levels and store in the dcompth component of
//! each Multifab in mf
void derive (const std::string& name,
Real time,
const Vector<MultiFab*>& mf,
int dcomp);
//! Compute derived data on all levels and return as a vector of MultiFab pointers
Vector<std::unique_ptr<MultiFab>> derive (const std::string& name,
amrex::Real time,
int ngrow);
//! Name of the restart chkpoint file.
const std::string& theRestartFile () const noexcept { return restart_chkfile; }
//! Name of the restart plotfile.
Expand Down
40 changes: 40 additions & 0 deletions Src/Amr/AMReX_Amr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,46 @@ Amr::derive (const std::string& name,
return amr_level[lev]->derive(name,time,ngrow);
}

Vector<std::unique_ptr<MultiFab>>
Amr::derive(const std::string& name,
amrex::Real time,
int ngrow)
{
BL_PROFILE("Amr::derive()");
Vector<std::unique_ptr<MultiFab>> out;
out.reserve(finest_level + 1);

for (int i = 0; i <= finest_level; ++i)
{
auto mf = amr_level[i]->derive(name,time,ngrow);
out.push_back(std::move(mf));
}

return out;
}

void
Amr::derive (const std::string& name,
Real time,
const Vector<MultiFab*>& mf,
int dcomp)
{
BL_PROFILE("Amr::derive()");
AMREX_ASSERT(mf.size() == static_cast<amrex::Long>(finest_level + 1));

for (int i = 0; i <= finest_level; ++i)
{
AMREX_ASSERT(mf[i] != nullptr);
AMREX_ASSERT(mf[i]->ok());
AMREX_ASSERT(mf[i]->nComp() > dcomp);
}

for (int i = 0; i <= finestLevel(); ++i)
{
amr_level[i]->derive(name,time,*(mf[i]),dcomp);
}
}

Amr::Amr (LevelBld* a_levelbld)
:
levelbld(a_levelbld)
Expand Down
Loading