From b7ebc021c868bc9a47793c8d07115f3b2c94b54f Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Tue, 16 Sep 2014 13:07:38 +0100 Subject: [PATCH] BUG: sampledSet: track on static mesh --- src/sampling/sampledSet/face/faceOnlySet.C | 12 ++++++++---- src/sampling/sampledSet/face/faceOnlySet.H | 3 ++- src/sampling/sampledSet/polyLine/polyLineSet.C | 12 ++++++++---- src/sampling/sampledSet/polyLine/polyLineSet.H | 3 ++- src/sampling/sampledSet/uniform/uniformSet.C | 3 +++ 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/sampling/sampledSet/face/faceOnlySet.C b/src/sampling/sampledSet/face/faceOnlySet.C index 1583261d1c6..85fb7bc74b5 100644 --- a/src/sampling/sampledSet/face/faceOnlySet.C +++ b/src/sampling/sampledSet/face/faceOnlySet.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,6 +43,7 @@ namespace Foam bool Foam::faceOnlySet::trackToBoundary ( + passiveParticleCloud& particleCloud, passiveParticle& singleParticle, DynamicList<point>& samplingPts, DynamicList<label>& samplingCells, @@ -55,7 +56,6 @@ bool Foam::faceOnlySet::trackToBoundary const vector smallVec = tol*offset; const scalar smallDist = mag(smallVec); - passiveParticleCloud particleCloud(mesh()); particle::TrackingData<passiveParticleCloud> trackData(particleCloud); // Alias @@ -115,8 +115,9 @@ void Foam::faceOnlySet::calcSamples const vector smallVec = tol*offset; const scalar smallDist = mag(smallVec); - // Force calculation of minimum-tet decomposition. - (void) mesh().tetBasePtIs(); + // Force calculation of cloud addressing on all processors + const bool oldMoving = const_cast<polyMesh&>(mesh()).moving(false); + passiveParticleCloud particleCloud(mesh()); // Get all boundary intersections List<pointIndexHit> bHits = searchEngine().intersections @@ -218,6 +219,7 @@ void Foam::faceOnlySet::calcSamples bool reachedBoundary = trackToBoundary ( + particleCloud, singleParticle, samplingPts, samplingCells, @@ -286,6 +288,8 @@ void Foam::faceOnlySet::calcSamples startSegmentI = samplingPts.size(); } + + const_cast<polyMesh&>(mesh()).moving(oldMoving); } diff --git a/src/sampling/sampledSet/face/faceOnlySet.H b/src/sampling/sampledSet/face/faceOnlySet.H index f50900e6b70..fdb47d4d435 100644 --- a/src/sampling/sampledSet/face/faceOnlySet.H +++ b/src/sampling/sampledSet/face/faceOnlySet.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -68,6 +68,7 @@ class faceOnlySet // reached bool trackToBoundary ( + passiveParticleCloud& particleCloud, passiveParticle& singleParticle, DynamicList<point>& samplingPts, DynamicList<label>& samplingCells, diff --git a/src/sampling/sampledSet/polyLine/polyLineSet.C b/src/sampling/sampledSet/polyLine/polyLineSet.C index 5ba23c5293d..023acc1dce9 100644 --- a/src/sampling/sampledSet/polyLine/polyLineSet.C +++ b/src/sampling/sampledSet/polyLine/polyLineSet.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,6 +43,7 @@ namespace Foam bool Foam::polyLineSet::trackToBoundary ( + passiveParticleCloud& particleCloud, passiveParticle& singleParticle, label& sampleI, DynamicList<point>& samplingPts, @@ -51,7 +52,6 @@ bool Foam::polyLineSet::trackToBoundary DynamicList<scalar>& samplingCurveDist ) const { - passiveParticleCloud particleCloud(mesh()); particle::TrackingData<passiveParticleCloud> trackData(particleCloud); // Alias @@ -157,8 +157,9 @@ void Foam::polyLineSet::calcSamples oldPoint = sampleCoords_[sampleI]; } - // Force calculation of minimum-tet decomposition. - (void) mesh().tetBasePtIs(); + // Force calculation of cloud addressing on all processors + const bool oldMoving = const_cast<polyMesh&>(mesh()).moving(false); + passiveParticleCloud particleCloud(mesh()); // current segment number label segmentI = 0; @@ -267,6 +268,7 @@ void Foam::polyLineSet::calcSamples bool bReached = trackToBoundary ( + particleCloud, singleParticle, sampleI, samplingPts, @@ -306,6 +308,8 @@ void Foam::polyLineSet::calcSamples startSegmentI = samplingPts.size(); } + + const_cast<polyMesh&>(mesh()).moving(oldMoving); } diff --git a/src/sampling/sampledSet/polyLine/polyLineSet.H b/src/sampling/sampledSet/polyLine/polyLineSet.H index b95e2e0c47d..0c1339ee727 100644 --- a/src/sampling/sampledSet/polyLine/polyLineSet.H +++ b/src/sampling/sampledSet/polyLine/polyLineSet.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -65,6 +65,7 @@ class polyLineSet // Returns false if end of samples reached. bool trackToBoundary ( + passiveParticleCloud& particleCloud, passiveParticle& singleParticle, label& sampleI, DynamicList<point>& samplingPts, diff --git a/src/sampling/sampledSet/uniform/uniformSet.C b/src/sampling/sampledSet/uniform/uniformSet.C index a36319d8175..9689218ae58 100644 --- a/src/sampling/sampledSet/uniform/uniformSet.C +++ b/src/sampling/sampledSet/uniform/uniformSet.C @@ -232,6 +232,7 @@ void Foam::uniformSet::calcSamples const scalar smallDist = mag(smallVec); // Force calculation of cloud addressing on all processors + const bool oldMoving = const_cast<polyMesh&>(mesh()).moving(false); passiveParticleCloud particleCloud(mesh()); // Get all boundary intersections @@ -383,6 +384,8 @@ void Foam::uniformSet::calcSamples startSegmentI = samplingPts.size(); } + + const_cast<polyMesh&>(mesh()).moving(oldMoving); } -- GitLab