diff --git a/Source/EmbeddedBoundary/WarpXInitEB.H b/Source/EmbeddedBoundary/WarpXInitEB.H new file mode 100644 index 00000000000..e6dccd62de2 --- /dev/null +++ b/Source/EmbeddedBoundary/WarpXInitEB.H @@ -0,0 +1,33 @@ +/* Copyright 2021 Lorenzo Giacomel, Luca Fedeli + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ + +#ifndef WARPX_EMBEDDEDBOUNDARY_WARPXINITEB_H +#define WARPX_EMBEDDEDBOUNDARY_WARPXINITEB_H + +#include +#include + +#include +#include + +namespace warpx::embedded_boundary +{ + + /** + * \brief Scale the edges lengths by the mesh width to obtain the real lengths. + */ + void ScaleEdges (std::array< std::unique_ptr, 3 >& edge_lengths, + const std::array& cell_size); + /** + * \brief Scale the edges areas by the mesh width to obtain the real areas. + */ + void ScaleAreas (std::array< std::unique_ptr, 3 >& face_areas, + const std::array& cell_size); + +} + +#endif //WARPX_EMBEDDEDBOUNDARY_WARPXINITEB_H diff --git a/Source/EmbeddedBoundary/WarpXInitEB.cpp b/Source/EmbeddedBoundary/WarpXInitEB.cpp index 655bec0dc29..4a3e42d8d2f 100644 --- a/Source/EmbeddedBoundary/WarpXInitEB.cpp +++ b/Source/EmbeddedBoundary/WarpXInitEB.cpp @@ -5,9 +5,11 @@ * License: BSD-3-Clause-LBNL */ -#include "WarpX.H" +# include "WarpX.H" #ifdef AMREX_USE_EB + +# include "WarpXInit.H" # include "Utils/Parser/ParserUtils.H" # include "Utils/TextMsg.H" @@ -43,6 +45,9 @@ #endif #ifdef AMREX_USE_EB + +using namespace warpx::embedded_boundary; + namespace { class ParserIF : public amrex::GPUable @@ -240,7 +245,7 @@ WarpX::ComputeFaceAreas (std::array< std::unique_ptr, 3 >& face void -WarpX::ScaleEdges (std::array< std::unique_ptr, 3 >& edge_lengths, +ScaleEdges (std::array< std::unique_ptr, 3 >& edge_lengths, const std::array& cell_size) { BL_PROFILE("ScaleEdges"); @@ -265,7 +270,7 @@ WarpX::ScaleEdges (std::array< std::unique_ptr, 3 >& edge_lengt } void -WarpX::ScaleAreas(std::array< std::unique_ptr, 3 >& face_areas, +ScaleAreas(std::array< std::unique_ptr, 3 >& face_areas, const std::array& cell_size) { BL_PROFILE("ScaleAreas"); diff --git a/Source/Initialization/WarpXInitData.cpp b/Source/Initialization/WarpXInitData.cpp index 8af0ce23ce8..788cdf97486 100644 --- a/Source/Initialization/WarpXInitData.cpp +++ b/Source/Initialization/WarpXInitData.cpp @@ -16,6 +16,9 @@ #endif #include "Diagnostics/MultiDiagnostics.H" #include "Diagnostics/ReducedDiags/MultiReducedDiags.H" +#ifdef AMREX_USE_EB +# include "EmbeddedBoundary/WarpXInitEB.H" +#endif #include "FieldSolver/Fields.H" #include "FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.H" #include "FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.H" @@ -1292,9 +1295,9 @@ void WarpX::InitializeEBGridData (int lev) auto const eb_fact = fieldEBFactory(lev); ComputeEdgeLengths(m_edge_lengths[lev], eb_fact); - ScaleEdges(m_edge_lengths[lev], CellSize(lev)); + warpx::embedded_boundary::ScaleEdges(m_edge_lengths[lev], CellSize(lev)); ComputeFaceAreas(m_face_areas[lev], eb_fact); - ScaleAreas(m_face_areas[lev], CellSize(lev)); + warpx::embedded_boundary::ScaleAreas(m_face_areas[lev], CellSize(lev)); if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::ECT) { MarkCells(); diff --git a/Source/WarpX.H b/Source/WarpX.H index 3372dd869cc..f1029d8ba7a 100644 --- a/Source/WarpX.H +++ b/Source/WarpX.H @@ -1130,16 +1130,6 @@ public: const amrex::EBFArrayBoxFactory& eb_fact); /** - * \brief Scale the edges lengths by the mesh width to obtain the real lengths. - */ - static void ScaleEdges (std::array< std::unique_ptr, 3 >& edge_lengths, - const std::array& cell_size); - /** - * \brief Scale the edges areas by the mesh width to obtain the real areas. - */ - static void ScaleAreas (std::array< std::unique_ptr, 3 >& face_areas, - const std::array& cell_size); - /** * \brief Initialize information for cell extensions. * The flags convention for m_flag_info_face is as follows * - 0 for unstable cells