Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 019236ff authored by BRAMAS Berenger's avatar BRAMAS Berenger
Browse files

add a method to reset the potential and forces of the FP2PParticleContainer

parent 0734af0a
No related branches found
No related tags found
No related merge requests found
...@@ -306,6 +306,11 @@ public: ...@@ -306,6 +306,11 @@ public:
memset(attributes[idx], 0, sizeof(AttributeClass) * allocatedParticles); memset(attributes[idx], 0, sizeof(AttributeClass) * allocatedParticles);
} }
} }
/** Reset the attributes to zeros */
void resetToInitialState(const int idxAttribute){
memset(attributes[idxAttribute], 0, sizeof(AttributeClass) * allocatedParticles);
}
}; };
......
...@@ -62,6 +62,12 @@ public: ...@@ -62,6 +62,12 @@ public:
const FReal* getForcesZ(const int idxLhs = 0) const { const FReal* getForcesZ(const int idxLhs = 0) const {
return Parent::getAttribute(NRHS+3*NLHS+idxLhs); return Parent::getAttribute(NRHS+3*NLHS+idxLhs);
} }
void resetForcesAndPotential(){
for(int idx = 0 ; idx < 4*NLHS ; ++idx){
Parent::resetToInitialState(idx + NRHS);
}
}
}; };
#endif // FP2PPARTICLECONTAINER_HPP #endif // FP2PPARTICLECONTAINER_HPP
...@@ -92,7 +92,7 @@ class TestRotationDirectSeveralTime : public FUTester<TestRotationDirectSeveralT ...@@ -92,7 +92,7 @@ class TestRotationDirectSeveralTime : public FUTester<TestRotationDirectSeveralT
}); });
// If we want to reset the leaf // If we want to reset the leaf
//tree.forEachLeaf([&](LeafClass* leaf){ //tree.forEachLeaf([&](LeafClass* leaf){
// leaf->resetToInitialState(); // leaf->resetForcesAndPotential();
//} //}
} }
///////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment