/* Copyright 2019-2020 Luca Fedeli, Maxence Thevenet * * This file is part of WarpX. * * License: BSD-3-Clause-LBNL */ #include "NCIGodfreyFilter.H" #include "Utils/NCIGodfreyTables.H" #include "WarpX.H" #ifdef _OPENMP # include #endif using namespace amrex; NCIGodfreyFilter::NCIGodfreyFilter(godfrey_coeff_set coeff_set, amrex::Real cdtodz, bool nodal_gather){ // Store parameters into class data members m_coeff_set = coeff_set; m_cdtodz = cdtodz; m_nodal_gather = nodal_gather; // NCI Godfrey filter has fixed size, and is applied along z only. #if (AMREX_SPACEDIM == 3) stencil_length_each_dir = {1,1,5}; slen = {1,1,5}; #else stencil_length_each_dir = {1,5}; slen = {1,5,1}; #endif } void NCIGodfreyFilter::ComputeStencils(){ // Sanity checks: filter length shoulz be 5 in z #if (AMREX_SPACEDIM == 3) AMREX_ALWAYS_ASSERT_WITH_MESSAGE( slen.z==5,"ERROR: NCI filter requires 5 points in z"); #else AMREX_ALWAYS_ASSERT_WITH_MESSAGE( slen.y==5,"ERROR: NCI filter requires 5 points in z"); #endif // Interpolate coefficients from the table, and store into prestencil. auto index = static_cast(tab_length*m_cdtodz); index = min(index, tab_length-2); index = max(index, 0); Real weight_right = m_cdtodz - index/tab_length; Real prestencil[4]; // read prestencil coefficients from table (the stencil is computed from // these coefficients) for(int i=0; i