|
1 | 1 | /**
|
2 |
| - * Copyright 2013-2014 Heiko Burau, Rene Widera, Felix Schmitt, |
| 2 | + * Copyright 2013-2015 Heiko Burau, Rene Widera, Felix Schmitt, |
3 | 3 | * Richard Pausch
|
4 | 4 | *
|
5 | 5 | * This file is part of PIConGPU.
|
@@ -66,10 +66,10 @@ void SliceFieldPrinter<Field>::pluginLoad()
|
66 | 66 | namespace vec = ::PMacc::math;
|
67 | 67 | typedef SuperCellSize BlockDim;
|
68 | 68 |
|
69 |
| - vec::Size_t<3> size = vec::Size_t<3>(this->cellDescription->getGridSuperCells()) * precisionCast<size_t>(BlockDim::toRT()) |
| 69 | + vec::Size_t<simDim> size = vec::Size_t<simDim>(this->cellDescription->getGridSuperCells()) * precisionCast<size_t>(BlockDim::toRT()) |
70 | 70 | - precisionCast<size_t>(2 * BlockDim::toRT());
|
71 |
| - this->dBuffer_SI = new container::DeviceBuffer<float3_64, 2>( |
72 |
| - size.shrink<2>((this->plane+1)%3)); |
| 71 | + this->dBuffer_SI = new container::DeviceBuffer<float3_64, simDim-1>( |
| 72 | + size.shrink<simDim-1>((this->plane+1)%simDim)); |
73 | 73 | }
|
74 | 74 | else
|
75 | 75 | {
|
@@ -126,39 +126,50 @@ void SliceFieldPrinter<Field>::printSlice(const TField& field, int nAxis, float
|
126 | 126 | namespace vec = PMacc::math;
|
127 | 127 | using namespace vec::tools;
|
128 | 128 |
|
129 |
| - PMacc::GridController<3>& con = PMacc::Environment<3>::get().GridController(); |
130 |
| - vec::Size_t<3> gpuDim = (vec::Size_t<3>)con.getGpuNodes(); |
131 |
| - vec::Size_t<3> globalGridSize = gpuDim * field.size(); |
| 129 | + PMacc::GridController<simDim>& con = PMacc::Environment<simDim>::get().GridController(); |
| 130 | + vec::Size_t<simDim> gpuDim = (vec::Size_t<simDim>)con.getGpuNodes(); |
| 131 | + vec::Size_t<simDim> globalGridSize = gpuDim * field.size(); |
132 | 132 | int globalPlane = globalGridSize[nAxis] * slicePoint;
|
133 | 133 | int localPlane = globalPlane % field.size()[nAxis];
|
134 | 134 | int gpuPlane = globalPlane / field.size()[nAxis];
|
135 | 135 |
|
136 |
| - vec::Int<3> nVector(vec::Int<3>::create(0)); |
| 136 | + vec::Int<simDim> nVector(vec::Int<simDim>::create(0)); |
137 | 137 | nVector[nAxis] = 1;
|
138 | 138 |
|
139 |
| - zone::SphericZone<3> gpuGatheringZone(vec::Size_t<3>(gpuDim.x(), gpuDim.y(), gpuDim.z()), |
140 |
| - nVector * gpuPlane); |
| 139 | + zone::SphericZone<simDim> gpuGatheringZone(gpuDim, nVector * gpuPlane); |
141 | 140 | gpuGatheringZone.size[nAxis] = 1;
|
142 | 141 |
|
143 |
| - algorithm::mpi::Gather<3> gather(gpuGatheringZone); |
| 142 | + algorithm::mpi::Gather<simDim> gather(gpuGatheringZone); |
144 | 143 | if(!gather.participate()) return;
|
145 | 144 |
|
146 | 145 | using namespace lambda;
|
147 |
| - vec::UInt32<3> twistedVector((nAxis+1)%3, (nAxis+2)%3, nAxis); |
| 146 | +#if(SIMDIM==DIM3) |
| 147 | + vec::UInt32<3> twistedAxesVec((nAxis+1)%3, (nAxis+2)%3, nAxis); |
148 | 148 |
|
149 | 149 | /* convert data to higher precision and to SI units */
|
150 | 150 | SliceFieldPrinterHelper::ConversionFunctor<Field> cf;
|
151 | 151 | algorithm::kernel::Foreach<vec::CT::UInt32<4,4,1> >()(
|
152 | 152 | dBuffer_SI->zone(), dBuffer_SI->origin(),
|
153 |
| - cursor::tools::slice(field.originCustomAxes(twistedVector)(0,0,localPlane)), |
| 153 | + cursor::tools::slice(field.originCustomAxes(twistedAxesVec)(0,0,localPlane)), |
154 | 154 | cf );
|
| 155 | +#endif |
| 156 | +#if(SIMDIM==DIM2) |
| 157 | + vec::UInt32<2> twistedAxesVec((nAxis+1)%2, nAxis); |
| 158 | + |
| 159 | + /* convert data to higher precision and to SI units */ |
| 160 | + SliceFieldPrinterHelper::ConversionFunctor<Field> cf; |
| 161 | + algorithm::kernel::Foreach<vec::CT::UInt32<16,1,1> >()( |
| 162 | + dBuffer_SI->zone(), dBuffer_SI->origin(), |
| 163 | + cursor::tools::slice(field.originCustomAxes(twistedAxesVec)(0,localPlane)), |
| 164 | + cf ); |
| 165 | +#endif |
155 | 166 |
|
156 | 167 | /* copy selected plane from device to host */
|
157 |
| - container::HostBuffer<float3_64, 2> hBuffer(dBuffer_SI->size()); |
| 168 | + container::HostBuffer<float3_64, simDim-1> hBuffer(dBuffer_SI->size()); |
158 | 169 | hBuffer = *dBuffer_SI;
|
159 | 170 |
|
160 | 171 | /* collect data from all nodes/GPUs */
|
161 |
| - container::HostBuffer<float3_64, 2> globalBuffer(hBuffer.size() * gpuDim.shrink<2>((nAxis+1)%3)); |
| 172 | + container::HostBuffer<float3_64, simDim-1> globalBuffer(hBuffer.size() * gpuDim.shrink<simDim-1>((nAxis+1)%simDim)); |
162 | 173 | gather(globalBuffer, hBuffer, nAxis);
|
163 | 174 | if(!gather.root()) return;
|
164 | 175 | std::ofstream file(filename.c_str());
|
|
0 commit comments