Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Topic cleanup particle interpolation interface #314

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions src/picongpu/include/algorithms/FieldToParticleInterpolation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@
* You should have received a copy of the GNU General Public License
* along with PIConGPU.
* If not, see <http://www.gnu.org/licenses/>.
*/
*/



#pragma once

#include "simulation_defines.hpp"
#include <cuSTL/cursor/FunctorCursor.hpp>
#include "math/vector/compile-time/Int.hpp"
#include "algorithms/ShiftCoordinateSystem.hpp"

namespace picongpu
{
Expand All @@ -39,9 +40,10 @@ namespace picongpu
* \tparam AssignmentFunction AssignmentFunction which is used for interpolation
* \tparam InterpolationMethod functor for interpolation method
*/
template<class GridShiftMethod, class AssignmentFunction, class InterpolationMethod>
template<class T_Shape, class InterpolationMethod>
struct FieldToParticleInterpolation
{
typedef typename T_Shape::ChargeAssignmentOnSupport AssignmentFunction;
static const int supp = AssignmentFunction::support;

static const int lowerMargin = supp / 2;
Expand Down Expand Up @@ -74,17 +76,17 @@ struct FieldToParticleInterpolation

BOOST_AUTO(field_x, PMacc::cursor::make_FunctorCursor(field, _1[mpl::int_ < 0 > ()]));
floatD_X pos_tmp(particlePos);
GridShiftMethod()(field_x, pos_tmp, fieldPos.x());
ShiftCoordinateSystem<supp>()(field_x, pos_tmp, fieldPos.x());
float_X result_x = InterpolationMethod::template interpolate<AssignmentFunction, begin, end > (field_x, pos_tmp);

BOOST_AUTO(field_y, PMacc::cursor::make_FunctorCursor(field, _1[mpl::int_ < 1 > ()]));
pos_tmp = particlePos;
GridShiftMethod()(field_y, pos_tmp, fieldPos.y());
ShiftCoordinateSystem<supp>()(field_y, pos_tmp, fieldPos.y());
float_X result_y = InterpolationMethod::template interpolate<AssignmentFunction, begin, end > (field_y, pos_tmp);

BOOST_AUTO(field_z, PMacc::cursor::make_FunctorCursor(field, _1[mpl::int_ < 2 > ()]));
pos_tmp = particlePos;
GridShiftMethod()(field_z, pos_tmp, fieldPos.z());
ShiftCoordinateSystem<supp>()(field_z, pos_tmp, fieldPos.z());
float_X result_z = InterpolationMethod::template interpolate<AssignmentFunction, begin, end > (field_z, pos_tmp);

return float3_X(result_x, result_y, result_z);
Expand All @@ -98,11 +100,11 @@ namespace traits
/*Get margin of a solver
* class must define a LowerMargin and UpperMargin
*/
template<class GridShiftMethod, class AssignMethod, class InterpolationMethod>
struct GetMargin<picongpu::FieldToParticleInterpolation<GridShiftMethod, AssignMethod, InterpolationMethod> >
template<class AssignMethod, class InterpolationMethod>
struct GetMargin<picongpu::FieldToParticleInterpolation<AssignMethod, InterpolationMethod> >
{
private:
typedef picongpu::FieldToParticleInterpolation<GridShiftMethod, AssignMethod, InterpolationMethod> Interpolation;
typedef picongpu::FieldToParticleInterpolation<AssignMethod, InterpolationMethod> Interpolation;
public:
typedef typename Interpolation::LowerMargin LowerMargin;
typedef typename Interpolation::UpperMargin UpperMargin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@
* You should have received a copy of the GNU General Public License
* along with PIConGPU.
* If not, see <http://www.gnu.org/licenses/>.
*/
*/



#pragma once

#include "simulation_defines.hpp"
#include <cuSTL/cursor/FunctorCursor.hpp>
#include "math/vector/compile-time/Int.hpp"
#include "algorithms/ShiftCoordinateSystemNative.hpp"

namespace picongpu
{
Expand All @@ -39,9 +40,10 @@ namespace picongpu
* \tparam AssignmentFunction AssignmentFunction which is used for interpolation
* \tparam InterpolationMethod functor for interpolation method
*/
template<class GridShiftMethod, class AssignmentFunction, class InterpolationMethod>
template<class T_Shape, class InterpolationMethod>
struct FieldToParticleInterpolationNative
{
typedef typename T_Shape::ChargeAssignment AssignmentFunction;
static const int supp = AssignmentFunction::support;

static const int lowerMargin = supp / 2;
Expand Down Expand Up @@ -70,17 +72,17 @@ struct FieldToParticleInterpolationNative

BOOST_AUTO(field_x, PMacc::cursor::make_FunctorCursor(field, _1[mpl::int_ < 0 > ()]));
floatD_X pos_tmp(particlePos);
GridShiftMethod()(field_x, pos_tmp, fieldPos.x());
ShiftCoordinateSystemNative<supp>()(field_x, pos_tmp, fieldPos.x());
float_X result_x = InterpolationMethod::template interpolate<AssignmentFunction, -lowerMargin, upperMargin > (field_x, pos_tmp);

BOOST_AUTO(field_y, PMacc::cursor::make_FunctorCursor(field, _1[mpl::int_ < 1 > ()]));
pos_tmp = particlePos;
GridShiftMethod()(field_y, pos_tmp, fieldPos.y());
ShiftCoordinateSystemNative<supp>()(field_y, pos_tmp, fieldPos.y());
float_X result_y = InterpolationMethod::template interpolate<AssignmentFunction, -lowerMargin, upperMargin > (field_y, pos_tmp);

BOOST_AUTO(field_z, PMacc::cursor::make_FunctorCursor(field, _1[mpl::int_ < 2 > ()]));
pos_tmp = particlePos;
GridShiftMethod()(field_z, pos_tmp, fieldPos.z());
ShiftCoordinateSystemNative<supp>()(field_z, pos_tmp, fieldPos.z());
float_X result_z = InterpolationMethod::template interpolate<AssignmentFunction, -lowerMargin, upperMargin > (field_z, pos_tmp);

return float3_X(result_x, result_y, result_z);
Expand All @@ -94,11 +96,11 @@ namespace traits
/*Get margin of a solver
* class must define a LowerMargin and UpperMargin
*/
template<class GridShiftMethod, class AssignMethod, class InterpolationMethod>
struct GetMargin<picongpu::FieldToParticleInterpolationNative<GridShiftMethod, AssignMethod, InterpolationMethod> >
template<class AssignMethod, class InterpolationMethod>
struct GetMargin<picongpu::FieldToParticleInterpolationNative<AssignMethod, InterpolationMethod> >
{
private:
typedef picongpu::FieldToParticleInterpolationNative<GridShiftMethod, AssignMethod, InterpolationMethod> Interpolation;
typedef picongpu::FieldToParticleInterpolationNative< AssignMethod, InterpolationMethod> Interpolation;
public:
typedef typename Interpolation::LowerMargin LowerMargin;
typedef typename Interpolation::UpperMargin UpperMargin;
Expand Down
3 changes: 2 additions & 1 deletion src/picongpu/include/algorithms/ShiftCoordinateSystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
namespace picongpu
{

template<uint32_t T_support>
struct ShiftCoordinateSystem
{

Expand All @@ -44,7 +45,7 @@ struct ShiftCoordinateSystem
{
floatD_X coordinate_shift;

if (speciesParticleShape::ParticleShape::support % 2 == 0)
if (T_support % 2 == 0)
{
//even support

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
namespace picongpu
{

template<uint32_t T_support>
struct ShiftCoordinateSystemNative
{

Expand Down
3 changes: 1 addition & 2 deletions src/picongpu/include/fields/FieldTmp.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ namespace picongpu
const DataSpace<simDim> coreBorderSize = cellDescription.getGridLayout( ).getDataSpaceWithoutGuarding( );

typedef picongpu::FieldToParticleInterpolationNative<
ShiftCoordinateSystemNative,
speciesParticleShape::ParticleShape::ChargeAssignment,
speciesParticleShape::ParticleShape,
AssignedTrilinearInterpolation> maxMarginsFrameSolver;

/* The maximum Neighbors we need will be given by the ParticleShape */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ namespace fieldSolverNone
typedef yeeCell::YeeCell NumericalCellType;

typedef picongpu::FieldToParticleInterpolationNative<
ShiftCoordinateSystemNative,
speciesParticleShape::ParticleShape::ChargeAssignment,
speciesParticleShape::ParticleShape,
AssignedTrilinearInterpolation> FieldToParticleInterpolation;
}

Expand All @@ -56,8 +55,7 @@ namespace fieldSolverYeeNative
typedef yeeCell::YeeCell NumericalCellType;

typedef picongpu::FieldToParticleInterpolationNative<
ShiftCoordinateSystemNative,
speciesParticleShape::ParticleShape::ChargeAssignment,
speciesParticleShape::ParticleShape,
AssignedTrilinearInterpolation> FieldToParticleInterpolation;
}

Expand All @@ -67,8 +65,7 @@ namespace fieldSolverYee
typedef yeeCell::YeeCell NumericalCellType;

typedef picongpu::FieldToParticleInterpolation<
ShiftCoordinateSystem,
speciesParticleShape::ParticleShape::ChargeAssignmentOnSupport,
speciesParticleShape::ParticleShape,
AssignedTrilinearInterpolation> FieldToParticleInterpolation;
}

Expand All @@ -79,8 +76,7 @@ namespace fieldSolverDirSplitting
typedef allCenteredCell::AllCenteredCell NumericalCellType;

typedef picongpu::FieldToParticleInterpolationNative<
ShiftCoordinateSystemNative,
speciesParticleShape::ParticleShape::ChargeAssignment,
speciesParticleShape::ParticleShape,
AssignedTrilinearInterpolation> FieldToParticleInterpolation;
}

Expand All @@ -90,8 +86,7 @@ namespace fieldSolverLehe
typedef yeeCell::YeeCell NumericalCellType;

typedef picongpu::FieldToParticleInterpolationNative<
ShiftCoordinateSystemNative,
speciesParticleShape::ParticleShape::ChargeAssignment,
speciesParticleShape::ParticleShape,
AssignedTrilinearInterpolation> FieldToParticleInterpolation;
}
#endif
Expand Down