Skip to content

Commit

Permalink
keep moving EB functions out of WarpX class
Browse files Browse the repository at this point in the history
  • Loading branch information
lucafedeli88 committed Jul 22, 2024
1 parent 1492442 commit 82a7102
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
2 changes: 2 additions & 0 deletions Source/EmbeddedBoundary/WarpXInitEB.H
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ namespace warpx::embedded_boundary

public:

EmbeddedBoundary(int nlevs_max);

/**
* \brief Initialize information for cell extensions.
* The flags convention for m_flag_info_face is as follows
Expand Down
15 changes: 15 additions & 0 deletions Source/EmbeddedBoundary/WarpXInitEB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,21 @@ ScaleAreas(std::array< std::unique_ptr<amrex::MultiFab>, 3 >& face_areas,
}


void
EmbeddedBoundary::EmbeddedBoundary(const int nlevs_max)
{
m_field_factory.resize(nlevs_max);

for (int lev = 0; lev < nlevs_max; ++lev)
{
int max_guard = guard_cells.ng_FieldSolver.max();
m_field_factory[lev] = amrex::makeEBFabFactory(
Geom(lev), ba, dm,
{max_guard, max_guard, max_guard},
amrex::EBSupport::full);
}
}

void
EmbeddedBoundary::MarkCells(const std::array<amrex::Real,3>& cell_size, const int max_level)
{
Expand Down
15 changes: 3 additions & 12 deletions Source/WarpX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,9 @@ WarpX::WarpX ()
costs.resize(nlevs_max);
load_balance_efficiency.resize(nlevs_max);

m_field_factory.resize(nlevs_max);
#ifdef AMREX_USE_EB
m_embedded_boundary = warpx:embedded_boundary::EmbeddedBoundary(nlevs_max);
#endif

if (em_solver_medium == MediumForEM::Macroscopic) {
// create object for macroscopic solver
Expand Down Expand Up @@ -2164,17 +2166,6 @@ WarpX::AllocLevelData (int lev, const BoxArray& ba, const DistributionMapping& d
use_filter,
bilinear_filter.stencil_length_each_dir);


#ifdef AMREX_USE_EB
int max_guard = guard_cells.ng_FieldSolver.max();
m_field_factory[lev] = amrex::makeEBFabFactory(Geom(lev), ba, dm,
{max_guard, max_guard, max_guard},
amrex::EBSupport::full);
#else
m_field_factory[lev] = std::make_unique<FArrayBoxFactory>();
#endif


if (mypc->nSpeciesDepositOnMainGrid() && n_current_deposition_buffer == 0) {
n_current_deposition_buffer = 1;
// This forces the allocation of buffers and allows the code associated
Expand Down

0 comments on commit 82a7102

Please sign in to comment.