__global__ void kernelAddOneParticle(ParBox pb, DataSpace<simDim> superCell, DataSpace<simDim> parLocalCell) { typedef typename ParBox::FrameType FRAME; FRAME *frame; int linearIdx = DataSpaceOperations<simDim>::template map<MappingDesc::SuperCellSize > (parLocalCell); float_X parWeighting = NUM_EL_PER_PARTICLE; frame = &(pb.getEmptyFrame()); pb.setAsLastFrame(*frame, superCell); // many particle loop: for (unsigned i = 0; i < 1; ++i) { PMACC_AUTO(par,(*frame)[i]); floatD_X pos; for(int i=0; i<simDim; ++i) pos[i] = 0.5; const float_X GAMMA0_X = 1.0f / sqrtf(1.0f - float_X(BETA0_X * BETA0_X)); const float_X GAMMA0_Y = 1.0f / sqrtf(1.0f - float_X(BETA0_Y * BETA0_Y)); const float_X GAMMA0_Z = 1.0f / sqrtf(1.0f - float_X(BETA0_Z * BETA0_Z)); float3_X mom = float3_X( GAMMA0_X * getMass<FRAME>(parWeighting) * float_X(BETA0_X) * SPEED_OF_LIGHT, GAMMA0_Y * getMass<FRAME>(parWeighting) * float_X(BETA0_Y) * SPEED_OF_LIGHT, GAMMA0_Z * getMass<FRAME>(parWeighting) * float_X(BETA0_Z) * SPEED_OF_LIGHT ); par[position_] = pos; par[momentum_] = mom; par[multiMask_] = 1; par[localCellIdx_] = linearIdx; par[weighting_] = parWeighting; #if(ENABLE_RADIATION == 1) par[momentumPrev1_] = float3_X(0.f, 0.f, 0.f); #if(RAD_MARK_PARTICLE>1) || (RAD_ACTIVATE_GAMMA_FILTER!=0) /*this code tree is only passed if we not select any particle*/ par[radiationFlag_] = true; #endif #endif } }
__global__ void kernelAddOneParticle(ParBox pb, DataSpace<simDim> superCell, DataSpace<simDim> parLocalCell) { typedef typename ParBox::FrameType FRAME; FRAME *frame; int linearIdx = DataSpaceOperations<simDim>::template map<MappingDesc::SuperCellSize > (parLocalCell); float_X parWeighting = NUM_EL_PER_PARTICLE; frame = &(pb.getEmptyFrame()); pb.setAsLastFrame(*frame, superCell); // many particle loop: for (unsigned i = 0; i < 1; ++i) { PMACC_AUTO(par, (*frame)[i]); /** we now initialize all attributes of the new particle to their default values * some attributes, such as the position, localCellIdx, weighting or the * multiMask (\see AttrToIgnore) of the particle will be set individually * in the following lines since they are already known at this point. */ { typedef typename ParBox::FrameType FrameType; typedef typename FrameType::ValueTypeSeq ParticleAttrList; typedef bmpl::vector4<position<>, multiMask, localCellIdx, weighting> AttrToIgnore; typedef typename ResolveAndRemoveFromSeq<ParticleAttrList, AttrToIgnore>::type ParticleCleanedAttrList; algorithms::forEach::ForEach<ParticleCleanedAttrList, SetAttributeToDefault<bmpl::_1> > setToDefault; setToDefault(forward(par)); } float3_X pos = float3_X(0.5, 0.5, 0.5); const float_X GAMMA0 = (float_X) (1.0 / sqrt(1.0 - (BETA0_X * BETA0_X + BETA0_Y * BETA0_Y + BETA0_Z * BETA0_Z))); float3_X mom = float3_X( GAMMA0 * attribute::getMass(parWeighting,par) * float_X(BETA0_X) * SPEED_OF_LIGHT, GAMMA0 * attribute::getMass(parWeighting,par) * float_X(BETA0_Y) * SPEED_OF_LIGHT, GAMMA0 * attribute::getMass(parWeighting,par) * float_X(BETA0_Z) * SPEED_OF_LIGHT ); par[position_] = pos; par[momentum_] = mom; par[multiMask_] = 1; par[localCellIdx_] = linearIdx; par[weighting_] = parWeighting; #if(ENABLE_RADIATION == 1) #if(RAD_MARK_PARTICLE>1) || (RAD_ACTIVATE_GAMMA_FILTER!=0) par[radiationFlag_] = true; #endif #endif } }