Task: CI: Run 2D and 1D Tests (AMReX-Codes/amrex#2475)

org: AMReX-Codes
repo: amrex
pr_number: 2475
issue_title: CI: Run 2D and 1D Tests
issue_body: ## Summary

Run tests also for 2D and 1D builds of AMReX.

## Additional background

Related to 2D issues with `DenseBin` in WarpX: https://github.com/ECP-WarpX/WarpX/pull/2550

## Checklist

The proposed changes:
- [x] fix a bug or incorrect behavior in AMReX
- [x] add new capabilities to AMReX
- [ ] changes answers in the test suite to more than roundoff level
- [ ] are likely to significantly affect the results of downstream AMReX users
- [ ] include documentation in the code and/or rst files, if appropriate

resolved_issues: number: 2
title: Physical Boundary Conditions - Fortran
body: I cannot find any example fortran code that uses the amrex_physbc fortran interface to supply boundary conditions.  The current examples in Tuturials/*_CF use periodic bcs.  I did notice that in some of the _C tutorials, an f77 file was present which provided a `filcc` routine.  To impose boundary conditions, should I customize the filcc routines or is there a better way utilizing amrex_physbc?

Reference solution:
fix_patch: diff --git a/.github/workflows/gcc.yml b/.github/workflows/gcc.yml
index 9ea1ca69516..244b8192a76 100644
--- a/.github/workflows/gcc.yml
+++ b/.github/workflows/gcc.yml
@@ -40,8 +40,8 @@ jobs:
         ctest --output-on-failure
 
   # Build libamrex and all tests
-  tests_build:
-    name: GNU@7.5 C++14 Debug Fortran [tests]
+  tests_build_3D:
+    name: GNU@7.5 C++14 3D Debug Fortran [tests]
     runs-on: ubuntu-18.04
     env: {CXXFLAGS: "-fno-operator-names -Werror -Wall -Wextra -Wpedantic -Wnull-dereference -Wfloat-conversion -Wshadow -Woverloaded-virtual -O1"}
       # It's too slow with -O0
@@ -51,18 +51,65 @@ jobs:
       run: .github/workflows/dependencies/dependencies.sh
     - name: Build & Install
       run: |
-        mkdir build
-        cd build
-        cmake ..                        \
+        cmake -S . -B build             \
             -DCMAKE_BUILD_TYPE=Debug    \
             -DCMAKE_VERBOSE_MAKEFILE=ON \
             -DAMReX_EB=ON               \
             -DAMReX_ENABLE_TESTS=ON     \
             -DAMReX_FORTRAN=ON          \
-            -DAMReX_PARTICLES=ON
-        make -j 2
+            -DAMReX_PARTICLES=ON        \
+            -DAMReX_SPACEDIM=3
+        cmake --build build -j 2
 
-        ctest --output-on-failure
+        ctest --test-dir build --output-on-failure
+
+  tests_build_2D:
+    name: GNU@7.5 C++14 2D Debug Fortran [tests]
+    runs-on: ubuntu-18.04
+    env: {CXXFLAGS: "-fno-operator-names -Wall -Wextra -Wpedantic -Wnull-dereference -Wfloat-conversion -Wshadow -Woverloaded-virtual -O1"}
+      # -Werror temporarily skipped until we have functional testing established
+      # It's too slow with -O0
+    steps:
+    - uses: actions/checkout@v2
+    - name: Dependencies
+      run: .github/workflows/dependencies/dependencies.sh
+    - name: Build & Install
+      run: |
+        cmake -S . -B build             \
+            -DCMAKE_BUILD_TYPE=Debug    \
+            -DCMAKE_VERBOSE_MAKEFILE=ON \
+            -DAMReX_EB=ON               \
+            -DAMReX_ENABLE_TESTS=ON     \
+            -DAMReX_FORTRAN=ON          \
+            -DAMReX_PARTICLES=ON        \
+            -DAMReX_SPACEDIM=2
+        cmake --build build -j 2
+
+        ctest --test-dir build --output-on-failure
+
+  tests_build_1D:
+    name: GNU@7.5 C++14 1D Debug Fortran [tests]
+    runs-on: ubuntu-18.04
+    env: {CXXFLAGS: "-fno-operator-names -Wall -Wextra -Wpedantic -Wnull-dereference -Wfloat-conversion -Wshadow -Woverloaded-virtual -O1"}
+      # -Werror temporarily skipped until we have functional testing established
+      # It's too slow with -O0
+    steps:
+    - uses: actions/checkout@v2
+    - name: Dependencies
+      run: .github/workflows/dependencies/dependencies.sh
+    - name: Build & Install
+      run: |
+        cmake -S . -B build             \
+            -DCMAKE_BUILD_TYPE=Debug    \
+            -DCMAKE_VERBOSE_MAKEFILE=ON \
+            -DAMReX_EB=ON               \
+            -DAMReX_ENABLE_TESTS=ON     \
+            -DAMReX_FORTRAN=ON          \
+            -DAMReX_PARTICLES=ON        \
+            -DAMReX_SPACEDIM=1
+        cmake --build build -j 2
+
+        ctest --test-dir build --output-on-failure
 
   # Build libamrex and all tests
   tests_cxx20:
diff --git a/Src/Particle/AMReX_ParticleInterpolators.H b/Src/Particle/AMReX_ParticleInterpolators.H
new file mode 100644
index 00000000000..f241ac3ff1e
--- /dev/null
+++ b/Src/Particle/AMReX_ParticleInterpolators.H
@@ -0,0 +1,127 @@
+#ifndef AMREX_PARTICLEINTERPOLATORS_H_
+#define AMREX_PARTICLEINTERPOLATORS_H_
+#include <AMReX_Config.H>
+
+#include <AMReX_IntVect.H>
+#include <AMReX_Gpu.H>
+#include <AMReX_Print.H>
+
+namespace amrex
+{
+namespace ParticleInterpolator
+{
+
+template <class Derived, class WeightType>
+struct Base
+{
+    int index[3];
+    WeightType* w;
+
+    template <typename P, typename V, typename F>
+    AMREX_GPU_DEVICE AMREX_FORCE_INLINE
+    void ParticleToMesh (const P& p,
+                         amrex::Array4<V> const& arr,
+                         int src_comp, int dst_comp, int num_comps, F&& f)
+    {
+        static constexpr int stencil_width = Derived::stencil_width;
+        for (int ic=0; ic < num_comps; ++ic) {
+            for (int kk = 0; kk <= Derived::nz; ++kk) {
+                for (int jj = 0; jj <= Derived::ny; ++jj) {
+                    for (int ii = 0; ii <= Derived::nx; ++ii) {
+                        const auto pval = f(p, src_comp+ic);
+                        const auto val = w[0*stencil_width+ii] *
+                                         w[1*stencil_width+jj] *
+                                         w[2*stencil_width+kk] * pval;
+                        Gpu::Atomic::AddNoRet(&arr(index[0]+ii, index[1]+jj, index[2]+kk, ic+dst_comp), val);
+                    }
+                }
+            }
+        }
+    }
+
+    template <typename P, typename V, typename F, typename G>
+    AMREX_GPU_DEVICE AMREX_FORCE_INLINE
+    void MeshToParticle (P& p,
+                         amrex::Array4<const V> const& arr,
+                         int src_comp, int dst_comp, int num_comps, F&& f, G&& g)
+    {
+        static constexpr int stencil_width = Derived::stencil_width;
+        for (int ic=0; ic < num_comps; ++ic) {
+            for (int kk = 0; kk <= Derived::nz; ++kk) {
+                for (int jj = 0; jj <= Derived::ny; ++jj) {
+                    for (int ii = 0; ii <= Derived::nx; ++ii) {
+                        const auto mval = f(arr,index[0]+ii,index[1]+jj,index[2]+kk,src_comp+ic);
+                        const auto val = w[0*stencil_width+ii] *
+                                         w[1*stencil_width+jj] *
+                                         w[2*stencil_width+kk] * mval;
+                        g(p, ic + dst_comp, val);
+                    }
+                }
+            }
+        }
+    }
+};
+
+struct Nearest : public Base<Nearest, int>
+{
+    static constexpr int stencil_width = 1;
+    int weights[3*stencil_width];
+
+    static constexpr int nx = (AMREX_SPACEDIM >= 1) ? stencil_width - 1 : 0;
+    static constexpr int ny = (AMREX_SPACEDIM >= 2) ? stencil_width - 1 : 0;
+    static constexpr int nz = (AMREX_SPACEDIM >= 3) ? stencil_width - 1 : 0;
+
+    template <typename P>
+    AMREX_GPU_DEVICE AMREX_FORCE_INLINE
+    Nearest (const P& p,
+             amrex::GpuArray<amrex::Real,AMREX_SPACEDIM> const& plo,
+             amrex::GpuArray<amrex::Real,AMREX_SPACEDIM> const& dxi)
+    {
+        w = &weights[0];
+        for (int i = 0; i < AMREX_SPACEDIM; ++i) {
+            amrex::Real l = (p.pos(i) - plo[i]) * dxi[i] + 0.5;
+            index[i] = static_cast<int>(amrex::Math::floor(l));
+            w[i] = 1;
+        }
+        for (int i = AMREX_SPACEDIM; i < 3; ++i) {
+            index[i] = 0;
+            w[i] = 1;
+        }
+    }
+};
+
+struct Linear : public Base<Linear, amrex::Real>
+{
+    static constexpr int stencil_width = 2;
+
+    static constexpr int nx = (AMREX_SPACEDIM >= 1) ? stencil_width - 1 : 0;
+    static constexpr int ny = (AMREX_SPACEDIM >= 2) ? stencil_width - 1 : 0;
+    static constexpr int nz = (AMREX_SPACEDIM >= 3) ? stencil_width - 1 : 0;
+
+    amrex::Real weights[3*stencil_width];
+
+    template <typename P>
+    AMREX_GPU_DEVICE AMREX_FORCE_INLINE
+    Linear (const P& p,
+            amrex::GpuArray<amrex::Real,AMREX_SPACEDIM> const& plo,
+            amrex::GpuArray<amrex::Real,AMREX_SPACEDIM> const& dxi)
+    {
+        w = &weights[0];
+        for (int i = 0; i < AMREX_SPACEDIM; ++i) {
+            amrex::Real l = (p.pos(i) - plo[i]) * dxi[i] + 0.5;
+            index[i] = static_cast<int>(amrex::Math::floor(l)) - 1;
+            amrex::Real lint = l - (index[i] + 1);
+            w[stencil_width*i + 0] = 1.-lint;
+            w[stencil_width*i + 1] = lint;
+        }
+        for (int i = AMREX_SPACEDIM; i < 3; ++i) {
+            index[i] = 0;
+            w[stencil_width*i + 0] = 1.;
+            w[stencil_width*i + 1] = 0.;
+        }
+    }
+};
+}
+}
+
+#endif // include guard
diff --git a/Src/Particle/CMakeLists.txt b/Src/Particle/CMakeLists.txt
index 7b0efb39d4e..980fdb178ab 100644
--- a/Src/Particle/CMakeLists.txt
+++ b/Src/Particle/CMakeLists.txt
@@ -34,6 +34,7 @@ target_sources( amrex
    AMReX_ParticleBufferMap.cpp
    AMReX_ParticleCommunication.H
    AMReX_ParticleCommunication.cpp
+   AMReX_ParticleInterpolators.H
    AMReX_ParticleReduce.H
    AMReX_ParticleMesh.H
    AMReX_ParticleLocator.H
diff --git a/Src/Particle/Make.package b/Src/Particle/Make.package
index f693b923492..efb65679118 100644
--- a/Src/Particle/Make.package
+++ b/Src/Particle/Make.package
@@ -14,6 +14,7 @@ C$(AMREX_PARTICLE)_headers += AMReX_WriteBinaryParticleData.H
 C$(AMREX_PARTICLE)_headers += AMReX_ParticleContainerBase.H
 C$(AMREX_PARTICLE)_sources += AMReX_ParticleContainerBase.cpp
 C$(AMREX_PARTICLE)_headers += AMReX_ParticleArray.H
+C$(AMREX_PARTICLE)_headers += AMReX_ParticleInterpolators.H
 
 VPATH_LOCATIONS += $(AMREX_HOME)/Src/Particle
 INCLUDE_LOCATIONS += $(AMREX_HOME)/Src/Particle