From 07df6305e53ca90ae247ff78f4d8829f8fd89188 Mon Sep 17 00:00:00 2001 From: Edoardo Zoni Date: Thu, 4 Nov 2021 13:25:15 -0700 Subject: [PATCH] Use GetPML Method for F,G Nodal Flags --- Source/Python/WarpXWrappers.cpp | 15 +++++++++++++-- Source/WarpX.H | 2 -- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Source/Python/WarpXWrappers.cpp b/Source/Python/WarpXWrappers.cpp index 7c251bc4d9b..9ee99e8ab22 100644 --- a/Source/Python/WarpXWrappers.cpp +++ b/Source/Python/WarpXWrappers.cpp @@ -454,8 +454,19 @@ extern "C" WARPX_GET_LOVECTS_PML_SCALAR(warpx_getGfieldCPLoVects_PML, GetG_cp) WARPX_GET_LOVECTS_PML_SCALAR(warpx_getGfieldFPLoVects_PML, GetG_fp) - int* warpx_getF_pml_nodal_flag() {return getFieldNodalFlagData( WarpX::GetInstance().getPML(0).GetF_fp() );} - int* warpx_getG_pml_nodal_flag() {return getFieldNodalFlagData( WarpX::GetInstance().getPML(0).GetG_fp() );} + int* warpx_getF_pml_nodal_flag() + { + auto * pml = WarpX::GetInstance().GetPML(0); + if (!pml) return nullptr; + return getFieldNodalFlagData(pml->GetF_fp()); + } + + int* warpx_getG_pml_nodal_flag() + { + auto * pml = WarpX::GetInstance().GetPML(0); + if (!pml) return nullptr; + return getFieldNodalFlagData(pml->GetG_fp()); + } amrex::ParticleReal** warpx_getParticleStructs( const char* char_species_name, int lev, diff --git a/Source/WarpX.H b/Source/WarpX.H index 479bd2d70b9..31b7afb7c11 100644 --- a/Source/WarpX.H +++ b/Source/WarpX.H @@ -345,8 +345,6 @@ public: const amrex::MultiFab& getEfield_avg_cp (int lev, int direction) {return *Efield_avg_cp[lev][direction];} const amrex::MultiFab& getBfield_avg_cp (int lev, int direction) {return *Bfield_avg_cp[lev][direction];} - PML& getPML(int lev) {return *pml[lev];} - bool DoPML () const {return do_pml;} /** get low-high-low-high-... vector for each direction indicating if mother grid PMLs are enabled */