Skip to content

Commit

Permalink
LSCore needs to be a template class (so that it can hold gshop objects)
Browse files Browse the repository at this point in the history
  • Loading branch information
JBlaschke committed Nov 9, 2018
1 parent 5a5fdfc commit 62238fc
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 38 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Docs/sphinx/build
# catalyst/libsim
Tutorials/Amr/Advection_AmrLevel/Exec/SingleVortex/*.png
Tutorials/Amr/Advection_AmrCore/Exec/SingleVortex/*.png
Tutorials/EB/LevelSet/Exec/ImpFunc*
Tutorials/EB/LevelSet/Exec/LevelSet*
*.vth
*.vti
*.pvd
Expand Down
2 changes: 1 addition & 1 deletion Src/EB/AMReX_EB2_IF_Intersection.H
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace IIF_detail {
{
return f(p);
}

template <typename F, typename... Fs>
Real do_min (const RealArray& p, F&& f, Fs&... fs)
{
Expand Down
7 changes: 6 additions & 1 deletion Src/EB/AMReX_EB_LSCore.H
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class AmrMeshInSituBridge;

namespace amrex {


template <class F>
class LSCore
: public amrex::AmrCore
{
Expand All @@ -39,7 +41,7 @@ public:

// Constructor - reads amr in parameters from inputs file
// - sizes multilevel arrays and data structures
LSCore ();
LSCore (EB2::GeometryShop<F> gshop);
virtual ~LSCore ();

// Initializes multilevel data
Expand Down Expand Up @@ -128,6 +130,9 @@ private:
Vector<MultiFab> level_set;
Vector<LSFactory> ls_factory;


int eb_pad;

// This is essentially a 2*DIM integer array storing the physical boundary
// condition types at the lo/hi walls in each direction
BCRec bcs;
Expand Down
46 changes: 13 additions & 33 deletions Src/EB/AMReX_EB_LSCore.cpp → Src/EB/AMReX_EB_LSCoreI.H
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,16 @@ void LSCore::InitData () {
InitFromScratch(time);
AverageDown();

if (chk_int > 0) {
if (chk_int > 0)
WriteCheckpointFile();
}

}
else {
} else {
// restart from a checkpoint
ReadCheckpointFile();
}

if (plot_int > 0) {
if (plot_int > 0)
WritePlotFile();
}
}


Expand Down Expand Up @@ -146,8 +143,12 @@ void LSCore::MakeNewLevelFromScratch (int lev, Real time, const BoxArray & ba,
const int nghost = 1;

level_set[lev].define(ba, dm, ncomp, nghost);
// NOTE: use move semantics since LSFactory contains unique_ptrs
ls_factory[lev] = std::move(LSFacory(0, ));
// NOTE: use move semantics since LSFactory contains unique_ptrs.
int levelset_pad = 1;
int levelset_eb_pad = 1;
ls_factory[lev] = std::move(
LSFacory(lev, 1, 1, levelset_pad, levelset_eb_pad, ba, geom[lev], dm)
);

const Real * dx = geom[lev].CellSize();

Expand Down Expand Up @@ -243,34 +244,13 @@ void LSCore::ErrorEst (int lev, TagBoxArray& tags, Real time, int ngrow) {
// read in some parameters from inputs file
void LSCore::ReadParameters () {


/************************************************************************
* Parse inputs *
***********************************************************************/

ParmParse pp("eb_amr");
pp.query("eb_pad", eb_pad);

{
ParmParse pp("particles");

int n_part;
Vector<Real> pos, rad;

pp.query("n_particles", n_part);
pp.getarr("positions", pos, 0, 3 * n_part);
pp.getarr("radii", rad, 0, n_part);


// Convert input arrays to vectors of type particle_info
int i_part = 0;
for(int i = 0; i + 2 < pos.size(); i += 3) {
particle_info particle;

particle.pos = RealVect(pos[i], pos[i+1], pos[i+2]);
particle.radius = rad[i_part];
particle_data.push_back(particle);
i_part ++;
}
}
}


Expand Down Expand Up @@ -326,8 +306,8 @@ void LSCore::FillPatch (int lev, Real time, MultiFab& mf, int icomp, int ncomp)
void LSCore::FillCoarsePatch (int lev, Real time, MultiFab& mf, int icomp, int ncomp) {
BL_ASSERT(lev > 0);

PhysBCFunct cphysbc(geom[lev-1],bcs,BndryFunctBase(phifill));
PhysBCFunct fphysbc(geom[lev ],bcs,BndryFunctBase(phifill));
PhysBCFunct cphysbc(geom[lev-1], bcs, BndryFunctBase(phifill));
PhysBCFunct fphysbc(geom[lev ], bcs, BndryFunctBase(phifill));

Interpolater * mapper = & cell_cons_interp;

Expand Down
9 changes: 6 additions & 3 deletions Src/EB/AMReX_EB_levelset.H
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ class LSFactory {
private:

// MultiFab pointers storing level-set data
// -> ls_phi: nodal MultiFab storing signed distance function to the nearest wall
// -> ls_valid: cell-centered iMultiFab storing integer flags assuming the following values:
// -> ls_phi: nodal MultiFab storing signed distance function to the
// nearest wall
// -> ls_valid: cell-centered iMultiFab storing integer flags
// assuming the following values:
// -1 : not all nodes around cell have been initialized
// 0 : none of the cell's neighbours contain negative vlaues of ls_phi on its nodes
// 0 : none of the cell's neighbours contain negative vlaues of
// ls_phi on its nodes
// 1 : the cell is in the neighbourhood of phi < 0

std::unique_ptr<MultiFab> ls_grid;
Expand Down

0 comments on commit 62238fc

Please sign in to comment.