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

delete TVec, refactor DataSpace #394

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class OneParticleSimulation : public MySimulation
const DataSpace<simDim> halfSimSize(simBox.getGlobalSize() / 2);


GridLayout<DIM3> layout(simBox.getLocalSize(), MappingDesc::SuperCellSize::getDataSpace());
GridLayout<DIM3> layout(simBox.getLocalSize(), MappingDesc::SuperCellSize::toRT());
MappingDesc cellDescription = MappingDesc(layout.getDataSpace(), GUARD_SIZE, GUARD_SIZE);

ParticlesInitOneParticle<PIC_Electrons>::addOneParticle(*(this->electrons),
Expand Down Expand Up @@ -143,7 +143,7 @@ class OneParticleSimulation : public MySimulation
virtual void movingWindowCheck(uint32_t currentStep)
{
PMACC_AUTO(simBox, Environment<simDim>::get().SubGrid().getSimulationBox());
GridLayout<DIM3> gridLayout(simBox.getLocalSize(), MappingDesc::SuperCellSize::getDataSpace());
GridLayout<DIM3> gridLayout(simBox.getLocalSize(), MappingDesc::SuperCellSize::toRT());
if (MovingWindow::getInstance().getVirtualWindow(currentStep).doSlide)
{
GridController<simDim>& gc = Environment<simDim>::get().GridController();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ class ParticlesInitOneParticle
}

//calculate supercell
DataSpace<DIM3> localSuperCell = (localParCell / MappingDesc::SuperCellSize::getDataSpace());
DataSpace<DIM3> cellInSuperCell = localParCell - (localSuperCell * MappingDesc::SuperCellSize::getDataSpace());
DataSpace<DIM3> localSuperCell = (localParCell / MappingDesc::SuperCellSize::toRT());
DataSpace<DIM3> cellInSuperCell = localParCell - (localSuperCell * MappingDesc::SuperCellSize::toRT());
//add garding blocks to supercell
localSuperCell = localSuperCell + cellDescription.getGuardingSuperCells();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
/**
* Copyright 2013 Axel Huebl, Heiko Burau, Rene Widera, Richard Pausch
*
* This file is part of PIConGPU.
*
* PIConGPU is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PIConGPU 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with PIConGPU.
* If not, see <http://www.gnu.org/licenses/>.
*/
* This file is part of PIConGPU.
*
* PIConGPU is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PIConGPU 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with PIConGPU.
* If not, see <http://www.gnu.org/licenses/>.
*/



#ifndef ONEPARTICLESIMULATION_HPP
Expand Down Expand Up @@ -87,7 +87,7 @@ class OneParticleSimulation : public MySimulation
}


//diabled because we have a transaction bug
//diabled because we have a transaction bug
//StreamController::getInstance().addStreams(6);

//add one particle in simulation
Expand All @@ -96,11 +96,11 @@ class OneParticleSimulation : public MySimulation

const DataSpace<simDim> halfSimSize(simBox.getGlobalSize() / 2);

GridLayout<DIM3> layout(simBox.getLocalSize(), MappingDesc::SuperCellSize::getDataSpace());
GridLayout<DIM3> layout(simBox.getLocalSize(), MappingDesc::SuperCellSize::toRT());
MappingDesc cellDescription = MappingDesc(layout.getDataSpace(), GUARD_SIZE, GUARD_SIZE);

DataSpace<DIM3> centerXZPlan(halfSimSize);
centerXZPlan.y() = OneParticleOffset; //1380;//MappingDesc::SuperCellSize::y + 32;
centerXZPlan.y() = OneParticleOffset;

ParticlesInitOneParticle<PIC_Electrons>::addOneParticle(*(this->electrons),
cellDescription,
Expand Down Expand Up @@ -177,7 +177,7 @@ class OneParticleSimulation : public MySimulation
{

PMACC_AUTO(simBox, Environment<simDim>::get().SubGrid().getSimulationBox());
GridLayout<DIM3> gridLayout(simBox.getLocalSize(), MappingDesc::SuperCellSize::getDataSpace());
GridLayout<DIM3> gridLayout(simBox.getLocalSize(), MappingDesc::SuperCellSize::toRT());
if (MovingWindow::getInstance().getVirtualWindow(currentStep).doSlide)
{
GridController<simDim>& gc = Environment<simDim>::get().GridController();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ class ParticlesInitOneParticle
}

//calculate supercell
DataSpace<DIM3> localSuperCell = (localParCell / MappingDesc::SuperCellSize::getDataSpace());
DataSpace<DIM3> cellInSuperCell = localParCell - (localSuperCell * MappingDesc::SuperCellSize::getDataSpace());
DataSpace<DIM3> localSuperCell = (localParCell / MappingDesc::SuperCellSize::toRT());
DataSpace<DIM3> cellInSuperCell = localParCell - (localSuperCell * MappingDesc::SuperCellSize::toRT());
//add garding blocks to supercell
localSuperCell = localSuperCell + cellDescription.getGuardingSuperCells();

Expand Down
42 changes: 21 additions & 21 deletions examples/SingleParticleTest/include/OneParticleSimulation.hpp
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
/**
* Copyright 2013 Axel Huebl, Heiko Burau, Rene Widera
*
* This file is part of PIConGPU.
*
* PIConGPU is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PIConGPU 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with PIConGPU.
* If not, see <http://www.gnu.org/licenses/>.
*/
* This file is part of PIConGPU.
*
* PIConGPU is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PIConGPU 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with PIConGPU.
* If not, see <http://www.gnu.org/licenses/>.
*/



#ifndef ONEPARTICLESIMULATION_HPP
Expand Down Expand Up @@ -88,7 +88,7 @@ class OneParticleSimulation : public MySimulation
}


//diabled because we have a transaction bug
//diabled because we have a transaction bug
//StreamController::getInstance().addStreams(6);

//add one particle in simulation
Expand All @@ -97,11 +97,11 @@ class OneParticleSimulation : public MySimulation

const DataSpace<simDim> halfSimSize(simBox.getGlobalSize() / 2);

GridLayout<DIM3> layout(simBox.getLocalSize(), MappingDesc::SuperCellSize::getDataSpace());
GridLayout<DIM3> layout(simBox.getLocalSize(), MappingDesc::SuperCellSize::toRT());
MappingDesc cellDescription = MappingDesc(layout.getDataSpace(), GUARD_SIZE, GUARD_SIZE);

DataSpace<DIM3> centerXZPlan(halfSimSize);
centerXZPlan.y() = OneParticleOffset; //VACUUM_Y / CELL_HEIGHT + 32; //MappingDesc::SuperCellSize::y + 32;
centerXZPlan.y() = OneParticleOffset;

ParticlesInitOneParticle<PIC_Electrons>::addOneParticle(*(this->electrons),
cellDescription,
Expand Down Expand Up @@ -155,7 +155,7 @@ class OneParticleSimulation : public MySimulation
virtual void movingWindowCheck(uint32_t currentStep)
{
PMACC_AUTO(simBox, Environment<simDim>::get().SubGrid().getSimulationBox());
GridLayout<DIM3> gridLayout(simBox.getLocalSize(), MappingDesc::SuperCellSize::getDataSpace());
GridLayout<DIM3> gridLayout(simBox.getLocalSize(), MappingDesc::SuperCellSize::toRT());
if (MovingWindow::getInstance().getVirtualWindow(currentStep).doSlide)
{
GridController<simDim>& gc = Environment<simDim>::get().GridController();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ namespace picongpu
}

//calculate supercell
DataSpace<DIM3> localSuperCell = (localParCell / MappingDesc::SuperCellSize::getDataSpace());
DataSpace<DIM3> cellInSuperCell = localParCell - (localSuperCell * MappingDesc::SuperCellSize::getDataSpace());
DataSpace<DIM3> localSuperCell = (localParCell / MappingDesc::SuperCellSize::toRT());
DataSpace<DIM3> cellInSuperCell = localParCell - (localSuperCell * MappingDesc::SuperCellSize::toRT());
//add garding blocks to supercell
localSuperCell = localSuperCell + cellDescription.getGuardingSuperCells();

Expand Down
52 changes: 26 additions & 26 deletions src/libPMacc/examples/gameOfLife2D/include/Evolution.hpp
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
/**
* Copyright 2013 Rene Widera
*
* This file is part of libPMacc.
*
* libPMacc is free software: you can redistribute it and/or modify
* it under the terms of 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 <http://www.gnu.org/licenses/>.
*/
* This file is part of libPMacc.
*
* libPMacc is free software: you can redistribute it and/or modify
* it under the terms of 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 <http://www.gnu.org/licenses/>.
*/

#pragma once

#include "types.hpp"
#include "dimensions/TVec.h"
#include "math/vector/compile-time/Int.hpp"
#include "mappings/threads/ThreadCollective.hpp"
#include "nvidia/functors/Assign.hpp"
#include "memory/boxes/CachedBox.hpp"
Expand All @@ -47,13 +47,13 @@ namespace gol
typedef typename BoxReadOnly::ValueType Type;
typedef SuperCellDescription<
typename Mapping::SuperCellSize,
TVec < 1, 1 >,
TVec < 1, 1 >
math::CT::Int< 1, 1 >,
math::CT::Int< 1, 1 >
> BlockArea;
PMACC_AUTO(cache, CachedBox::create < 0, Type > (BlockArea()));

const Space block(mapper.getSuperCellIndex(Space(blockIdx)));
const Space blockCell = block * Mapping::SuperCellSize();
const Space blockCell = block * Mapping::SuperCellSize::toRT();
const Space threadIndex(threadIdx);
PMACC_AUTO(buffRead_shifted, buffRead.shift(blockCell));

Expand Down Expand Up @@ -90,11 +90,11 @@ namespace gol
/* get position in grid in units of SuperCells from blockID */
const Space block(mapper.getSuperCellIndex(Space(blockIdx)));
/* convert position in unit of cells */
const Space blockCell = block * Mapping::SuperCellSize();
const Space blockCell = block * Mapping::SuperCellSize::toRT();
/* convert CUDA dim3 to DataSpace<DIM3> */
const Space threadIndex(threadIdx);
const uint32_t cellIdx = DataSpaceOperations<DIM2>::map(
mapper.getGridSuperCells() * Mapping::SuperCellSize(),
mapper.getGridSuperCells() * Mapping::SuperCellSize::toRT(),
blockCell + threadIndex);

/* get uniform random number from seed */
Expand Down Expand Up @@ -131,7 +131,7 @@ namespace gol
uint32_t seed = gc.getGlobalSize() + gc.getGlobalRank();

__cudaKernel(kernel::randomInit)
(mapper.getGridDim(), MappingDesc::SuperCellSize::getDataSpace())
(mapper.getGridDim(), MappingDesc::SuperCellSize::toRT().toDim3())
(
writeBox,
seed,
Expand All @@ -144,7 +144,7 @@ namespace gol
{
AreaMapping < Area, MappingDesc > mapper(mapping);
__cudaKernel(kernel::evolution)
(mapper.getGridDim(), MappingDesc::SuperCellSize::getDataSpace())
(mapper.getGridDim(), MappingDesc::SuperCellSize::toRT().toDim3())
(readBox,
writeBox,
rule,
Expand Down
10 changes: 5 additions & 5 deletions src/libPMacc/examples/gameOfLife2D/include/Simulation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ namespace gol
class Simulation
{
private:
/* TVec<16,16> is arbitrarily chosen SuperCellSize! */
typedef MappingDescription<DIM2, TVec < 16, 16 > > MappingDesc;
/* math::CT::Int<16,16> is arbitrarily chosen SuperCellSize! */
typedef MappingDescription<DIM2, math::CT::Int< 16, 16 > > MappingDesc;
typedef Evolution<MappingDesc> Evolutiontype;

Space gridSize;
Expand Down Expand Up @@ -115,15 +115,15 @@ class Simulation
PMACC_AUTO(simBox, Environment<DIM2>::get().SubGrid().getSimulationBox());

/* Recall that in types.hpp the following is defined: *
* typedef MappingDescription<DIM2, TVec<16,16> > MappingDesc; *
* where TVec<16,16> is arbitrarily(!) chosen SuperCellSize and DIM2 *
* typedef MappingDescription<DIM2, math::CT::Int<16,16> > MappingDesc; *
* where math::CT::Int<16,16> is arbitrarily(!) chosen SuperCellSize and DIM2 *
* is the dimension of the grid. *
* Expression of 2nd argument translates to DataSpace<DIM3>(16,16,0). *
* This is the guard size (here set to be one Supercell wide in all *
* directions). Meaning we have 16*16*(2*grid.x+2*grid.y+4) more *
* cells in GridLayout than in SimulationBox. */
GridLayout<DIM2> layout( simBox.getLocalSize(),
MappingDesc::SuperCellSize::getDataSpace());
MappingDesc::SuperCellSize::toRT());

/* getDataSpace will return DataSpace( grid.x +16+16, grid.y +16+16) *
* init stores the arguments internally in a MappingDesc private *
Expand Down
Loading