void ReferencePlatform::contextDestroyed(ContextImpl& context) const { PlatformData* data = reinterpret_cast<PlatformData*>(context.getPlatformData()); delete data; }
void CpuIntegrateLangevinStepKernel::execute(ContextImpl& context, const LangevinIntegrator& integrator) { double temperature = integrator.getTemperature(); double friction = integrator.getFriction(); double stepSize = integrator.getStepSize(); vector<RealVec>& posData = extractPositions(context); vector<RealVec>& velData = extractVelocities(context); vector<RealVec>& forceData = extractForces(context); if (dynamics == 0 || temperature != prevTemp || friction != prevFriction || stepSize != prevStepSize) { // Recreate the computation objects with the new parameters. if (dynamics) delete dynamics; RealOpenMM tau = (friction == 0.0 ? 0.0 : 1.0/friction); dynamics = new CpuLangevinDynamics(context.getSystem().getNumParticles(), stepSize, tau, temperature, data.threads, data.random); dynamics->setReferenceConstraintAlgorithm(&extractConstraints(context)); prevTemp = temperature; prevFriction = friction; prevStepSize = stepSize; } dynamics->update(context.getSystem(), posData, velData, forceData, masses, integrator.getConstraintTolerance()); ReferencePlatform::PlatformData* refData = reinterpret_cast<ReferencePlatform::PlatformData*>(context.getPlatformData()); refData->time += stepSize; refData->stepCount++; }
void OclMD::CpuPlatform::deleteData(ContextImpl& context) const { CpuPlatform::PlatformData* data = reinterpret_cast<PlatformData*>(context.getPlatformData()); delete data; }