示例#1
0
        void initEvolution(
            DBox const & writeBox,
            float const fraction
        )
        {
            AreaMapping <
                CORE + BORDER,
                T_MappingDesc
            > mapper( *mapping );
            constexpr uint32_t numWorkers = traits::GetNumWorkers<
                math::CT::volume< typename T_MappingDesc::SuperCellSize >::type::value
            >::value;

            GridController< DIM2 >& gc = Environment< DIM2 >::get( ).GridController( );
            uint32_t seed = gc.getGlobalSize( ) + gc.getGlobalRank( );

            PMACC_KERNEL( kernel::RandomInit< numWorkers >{ } )(
                mapper.getGridDim( ),
                numWorkers
            )(
                writeBox,
                seed,
                fraction,
                mapper
            );
        }
示例#2
0
        /** Functor
         *
         * @param currentStep the current time step
         * @param speciesGroup naming for the group of species in T_SpeciesList
         */
        void operator()(
            uint32_t currentStep,
            std::string const & speciesGroup
        )
        {
            // generating a density requires at least one slot in FieldTmp
            PMACC_CASSERT_MSG(
                _please_allocate_at_least_one_FieldTmp_in_memory_param,
                fieldTmpNumSlots > 0
            );

            DataConnector &dc = Environment<>::get().DataConnector();

            // load FieldTmp without copy data to host and zero it
            auto fieldTmp = dc.get< FieldTmp >(
                FieldTmp::getUniqueId( 0 ),
                true
            );
            using DensityValueType = typename FieldTmp::ValueType;
            fieldTmp->getGridBuffer().getDeviceBuffer().setValue( DensityValueType::create(0.0) );

            // add density of each species in list to FieldTmp
            ForEach< SpeciesList, detail::AddSingleDensity< bmpl::_1 > > addSingleDensity;
            addSingleDensity( currentStep, forward( fieldTmp ) );

            /* create valid density in the BORDER region
             * note: for average != supercell multiples the GUARD of fieldTmp
             *       also needs to be filled in the communication above
             */
            EventTask fieldTmpEvent = fieldTmp->asyncCommunication(__getTransactionEvent());
            __setTransactionEvent(fieldTmpEvent);

            /* average summed density in FieldTmp down to local resolution and
             * write in new field
             */
            auto nlocal = dc.get< LocalDensity >(
                helperFields::LocalDensity::getName( speciesGroup ),
                true
            );
            constexpr uint32_t numWorkers = pmacc::traits::GetNumWorkers<
                pmacc::math::CT::volume< SuperCellSize >::type::value
            >::value;
            PMACC_KERNEL( helperFields::KernelAverageDensity< numWorkers >{ } )
            (
                // one block per averaged density value
                nlocal->getGridBuffer().getGridLayout().getDataSpaceWithoutGuarding(),
                numWorkers
            )
            (
                // start in border (jump over GUARD area)
                fieldTmp->getDeviceDataBox().shift( SuperCellSize::toRT() * GuardSize::toRT() ),
                // start in border (has no GUARD area)
                nlocal->getGridBuffer().getDeviceBuffer( ).getDataBox( )
            );

            // release fields
            dc.releaseData( FieldTmp::getUniqueId( 0 ) );
            dc.releaseData( helperFields::LocalDensity::getName( speciesGroup ) );
        }
示例#3
0
 void run(const DBox& readBox, const DBox & writeBox)
 {
     AreaMapping < Area, MappingDesc > mapper(mapping);
     PMACC_KERNEL(kernel::Evolution{})
             (mapper.getGridDim(), MappingDesc::SuperCellSize::toRT())
             (readBox,
              writeBox,
              rule,
              mapper);
 }
示例#4
0
        void initEvolution(const DBox & writeBox, float fraction)
        {
            AreaMapping < CORE + BORDER, MappingDesc > mapper(mapping);
            GridController<DIM2>& gc = Environment<DIM2>::get().GridController();
            uint32_t seed = gc.getGlobalSize() + gc.getGlobalRank();

            PMACC_KERNEL(kernel::RandomInit{})
                    (mapper.getGridDim(), MappingDesc::SuperCellSize::toRT())
                    (
                     writeBox,
                     seed,
                     fraction,
                     mapper);
        }
        /** Functor
         *
         * @param currentStep the current time step
         * @param eneHistLocal the GridBuffer for local energy histograms
         * @param minEnergy minimum energy to account for (eV)
         * @param maxEnergy maximum energy to account for (eV)
         */
        void operator()(
            uint32_t currentStep,
            std::shared_ptr< LocalEnergyHistogram > & eneHistLocal,
            float_X const minEnergy,
            float_X const maxEnergy
        )
        {
            DataConnector &dc = Environment<>::get().DataConnector();

            // load particle without copy particle data to host
            auto speciesTmp = dc.get< SpeciesType >( FrameType::getName(), true );

            // mapper to access species in CORE & BORDER only
            MappingDesc cellDescription(
                speciesTmp->getParticlesBuffer().getSuperCellsLayout().getDataSpace() * SuperCellSize::toRT(),
                GuardSize::toRT()
            );
            AreaMapping<
                CORE + BORDER,
                MappingDesc
            > mapper( cellDescription );

            // add energy histogram on top of existing data
            constexpr uint32_t numWorkers = pmacc::traits::GetNumWorkers<
                pmacc::math::CT::volume< SuperCellSize >::type::value
            >::value;
            PMACC_KERNEL( helperFields::KernelAddLocalEnergyHistogram< numWorkers >{ } )
            (
                // one block per local energy histogram
                mapper.getGridDim(),
                numWorkers
            )
            (
                // start in border (jump over GUARD area)
                speciesTmp->getDeviceParticlesBox(),
                // start in border (has no GUARD area)
                eneHistLocal->getGridBuffer().getDeviceBuffer( ).getDataBox( ),
                minEnergy,
                maxEnergy,
                mapper
            );

            dc.releaseData( FrameType::getName() );
        }
示例#6
0
        void run(
            DBox const & readBox,
            DBox const & writeBox
        )
        {
            AreaMapping <
                Area,
                T_MappingDesc
            > mapper( *mapping );
            constexpr uint32_t numWorkers = traits::GetNumWorkers<
                math::CT::volume< typename T_MappingDesc::SuperCellSize >::type::value
            >::value;

            PMACC_KERNEL( kernel::Evolution< numWorkers >{ } )(
                mapper.getGridDim( ),
                numWorkers
            )(
                readBox,
                writeBox,
                rule,
                mapper
            );
        }