diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/pointEdgeStructuredWalk.H b/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/pointEdgeStructuredWalk.H index 55d003a16a..e6852dffa2 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/pointEdgeStructuredWalk.H +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/pointEdgeStructuredWalk.H @@ -37,11 +37,7 @@ SourceFiles #define pointEdgeStructuredWalk_H #include "point.H" -#include "label.H" -#include "scalar.H" #include "tensor.H" -#include "pTraits.H" - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -75,10 +71,12 @@ class pointEdgeStructuredWalk // Private Member Functions //- Evaluate distance to point. + template inline bool update ( const pointEdgeStructuredWalk& w2, - const scalar tol + const scalar tol, + TrackingData& td ); public: @@ -111,80 +109,105 @@ public: // Needed by meshWave - //- Check whether still contains original (invalid) value. - inline bool valid() const; + //- Check whether origin has been changed at all or + // still contains original (invalid) value. + template + inline bool valid(TrackingData& td) const; //- Check for identical geometrical data. Used for cyclics checking. + template inline bool sameGeometry ( const pointEdgeStructuredWalk&, - const scalar tol + const scalar tol, + TrackingData& td ) const; //- Convert origin to relative vector to leaving point // (= point coordinate) + template inline void leaveDomain ( const polyPatch& patch, const label patchPointI, - const point& pos + const point& pos, + TrackingData& td ); //- Convert relative origin to absolute by adding entering point + template inline void enterDomain ( const polyPatch& patch, const label patchPointI, - const point& pos + const point& pos, + TrackingData& td ); //- Apply rotation matrix to origin - inline void transform(const tensor& rotTensor); + template + inline void transform + ( + const tensor& rotTensor, + TrackingData& td + ); //- Influence of edge on point + template inline bool updatePoint ( const polyMesh& mesh, const label pointI, const label edgeI, const pointEdgeStructuredWalk& edgeInfo, - const scalar tol + const scalar tol, + TrackingData& td ); //- Influence of different value on same point. // Merge new and old info. + template inline bool updatePoint ( const polyMesh& mesh, const label pointI, const pointEdgeStructuredWalk& newPointInfo, - const scalar tol + const scalar tol, + TrackingData& td ); //- Influence of different value on same point. // No information about current position whatsoever. + template inline bool updatePoint ( const pointEdgeStructuredWalk& newPointInfo, - const scalar tol + const scalar tol, + TrackingData& td ); //- Influence of point on edge. + template inline bool updateEdge ( const polyMesh& mesh, const label edgeI, const label pointI, const pointEdgeStructuredWalk& pointInfo, - const scalar tol + const scalar tol, + TrackingData& td ); + //- Same (like operator==) + template + inline bool equal(const pointEdgeStructuredWalk&, TrackingData&) + const; + // Member Operators //Note: Used to determine whether to call update. inline bool operator==(const pointEdgeStructuredWalk&) const; - inline bool operator!=(const pointEdgeStructuredWalk&) const; diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/pointEdgeStructuredWalkI.H b/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/pointEdgeStructuredWalkI.H index d60e9b52f7..47adcdb775 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/pointEdgeStructuredWalkI.H +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/layeredSolver/pointEdgeStructuredWalkI.H @@ -29,13 +29,15 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // Update this with w2. +template inline bool Foam::pointEdgeStructuredWalk::update ( const pointEdgeStructuredWalk& w2, - const scalar tol + const scalar tol, + TrackingData& td ) { - if (!valid()) + if (!valid(td)) { // current not yet set. Walked from w2 to here (=point0) dist_ = w2.dist_ + mag(point0_-w2.previousPoint_); @@ -105,17 +107,20 @@ inline const Foam::vector& Foam::pointEdgeStructuredWalk::data() const } -inline bool Foam::pointEdgeStructuredWalk::valid() const +template +inline bool Foam::pointEdgeStructuredWalk::valid(TrackingData& td) const { return previousPoint_ != vector::max; } // Checks for cyclic points +template inline bool Foam::pointEdgeStructuredWalk::sameGeometry ( const pointEdgeStructuredWalk& w2, - const scalar tol + const scalar tol, + TrackingData& td ) const { scalar diff = Foam::mag(dist() - w2.dist()); @@ -138,18 +143,25 @@ inline bool Foam::pointEdgeStructuredWalk::sameGeometry } +template inline void Foam::pointEdgeStructuredWalk::leaveDomain ( const polyPatch& patch, const label patchPointI, - const point& coord + const point& coord, + TrackingData& td ) { previousPoint_ -= coord; } -inline void Foam::pointEdgeStructuredWalk::transform(const tensor& rotTensor) +template +inline void Foam::pointEdgeStructuredWalk::transform +( + const tensor& rotTensor, + TrackingData& td +) { previousPoint_ = Foam::transform(rotTensor, previousPoint_); } @@ -157,11 +169,13 @@ inline void Foam::pointEdgeStructuredWalk::transform(const tensor& rotTensor) // Update absolute geometric quantities. Note that distance (dist_) // is not affected by leaving/entering domain. +template inline void Foam::pointEdgeStructuredWalk::enterDomain ( const polyPatch& patch, const label patchPointI, - const point& coord + const point& coord, + TrackingData& td ) { // back to absolute form @@ -170,18 +184,20 @@ inline void Foam::pointEdgeStructuredWalk::enterDomain // Update this with information from connected edge +template inline bool Foam::pointEdgeStructuredWalk::updatePoint ( const polyMesh& mesh, const label pointI, const label edgeI, const pointEdgeStructuredWalk& edgeInfo, - const scalar tol + const scalar tol, + TrackingData& td ) { if (inZone()) { - return update(edgeInfo, tol); + return update(edgeInfo, tol, td); } else { @@ -191,17 +207,19 @@ inline bool Foam::pointEdgeStructuredWalk::updatePoint // Update this with new information on same point +template inline bool Foam::pointEdgeStructuredWalk::updatePoint ( const polyMesh& mesh, const label pointI, const pointEdgeStructuredWalk& newPointInfo, - const scalar tol + const scalar tol, + TrackingData& td ) { if (inZone()) { - return update(newPointInfo, tol); + return update(newPointInfo, tol, td); } else { @@ -211,29 +229,33 @@ inline bool Foam::pointEdgeStructuredWalk::updatePoint // Update this with new information on same point. No extra information. +template inline bool Foam::pointEdgeStructuredWalk::updatePoint ( const pointEdgeStructuredWalk& newPointInfo, - const scalar tol + const scalar tol, + TrackingData& td ) { - return update(newPointInfo, tol); + return update(newPointInfo, tol, td); } // Update this with information from connected point +template inline bool Foam::pointEdgeStructuredWalk::updateEdge ( const polyMesh& mesh, const label edgeI, const label pointI, const pointEdgeStructuredWalk& pointInfo, - const scalar tol + const scalar tol, + TrackingData& td ) { if (inZone()) { - return update(pointInfo, tol); + return update(pointInfo, tol, td); } else { @@ -242,6 +264,17 @@ inline bool Foam::pointEdgeStructuredWalk::updateEdge } +template +inline bool Foam::pointEdgeStructuredWalk::equal +( + const pointEdgeStructuredWalk& rhs, + TrackingData& td +) const +{ + return operator==(rhs); +} + + // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // inline bool Foam::pointEdgeStructuredWalk::operator== diff --git a/src/fvMotionSolver/motionDiffusivity/inversePointDistance/inversePointDistanceDiffusivity.C b/src/fvMotionSolver/motionDiffusivity/inversePointDistance/inversePointDistanceDiffusivity.C index 7ed2a34bba..486052b9db 100644 --- a/src/fvMotionSolver/motionDiffusivity/inversePointDistance/inversePointDistanceDiffusivity.C +++ b/src/fvMotionSolver/motionDiffusivity/inversePointDistance/inversePointDistanceDiffusivity.C @@ -91,6 +91,9 @@ void Foam::inversePointDistanceDiffusivity::correct() List pointWallDist(mesh.nPoints()); List edgeWallDist(mesh.nEdges()); + int dummyTrackData = 0; + + { // Seeds List seedInfo(nPatchEdges); @@ -108,7 +111,7 @@ void Foam::inversePointDistanceDiffusivity::correct() { label pointI = meshPoints[i]; - if (!pointWallDist[pointI].valid()) + if (!pointWallDist[pointI].valid(dummyTrackData)) { // Not yet seeded seedInfo[nPatchEdges] = pointEdgePoint @@ -135,7 +138,8 @@ void Foam::inversePointDistanceDiffusivity::correct() pointWallDist, edgeWallDist, - mesh.globalData().nTotalPoints() // max iterations + mesh.globalData().nTotalPoints(),// max iterations + dummyTrackData ); } diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C index 292ec5d142..d7abe804f7 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C @@ -756,6 +756,9 @@ void Foam::autoLayerDriver::medialAxisSmoothingInfo // Distance to wall List pointWallDist(mesh.nPoints()); + // Dummy additional info for PointEdgeWave + int dummyTrackData = 0; + // 1. Calculate distance to points where displacement is specified. { @@ -783,7 +786,8 @@ void Foam::autoLayerDriver::medialAxisSmoothingInfo wallInfo, pointWallDist, edgeWallDist, - mesh.globalData().nTotalPoints() // max iterations + mesh.globalData().nTotalPoints(), // max iterations + dummyTrackData ); } @@ -813,7 +817,7 @@ void Foam::autoLayerDriver::medialAxisSmoothingInfo { label pointI = e[ep]; - if (!pointMedialDist[pointI].valid()) + if (!pointMedialDist[pointI].valid(dummyTrackData)) { maxPoints.append(pointI); maxInfo.append @@ -857,7 +861,7 @@ void Foam::autoLayerDriver::medialAxisSmoothingInfo { label pointI = meshPoints[i]; - if (!pointMedialDist[pointI].valid()) + if (!pointMedialDist[pointI].valid(dummyTrackData)) { maxPoints.append(pointI); maxInfo.append @@ -888,7 +892,8 @@ void Foam::autoLayerDriver::medialAxisSmoothingInfo pointMedialDist, edgeMedialDist, - mesh.globalData().nTotalPoints() // max iterations + mesh.globalData().nTotalPoints(), // max iterations + dummyTrackData ); // Extract medial axis distance as pointScalarField diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.C index 6d97d1cd00..1d7f5090ae 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.C @@ -32,19 +32,20 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const pointData& wDist) if (os.format() == IOstream::ASCII) { return os - << wDist.origin() << token::SPACE << wDist.distSqr() + << static_cast(wDist) << token::SPACE << wDist.s() << token::SPACE << wDist.v(); } else { return os - << wDist.origin() << wDist.distSqr() << wDist.s() << wDist.v(); + << static_cast(wDist) + << wDist.s() << wDist.v(); } } Foam::Istream& Foam::operator>>(Istream& is, pointData& wDist) { - return is >> wDist.origin_ >> wDist.distSqr_ >> wDist.s_ >> wDist.v_; + return is >> static_cast(wDist) >> wDist.s_ >> wDist.v_; } // ************************************************************************* // diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.H index 050b9d92c7..7719079821 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.H +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.H @@ -25,10 +25,10 @@ Class Foam::pointData Description - Holds information regarding nearest wall point. Used in pointEdgeWave. - (so not standard meshWave) - - To be used in wall distance calculation. + Variant of pointEdgePoint with some transported additional data. + WIP - should be templated on data like wallDistData. + Passive vector v_ is not a coordinate (so no enterDomain/leaveDomain + transformation needed) SourceFiles pointDataI.H @@ -39,9 +39,10 @@ SourceFiles #ifndef pointData_H #define pointData_H -#include "point.H" -#include "label.H" -#include "tensor.H" +#include "pointEdgePoint.H" +//#include "point.H" +//#include "label.H" +//#include "tensor.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -49,51 +50,22 @@ SourceFiles namespace Foam { -// Class forward declarations -class polyPatch; -class polyMesh; - /*---------------------------------------------------------------------------*\ Class pointData Declaration \*---------------------------------------------------------------------------*/ class pointData +: + public pointEdgePoint { // Private data - //- position of nearest wall center - point origin_; - - //- normal distance (squared) from point to origin - scalar distSqr_; - //- additional information. scalar s_; //- additional information. vector v_; - - // Private Member Functions - - //- Evaluate distance to point. Update distSqr, origin from whomever - // is nearer pt. Return true if w2 is closer to point, - // false otherwise. - inline bool update - ( - const point&, - const pointData& w2, - const scalar tol - ); - - //- Combine current with w2. Update distSqr, origin if w2 has smaller - // quantities and returns true. - inline bool update - ( - const pointData& w2, - const scalar tol - ); - public: // Constructors @@ -118,10 +90,6 @@ public: // Access - inline const point& origin() const; - - inline scalar distSqr() const; - inline scalar s() const; inline const vector& v() const; @@ -129,81 +97,60 @@ public: // Needed by meshWave - //- Check whether origin has been changed at all or - // still contains original (invalid) value. - inline bool valid() const; - - //- Check for identical geometrical data. Used for cyclics checking. - inline bool sameGeometry(const pointData&, const scalar tol) - const; - - //- Convert origin to relative vector to leaving point - // (= point coordinate) - inline void leaveDomain - ( - const polyPatch& patch, - const label patchPointI, - const point& pos - ); - - //- Convert relative origin to absolute by adding entering point - inline void enterDomain - ( - const polyPatch& patch, - const label patchPointI, - const point& pos - ); - //- Apply rotation matrix to origin - inline void transform(const tensor& rotTensor); + template + inline void transform + ( + const tensor& rotTensor, + TrackingData& td + ); //- Influence of edge on point + template inline bool updatePoint ( const polyMesh& mesh, const label pointI, const label edgeI, const pointData& edgeInfo, - const scalar tol + const scalar tol, + TrackingData& td ); //- Influence of different value on same point. // Merge new and old info. + template inline bool updatePoint ( const polyMesh& mesh, const label pointI, const pointData& newPointInfo, - const scalar tol + const scalar tol, + TrackingData& td ); //- Influence of different value on same point. // No information about current position whatsoever. + template inline bool updatePoint ( const pointData& newPointInfo, - const scalar tol + const scalar tol, + TrackingData& td ); //- Influence of point on edge. + template inline bool updateEdge ( const polyMesh& mesh, const label edgeI, const label pointI, const pointData& pointInfo, - const scalar tol + const scalar tol, + TrackingData& td ); - - // Member Operators - - //Note: Used to determine whether to call update. - inline bool operator==(const pointData&) const; - - inline bool operator!=(const pointData&) const; - - // IOstream Operators friend Ostream& operator<<(Ostream&, const pointData&); diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointDataI.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointDataI.H index a04038c247..c2228eca82 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointDataI.H +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointDataI.H @@ -26,118 +26,12 @@ License #include "polyMesh.H" #include "transform.H" -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -// Update this with w2 if w2 nearer to pt. -inline bool Foam::pointData::update -( - const point& pt, - const pointData& w2, - const scalar tol -) -{ - scalar dist2 = magSqr(pt - w2.origin()); - - if (!valid()) - { - distSqr_ = dist2; - origin_ = w2.origin(); - s_ = w2.s(); - v_ = w2.v(); - - return true; - } - - -// if (v_ != w2.v()) -// { -// return false; -// } - - - scalar diff = distSqr_ - dist2; - - if (diff < 0) - { - // already nearer to pt - return false; - } - - if ((diff < SMALL) || ((distSqr_ > SMALL) && (diff/distSqr_ < tol))) - { - // don't propagate small changes - return false; - } - else - { - // update with new values - distSqr_ = dist2; - origin_ = w2.origin(); - s_ = w2.s(); - v_ = w2.v(); - - return true; - } -} - - -// Update this with w2 (information on same point) -inline bool Foam::pointData::update -( - const pointData& w2, - const scalar tol -) -{ - if (!valid()) - { - // current not yet set so use any value - distSqr_ = w2.distSqr(); - origin_ = w2.origin(); - s_ = w2.s(); - v_ = w2.v(); - return true; - } - - -// if (v_ != w2.v()) -// { -// return false; -// } - - - scalar diff = distSqr_ - w2.distSqr(); - - if (diff < 0) - { - // already nearer to pt - return false; - } - - if ((diff < SMALL) || ((distSqr_ > SMALL) && (diff/distSqr_ < tol))) - { - // don't propagate small changes - return false; - } - else - { - // update with new values - distSqr_ = w2.distSqr(); - origin_ = w2.origin(); - s_ = w2.s(); - v_ = w2.v(); - - return true; - } -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Null constructor inline Foam::pointData::pointData() : - origin_(point::max), - distSqr_(GREAT), + pointEdgePoint(), s_(GREAT), v_(point::max) {} @@ -152,8 +46,7 @@ inline Foam::pointData::pointData const vector& v ) : - origin_(origin), - distSqr_(distSqr), + pointEdgePoint(origin, distSqr), s_(s), v_(v) {} @@ -162,8 +55,7 @@ inline Foam::pointData::pointData // Construct as copy inline Foam::pointData::pointData(const pointData& wpt) : - origin_(wpt.origin()), - distSqr_(wpt.distSqr()), + pointEdgePoint(wpt), s_(wpt.s()), v_(wpt.v()) {} @@ -171,18 +63,6 @@ inline Foam::pointData::pointData(const pointData& wpt) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline const Foam::point& Foam::pointData::origin() const -{ - return origin_; -} - - -inline Foam::scalar Foam::pointData::distSqr() const -{ - return distSqr_; -} - - inline Foam::scalar Foam::pointData::s() const { return s_; @@ -195,157 +75,143 @@ inline const Foam::vector& Foam::pointData::v() const } -inline bool Foam::pointData::valid() const -{ - return origin_ != point::max; -} - - -// Checks for cyclic points -inline bool Foam::pointData::sameGeometry +template +inline void Foam::pointData::transform ( - const pointData& w2, - const scalar tol -) const -{ - scalar diff = Foam::mag(distSqr() - w2.distSqr()); - - if (diff < SMALL) - { - return true; - } - else - { - if ((distSqr() > SMALL) && ((diff/distSqr()) < tol)) - { - return true; - } - else - { - return false; - } - } -} - - -inline void Foam::pointData::leaveDomain -( - const polyPatch& patch, - const label patchPointI, - const point& coord + const tensor& rotTensor, + TrackingData& td ) { - origin_ -= coord; -} - - -inline void Foam::pointData::transform(const tensor& rotTensor) -{ - origin_ = Foam::transform(rotTensor, origin_); -} - - -// Update absolute geometric quantities. Note that distance (distSqr_) -// is not affected by leaving/entering domain. -inline void Foam::pointData::enterDomain -( - const polyPatch& patch, - const label patchPointI, - const point& coord -) -{ - // back to absolute form - origin_ += coord; + pointEdgePoint::transform(rotTensor, td); + v_ = Foam::transform(rotTensor, v_); } // Update this with information from connected edge +template inline bool Foam::pointData::updatePoint ( const polyMesh& mesh, const label pointI, const label edgeI, const pointData& edgeInfo, - const scalar tol + const scalar tol, + TrackingData& td ) { - return - update + if + ( + pointEdgePoint::updatePoint ( - mesh.points()[pointI], + mesh, + pointI, + edgeI, edgeInfo, - tol - ); + tol, + td + ) + ) + { + s_ = edgeInfo.s_; + v_ = edgeInfo.v_; + return true; } - + else + { + return false; + } +} // Update this with new information on same point +template inline bool Foam::pointData::updatePoint ( const polyMesh& mesh, const label pointI, const pointData& newPointInfo, - const scalar tol + const scalar tol, + TrackingData& td ) { - return - update + if + ( + pointEdgePoint::updatePoint ( - mesh.points()[pointI], + mesh, + pointI, newPointInfo, - tol - ); + tol, + td + ) + ) + { + s_ = newPointInfo.s_; + v_ = newPointInfo.v_; + return true; + } + else + { + return false; + } } // Update this with new information on same point. No extra information. +template inline bool Foam::pointData::updatePoint ( const pointData& newPointInfo, - const scalar tol + const scalar tol, + TrackingData& td ) { - return update(newPointInfo, tol); + if (pointEdgePoint::updatePoint(newPointInfo, tol, td)) + { + s_ = newPointInfo.s_; + v_ = newPointInfo.v_; + return true; + } + else + { + return false; + } } // Update this with information from connected point +template inline bool Foam::pointData::updateEdge ( const polyMesh& mesh, const label edgeI, const label pointI, const pointData& pointInfo, - const scalar tol + const scalar tol, + TrackingData& td + ) { - const pointField& points = mesh.points(); - - const edge& e = mesh.edges()[edgeI]; - - const point edgeMid(0.5*(points[e[0]] + points[e[1]])); - - return - update + if + ( + pointEdgePoint::updateEdge ( - edgeMid, + mesh, + edgeI, + pointI, pointInfo, - tol - ); -} - - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - -inline bool Foam::pointData::operator==(const pointData& rhs) const -{ - return origin() == rhs.origin(); -} - - -inline bool Foam::pointData::operator!=(const pointData& rhs) const -{ - return !(*this == rhs); + tol, + td + ) + ) + { + s_ = pointInfo.s_; + v_ = pointInfo.v_; + return true; + } + else + { + return false; + } } diff --git a/src/meshTools/PointEdgeWave/PointEdgeWave.C b/src/meshTools/PointEdgeWave/PointEdgeWave.C index 304675d71f..a11d6601be 100644 --- a/src/meshTools/PointEdgeWave/PointEdgeWave.C +++ b/src/meshTools/PointEdgeWave/PointEdgeWave.C @@ -32,36 +32,25 @@ License #include "PstreamCombineReduceOps.H" #include "debug.H" #include "typeInfo.H" +#include "globalMeshData.H" +#include "pointFields.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -template -Foam::scalar Foam::PointEdgeWave::propagationTol_ = 0.01; +template +Foam::scalar Foam::PointEdgeWave::propagationTol_ = 0.01; - -// Offset labelList. Used for transferring from one cyclic half to the other. -template -void Foam::PointEdgeWave::offset(const label val, labelList& elems) -{ - forAll(elems, i) - { - elems[i] += val; - } -} +template +Foam::label Foam::PointEdgeWave::dummyTrackData_ = 12345; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -// Gets point-point correspondence. Is -// - list of halfA points (in cyclic patch points) -// - list of halfB points (can overlap with A!) -// - for every patchPoint its corresponding point // Handle leaving domain. Implementation referred to Type -template -void Foam::PointEdgeWave::leaveDomain +template +void Foam::PointEdgeWave::leaveDomain ( - const polyPatch& meshPatch, - const primitivePatch& patch, + const polyPatch& patch, const labelList& patchPointLabels, List& pointInfo ) const @@ -74,17 +63,16 @@ void Foam::PointEdgeWave::leaveDomain const point& pt = patch.points()[meshPoints[patchPointI]]; - pointInfo[i].leaveDomain(meshPatch, patchPointI, pt); + pointInfo[i].leaveDomain(patch, patchPointI, pt, td_); } } // Handle entering domain. Implementation referred to Type -template -void Foam::PointEdgeWave::enterDomain +template +void Foam::PointEdgeWave::enterDomain ( - const polyPatch& meshPatch, - const primitivePatch& patch, + const polyPatch& patch, const labelList& patchPointLabels, List& pointInfo ) const @@ -97,15 +85,16 @@ void Foam::PointEdgeWave::enterDomain const point& pt = patch.points()[meshPoints[patchPointI]]; - pointInfo[i].enterDomain(meshPatch, patchPointI, pt); + pointInfo[i].enterDomain(patch, patchPointI, pt, td_); } } // Transform. Implementation referred to Type -template -void Foam::PointEdgeWave::transform +template +void Foam::PointEdgeWave::transform ( + const polyPatch& patch, const tensorField& rotTensor, List& pointInfo ) const @@ -116,19 +105,22 @@ void Foam::PointEdgeWave::transform forAll(pointInfo, i) { - pointInfo[i].transform(T); + pointInfo[i].transform(T, td_); } } else { FatalErrorIn ( - "PointEdgeWave::transform(const tensorField&, List&)" - ) << "Parallel cyclics not supported" << abort(FatalError); + "PointEdgeWave::transform" + "(const tensorField&, List&)" + ) << "Non-uniform transformation on patch " << patch.name() + << " not supported for point fields" + << abort(FatalError); forAll(pointInfo, i) { - pointInfo[i].transform(rotTensor[i]); + pointInfo[i].transform(rotTensor[i], td_); } } } @@ -139,19 +131,18 @@ void Foam::PointEdgeWave::transform // Updates: // - changedPoint_, changedPoints_, nChangedPoints_, // - statistics: nEvals_, nUnvisitedPoints_ -template -bool Foam::PointEdgeWave::updatePoint +template +bool Foam::PointEdgeWave::updatePoint ( const label pointI, const label neighbourEdgeI, const Type& neighbourInfo, - const scalar tol, Type& pointInfo ) { nEvals_++; - bool wasValid = pointInfo.valid(); + bool wasValid = pointInfo.valid(td_); bool propagate = pointInfo.updatePoint @@ -160,7 +151,8 @@ bool Foam::PointEdgeWave::updatePoint pointI, neighbourEdgeI, neighbourInfo, - tol + propagationTol_, + td_ ); if (propagate) @@ -172,7 +164,7 @@ bool Foam::PointEdgeWave::updatePoint } } - if (!wasValid && pointInfo.valid()) + if (!wasValid && pointInfo.valid(td_)) { --nUnvisitedPoints_; } @@ -186,18 +178,17 @@ bool Foam::PointEdgeWave::updatePoint // Updates: // - changedPoint_, changedPoints_, nChangedPoints_, // - statistics: nEvals_, nUnvisitedPoints_ -template -bool Foam::PointEdgeWave::updatePoint +template +bool Foam::PointEdgeWave::updatePoint ( const label pointI, const Type& neighbourInfo, - const scalar tol, Type& pointInfo ) { nEvals_++; - bool wasValid = pointInfo.valid(); + bool wasValid = pointInfo.valid(td_); bool propagate = pointInfo.updatePoint @@ -205,7 +196,8 @@ bool Foam::PointEdgeWave::updatePoint mesh_, pointI, neighbourInfo, - tol + propagationTol_, + td_ ); if (propagate) @@ -217,7 +209,7 @@ bool Foam::PointEdgeWave::updatePoint } } - if (!wasValid && pointInfo.valid()) + if (!wasValid && pointInfo.valid(td_)) { --nUnvisitedPoints_; } @@ -231,19 +223,18 @@ bool Foam::PointEdgeWave::updatePoint // Updates: // - changedEdge_, changedEdges_, nChangedEdges_, // - statistics: nEvals_, nUnvisitedEdge_ -template -bool Foam::PointEdgeWave::updateEdge +template +bool Foam::PointEdgeWave::updateEdge ( const label edgeI, const label neighbourPointI, const Type& neighbourInfo, - const scalar tol, Type& edgeInfo ) { nEvals_++; - bool wasValid = edgeInfo.valid(); + bool wasValid = edgeInfo.valid(td_); bool propagate = edgeInfo.updateEdge @@ -252,7 +243,8 @@ bool Foam::PointEdgeWave::updateEdge edgeI, neighbourPointI, neighbourInfo, - tol + propagationTol_, + td_ ); if (propagate) @@ -264,7 +256,7 @@ bool Foam::PointEdgeWave::updateEdge } } - if (!wasValid && edgeInfo.valid()) + if (!wasValid && edgeInfo.valid(td_)) { --nUnvisitedEdges_; } @@ -274,9 +266,9 @@ bool Foam::PointEdgeWave::updateEdge // Check if patches of given type name are present -template +template template -Foam::label Foam::PointEdgeWave::countPatchType() const +Foam::label Foam::PointEdgeWave::countPatchType() const { label nPatches = 0; @@ -291,199 +283,110 @@ Foam::label Foam::PointEdgeWave::countPatchType() const } -// Collect changed patch points -template -void Foam::PointEdgeWave::getChangedPatchPoints -( - const primitivePatch& patch, - - DynamicList& patchInfo, - DynamicList