From 247cd790c74dfd7fde9f41708001e7184c615ff0 Mon Sep 17 00:00:00 2001 From: Roelof Groenewald <40245517+roelof-groenewald@users.noreply.github.com> Date: Mon, 23 Aug 2021 16:08:41 -0700 Subject: Scalar field interpolator from grid to particle position (#2221) * refactored distance to EB calculation to have a more general function to interpolate from a scalar field on the grid to a given position * changed RZ error message to general interpolation function * changed function names to specify that scalar field interpolation is for a nodal field only --- Source/Particles/ParticleBoundaryBuffer.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'Source/Particles/ParticleBoundaryBuffer.cpp') diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index 5f29baa09..f84d05b28 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -9,6 +9,7 @@ #include "EmbeddedBoundary/DistanceToEB.H" #include "Particles/ParticleBoundaryBuffer.H" #include "Particles/MultiParticleContainer.H" +#include "Particles/Gather/ScalarFieldGather.H" #include #include @@ -217,11 +218,9 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, amrex::ParticleReal xp, yp, zp; getPosition(ip, xp, yp, zp); - int ii, jj, kk; - amrex::Real W[AMREX_SPACEDIM][2]; - DistanceToEB::compute_weights(xp, yp, zp, plo, dxi, ii, jj, kk, W); - - amrex::Real phi_value = DistanceToEB::interp_distance(ii, jj, kk, W, phiarr); + amrex::Real phi_value = doGatherScalarFieldNodal( + xp, yp, zp, phiarr, dxi, plo + ); return phi_value < 0.0 ? 1 : 0; }, CopyAndTimestamp{timestamp_index, timestep}, 0, dst_index); -- cgit v1.2.3