From 1ca946f339739fdecdfa9443d5ac9aef38e1df71 Mon Sep 17 00:00:00 2001 From: Heikman Date: Wed, 27 May 2015 12:47:47 +0200 Subject: [PATCH 1/4] add PMacc::math::tools::CT::VectorTwistAxes --- .../vector/compile-time/twistVectorAxes.hpp | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 src/libPMacc/include/math/vector/compile-time/twistVectorAxes.hpp diff --git a/src/libPMacc/include/math/vector/compile-time/twistVectorAxes.hpp b/src/libPMacc/include/math/vector/compile-time/twistVectorAxes.hpp new file mode 100644 index 0000000000..1b28814d6c --- /dev/null +++ b/src/libPMacc/include/math/vector/compile-time/twistVectorAxes.hpp @@ -0,0 +1,70 @@ +/** + * Copyright 2015 Heiko Burau + * + * This file is part of libPMacc. + * + * libPMacc is free software: you can redistribute it and/or modify + * it under the terms of either the GNU General Public License or + * the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * libPMacc is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License and the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License + * and the GNU Lesser General Public License along with libPMacc. + * If not, see . + */ + +#pragma once + +#include "math/vector/compile-time/Vector.hpp" + +namespace PMacc +{ +namespace math +{ +namespace tools +{ +namespace CT +{ + +/** + * @class TwistVectorAxes + * @brief Twists axes of a compile-time vector. + * @tparam Vec compile-time vector to be twisted + * @tparam Axes compile-time vector containing new axes + * + * Example: + * + * typedef PMacc::math::CT::Int<1,2,0> Orientation_Y; + * typedef typename PMacc::math::tools::CT::TwistVectorAxes::type TwistedBlockDim; + */ +template +struct TwistVectorAxes; + +template +struct TwistVectorAxes +{ + typedef math::CT::Vector< + typename Vec::template at::type, + typename Vec::template at::type> type; +}; + +template +struct TwistVectorAxes +{ + typedef math::CT::Vector< + typename Vec::template at::type, + typename Vec::template at::type, + typename Vec::template at::type> type; +}; + +} // namespace CT +} // namespace tools +} // namespace math +} // namespace PMacc From 033eb93214ea7e693f8e1689bb197ba816373803 Mon Sep 17 00:00:00 2001 From: Heikman Date: Wed, 27 May 2015 14:37:01 +0200 Subject: [PATCH 2/4] rename TwistVectorAxes to TwistComponents - remove surounding namespace `tools` --- .../{twistVectorAxes.hpp => twistComponents.hpp} | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) rename src/libPMacc/include/math/vector/compile-time/{twistVectorAxes.hpp => twistComponents.hpp} (86%) diff --git a/src/libPMacc/include/math/vector/compile-time/twistVectorAxes.hpp b/src/libPMacc/include/math/vector/compile-time/twistComponents.hpp similarity index 86% rename from src/libPMacc/include/math/vector/compile-time/twistVectorAxes.hpp rename to src/libPMacc/include/math/vector/compile-time/twistComponents.hpp index 1b28814d6c..8e258a0c5a 100644 --- a/src/libPMacc/include/math/vector/compile-time/twistVectorAxes.hpp +++ b/src/libPMacc/include/math/vector/compile-time/twistComponents.hpp @@ -28,13 +28,11 @@ namespace PMacc { namespace math { -namespace tools -{ namespace CT { /** - * @class TwistVectorAxes + * @class TwistComponents * @brief Twists axes of a compile-time vector. * @tparam Vec compile-time vector to be twisted * @tparam Axes compile-time vector containing new axes @@ -42,13 +40,13 @@ namespace CT * Example: * * typedef PMacc::math::CT::Int<1,2,0> Orientation_Y; - * typedef typename PMacc::math::tools::CT::TwistVectorAxes::type TwistedBlockDim; + * typedef typename PMacc::math::CT::TwistComponents::type TwistedBlockDim; */ template -struct TwistVectorAxes; +struct TwistComponents; template -struct TwistVectorAxes +struct TwistComponents { typedef math::CT::Vector< typename Vec::template at::type, @@ -56,7 +54,7 @@ struct TwistVectorAxes }; template -struct TwistVectorAxes +struct TwistComponents { typedef math::CT::Vector< typename Vec::template at::type, @@ -65,6 +63,5 @@ struct TwistVectorAxes }; } // namespace CT -} // namespace tools } // namespace math } // namespace PMacc From 86700ea7a67ffc45d6db200448d0913b2ce49412 Mon Sep 17 00:00:00 2001 From: Heikman Date: Wed, 27 May 2015 14:55:00 +0200 Subject: [PATCH 3/4] rename runtime twistVectorAxes to twistComponents --- .../cuSTL/cursor/accessor/TwistAxesAccessor.hpp | 6 +++--- .../twistVectorAxes.hpp => twistComponents.hpp} | 15 ++++++--------- .../MaxwellSolver/DirSplitting/DirSplitting.hpp | 2 +- .../include/plugins/SliceFieldPrinter.tpp | 2 -- .../include/plugins/SliceFieldPrinterMulti.tpp | 1 - 5 files changed, 10 insertions(+), 16 deletions(-) rename src/libPMacc/include/math/vector/{tools/twistVectorAxes.hpp => twistComponents.hpp} (87%) diff --git a/src/libPMacc/include/cuSTL/cursor/accessor/TwistAxesAccessor.hpp b/src/libPMacc/include/cuSTL/cursor/accessor/TwistAxesAccessor.hpp index 2fbcddd75b..f73e67245c 100644 --- a/src/libPMacc/include/cuSTL/cursor/accessor/TwistAxesAccessor.hpp +++ b/src/libPMacc/include/cuSTL/cursor/accessor/TwistAxesAccessor.hpp @@ -23,7 +23,7 @@ #pragma once #include "types.h" -#include "math/vector/tools/twistVectorAxes.hpp" +#include "math/vector/twistComponents.hpp" namespace PMacc { @@ -33,7 +33,7 @@ namespace cursor template struct TwistAxesAccessor { - typedef typename math::tools::result_of::TwistVectorAxes< + typedef typename math::result_of::TwistComponents< Axes, typename TCursor::ValueType>::type type; /** Returns a reference to the result of '*cursor' (with twisted axes). @@ -43,7 +43,7 @@ struct TwistAxesAccessor */ HDINLINE type operator()(TCursor& cursor) { - return math::tools::twistVectorAxes(*cursor); + return math::twistComponents(*cursor); } ///\todo: implement const method here with a const TCursor& argument and 'type' as return type. diff --git a/src/libPMacc/include/math/vector/tools/twistVectorAxes.hpp b/src/libPMacc/include/math/vector/twistComponents.hpp similarity index 87% rename from src/libPMacc/include/math/vector/tools/twistVectorAxes.hpp rename to src/libPMacc/include/math/vector/twistComponents.hpp index 904b2bbd3d..41c9bf17fc 100644 --- a/src/libPMacc/include/math/vector/tools/twistVectorAxes.hpp +++ b/src/libPMacc/include/math/vector/twistComponents.hpp @@ -29,17 +29,15 @@ namespace PMacc { namespace math { -namespace tools -{ namespace result_of { template -struct TwistVectorAxes +struct TwistComponents { - typedef typename TwistVectorAxes::type type; + typedef typename TwistComponents::type type; }; template class T_Storage> -struct TwistVectorAxes > +struct TwistComponents > { typedef math::Vector >,T_Storage >& type; @@ -69,15 +67,14 @@ struct TwistVectorAxes HDINLINE -typename result_of::TwistVectorAxes::type -twistVectorAxes(T_Vector& vector) +typename result_of::TwistComponents::type +twistComponents(T_Vector& vector) { /* The reinterpret_cast is valid because the target type is the same as the * input type except its navigator policy which does not occupy any memory though. */ - return reinterpret_cast::type>(vector); + return reinterpret_cast::type>(vector); } -} // tools } // math } // PMacc diff --git a/src/picongpu/include/fields/MaxwellSolver/DirSplitting/DirSplitting.hpp b/src/picongpu/include/fields/MaxwellSolver/DirSplitting/DirSplitting.hpp index a5b203adda..802f70e400 100644 --- a/src/picongpu/include/fields/MaxwellSolver/DirSplitting/DirSplitting.hpp +++ b/src/picongpu/include/fields/MaxwellSolver/DirSplitting/DirSplitting.hpp @@ -113,7 +113,7 @@ class DirSplitting : private ConditionCheck -GuardDim().toRT())); using namespace cursor::tools; - using namespace PMacc::math::tools; + using namespace PMacc::math; PMacc::math::Size_t<3> gridSize = fieldE_coreBorder.size(); diff --git a/src/picongpu/include/plugins/SliceFieldPrinter.tpp b/src/picongpu/include/plugins/SliceFieldPrinter.tpp index e616778b2f..74d465f9bd 100644 --- a/src/picongpu/include/plugins/SliceFieldPrinter.tpp +++ b/src/picongpu/include/plugins/SliceFieldPrinter.tpp @@ -34,7 +34,6 @@ #include "cuSTL/algorithm/host/Foreach.hpp" #include "lambda/Expression.hpp" #include "SliceFieldPrinter.hpp" -#include #include namespace picongpu @@ -124,7 +123,6 @@ template void SliceFieldPrinter::printSlice(const TField& field, int nAxis, float slicePoint, std::string filename) { namespace vec = PMacc::math; - using namespace vec::tools; PMacc::GridController& con = PMacc::Environment::get().GridController(); vec::Size_t gpuDim = (vec::Size_t)con.getGpuNodes(); diff --git a/src/picongpu/include/plugins/SliceFieldPrinterMulti.tpp b/src/picongpu/include/plugins/SliceFieldPrinterMulti.tpp index 0c57926b51..3559b0f220 100644 --- a/src/picongpu/include/plugins/SliceFieldPrinterMulti.tpp +++ b/src/picongpu/include/plugins/SliceFieldPrinterMulti.tpp @@ -36,7 +36,6 @@ #include "cuSTL/algorithm/host/Foreach.hpp" #include "lambda/Expression.hpp" #include "SliceFieldPrinterMulti.hpp" -#include #include namespace picongpu From 8357f8c340c519e9f02afdcffe265004634b6b36 Mon Sep 17 00:00:00 2001 From: Heikman Date: Fri, 10 Jul 2015 11:08:16 +0200 Subject: [PATCH 4/4] rename twistComponents.hpp to TwistComponents.hpp --- .../cuSTL/cursor/accessor/TwistAxesAccessor.hpp | 2 +- .../{twistComponents.hpp => TwistComponents.hpp} | 2 +- .../{twistComponents.hpp => TwistComponents.hpp} | 0 .../MaxwellSolver/DirSplitting/DirSplitting.hpp | 12 +++++------- 4 files changed, 7 insertions(+), 9 deletions(-) rename src/libPMacc/include/math/vector/{twistComponents.hpp => TwistComponents.hpp} (99%) rename src/libPMacc/include/math/vector/compile-time/{twistComponents.hpp => TwistComponents.hpp} (100%) diff --git a/src/libPMacc/include/cuSTL/cursor/accessor/TwistAxesAccessor.hpp b/src/libPMacc/include/cuSTL/cursor/accessor/TwistAxesAccessor.hpp index f73e67245c..01f35eb68a 100644 --- a/src/libPMacc/include/cuSTL/cursor/accessor/TwistAxesAccessor.hpp +++ b/src/libPMacc/include/cuSTL/cursor/accessor/TwistAxesAccessor.hpp @@ -23,7 +23,7 @@ #pragma once #include "types.h" -#include "math/vector/twistComponents.hpp" +#include "math/vector/TwistComponents.hpp" namespace PMacc { diff --git a/src/libPMacc/include/math/vector/twistComponents.hpp b/src/libPMacc/include/math/vector/TwistComponents.hpp similarity index 99% rename from src/libPMacc/include/math/vector/twistComponents.hpp rename to src/libPMacc/include/math/vector/TwistComponents.hpp index 41c9bf17fc..9beda4b987 100644 --- a/src/libPMacc/include/math/vector/twistComponents.hpp +++ b/src/libPMacc/include/math/vector/TwistComponents.hpp @@ -38,7 +38,7 @@ typename T_Vector> struct TwistComponents { typedef typename TwistComponents::type type; - }; +}; template #include #include +#include +#include namespace picongpu { @@ -74,16 +76,12 @@ class DirSplitting : private ConditionCheck void propagate(CursorE cursorE, CursorB cursorB, GridSize gridSize) const { using namespace cursor::tools; - using namespace PMacc::math::tools; + using namespace PMacc::math; - PMACC_AUTO(gridSizeTwisted,twistVectorAxes(gridSize)); + PMACC_AUTO(gridSizeTwisted, twistComponents(gridSize)); /* twist components of the supercell */ - typedef PMacc::math::CT::Int< - PMacc::math::CT::At::type::value, - PMacc::math::CT::At::type::value, - PMacc::math::CT::At::type::value - > BlockDim; + typedef typename CT::TwistComponents::type BlockDim; algorithm::kernel::ForeachBlock foreach; foreach(zone::SphericZone<3>(PMacc::math::Size_t<3>(BlockDim::x::value, gridSizeTwisted.y(), gridSizeTwisted.z())),