ENH: uniformSet: constructing cloud on all processors

This commit is contained in:
mattijs
2014-09-16 09:56:14 +01:00
committed by Andrew Heather
parent 56ea04255b
commit a50cca5fb4
2 changed files with 19 additions and 19 deletions

View File

@ -77,6 +77,7 @@ bool Foam::uniformSet::nextSample
bool Foam::uniformSet::trackToBoundary bool Foam::uniformSet::trackToBoundary
( (
passiveParticleCloud& particleCloud,
passiveParticle& singleParticle, passiveParticle& singleParticle,
point& samplePt, point& samplePt,
label& sampleI, label& sampleI,
@ -94,7 +95,6 @@ bool Foam::uniformSet::trackToBoundary
// Alias // Alias
const point& trackPt = singleParticle.position(); const point& trackPt = singleParticle.position();
passiveParticleCloud particleCloud(mesh());
particle::TrackingData<passiveParticleCloud> trackData(particleCloud); particle::TrackingData<passiveParticleCloud> trackData(particleCloud);
while(true) while(true)
@ -105,7 +105,7 @@ bool Foam::uniformSet::trackToBoundary
// no more samples. // no more samples.
if (debug) if (debug)
{ {
Info<< "trackToBoundary : Reached end : samplePt now:" Pout<< "trackToBoundary : Reached end : samplePt now:"
<< samplePt << " sampleI now:" << sampleI << endl; << samplePt << " sampleI now:" << sampleI << endl;
} }
return false; return false;
@ -116,7 +116,7 @@ bool Foam::uniformSet::trackToBoundary
// trackPt corresponds with samplePt. Store and use next samplePt // trackPt corresponds with samplePt. Store and use next samplePt
if (debug) if (debug)
{ {
Info<< "trackToBoundary : samplePt corresponds to trackPt : " Pout<< "trackToBoundary : samplePt corresponds to trackPt : "
<< " trackPt:" << trackPt << " samplePt:" << samplePt << " trackPt:" << trackPt << " samplePt:" << samplePt
<< endl; << endl;
} }
@ -132,7 +132,7 @@ bool Foam::uniformSet::trackToBoundary
// no more samples. // no more samples.
if (debug) if (debug)
{ {
Info<< "trackToBoundary : Reached end : " Pout<< "trackToBoundary : Reached end : "
<< " samplePt now:" << samplePt << " samplePt now:" << samplePt
<< " sampleI now:" << sampleI << " sampleI now:" << sampleI
<< endl; << endl;
@ -145,7 +145,7 @@ bool Foam::uniformSet::trackToBoundary
if (debug) if (debug)
{ {
Info<< "Searching along trajectory from " Pout<< "Searching along trajectory from "
<< " trackPt:" << trackPt << " trackPt:" << trackPt
<< " trackCellI:" << singleParticle.cell() << " trackCellI:" << singleParticle.cell()
<< " to:" << samplePt << endl; << " to:" << samplePt << endl;
@ -160,7 +160,7 @@ bool Foam::uniformSet::trackToBoundary
if (debug) if (debug)
{ {
Info<< "Result of tracking " Pout<< "Result of tracking "
<< " trackPt:" << trackPt << " trackPt:" << trackPt
<< " trackCellI:" << singleParticle.cell() << " trackCellI:" << singleParticle.cell()
<< " trackFaceI:" << singleParticle.face() << " trackFaceI:" << singleParticle.face()
@ -178,10 +178,10 @@ bool Foam::uniformSet::trackToBoundary
if (singleParticle.onBoundary()) if (singleParticle.onBoundary())
{ {
//Info<< "trackToBoundary : reached boundary" << endl; //Pout<< "trackToBoundary : reached boundary" << endl;
if (mag(trackPt - samplePt) < smallDist) if (mag(trackPt - samplePt) < smallDist)
{ {
//Info<< "trackToBoundary : boundary is also sampling point" //Pout<< "trackToBoundary : boundary is also sampling point"
// << endl; // << endl;
// Reached samplePt on boundary // Reached samplePt on boundary
samplingPts.append(trackPt); samplingPts.append(trackPt);
@ -193,7 +193,7 @@ bool Foam::uniformSet::trackToBoundary
return true; return true;
} }
//Info<< "trackToBoundary : reached internal sampling point" << endl; //Pout<< "trackToBoundary : reached internal sampling point" << endl;
// Reached samplePt in cell or on internal face // Reached samplePt in cell or on internal face
samplingPts.append(trackPt); samplingPts.append(trackPt);
samplingCells.append(singleParticle.cell()); samplingCells.append(singleParticle.cell());
@ -226,16 +226,13 @@ void Foam::uniformSet::calcSamples
<< exit(FatalError); << exit(FatalError);
} }
// Dummy cloud to force cyclicAMI and min-tet decomposition construction
// even on those processors where there are no points
passiveParticleCloud dummyCloud(mesh());
const vector offset = (end_ - start_)/(nPoints_ - 1); const vector offset = (end_ - start_)/(nPoints_ - 1);
const vector normOffset = offset/mag(offset); const vector normOffset = offset/mag(offset);
const vector smallVec = tol*offset; const vector smallVec = tol*offset;
const scalar smallDist = mag(smallVec); const scalar smallDist = mag(smallVec);
// Force calculation of cloud addressing on all processors
passiveParticleCloud particleCloud(mesh());
// Get all boundary intersections // Get all boundary intersections
List<pointIndexHit> bHits = searchEngine().intersections List<pointIndexHit> bHits = searchEngine().intersections
@ -312,6 +309,7 @@ void Foam::uniformSet::calcSamples
bool reachedBoundary = trackToBoundary bool reachedBoundary = trackToBoundary
( (
particleCloud,
singleParticle, singleParticle,
samplePt, samplePt,
sampleI, sampleI,
@ -332,7 +330,7 @@ void Foam::uniformSet::calcSamples
{ {
if (debug) if (debug)
{ {
Info<< "calcSamples : Reached end of samples: " Pout<< "calcSamples : Reached end of samples: "
<< " samplePt now:" << samplePt << " samplePt now:" << samplePt
<< " sampleI now:" << sampleI << " sampleI now:" << sampleI
<< endl; << endl;
@ -351,7 +349,7 @@ void Foam::uniformSet::calcSamples
if (debug) if (debug)
{ {
Info<< "Finding next boundary : " Pout<< "Finding next boundary : "
<< "bPoint:" << bHits[bHitI].hitPoint() << "bPoint:" << bHits[bHitI].hitPoint()
<< " tracking:" << singleParticle.position() << " tracking:" << singleParticle.position()
<< " dist:" << dist << " dist:" << dist
@ -422,6 +420,7 @@ void Foam::uniformSet::genSamples()
); );
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::uniformSet::uniformSet Foam::uniformSet::uniformSet
@ -444,7 +443,7 @@ Foam::uniformSet::uniformSet
if (debug) if (debug)
{ {
write(Info); write(Pout);
} }
} }
@ -466,7 +465,7 @@ Foam::uniformSet::uniformSet
if (debug) if (debug)
{ {
write(Info); write(Pout);
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -82,6 +82,7 @@ class uniformSet
// reached // reached
bool trackToBoundary bool trackToBoundary
( (
passiveParticleCloud& particleCloud,
passiveParticle& singleParticle, passiveParticle& singleParticle,
point& samplePt, point& samplePt,
label& sampleI, label& sampleI,