SglParticle<FloatPos> getPositionsParticles(uint32_t currentStep)
    {

        typedef typename MappingDesc::SuperCellSize SuperCellSize;
        SglParticle<FloatPos> positionParticleTmp;

        gParticle->getDeviceBuffer().setValue(positionParticleTmp);
        dim3 block(SuperCellSize::getDataSpace());

        __picKernelArea(kernelPositionsParticles, *cellDescription, AREA)
            (block)
            (particles->getDeviceParticlesBox(),
             gParticle->getDeviceBuffer().getBasePointer());
        gParticle->deviceToHost();

        DataSpace<simDim> localSize(cellDescription->getGridLayout().getDataSpaceWithoutGuarding());
        VirtualWindow window(MovingWindow::getInstance().getVirtualWindow(currentStep));

        DataSpace<simDim> gpuPhyCellOffset(SubGrid<simDim>::getInstance().getSimulationBox().getGlobalOffset());
        gpuPhyCellOffset.y() += (localSize.y() * window.slides);

        gParticle->getHostBuffer().getDataBox()[0].globalCellOffset += gpuPhyCellOffset;


        return gParticle->getHostBuffer().getDataBox()[0];
    }
예제 #2
0
        void getLineSliceFields()
        {
            typedef typename MappingDesc::SuperCellSize SuperCellSize;

            const float3_X tmpFloat3(float3_X(float_X(0.0), float_X(0.0), float_X(0.0)));
            sliceDataField->getDeviceBuffer().setValue(tmpFloat3);
            dim3 block(SuperCellSize::toRT().toDim3());

            const SubGrid<simDim>& subGrid = Environment<simDim>::get().SubGrid();
            // global cell id offset (without guardings!)
            // returns the global id offset of the "first" border cell on a GPU
            const DataSpace<simDim> globalCellIdOffset(subGrid.getLocalDomain().offset);

            // global number of cells for whole simulation: local cells on GPU * GPUs
            // (assumed same size on each gpu :-/  -> todo: provide interface!)
            //! \todo create a function for: global number of cells for whole simulation
            //!
            const DataSpace<simDim> localNrOfCells(subGrid.getLocalDomain().size);
            const DataSpace<simDim> globalNrOfCells (subGrid.getGlobalDomain().size);


            __picKernelArea(kernelLineSliceFields, *cellDescription, AREA)
                    (block)
                    (fieldE->getDeviceDataBox(),
                    fieldB->getDeviceDataBox(),
                    sliceDataField->getDeviceBuffer().getBasePointer(),
                    globalCellIdOffset,
                    globalNrOfCells
                    );
            sliceDataField->deviceToHost();
            //return sliceDataField->getHostBuffer().getDataBox()[0];
        }