Commit 16ecad0d authored by jduriez's avatar jduriez
Browse files

Parallelization of one loop of Law2_ScGeom_CapillaryPhys_Capillarity (see...

Parallelization of one loop of Law2_ScGeom_CapillaryPhys_Capillarity (see http://www.mail-archive.com/yade-dev@lists.launchpad.net/msg11238.html) and some comments
parent cdac2f98
......@@ -75,7 +75,7 @@ void Law2_ScGeom_CapillaryPhys_Capillarity::action()
if (fusionDetection && !bodiesMenisciiList.initialized) bodiesMenisciiList.prepare(scene,hertzOn);
FOREACH(const shared_ptr<Interaction>& interaction, *scene->interactions){ // could be done in parallel ? Was tried once, but needs maybe more comparison to assert it is OK: http://www.mail-archive.com/yade-dev@lists.launchpad.net/msg10842.html
FOREACH(const shared_ptr<Interaction>& interaction, *scene->interactions){ // could be done in parallel as soon as OpenMPVector class (lib/base/openmp-accu.hpp) is extended See http://www.mail-archive.com/yade-dev@lists.launchpad.net/msg10842.html and msg11238.html
/// interaction is real
if (interaction->isReal()) {
CapillaryPhys* cundallContactPhysics=NULL;
......@@ -175,7 +175,14 @@ void Law2_ScGeom_CapillaryPhys_Capillarity::action()
}
if (fusionDetection) checkFusion();
FOREACH(const shared_ptr<Interaction>& interaction, *scene->interactions){ // same remark for parallel loops
#ifdef YADE_OPENMP
const long size=scene->interactions->size();
#pragma omp parallel for schedule(guided) num_threads(ompThreads>0 ? min(ompThreads,omp_get_max_threads()) : omp_get_max_threads())
for(long i=0; i<size; i++){
const shared_ptr<Interaction>& interaction=(*scene->interactions)[i];
#else
FOREACH(const shared_ptr<Interaction>& interaction, *scene->interactions){
#endif
if (interaction->isReal()) {
CapillaryPhys* cundallContactPhysics=NULL;
MindlinCapillaryPhys* mindlinContactPhysics=NULL;
......
......@@ -55,7 +55,7 @@ class Interaction;
class BodiesMenisciiList
{
private:
vector< list< shared_ptr<Interaction> > > interactionsOnBody;
vector< list< shared_ptr<Interaction> > > interactionsOnBody; // would require use of OpenMPVector (lib/base/openmp-accu.hpp) for parallel coding, see http://www.mail-archive.com/yade-dev@lists.launchpad.net/msg10842.html and msg11238.html
//shared_ptr<Interaction> empty;
......@@ -122,7 +122,7 @@ class Tableau
{
public:
Real R;
std::vector<TableauD> full_data;
std::vector<TableauD> full_data; // full_data contains a lot of TableauD, for different D. that are the Laplace solutions for a given r, and a given D
MeniscusParameters Interpolate2(Real D, Real P, int& index1, int& index2);
std::ifstream& operator<< (std::ifstream& file);
Tableau();
......@@ -134,7 +134,7 @@ class capillarylaw
{
public:
capillarylaw();
std::vector<Tableau> data_complete;
std::vector<Tableau> data_complete; // each Tableau of data_complete corresponds to one capillary file M(r=..), in ascending order of r
MeniscusParameters interpolate(Real R1, Real R2, Real D, Real P, int* index);
void fill (const char* filename);
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment