How to pass a variable to a different __device__ in CUDA Code?
Hi,
i'm sure it's a rather simple question but i need to calculate the contact forces between the geometry and all particles interacting with this geometry. I use the following code in the calculateForce device:
__device__
void calculateForce(NCudaApiTypesV1_0_0::CApiElement& element1,
NCudaApiTypesV1_0_0::CApiElement& element2,
NCudaApiTypesV1_0_0::CApiInteraction& interaction,
NCudaApiTypesV1_0_0::CApiContact& contactData,
NCudaApiTypesV1_0_0::CApiSimulation& simulationData,
NCudaApiTypesV1_0_0::CApiContactResults& contactResult)
{
real ID = element1.getID();
bool isPart = element2.isParticle();
real normForce = contactResult.getNormalForce().length();
real tangForce = contactResult.getTangentialForce().length();
real totalForce = normForce + tangForce;
customPropReal* ForceDelta = element2.getCustomPropertyDelta(0);
const customPropReal* Force = element2.getCustomPropertyValue(0);
if (ID >= REAL_CONST(13663.0) && ID <= REAL_CONST(61934.0) && isPart == true)
//if (isPart == true)
{
ForceDelta[0] += totalForce;
}
return;
}
However i now need to use the momentary (cumulated) value of the contact force to scale my particles. I think this is only possible in the externalForce device as it has the setScale-function. How can i pass the cumulated total Force to externalForce and use it to scale my particles?
Thank you