diff --git a/src/functionObjects/field/nearWallFields/findCellParticle.C b/src/functionObjects/field/nearWallFields/findCellParticle.C index 756bd50200..b23d408020 100644 --- a/src/functionObjects/field/nearWallFields/findCellParticle.C +++ b/src/functionObjects/field/nearWallFields/findCellParticle.C @@ -34,13 +34,12 @@ Foam::findCellParticle::findCellParticle const label celli, const label tetFacei, const label tetPtI, - const point& end, + const vector& displacement, const label data ) : particle(mesh, coordinates, celli, tetFacei, tetPtI), - start_(position()), - end_(end), + displacement_(displacement), data_(data) {} @@ -50,13 +49,12 @@ Foam::findCellParticle::findCellParticle const polyMesh& mesh, const vector& position, const label celli, - const point& end, + const vector& displacement, const label data ) : particle(mesh, position, celli), - start_(this->position()), - end_(end), + displacement_(displacement), data_(data) {} @@ -74,15 +72,15 @@ Foam::findCellParticle::findCellParticle { if (is.format() == IOstream::ASCII) { - is >> start_ >> end_; + is >> displacement_; data_ = readLabel(is); } else { is.read ( - reinterpret_cast(&start_), - sizeof(start_) + sizeof(end_) + sizeof(data_) + reinterpret_cast(&displacement_), + sizeof(displacement_) + sizeof(data_) ); } } @@ -111,10 +109,10 @@ bool Foam::findCellParticle::move while (td.keepParticle && !td.switchProcessor && stepFraction() < 1) { const scalar f = 1 - stepFraction(); - trackToAndHitFace(f*(end_ - start_), f, cloud, td); + trackToAndHitFace(f*displacement_, f, cloud, td); } - if (stepFraction() == 1 || !td.keepParticle) + if (!td.switchProcessor) { // Hit endpoint or patch. If patch hit could do fancy stuff but just // to use the patch point is good enough for now. @@ -229,8 +227,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const findCellParticle& p) if (os.format() == IOstream::ASCII) { os << static_cast(p) - << token::SPACE << p.start_ - << token::SPACE << p.end_ + << token::SPACE << p.displacement_ << token::SPACE << p.data_; } else @@ -238,8 +235,8 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const findCellParticle& p) os << static_cast(p); os.write ( - reinterpret_cast(&p.start_), - sizeof(p.start_) + sizeof(p.end_) + sizeof(p.data_) + reinterpret_cast(&p.displacement_), + sizeof(p.displacement_) + sizeof(p.data_) ); } diff --git a/src/functionObjects/field/nearWallFields/findCellParticle.H b/src/functionObjects/field/nearWallFields/findCellParticle.H index f8a88ae115..4e883760a8 100644 --- a/src/functionObjects/field/nearWallFields/findCellParticle.H +++ b/src/functionObjects/field/nearWallFields/findCellParticle.H @@ -63,11 +63,8 @@ class findCellParticle { // Private data - //- Start point to track from - point start_; - - //- End point to track to - point end_; + //- Displacement over which to track + vector displacement_; //- Passive data label data_; @@ -126,7 +123,7 @@ public: const label celli, const label tetFacei, const label tetPtI, - const point& end, + const vector& displacement, const label data ); @@ -137,7 +134,7 @@ public: const polyMesh& mesh, const vector& position, const label celli, - const point& end, + const vector& displacement, const label data ); @@ -180,28 +177,16 @@ public: // Member Functions - //- Point to track from - const point& start() const + //- Displacement over which to track + const vector& displacement() const { - return start_; + return displacement_; } - //- Point to track from - point& start() + //- Displacement over which to track + vector& displacement() { - return start_; - } - - //- Point to track to - const point& end() const - { - return end_; - } - - //- Point to track to - point& end() - { - return end_; + return displacement_; } //- Transported label diff --git a/src/functionObjects/field/nearWallFields/nearWallFields.C b/src/functionObjects/field/nearWallFields/nearWallFields.C index fa4e086ee2..3c79c2b221 100644 --- a/src/functionObjects/field/nearWallFields/nearWallFields.C +++ b/src/functionObjects/field/nearWallFields/nearWallFields.C @@ -79,17 +79,14 @@ void Foam::functionObjects::nearWallFields::calcAddressing() forAll(patch, patchFacei) { - const point& start = patch.Cf()[patchFacei]; - const point end = start - distance_*nf[patchFacei]; - cloud.addParticle ( new findCellParticle ( mesh_, - start, + patch.Cf()[patchFacei], patch.faceCells()[patchFacei], - end, + - distance_*nf[patchFacei], globalWalls.toGlobal(nPatchFaces) // passive data ) ); @@ -112,8 +109,8 @@ void Foam::functionObjects::nearWallFields::calcAddressing() forAllConstIter(Cloud, cloud, iter) { - const findCellParticle& tp = iter(); - str.write(linePointRef(tp.position(), tp.end())); + const vector p = iter().position(); + str.write(linePointRef(p, p + iter().displacement())); } }