Skip to content

Commit d7b7290

Browse files
refactor nummerical cell types
- change namespaces into structs - update traits spezilization of `FieldPosition`
1 parent a5ae92b commit d7b7290

File tree

2 files changed

+74
-38
lines changed

2 files changed

+74
-38
lines changed

include/picongpu/fields/numericalCellTypes/EMFCenteredCell.hpp

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,28 @@
2020
#pragma once
2121

2222
#include "picongpu/simulation_defines.hpp"
23+
#include "picongpu/traits/FieldPosition.hpp"
2324
#include "picongpu/fields/Fields.def"
25+
2426
#include <pmacc/math/Vector.hpp>
2527

2628

2729
namespace picongpu
2830
{
29-
namespace emfCenteredCell
30-
{
31-
namespace traits
31+
namespace numericalCellTypes
3232
{
33-
/** \tparam floatD_X position of the component in the cell
34-
* \tparam DIM3 Fields (E/B/J) have 3 components, even in 1 or 2D !
35-
*/
36-
typedef const ::pmacc::math::Vector<float2_X,DIM3> VectorVector2D3V;
37-
typedef const ::pmacc::math::Vector<float3_X,DIM3> VectorVector3D3V;
3833

39-
template<typename T_Field, uint32_t T_simDim = simDim>
40-
struct FieldPosition;
34+
struct EMFCenteredCell{};
4135

36+
} //namespace numericalCellTypes
37+
38+
namespace traits
39+
{
4240
/** position (floatD_X in case of T_simDim == simDim) in cell for
4341
* E_x, E_y, E_z
4442
*/
4543
template<uint32_t T_simDim>
46-
struct FieldPosition<FieldE, T_simDim>
44+
struct FieldPosition<numericalCellTypes::EMFCenteredCell, FieldE, T_simDim>
4745
{
4846
typedef pmacc::math::Vector<float_X, T_simDim> PosType;
4947
typedef const pmacc::math::Vector<PosType, DIM3> ReturnType;
@@ -72,8 +70,8 @@ namespace traits
7270
* B_x, B_y, B_z
7371
*/
7472
template<uint32_t T_simDim>
75-
struct FieldPosition<FieldB, T_simDim> :
76-
public FieldPosition<FieldE, T_simDim>
73+
struct FieldPosition<numericalCellTypes::EMFCenteredCell, FieldB, T_simDim> :
74+
public FieldPosition<numericalCellTypes::EMFCenteredCell, FieldE, T_simDim>
7775
{
7876
HDINLINE FieldPosition()
7977
{
@@ -82,8 +80,15 @@ namespace traits
8280

8381
/** position (float2_X) in cell for J_x, J_y, J_z */
8482
template<>
85-
struct FieldPosition<FieldJ, DIM2>
83+
struct FieldPosition<numericalCellTypes::EMFCenteredCell, FieldJ, DIM2>
8684
{
85+
/** \tparam float2_X position of the component in the cell
86+
* \tparam DIM3 Fields (E/B/J) have 3 components, even in 1 or 2D !
87+
*/
88+
using VectorVector2D3V = const ::pmacc::math::Vector<
89+
float2_X,
90+
DIM3
91+
>;
8792
/// boost::result_of hints
8893
template<class> struct result;
8994

@@ -109,8 +114,15 @@ namespace traits
109114
/** position (float3_X) in cell for J_x, J_y, J_z
110115
*/
111116
template<>
112-
struct FieldPosition<FieldJ, DIM3>
117+
struct FieldPosition<numericalCellTypes::EMFCenteredCell, FieldJ, DIM3>
113118
{
119+
/** \tparam float2_X position of the component in the cell
120+
* \tparam DIM3 Fields (E/B/J) have 3 components, even in 1 or 2D !
121+
*/
122+
using VectorVector3D3V = const ::pmacc::math::Vector<
123+
float3_X,
124+
DIM3
125+
>;
114126
/// boost::result_of hints
115127
template<class> struct result;
116128

@@ -138,7 +150,7 @@ namespace traits
138150
* scalar field FieldTmp
139151
*/
140152
template<uint32_t T_simDim>
141-
struct FieldPosition<FieldTmp, T_simDim>
153+
struct FieldPosition<numericalCellTypes::EMFCenteredCell, FieldTmp, T_simDim>
142154
{
143155
typedef pmacc::math::Vector<float_X, T_simDim> FieldPos;
144156
typedef pmacc::math::Vector<FieldPos, DIM1> ReturnType;
@@ -160,6 +172,5 @@ namespace traits
160172
return ReturnType( FieldPos::create(0.0) );
161173
}
162174
};
163-
} // traits
164-
} // emfCenteredCell
175+
} // namespace traits
165176
} // picongpu

include/picongpu/fields/numericalCellTypes/YeeCell.hpp

Lines changed: 45 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,33 @@
2020
#pragma once
2121

2222
#include "picongpu/simulation_defines.hpp"
23+
#include "picongpu/traits/FieldPosition.hpp"
2324
#include "picongpu/fields/Fields.def"
25+
2426
#include <pmacc/math/Vector.hpp>
2527

2628

2729
namespace picongpu
2830
{
29-
namespace yeeCell
31+
namespace numericalCellTypes
3032
{
33+
struct YeeCell{};
34+
} //namespace numericalCellTypes
35+
3136
namespace traits
3237
{
33-
/** \tparam floatD_X position of the component in the cell
34-
* \tparam DIM3 Fields (E/B/J) have 3 components, even in 1 or 2D !
35-
*/
36-
typedef const ::pmacc::math::Vector<float2_X,DIM3> VectorVector2D3V;
37-
typedef const ::pmacc::math::Vector<float3_X,DIM3> VectorVector3D3V;
38-
39-
template<typename T_Field, uint32_t T_simDim = simDim>
40-
struct FieldPosition;
41-
4238
/** position (float2_X) in cell for E_x, E_y, E_z
4339
*/
4440
template<>
45-
struct FieldPosition<FieldE, DIM2>
41+
struct FieldPosition<numericalCellTypes::YeeCell, FieldE, DIM2>
4642
{
43+
/** \tparam float2_X position of the component in the cell
44+
* \tparam DIM3 Fields (E/B/J) have 3 components, even in 1 or 2D !
45+
*/
46+
using VectorVector2D3V = const ::pmacc::math::Vector<
47+
float2_X,
48+
DIM3
49+
>;
4750
/// boost::result_of hints
4851
template<class> struct result;
4952

@@ -69,8 +72,16 @@ namespace traits
6972
/** position (float3_X) in cell for E_x, E_y, E_z
7073
*/
7174
template<>
72-
struct FieldPosition<FieldE, DIM3>
75+
struct FieldPosition<numericalCellTypes::YeeCell, FieldE, DIM3>
7376
{
77+
/** \tparam float2_X position of the component in the cell
78+
* \tparam DIM3 Fields (E/B/J) have 3 components, even in 1 or 2D !
79+
*/
80+
using VectorVector3D3V = const ::pmacc::math::Vector<
81+
float3_X,
82+
DIM3
83+
>;
84+
7485
/// boost::result_of hints
7586
template<class> struct result;
7687

@@ -96,8 +107,15 @@ namespace traits
96107
/** position (float2_X) in cell for B_x, B_y, B_z
97108
*/
98109
template<>
99-
struct FieldPosition<FieldB, DIM2>
110+
struct FieldPosition<numericalCellTypes::YeeCell, FieldB, DIM2>
100111
{
112+
/** \tparam float2_X position of the component in the cell
113+
* \tparam DIM3 Fields (E/B/J) have 3 components, even in 1 or 2D !
114+
*/
115+
using VectorVector2D3V = const ::pmacc::math::Vector<
116+
float2_X,
117+
DIM3
118+
>;
101119
/// boost::result_of hints
102120
template<class> struct result;
103121

@@ -123,8 +141,16 @@ namespace traits
123141
/** position (float3_X) in cell for B_x, B_y, B_z
124142
*/
125143
template<>
126-
struct FieldPosition<FieldB, DIM3>
144+
struct FieldPosition<numericalCellTypes::YeeCell, FieldB, DIM3>
127145
{
146+
/** \tparam float2_X position of the component in the cell
147+
* \tparam DIM3 Fields (E/B/J) have 3 components, even in 1 or 2D !
148+
*/
149+
using VectorVector3D3V = const ::pmacc::math::Vector<
150+
float3_X,
151+
DIM3
152+
>;
153+
128154
/// boost::result_of hints
129155
template<class> struct result;
130156

@@ -151,8 +177,8 @@ namespace traits
151177
* J_x, J_y, J_z
152178
*/
153179
template<uint32_t T_simDim>
154-
struct FieldPosition<FieldJ, T_simDim> :
155-
public FieldPosition<FieldE, T_simDim>
180+
struct FieldPosition<numericalCellTypes::YeeCell, FieldJ, T_simDim> :
181+
public FieldPosition<numericalCellTypes::YeeCell, FieldE, T_simDim>
156182
{
157183
HDINLINE FieldPosition()
158184
{
@@ -164,7 +190,7 @@ namespace traits
164190
* scalar field FieldTmp
165191
*/
166192
template<uint32_t T_simDim>
167-
struct FieldPosition<FieldTmp, T_simDim>
193+
struct FieldPosition<numericalCellTypes::YeeCell, FieldTmp, T_simDim>
168194
{
169195
typedef pmacc::math::Vector<float_X, T_simDim> FieldPos;
170196
typedef pmacc::math::Vector<FieldPos, DIM1> ReturnType;
@@ -186,6 +212,5 @@ namespace traits
186212
return ReturnType( FieldPos::create(0.0) );
187213
}
188214
};
189-
} // traits
190-
} // yeeCell
191-
} // picongpu
215+
} // namespace traits
216+
} // namespace picongpu

0 commit comments

Comments
 (0)