STYLE: adjust code format for trackingData

- rationalized some layout and comments
This commit is contained in:
Mark Olesen
2020-01-20 12:14:18 +01:00
parent 0a9295b219
commit f4ee841c6d
84 changed files with 1140 additions and 1224 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd. Copyright (C) 2016-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -59,15 +59,18 @@ class smoothDelta
{ {
public: public:
//- Public member class used by mesh-wave to propagate the delta-ratio //- Public class used by mesh-wave to propagate the delta-ratio
class deltaData class deltaData
{ {
// Private Data
scalar delta_; scalar delta_;
// Private Member Functions // Private Member Functions
//- Update. Gets information from neighbouring face/cell and //- Update gets information from neighbouring face/cell and
// uses this to update itself (if necessary) and return true. //- uses this to update itself (if necessary) and return true.
template<class TrackingData> template<class TrackingData>
inline bool update inline bool update
( (
@ -82,7 +85,7 @@ public:
// Constructors // Constructors
//- Construct null //- Default construct
inline deltaData(); inline deltaData();
//- Construct from delta value //- Construct from delta value
@ -101,13 +104,11 @@ public:
// Needed by FaceCellWave // Needed by FaceCellWave
//- Check whether origin has been changed at all or //- Changed or contains original (invalid) value
// still contains original (invalid) value.
template<class TrackingData> template<class TrackingData>
inline bool valid(TrackingData& td) const; inline bool valid(TrackingData& td) const;
//- Check for identical geometrical data. //- Check for identical geometrical data (eg, cyclics checking)
// Used for cyclics checking.
template<class TrackingData> template<class TrackingData>
inline bool sameGeometry inline bool sameGeometry
( (
@ -118,7 +119,7 @@ public:
) const; ) const;
//- Convert any absolute coordinates into relative to //- Convert any absolute coordinates into relative to
// (patch)face centre //- (patch)face centre
template<class TrackingData> template<class TrackingData>
inline void leaveDomain inline void leaveDomain
( (
@ -184,40 +185,40 @@ public:
TrackingData& td TrackingData& td
); );
//- Same (like operator==) //- Test for equality, with TrackingData
template<class TrackingData> template<class TrackingData>
inline bool equal(const deltaData&, TrackingData& td) const; inline bool equal(const deltaData&, TrackingData& td) const;
// Member Operators // Member Operators
// Needed for List IO //- Test for equality
inline bool operator==(const deltaData&) const; inline bool operator==(const deltaData&) const;
//- Test for inequality
inline bool operator!=(const deltaData&) const; inline bool operator!=(const deltaData&) const;
// IOstream Operators // IOstream Operators
friend Ostream& operator<< friend Ostream& operator<<(Ostream& os, const deltaData& rhs)
(
Ostream& os,
const deltaData& wDist
)
{ {
return os << wDist.delta_; return os << rhs.delta_;
} }
friend Istream& operator>>(Istream& is, deltaData& wDist) friend Istream& operator>>(Istream& is, deltaData& rhs)
{ {
return is >> wDist.delta_; return is >> rhs.delta_;
} }
}; };
private: private:
// Private data // Private Data
autoPtr<LESdelta> geometricDelta_; autoPtr<LESdelta> geometricDelta_;
scalar maxDeltaRatio_; scalar maxDeltaRatio_;
@ -253,10 +254,9 @@ private:
DynamicList<deltaData>& changedFacesInfo DynamicList<deltaData>& changedFacesInfo
); );
public: public:
//- Runtime type information //- Declare type-name, virtual type (with debug switch)
TypeName("smooth"); TypeName("smooth");
@ -278,7 +278,7 @@ public:
// Member Functions // Member Functions
//- Read the LESdelta dictionary //- Read the LESdelta dictionary
virtual void read(const dictionary&); virtual void read(const dictionary& dict);
// Correct values // Correct values
virtual void correct(); virtual void correct();

View File

@ -198,7 +198,7 @@ inline bool Foam::LESModels::smoothDelta::deltaData::operator==
const deltaData& rhs const deltaData& rhs
) const ) const
{ {
return delta_ == rhs.delta(); return delta_ == rhs.delta_;
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -199,23 +200,23 @@ Foam::label Foam::directionInfo::edgeToFaceIndex
} }
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<< Foam::Ostream& Foam::operator<<
( (
Foam::Ostream& os, Ostream& os,
const Foam::directionInfo& wDist const directionInfo& rhs
) )
{ {
if (os.format() == IOstream::ASCII) if (os.format() == IOstream::ASCII)
{ {
os << wDist.index_ << wDist.n_; os << rhs.index_ << rhs.n_;
} }
else else
{ {
os.write os.write
( (
reinterpret_cast<const char*>(&wDist.index_), reinterpret_cast<const char*>(&rhs.index_),
sizeof(directionInfo) sizeof(directionInfo)
); );
} }
@ -225,19 +226,23 @@ Foam::Ostream& Foam::operator<<
} }
Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::directionInfo& wDist) Foam::Istream& Foam::operator>>
(
Istream& is,
directionInfo& rhs
)
{ {
if (is.format() == IOstream::ASCII) if (is.format() == IOstream::ASCII)
{ {
is >> wDist.index_ >> wDist.n_; is >> rhs.index_ >> rhs.n_;
} }
else if (!is.checkLabelSize<>() || !is.checkScalarSize<>()) else if (!is.checkLabelSize<>() || !is.checkScalarSize<>())
{ {
// Non-native label or scalar size // Non-native label or scalar size
is.beginRawRead(); is.beginRawRead();
readRawLabel(is, &wDist.index_); readRawLabel(is, &rhs.index_);
readRawScalar(is, wDist.n_.data(), vector::nComponents); readRawScalar(is, rhs.n_.data(), vector::nComponents);
is.endRawRead(); is.endRawRead();
} }
@ -245,7 +250,7 @@ Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::directionInfo& wDist)
{ {
is.read is.read
( (
reinterpret_cast<char*>(&wDist.index_), reinterpret_cast<char*>(&rhs.index_),
sizeof(directionInfo) sizeof(directionInfo)
); );
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -72,13 +72,11 @@ class polyMesh;
class primitiveMesh; class primitiveMesh;
class edge; class edge;
class face; class face;
class polyMesh;
class directionInfo; class directionInfo;
Istream& operator>>(Istream&, directionInfo&); Istream& operator>>(Istream&, directionInfo&);
Ostream& operator<<(Ostream&, const directionInfo&); Ostream& operator<<(Ostream&, const directionInfo&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class directionInfo Declaration Class directionInfo Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -87,10 +85,10 @@ class directionInfo
{ {
// Private Data // Private Data
// Either mesh edge or face point //- The mesh edge or face point
label index_; label index_;
// Local n axis //- The local n axis
vector n_; vector n_;
@ -128,44 +126,42 @@ public:
const label edgeI const label edgeI
); );
// Constructors // Constructors
//- Construct null //- Default construct, index=-1, vector::zero
inline directionInfo(); inline directionInfo();
//- Construct from components //- Construct from components
inline directionInfo inline directionInfo
( (
const label, const label index,
const vector& n const vector& n
); );
//- Construct as copy
inline directionInfo(const directionInfo&);
// Member Functions // Member Functions
// Access // Access
inline label index() const label index() const
{ {
return index_; return index_;
} }
inline const vector& n() const const vector& n() const
{ {
return n_; return n_;
} }
// Needed by FaceCellWave // Needed by FaceCellWave
//- Check whether origin has been changed at all or //- Changed or contains original (invalid) value
// still contains original (invalid) value.
template<class TrackingData> template<class TrackingData>
inline bool valid(TrackingData& td) const; inline bool valid(TrackingData& td) const;
//- Check for identical geometrical data. Used for cyclics checking. //- Check for identical geometrical data (eg, cyclics checking)
template<class TrackingData> template<class TrackingData>
inline bool sameGeometry inline bool sameGeometry
( (
@ -242,15 +238,17 @@ public:
TrackingData& td TrackingData& td
); );
//- Same (like operator==) //- Test for equality, with TrackingData
template<class TrackingData> template<class TrackingData>
inline bool equal(const directionInfo&, TrackingData& td) const; inline bool equal(const directionInfo&, TrackingData& td) const;
// Member Operators // Member Operators
// Needed for List IO //- Test for equality
inline bool operator==(const directionInfo&) const; inline bool operator==(const directionInfo&) const;
//- Test for inequality
inline bool operator!=(const directionInfo&) const; inline bool operator!=(const directionInfo&) const;

View File

@ -31,7 +31,6 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor
inline Foam::directionInfo::directionInfo() inline Foam::directionInfo::directionInfo()
: :
index_(-3), index_(-3),
@ -39,7 +38,6 @@ inline Foam::directionInfo::directionInfo()
{} {}
// Construct from components
inline Foam::directionInfo::directionInfo inline Foam::directionInfo::directionInfo
( (
const label index, const label index,
@ -51,14 +49,6 @@ inline Foam::directionInfo::directionInfo
{} {}
// Construct as copy
inline Foam::directionInfo::directionInfo(const directionInfo& w2)
:
index_(w2.index()),
n_(w2.n())
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class TrackingData> template<class TrackingData>
@ -76,8 +66,7 @@ inline bool Foam::directionInfo::sameGeometry
const directionInfo& w2, const directionInfo& w2,
const scalar tol, const scalar tol,
TrackingData& td TrackingData& td
) ) const
const
{ {
return true; return true;
} }
@ -253,7 +242,6 @@ inline bool Foam::directionInfo::updateFace
index_ = -2; index_ = -2;
} }
n_ = neighbourInfo.n(); n_ = neighbourInfo.n();
return true; return true;
@ -300,15 +288,19 @@ inline bool Foam::directionInfo::equal
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline bool Foam::directionInfo::operator==(const Foam::directionInfo& rhs) inline bool Foam::directionInfo::operator==
const (
const directionInfo& rhs
) const
{ {
return index() == rhs.index() && n() == rhs.n(); return index_ == rhs.index_ && n_ == rhs.n_;
} }
inline bool Foam::directionInfo::operator!=(const Foam::directionInfo& rhs) inline bool Foam::directionInfo::operator!=
const (
const directionInfo& rhs
) const
{ {
return !(*this == rhs); return !(*this == rhs);
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,23 +28,23 @@ License
#include "wallNormalInfo.H" #include "wallNormalInfo.H"
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<< Foam::Ostream& Foam::operator<<
( (
Foam::Ostream& os, Ostream& os,
const Foam::wallNormalInfo& wDist const wallNormalInfo& rhs
) )
{ {
if (os.format() == IOstream::ASCII) if (os.format() == IOstream::ASCII)
{ {
os << wDist.normal(); os << rhs.normal();
} }
else else
{ {
os.write os.write
( (
reinterpret_cast<const char*>(&wDist.normal_), reinterpret_cast<const char*>(&rhs.normal_),
sizeof(vector) sizeof(vector)
); );
} }
@ -53,18 +54,22 @@ Foam::Ostream& Foam::operator<<
} }
Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::wallNormalInfo& wDist) Foam::Istream& Foam::operator>>
(
Istream& is,
wallNormalInfo& rhs
)
{ {
if (is.format() == IOstream::ASCII) if (is.format() == IOstream::ASCII)
{ {
is >> wDist.normal_; is >> rhs.normal_;
} }
else if (!is.checkLabelSize<>() || !is.checkScalarSize<>()) else if (!is.checkLabelSize<>() || !is.checkScalarSize<>())
{ {
// Non-native label or scalar size // Non-native label or scalar size
is.beginRawRead(); is.beginRawRead();
readRawScalar(is, wDist.normal_.data(), vector::nComponents); readRawScalar(is, rhs.normal_.data(), vector::nComponents);
is.endRawRead(); is.endRawRead();
} }
@ -72,7 +77,7 @@ Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::wallNormalInfo& wDist)
{ {
is.read is.read
( (
reinterpret_cast<char*>(&wDist.normal_), reinterpret_cast<char*>(&rhs.normal_),
sizeof(vector) sizeof(vector)
); );
} }

View File

@ -58,52 +58,58 @@ class wallNormalInfo;
Istream& operator>>(Istream&, wallNormalInfo&); Istream& operator>>(Istream&, wallNormalInfo&);
Ostream& operator<<(Ostream&, const wallNormalInfo&); Ostream& operator<<(Ostream&, const wallNormalInfo&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class wallNormalInfo Declaration Class wallNormalInfo Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class wallNormalInfo class wallNormalInfo
{ {
// Private data // Private Data
//- Normal at nearest wall point //- Normal at nearest wall point
vector normal_; vector normal_;
// Private Member Functions // Private Member Functions
//- Evaluate distance to point. Update normal_ //- Evaluate distance to point and update normal_
template<class TrackingData> template<class TrackingData>
inline bool update(const wallNormalInfo& w2, TrackingData& td); inline bool update(const wallNormalInfo& w2, TrackingData& td);
public: public:
// Constructors // Constructors
//- Construct null //- Default construct
inline wallNormalInfo(); inline wallNormalInfo();
//- Construct from normal //- Construct from normal
inline wallNormalInfo(const vector& normal); inline wallNormalInfo(const vector& normal);
//- Construct as copy
inline wallNormalInfo(const wallNormalInfo&);
// Member Functions // Member Functions
// Access // Access
inline const vector& normal() const; const vector& normal() const
{
return normal_;
}
vector& normal()
{
return normal_;
}
// Needed by FaceCellWave // Needed by FaceCellWave
//- Check whether origin has been changed at all or //- Changed or contains original (invalid) value
// still contains original (invalid) value.
template<class TrackingData> template<class TrackingData>
inline bool valid(TrackingData& td) const; inline bool valid(TrackingData& td) const;
//- Check for identical geometrical data. Used for cyclics checking. //- Check for identical geometrical data (eg, cyclics checking)
template<class TrackingData> template<class TrackingData>
inline bool sameGeometry inline bool sameGeometry
( (
@ -180,15 +186,17 @@ public:
TrackingData& td TrackingData& td
); );
//- Same (like operator==) //- Test for equality, with TrackingData
template<class TrackingData> template<class TrackingData>
inline bool equal(const wallNormalInfo&, TrackingData& td) const; inline bool equal(const wallNormalInfo&, TrackingData& td) const;
// Member Operators // Member Operators
// Needed for List IO //- Test for equality
inline bool operator==(const wallNormalInfo&) const; inline bool operator==(const wallNormalInfo&) const;
//- Test for inequality
inline bool operator!=(const wallNormalInfo&) const; inline bool operator!=(const wallNormalInfo&) const;

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -60,35 +61,20 @@ inline bool Foam::wallNormalInfo::update
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor
inline Foam::wallNormalInfo::wallNormalInfo() inline Foam::wallNormalInfo::wallNormalInfo()
: :
normal_(point::max) normal_(point::max)
{} {}
// Construct from normal
inline Foam::wallNormalInfo::wallNormalInfo(const vector& normal) inline Foam::wallNormalInfo::wallNormalInfo(const vector& normal)
: :
normal_(normal) normal_(normal)
{} {}
// Construct as copy
inline Foam::wallNormalInfo::wallNormalInfo(const wallNormalInfo& wpt)
:
normal_(wpt.normal())
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::vector& Foam::wallNormalInfo::normal() const
{
return normal_;
}
template<class TrackingData> template<class TrackingData>
inline bool Foam::wallNormalInfo::valid(TrackingData& td) const inline bool Foam::wallNormalInfo::valid(TrackingData& td) const
{ {
@ -207,15 +193,19 @@ inline bool Foam::wallNormalInfo::equal
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline bool Foam::wallNormalInfo::operator==(const Foam::wallNormalInfo& rhs) inline bool Foam::wallNormalInfo::operator==
const (
const wallNormalInfo& rhs
) const
{ {
return normal() == rhs.normal(); return normal_ == rhs.normal_;
} }
inline bool Foam::wallNormalInfo::operator!=(const Foam::wallNormalInfo& rhs) inline bool Foam::wallNormalInfo::operator!=
const (
const wallNormalInfo& rhs
) const
{ {
return !(*this == rhs); return !(*this == rhs);
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -55,7 +55,6 @@ class pointEdgeStructuredWalk;
Istream& operator>>(Istream&, pointEdgeStructuredWalk&); Istream& operator>>(Istream&, pointEdgeStructuredWalk&);
Ostream& operator<<(Ostream&, const pointEdgeStructuredWalk&); Ostream& operator<<(Ostream&, const pointEdgeStructuredWalk&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class pointEdgeStructuredWalk Declaration Class pointEdgeStructuredWalk Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -95,7 +94,7 @@ public:
// Constructors // Constructors
//- Construct null //- Default construct
inline pointEdgeStructuredWalk(); inline pointEdgeStructuredWalk();
//- Construct from components //- Construct from components
@ -113,27 +112,35 @@ public:
// Access // Access
//- The distance information
scalar dist() const
{
return dist_;
}
//- Tracking data
const vector& data() const
{
return data_;
}
//- Index (if any) associated with data
label index() const
{
return index_;
}
//- True if starting point is valid (ie, not point::max) //- True if starting point is valid (ie, not point::max)
inline bool inZone() const; inline bool inZone() const;
//- The distance information
inline scalar dist() const;
//- Tracking data // Needed by MeshWave
inline const vector& data() const;
//- Index (if any) associated with data //- Changed or contains original (invalid) value
inline label index() const;
// Needed by meshWave
//- Check whether origin has been changed at all or
// still contains original (invalid) value.
template<class TrackingData> template<class TrackingData>
inline bool valid(TrackingData& td) const; inline bool valid(TrackingData& td) const;
//- Check for identical geometrical data. Used for cyclics checking. //- Check for identical geometrical data (eg, cyclics checking)
template<class TrackingData> template<class TrackingData>
inline bool sameGeometry inline bool sameGeometry
( (
@ -217,16 +224,21 @@ public:
TrackingData& td TrackingData& td
); );
//- Same (like operator==) //- Test for equality, with TrackingData
template<class TrackingData> template<class TrackingData>
inline bool equal(const pointEdgeStructuredWalk&, TrackingData&) inline bool equal
const; (
const pointEdgeStructuredWalk&,
TrackingData&
) const;
// Member Operators // Member Operators
//Note: Used to determine whether to call update. //- Test for equality
inline bool operator==(const pointEdgeStructuredWalk&) const; inline bool operator==(const pointEdgeStructuredWalk&) const;
//- Test for inequality
inline bool operator!=(const pointEdgeStructuredWalk&) const; inline bool operator!=(const pointEdgeStructuredWalk&) const;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -91,24 +91,6 @@ inline bool Foam::pointEdgeStructuredWalk::inZone() const
} }
inline Foam::scalar Foam::pointEdgeStructuredWalk::dist() const
{
return dist_;
}
inline const Foam::vector& Foam::pointEdgeStructuredWalk::data() const
{
return data_;
}
inline Foam::label Foam::pointEdgeStructuredWalk::index() const
{
return index_;
}
template<class TrackingData> template<class TrackingData>
inline bool Foam::pointEdgeStructuredWalk::valid(TrackingData& td) const inline bool Foam::pointEdgeStructuredWalk::valid(TrackingData& td) const
{ {
@ -125,7 +107,7 @@ inline bool Foam::pointEdgeStructuredWalk::sameGeometry
TrackingData& td TrackingData& td
) const ) const
{ {
scalar diff = Foam::mag(dist() - w2.dist()); const scalar diff = Foam::mag(dist() - w2.dist());
if (diff < SMALL) if (diff < SMALL)
{ {
@ -275,7 +257,7 @@ inline bool Foam::pointEdgeStructuredWalk::equal
inline bool Foam::pointEdgeStructuredWalk::operator== inline bool Foam::pointEdgeStructuredWalk::operator==
( (
const Foam::pointEdgeStructuredWalk& rhs const pointEdgeStructuredWalk& rhs
) const ) const
{ {
return previousPoint_ == rhs.previousPoint_; return previousPoint_ == rhs.previousPoint_;
@ -284,7 +266,7 @@ inline bool Foam::pointEdgeStructuredWalk::operator==
inline bool Foam::pointEdgeStructuredWalk::operator!= inline bool Foam::pointEdgeStructuredWalk::operator!=
( (
const Foam::pointEdgeStructuredWalk& rhs const pointEdgeStructuredWalk& rhs
) const ) const
{ {
return !(*this == rhs); return !(*this == rhs);

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,25 +28,25 @@ License
#include "externalPointEdgePoint.H" #include "externalPointEdgePoint.H"
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<< Foam::Ostream& Foam::operator<<
( (
Foam::Ostream& os, Ostream& os,
const Foam::externalPointEdgePoint& wDist const externalPointEdgePoint& rhs
) )
{ {
return os << wDist.origin() << wDist.distSqr(); return os << rhs.origin() << rhs.distSqr();
} }
Foam::Istream& Foam::operator>> Foam::Istream& Foam::operator>>
( (
Foam::Istream& is, Istream& is,
Foam::externalPointEdgePoint& wDist externalPointEdgePoint& rhs
) )
{ {
return is >> wDist.origin_ >> wDist.distSqr_; return is >> rhs.origin_ >> rhs.distSqr_;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -56,14 +56,13 @@ class externalPointEdgePoint;
Istream& operator>>(Istream&, externalPointEdgePoint&); Istream& operator>>(Istream&, externalPointEdgePoint&);
Ostream& operator<<(Ostream&, const externalPointEdgePoint&); Ostream& operator<<(Ostream&, const externalPointEdgePoint&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class externalPointEdgePoint Declaration Class externalPointEdgePoint Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class externalPointEdgePoint class externalPointEdgePoint
{ {
// Private data // Private Data
//- Position of nearest wall center //- Position of nearest wall center
point origin_; point origin_;
@ -74,9 +73,9 @@ class externalPointEdgePoint
// Private Member Functions // Private Member Functions
//- Evaluate distance to point. Update distSqr, origin from whomever //- Evaluate distance to point.
// is nearer pt. Return true if w2 is closer to point, // Update distSqr, origin from whomever is nearer pt.
// false otherwise. // \return true if w2 is closer to point, false otherwise.
template<class TrackingData> template<class TrackingData>
inline bool update inline bool update
( (
@ -86,8 +85,8 @@ class externalPointEdgePoint
TrackingData& td TrackingData& td
); );
//- Combine current with w2. Update distSqr, origin if w2 has smaller //- Combine current with w2.
// quantities and returns true. // Update distSqr, origin if w2 has smaller quantities and return true
template<class TrackingData> template<class TrackingData>
inline bool update inline bool update
( (
@ -103,6 +102,7 @@ public:
class trackingData class trackingData
{ {
public: public:
const pointField& points_; const pointField& points_;
trackingData(const pointField& points) trackingData(const pointField& points)
@ -112,36 +112,37 @@ public:
}; };
// Constructors // Constructors
//- Construct null //- Default construct
inline externalPointEdgePoint(); inline externalPointEdgePoint();
//- Construct from origin, distance //- Construct from origin, distance
inline externalPointEdgePoint(const point&, const scalar); inline externalPointEdgePoint(const point&, const scalar);
//- Construct as copy
inline externalPointEdgePoint(const externalPointEdgePoint&);
// Member Functions // Member Functions
// Access // Access
inline const point& origin() const; const point& origin() const
{
return origin_;
}
inline scalar distSqr() const; scalar distSqr() const
{
return distSqr_;
}
// Needed by PointEdgeWave // Needed by PointEdgeWave
//- Check whether origin has been changed at all or //- Changed or contains original (invalid) value
// still contains original (invalid) value.
template<class TrackingData> template<class TrackingData>
inline bool valid(TrackingData& td) const; inline bool valid(TrackingData& td) const;
//- Check for identical geometrical data. Used for cyclics checking. //- Check for identical geometrical data (eg, cyclics checking)
template<class TrackingData> template<class TrackingData>
inline bool sameGeometry inline bool sameGeometry
( (
@ -151,7 +152,7 @@ public:
) const; ) const;
//- Convert origin to relative vector to leaving point //- Convert origin to relative vector to leaving point
// (= point coordinate) //- (= point coordinate)
template<class TrackingData> template<class TrackingData>
inline void leaveDomain inline void leaveDomain
( (
@ -225,7 +226,7 @@ public:
TrackingData& td TrackingData& td
); );
//- Equivalent to operator== with TrackingData //- Test for equality, with TrackingData
template<class TrackingData> template<class TrackingData>
inline bool equal inline bool equal
( (
@ -236,8 +237,10 @@ public:
// Member Operators // Member Operators
// Needed for List IO //- Test for equality
inline bool operator==(const externalPointEdgePoint&) const; inline bool operator==(const externalPointEdgePoint&) const;
//- Test for inequality
inline bool operator!=(const externalPointEdgePoint&) const; inline bool operator!=(const externalPointEdgePoint&) const;

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -39,7 +40,7 @@ inline bool Foam::externalPointEdgePoint::update
TrackingData& td TrackingData& td
) )
{ {
scalar dist2 = magSqr(pt - w2.origin()); const scalar dist2 = magSqr(pt - w2.origin());
if (!valid(td)) if (!valid(td))
{ {
@ -50,7 +51,7 @@ inline bool Foam::externalPointEdgePoint::update
return true; return true;
} }
scalar diff = distSqr_ - dist2; const scalar diff = distSqr_ - dist2;
if (diff < 0) if (diff < 0)
{ {
@ -91,7 +92,7 @@ inline bool Foam::externalPointEdgePoint::update
return true; return true;
} }
scalar diff = distSqr_ - w2.distSqr(); const scalar diff = distSqr_ - w2.distSqr();
if (diff < 0) if (diff < 0)
{ {
@ -135,30 +136,8 @@ inline Foam::externalPointEdgePoint::externalPointEdgePoint
{} {}
inline Foam::externalPointEdgePoint::externalPointEdgePoint
(
const externalPointEdgePoint& wpt
)
:
origin_(wpt.origin()),
distSqr_(wpt.distSqr())
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::point& Foam::externalPointEdgePoint::origin() const
{
return origin_;
}
inline Foam::scalar Foam::externalPointEdgePoint::distSqr() const
{
return distSqr_;
}
template<class TrackingData> template<class TrackingData>
inline bool Foam::externalPointEdgePoint::valid(TrackingData& td) const inline bool Foam::externalPointEdgePoint::valid(TrackingData& td) const
{ {
@ -175,7 +154,7 @@ inline bool Foam::externalPointEdgePoint::sameGeometry
TrackingData& td TrackingData& td
) const ) const
{ {
scalar diff = Foam::mag(distSqr() - w2.distSqr()); const scalar diff = Foam::mag(distSqr() - w2.distSqr());
if (diff < SMALL) if (diff < SMALL)
{ {
@ -305,19 +284,17 @@ inline bool Foam::externalPointEdgePoint::equal
inline bool Foam::externalPointEdgePoint::operator== inline bool Foam::externalPointEdgePoint::operator==
( (
const Foam::externalPointEdgePoint& rhs const externalPointEdgePoint& rhs
) ) const
const
{ {
return (origin() == rhs.origin()) && (distSqr() == rhs.distSqr()); return origin_ == rhs.origin_ && distSqr_ == rhs.distSqr_;
} }
inline bool Foam::externalPointEdgePoint::operator!= inline bool Foam::externalPointEdgePoint::operator!=
( (
const Foam::externalPointEdgePoint& rhs const externalPointEdgePoint& rhs
) ) const
const
{ {
return !(*this == rhs); return !(*this == rhs);
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012 OpenFOAM Foundation Copyright (C) 2012 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,30 +28,31 @@ License
#include "pointEdgeCollapse.H" #include "pointEdgeCollapse.H"
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<< Foam::Ostream& Foam::operator<<
( (
Foam::Ostream& os, Ostream& os,
const Foam::pointEdgeCollapse& wDist const pointEdgeCollapse& rhs
) )
{ {
return os return os
<< wDist.collapsePoint_ << rhs.collapsePoint_
<< wDist.collapseIndex_ << rhs.collapseIndex_
<< wDist.collapsePriority_; << rhs.collapsePriority_;
} }
Foam::Istream& Foam::operator>> Foam::Istream& Foam::operator>>
( (
Foam::Istream& is, Istream& is,
Foam::pointEdgeCollapse& wDist pointEdgeCollapse& rhs
) )
{ {
return is return is
>> wDist.collapsePoint_ >> rhs.collapsePoint_
>> wDist.collapseIndex_ >> rhs.collapseIndex_
>> wDist.collapsePriority_; >> rhs.collapsePriority_;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -55,14 +55,13 @@ class pointEdgeCollapse;
Istream& operator>>(Istream&, pointEdgeCollapse&); Istream& operator>>(Istream&, pointEdgeCollapse&);
Ostream& operator<<(Ostream&, const pointEdgeCollapse&); Ostream& operator<<(Ostream&, const pointEdgeCollapse&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class pointEdgeCollapse Declaration Class pointEdgeCollapse Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class pointEdgeCollapse class pointEdgeCollapse
{ {
// Private data // Private Data
//- Collapse location //- Collapse location
point collapsePoint_; point collapsePoint_;
@ -85,7 +84,6 @@ class pointEdgeCollapse
TrackingData& td TrackingData& td
); );
//- Check for same coordinate //- Check for same coordinate
inline bool samePoint(const point& pt) const; inline bool samePoint(const point& pt) const;
@ -93,7 +91,7 @@ public:
// Constructors // Constructors
//- Construct null //- Default construct
inline pointEdgeCollapse(); inline pointEdgeCollapse();
//- Construct from components //- Construct from components
@ -109,17 +107,25 @@ public:
// Access // Access
inline const point& collapsePoint() const; const point& collapsePoint() const
{
return collapsePoint_;
}
inline label collapseIndex() const; label collapseIndex() const
{
return collapseIndex_;
}
inline label collapsePriority() const; label collapsePriority() const
{
return collapsePriority_;
}
// Needed by meshWave // Needed by MeshWave
//- Check whether origin has been changed at all or //- Changed or contains original (invalid) value
// still contains original (invalid) value.
template<class TrackingData> template<class TrackingData>
inline bool valid(TrackingData& td) const; inline bool valid(TrackingData& td) const;
@ -198,16 +204,17 @@ public:
TrackingData& td TrackingData& td
); );
//- Same (like operator==) //- Test for equality, with TrackingData
template<class TrackingData> template<class TrackingData>
inline bool equal(const pointEdgeCollapse&, TrackingData&) inline bool equal(const pointEdgeCollapse&, TrackingData&) const;
const;
// Member Operators // Member Operators
//Note: Used to determine whether to call update. //- Test for equality
inline bool operator==(const pointEdgeCollapse&) const; inline bool operator==(const pointEdgeCollapse&) const;
//- Test for inequality
inline bool operator!=(const pointEdgeCollapse&) const; inline bool operator!=(const pointEdgeCollapse&) const;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -31,7 +31,6 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Update this with w2.
template<class TrackingData> template<class TrackingData>
inline bool Foam::pointEdgeCollapse::update inline bool Foam::pointEdgeCollapse::update
( (
@ -99,51 +98,6 @@ inline bool Foam::pointEdgeCollapse::update
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor
inline Foam::pointEdgeCollapse::pointEdgeCollapse()
:
collapsePoint_(GREAT, GREAT, GREAT),
collapseIndex_(-2),
collapsePriority_(-2)
{}
// Construct from origin, distance
inline Foam::pointEdgeCollapse::pointEdgeCollapse
(
const point& collapsePoint,
const label collapseIndex,
const label collapsePriority
)
:
collapsePoint_(collapsePoint),
collapseIndex_(collapseIndex),
collapsePriority_(collapsePriority)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::point& Foam::pointEdgeCollapse::collapsePoint() const
{
return collapsePoint_;
}
inline Foam::label Foam::pointEdgeCollapse::collapseIndex() const
{
return collapseIndex_;
}
inline Foam::label Foam::pointEdgeCollapse::collapsePriority() const
{
return collapsePriority_;
}
inline bool Foam::pointEdgeCollapse::samePoint(const point& pt) const inline bool Foam::pointEdgeCollapse::samePoint(const point& pt) const
{ {
bool isLegal1 = (cmptMin(collapsePoint_) < 0.5*GREAT); bool isLegal1 = (cmptMin(collapsePoint_) < 0.5*GREAT);
@ -160,6 +114,31 @@ inline bool Foam::pointEdgeCollapse::samePoint(const point& pt) const
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inline Foam::pointEdgeCollapse::pointEdgeCollapse()
:
collapsePoint_(GREAT, GREAT, GREAT),
collapseIndex_(-2),
collapsePriority_(-2)
{}
inline Foam::pointEdgeCollapse::pointEdgeCollapse
(
const point& collapsePoint,
const label collapseIndex,
const label collapsePriority
)
:
collapsePoint_(collapsePoint),
collapseIndex_(collapseIndex),
collapsePriority_(collapsePriority)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class TrackingData> template<class TrackingData>
inline bool Foam::pointEdgeCollapse::valid(TrackingData& td) const inline bool Foam::pointEdgeCollapse::valid(TrackingData& td) const
{ {
@ -282,7 +261,7 @@ inline bool Foam::pointEdgeCollapse::equal
inline bool Foam::pointEdgeCollapse::operator== inline bool Foam::pointEdgeCollapse::operator==
( (
const Foam::pointEdgeCollapse& rhs const pointEdgeCollapse& rhs
) const ) const
{ {
return return
@ -294,7 +273,7 @@ inline bool Foam::pointEdgeCollapse::operator==
inline bool Foam::pointEdgeCollapse::operator!= inline bool Foam::pointEdgeCollapse::operator!=
( (
const Foam::pointEdgeCollapse& rhs const pointEdgeCollapse& rhs
) const ) const
{ {
return !(*this == rhs); return !(*this == rhs);

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -28,23 +28,23 @@ License
#include "refinementData.H" #include "refinementData.H"
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<< Foam::Ostream& Foam::operator<<
( (
Foam::Ostream& os, Ostream& os,
const Foam::refinementData& wDist const refinementData& rhs
) )
{ {
if (os.format() == IOstream::ASCII) if (os.format() == IOstream::ASCII)
{ {
os << wDist.refinementCount_ << token::SPACE << wDist.count_; os << rhs.refinementCount_ << token::SPACE << rhs.count_;
} }
else else
{ {
os.write os.write
( (
reinterpret_cast<const char*>(&wDist.refinementCount_), reinterpret_cast<const char*>(&rhs.refinementCount_),
sizeof(refinementData) sizeof(refinementData)
); );
} }
@ -54,18 +54,22 @@ Foam::Ostream& Foam::operator<<
} }
Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::refinementData& wDist) Foam::Istream& Foam::operator>>
(
Istream& is,
refinementData& rhs
)
{ {
if (is.format() == IOstream::ASCII) if (is.format() == IOstream::ASCII)
{ {
is >> wDist.refinementCount_ >> wDist.count_; is >> rhs.refinementCount_ >> rhs.count_;
} }
else else
{ {
Detail::readContiguous<refinementData> Detail::readContiguous<refinementData>
( (
is, is,
reinterpret_cast<char*>(&wDist.refinementCount_), reinterpret_cast<char*>(&rhs.refinementCount_),
sizeof(refinementData) sizeof(refinementData)
); );
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -56,14 +56,13 @@ class refinementData;
Istream& operator>>(Istream&, refinementData&); Istream& operator>>(Istream&, refinementData&);
Ostream& operator<<(Ostream&, const refinementData&); Ostream& operator<<(Ostream&, const refinementData&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class refinementData Declaration Class refinementData Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class refinementData class refinementData
{ {
// Private data // Private Data
//- Count which triggers refinement //- Count which triggers refinement
label refinementCount_; label refinementCount_;
@ -75,7 +74,7 @@ public:
// Constructors // Constructors
//- Construct null //- Default construct
inline refinementData(); inline refinementData();
//- Construct from count //- Construct from count
@ -86,27 +85,25 @@ public:
// Access // Access
inline label refinementCount() const label refinementCount() const
{
return refinementCount_;
}
label& refinementCount()
{ {
return refinementCount_; return refinementCount_;
} }
inline label& refinementCount() label count() const
{ {
return refinementCount_; return count_;
} }
label& count()
inline label count() const
{ {
return count_; return count_;
} }
inline label& count() bool isRefined() const
{
return count_;
}
inline bool isRefined() const
{ {
return count_ >= refinementCount_; return count_ >= refinementCount_;
} }
@ -115,12 +112,11 @@ public:
// Needed by FaceCellWave // Needed by FaceCellWave
//- Check whether origin has been changed at all or //- Changed or contains original (invalid) value
// still contains original (invalid) value.
template<class TrackingData> template<class TrackingData>
inline bool valid(TrackingData& td) const; inline bool valid(TrackingData& td) const;
//- Check for identical geometrical data. Used for cyclics checking. //- Check for identical geometrical data (eg, cyclics checking)
template<class TrackingData> template<class TrackingData>
inline bool sameGeometry inline bool sameGeometry
( (
@ -197,16 +193,17 @@ public:
TrackingData& td TrackingData& td
); );
//- Same (like operator==) //- Test for equality, with TrackingData
template<class TrackingData> template<class TrackingData>
inline bool equal(const refinementData&, TrackingData& td) const; inline bool equal(const refinementData&, TrackingData& td) const;
// Member Operators // Member Operators
// Needed for List IO //- Test for equality
inline bool operator==(const refinementData&) const; inline bool operator==(const refinementData&) const;
//- Test for inequality
inline bool operator!=(const refinementData&) const; inline bool operator!=(const refinementData&) const;

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,7 +28,6 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor
inline Foam::refinementData::refinementData() inline Foam::refinementData::refinementData()
: :
refinementCount_(-1), refinementCount_(-1),
@ -35,7 +35,6 @@ inline Foam::refinementData::refinementData()
{} {}
// Construct from components
inline Foam::refinementData::refinementData inline Foam::refinementData::refinementData
( (
const label refinementCount, const label refinementCount,
@ -251,15 +250,19 @@ inline bool Foam::refinementData::equal
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline bool Foam::refinementData::operator==(const Foam::refinementData& rhs) inline bool Foam::refinementData::operator==
const (
const refinementData& rhs
) const
{ {
return count() == rhs.count() && refinementCount() == rhs.refinementCount(); return count_ == rhs.count_ && refinementCount_ == rhs.refinementCount_;
} }
inline bool Foam::refinementData::operator!=(const Foam::refinementData& rhs) inline bool Foam::refinementData::operator!=
const (
const refinementData& rhs
) const
{ {
return !(*this == rhs); return !(*this == rhs);
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,27 +28,27 @@ License
#include "refinementDistanceData.H" #include "refinementDistanceData.H"
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<< Foam::Ostream& Foam::operator<<
( (
Foam::Ostream& os, Ostream& os,
const Foam::refinementDistanceData& wDist const refinementDistanceData& rhs
) )
{ {
return os return os
<< wDist.level0Size_ << token::SPACE << wDist.origin_ << rhs.level0Size_ << token::SPACE << rhs.origin_
<< token::SPACE << wDist.originLevel_; << token::SPACE << rhs.originLevel_;
} }
Foam::Istream& Foam::operator>> Foam::Istream& Foam::operator>>
( (
Foam::Istream& is, Istream& is,
Foam::refinementDistanceData& wDist refinementDistanceData& rhs
) )
{ {
return is >> wDist.level0Size_ >> wDist.origin_ >> wDist.originLevel_; return is >> rhs.level0Size_ >> rhs.origin_ >> rhs.originLevel_;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -63,7 +63,7 @@ Ostream& operator<<(Ostream&, const refinementDistanceData&);
class refinementDistanceData class refinementDistanceData
{ {
// Private data // Private Data
//- Unrefined (level0) buffer size (nBufferLayers*level0Size) //- Unrefined (level0) buffer size (nBufferLayers*level0Size)
scalar level0Size_; scalar level0Size_;
@ -75,7 +75,8 @@ class refinementDistanceData
// Private Member Functions // Private Member Functions
//- Updates with neighbouring data. Returns true if something changed. //- Updates with neighbouring data.
// \return true if something changed.
template<class TrackingData> template<class TrackingData>
inline bool update inline bool update
( (
@ -89,7 +90,7 @@ public:
// Constructors // Constructors
//- Construct null //- Default construct
inline refinementDistanceData(); inline refinementDistanceData();
//- Construct from count //- Construct from count
@ -105,32 +106,29 @@ public:
// Access // Access
inline scalar level0Size() const scalar level0Size() const
{
return level0Size_;
}
scalar& level0Size()
{ {
return level0Size_; return level0Size_;
} }
inline scalar& level0Size() const point& origin() const
{ {
return level0Size_; return origin_;
} }
point& origin()
inline const point& origin() const
{ {
return origin_; return origin_;
} }
inline point& origin() label originLevel() const
{
return origin_;
}
inline label originLevel() const
{ {
return originLevel_; return originLevel_;
} }
label& originLevel()
inline label& originLevel()
{ {
return originLevel_; return originLevel_;
} }
@ -138,19 +136,18 @@ public:
// Other // Other
//- Calculates the wanted level at a given point. Walks out from //- Calculates the wanted level at a given point.
// the origin. // Walks out from the origin.
inline label wantedLevel(const point& pt) const; inline label wantedLevel(const point& pt) const;
// Needed by FaceCellWave // Needed by FaceCellWave
//- Check whether origin has been changed at all or //- Changed or contains original (invalid) value
// still contains original (invalid) value.
template<class TrackingData> template<class TrackingData>
inline bool valid(TrackingData&) const; inline bool valid(TrackingData&) const;
//- Check for identical geometrical data. Used for cyclics checking. //- Check for identical geometrical data (eg, cyclics checking)
template<class TrackingData> template<class TrackingData>
inline bool sameGeometry inline bool sameGeometry
( (
@ -227,19 +224,18 @@ public:
TrackingData& TrackingData&
); );
//- Same (like operator==) //- Test for equality, with TrackingData
template<class TrackingData> template<class TrackingData>
inline bool equal inline bool equal(const refinementDistanceData&, TrackingData&)
( const;
const refinementDistanceData&,
TrackingData&
) const;
// Member Operators // Member Operators
// Needed for List IO //- Test for equality
inline bool operator==(const refinementDistanceData&) const; inline bool operator==(const refinementDistanceData&) const;
//- Test for inequality
inline bool operator!=(const refinementDistanceData&) const; inline bool operator!=(const refinementDistanceData&) const;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -31,9 +31,10 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Returns the wanted level inline Foam::label Foam::refinementDistanceData::wantedLevel
inline Foam::label Foam::refinementDistanceData::wantedLevel(const point& pt) (
const const point& pt
) const
{ {
const scalar distSqr = magSqr(pt-origin_); const scalar distSqr = magSqr(pt-origin_);
@ -122,14 +123,12 @@ inline bool Foam::refinementDistanceData::update
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor
inline Foam::refinementDistanceData::refinementDistanceData() inline Foam::refinementDistanceData::refinementDistanceData()
: :
level0Size_(-1) level0Size_(-1)
{} {}
// Construct from components
inline Foam::refinementDistanceData::refinementDistanceData inline Foam::refinementDistanceData::refinementDistanceData
( (
const scalar level0Size, const scalar level0Size,
@ -283,7 +282,7 @@ inline bool Foam::refinementDistanceData::equal
inline bool Foam::refinementDistanceData::operator== inline bool Foam::refinementDistanceData::operator==
( (
const Foam::refinementDistanceData& rhs const refinementDistanceData& rhs
) const ) const
{ {
return return
@ -295,7 +294,7 @@ inline bool Foam::refinementDistanceData::operator==
inline bool Foam::refinementDistanceData::operator!= inline bool Foam::refinementDistanceData::operator!=
( (
const Foam::refinementDistanceData& rhs const refinementDistanceData& rhs
) const ) const
{ {
return !(*this == rhs); return !(*this == rhs);

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -44,12 +44,36 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward Declarations
class smoothData;
Ostream& operator<<(Ostream&, const smoothData&);
Istream& operator>>(Istream&, smoothData&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class smoothData Declaration Class smoothData Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class smoothData class smoothData
{ {
// Private Data
scalar value_;
// Private Member Functions
//- Update gets information from neighbouring face/cell and
//- uses this to update itself (if necessary) and return true
template<class TrackingData>
inline bool update
(
const smoothData& svf,
const scalar scale,
const scalar tol,
TrackingData& td
);
public: public:
@ -63,30 +87,18 @@ public:
}; };
private: // Generated Methods
scalar value_; //- Copy construct
smoothData(const smoothData&) = default;
// Private Member Functions //- Copy assignment
smoothData& operator=(const smoothData&) = default;
//- Update - gets information from neighbouring face/cell and
// uses this to update itself (if necessary) and return true
template<class TrackingData>
inline bool update
(
const smoothData& svf,
const scalar scale,
const scalar tol,
TrackingData& td
);
public:
// Constructors // Constructors
//- Construct null //- Default construct
inline smoothData(); inline smoothData();
//- Construct from inverse field value //- Construct from inverse field value
@ -103,16 +115,20 @@ public:
return value_; return value_;
} }
//- The value
scalar& value()
{
return value_;
}
// Needed by FaceCellWave // Needed by FaceCellWave
//- Check whether origin has been changed at all or //- Changed or contains original (invalid) value
// still contains original (invalid) value
template<class TrackingData> template<class TrackingData>
inline bool valid(TrackingData& td) const; inline bool valid(TrackingData& td) const;
//- Check for identical geometrical data //- Check for identical geometrical data (eg, cyclics checking)
// Used for cyclics checking
template<class TrackingData> template<class TrackingData>
inline bool sameGeometry inline bool sameGeometry
( (
@ -123,7 +139,7 @@ public:
) const; ) const;
//- Convert any absolute coordinates into relative to //- Convert any absolute coordinates into relative to
// (patch)face centre //- (patch)face centre
template<class TrackingData> template<class TrackingData>
inline void leaveDomain inline void leaveDomain
( (
@ -189,35 +205,36 @@ public:
TrackingData& td TrackingData& td
); );
//- Same (like operator==) //- Test for equality, with TrackingData
template<class TrackingData> template<class TrackingData>
inline bool equal(const smoothData&, TrackingData& td) const; inline bool equal(const smoothData&, TrackingData& td) const;
// Member Operators // Member Operators
inline void operator=(const scalar value); //- Assign new value
void operator=(const scalar value)
{
value_ = value;
}
// Needed for List IO //- Test for equality
inline bool operator==(const smoothData&) const; inline bool operator==(const smoothData&) const;
//- Test for inequality
inline bool operator!=(const smoothData&) const; inline bool operator!=(const smoothData&) const;
// IOstream Operators // IOstream Operators
friend Ostream& operator<< friend Ostream& operator<<(Ostream& os, const smoothData& rhs)
(
Ostream& os,
const smoothData& svf
)
{ {
return os << svf.value_; return os << rhs.value_;
} }
friend Istream& operator>>(Istream& is, smoothData& svf) friend Istream& operator>>(Istream& is, smoothData& rhs)
{ {
return is >> svf.value_; return is >> rhs.value_;
} }
}; };

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2013 OpenFOAM Foundation Copyright (C) 2011-2013 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -192,21 +193,12 @@ inline bool Foam::smoothData::equal
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline void Foam::smoothData::operator=
(
const scalar value
)
{
value_ = value;
}
inline bool Foam::smoothData::operator== inline bool Foam::smoothData::operator==
( (
const smoothData& rhs const smoothData& rhs
) const ) const
{ {
return value_ == rhs.value(); return value_ == rhs.value_;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -44,19 +44,29 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward Declarations
class sweepData;
Ostream& operator<<(Ostream&, const sweepData&);
Istream& operator>>(Istream&, sweepData&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class sweepData Declaration Class sweepData Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class sweepData class sweepData
{ {
// Private Data
scalar value_; scalar value_;
point origin_; point origin_;
// Private Member Functions // Private Member Functions
//- Update - gets information from neighbouring face/cell and //- Update gets information from neighbouring face/cell and
// uses this to update itself (if necessary) and return true //- uses this to update itself (if necessary) and return true
template<class TrackingData> template<class TrackingData>
inline bool update inline bool update
( (
@ -69,12 +79,21 @@ class sweepData
public: public:
// Generated Methods
//- Copy construct
sweepData(const sweepData&) = default;
//- Copy assignment
sweepData& operator=(const sweepData&) = default;
// Constructors // Constructors
//- Construct null //- Default construct
inline sweepData(); inline sweepData();
//- Construct from component //- Construct from components
inline sweepData(const scalar value, const point& origin); inline sweepData(const scalar value, const point& origin);
@ -88,6 +107,12 @@ public:
return value_; return value_;
} }
//- The value
scalar& value()
{
return value_;
}
//- Return origin //- Return origin
const point& origin() const const point& origin() const
{ {
@ -97,13 +122,11 @@ public:
// Needed by FaceCellWave // Needed by FaceCellWave
//- Check whether origin has been changed at all or //- Changed or contains original (invalid) value
// still contains original (invalid) value
template<class TrackingData> template<class TrackingData>
inline bool valid(TrackingData& td) const; inline bool valid(TrackingData& td) const;
//- Check for identical geometrical data //- Check for identical geometrical data (eg, cyclics checking)
// Used for cyclics checking
template<class TrackingData> template<class TrackingData>
inline bool sameGeometry inline bool sameGeometry
( (
@ -180,35 +203,36 @@ public:
TrackingData& td TrackingData& td
); );
//- Same (like operator==) //- Test for equality, with TrackingData
template<class TrackingData> template<class TrackingData>
inline bool equal(const sweepData&, TrackingData& td) const; inline bool equal(const sweepData&, TrackingData& td) const;
// Member Operators // Member Operators
inline void operator=(const scalar value); //- Assign new value
void operator=(const scalar value)
{
value_ = value;
}
// Needed for List IO //- Test for equality
inline bool operator==(const sweepData&) const; inline bool operator==(const sweepData&) const;
//- Test for inequality
inline bool operator!=(const sweepData&) const; inline bool operator!=(const sweepData&) const;
// IOstream Operators // IOstream Operators
friend Ostream& operator<< friend Ostream& operator<<(Ostream& os, const sweepData& rhs)
(
Ostream& os,
const sweepData& svf
)
{ {
return os << svf.value_ << svf.origin_; return os << rhs.value_ << rhs.origin_;
} }
friend Istream& operator>>(Istream& is, sweepData& svf) friend Istream& operator>>(Istream& is, sweepData& rhs)
{ {
return is >> svf.value_ >> svf.origin_; return is >> rhs.value_ >> rhs.origin_;
} }
}; };

View File

@ -44,7 +44,7 @@ inline bool Foam::sweepData::update
return true; return true;
} }
scalar myDist2 = magSqr(position - origin()); const scalar myDist2 = magSqr(position - origin());
if (myDist2 < SMALL) if (myDist2 < SMALL)
{ {
@ -76,11 +76,15 @@ inline bool Foam::sweepData::update
inline Foam::sweepData::sweepData() inline Foam::sweepData::sweepData()
: :
value_(-GREAT), value_(-GREAT),
origin_(vector::max) origin_(point::max)
{} {}
inline Foam::sweepData::sweepData(const scalar value, const point& origin) inline Foam::sweepData::sweepData
(
const scalar value,
const point& origin
)
: :
value_(value), value_(value),
origin_(origin) origin_(origin)
@ -208,21 +212,12 @@ inline bool Foam::sweepData::equal
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline void Foam::sweepData::operator=
(
const scalar value
)
{
value_ = value;
}
inline bool Foam::sweepData::operator== inline bool Foam::sweepData::operator==
( (
const sweepData& rhs const sweepData& rhs
) const ) const
{ {
return origin() == rhs.origin(); return origin_ == rhs.origin_;
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -25,16 +26,11 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Update this with w2 if w2 nearer to pt. // Update this with w2 if w2 nearer to pt.
template<class TrackingData> template<class TrackingData>
inline bool wallPointYPlus::update inline bool Foam::wallPointYPlus::update
( (
const point& pt, const point& pt,
const wallPointYPlus& w2, const wallPointYPlus& w2,
@ -42,11 +38,11 @@ inline bool wallPointYPlus::update
TrackingData& td TrackingData& td
) )
{ {
scalar dist2 = magSqr(pt - w2.origin()); const scalar dist2 = magSqr(pt - w2.origin());
if (valid(td)) if (valid(td))
{ {
scalar diff = distSqr() - dist2; const scalar diff = distSqr() - dist2;
if (diff < 0) if (diff < 0)
{ {
@ -65,7 +61,7 @@ inline bool wallPointYPlus::update
// Either *this is not yet valid or w2 is closer // Either *this is not yet valid or w2 is closer
{ {
// only propagate if interesting (i.e. y+ < 100) // only propagate if interesting (i.e. y+ < 100)
scalar yPlus = Foam::sqrt(dist2)/w2.data(); const scalar yPlus = Foam::sqrt(dist2)/w2.data();
if (yPlus < yPlusCutOff) if (yPlus < yPlusCutOff)
{ {
@ -86,8 +82,7 @@ inline bool wallPointYPlus::update
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor inline Foam::wallPointYPlus::wallPointYPlus()
inline wallPointYPlus::wallPointYPlus()
: :
wallPointData<scalar>() wallPointData<scalar>()
{ {
@ -96,8 +91,7 @@ inline wallPointYPlus::wallPointYPlus()
} }
// Construct from components inline Foam::wallPointYPlus::wallPointYPlus
inline wallPointYPlus::wallPointYPlus
( (
const point& origin, const point& origin,
const scalar yStar, const scalar yStar,
@ -112,7 +106,7 @@ inline wallPointYPlus::wallPointYPlus
// Update this with w2 if w2 nearer to pt. // Update this with w2 if w2 nearer to pt.
template<class TrackingData> template<class TrackingData>
inline bool wallPointYPlus::updateCell inline bool Foam::wallPointYPlus::updateCell
( (
const polyMesh& mesh, const polyMesh& mesh,
const label thisCelli, const label thisCelli,
@ -136,7 +130,7 @@ inline bool wallPointYPlus::updateCell
// Update this with w2 if w2 nearer to pt. // Update this with w2 if w2 nearer to pt.
template<class TrackingData> template<class TrackingData>
inline bool wallPointYPlus::updateFace inline bool Foam::wallPointYPlus::updateFace
( (
const polyMesh& mesh, const polyMesh& mesh,
const label thisFacei, const label thisFacei,
@ -160,7 +154,7 @@ inline bool wallPointYPlus::updateFace
// Update this with w2 if w2 nearer to pt. // Update this with w2 if w2 nearer to pt.
template<class TrackingData> template<class TrackingData>
inline bool wallPointYPlus::updateFace inline bool Foam::wallPointYPlus::updateFace
( (
const polyMesh& mesh, const polyMesh& mesh,
const label thisFacei, const label thisFacei,
@ -181,8 +175,4 @@ inline bool wallPointYPlus::updateFace
} }
// ************************************************************************* //
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013 OpenFOAM Foundation Copyright (C) 2013 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,25 +28,25 @@ License
#include "patchFaceOrientation.H" #include "patchFaceOrientation.H"
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<< Foam::Ostream& Foam::operator<<
( (
Foam::Ostream& os, Ostream& os,
const Foam::patchFaceOrientation& wDist const patchFaceOrientation& rhs
) )
{ {
return os << wDist.flipStatus_; return os << rhs.flipStatus_;
} }
Foam::Istream& Foam::operator>> Foam::Istream& Foam::operator>>
( (
Foam::Istream& is, Istream& is,
Foam::patchFaceOrientation& wDist patchFaceOrientation& rhs
) )
{ {
return is >> wDist.flipStatus_; return is >> rhs.flipStatus_;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2015 OpenFOAM Foundation Copyright (C) 2013-2015 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -54,14 +54,13 @@ class patchFaceOrientation;
Istream& operator>>(Istream&, patchFaceOrientation&); Istream& operator>>(Istream&, patchFaceOrientation&);
Ostream& operator<<(Ostream&, const patchFaceOrientation&); Ostream& operator<<(Ostream&, const patchFaceOrientation&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class patchFaceOrientation Declaration Class patchFaceOrientation Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class patchFaceOrientation class patchFaceOrientation
{ {
// Private data // Private Data
//- Flip status //- Flip status
label flipStatus_; label flipStatus_;
@ -70,7 +69,7 @@ public:
// Constructors // Constructors
//- Construct null //- Default construct
inline patchFaceOrientation(); inline patchFaceOrientation();
//- Construct from components //- Construct from components
@ -79,17 +78,21 @@ public:
// Member Functions // Member Functions
//- Orientation // Access
inline label flipStatus() const;
//- Reverse orientation //- Orientation
label flipStatus() const
{
return flipStatus_;
}
//- Reverse the orientation
inline void flip(); inline void flip();
// Needed by meshWave // Needed by MeshWave
//- Check whether origin has been changed at all or //- Changed or contains original (invalid) value
// still contains original (invalid) value.
template<class TrackingData> template<class TrackingData>
inline bool valid(TrackingData& td) const; inline bool valid(TrackingData& td) const;
@ -142,15 +145,17 @@ public:
TrackingData& td TrackingData& td
); );
//- Same (like operator==) //- Test for equality, with TrackingData
template<class TrackingData> template<class TrackingData>
inline bool equal(const patchFaceOrientation&, TrackingData&) const; inline bool equal(const patchFaceOrientation&, TrackingData&) const;
// Member Operators // Member Operators
// Needed for List IO //- Test for equality
inline bool operator==(const patchFaceOrientation&) const; inline bool operator==(const patchFaceOrientation&) const;
//- Test for equality
inline bool operator!=(const patchFaceOrientation&) const; inline bool operator!=(const patchFaceOrientation&) const;

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013 OpenFOAM Foundation Copyright (C) 2013 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -29,7 +30,7 @@ License
#include "transform.H" #include "transform.H"
#include "orientedSurface.H" #include "orientedSurface.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inline Foam::patchFaceOrientation::patchFaceOrientation() inline Foam::patchFaceOrientation::patchFaceOrientation()
: :
@ -48,12 +49,6 @@ inline Foam::patchFaceOrientation::patchFaceOrientation
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::label Foam::patchFaceOrientation::flipStatus() const
{
return flipStatus_;
}
inline void Foam::patchFaceOrientation::flip() inline void Foam::patchFaceOrientation::flip()
{ {
if (flipStatus_ == orientedSurface::NOFLIP) if (flipStatus_ == orientedSurface::NOFLIP)
@ -210,16 +205,16 @@ inline bool Foam::patchFaceOrientation::equal
inline bool Foam::patchFaceOrientation::operator== inline bool Foam::patchFaceOrientation::operator==
( (
const Foam::patchFaceOrientation& rhs const patchFaceOrientation& rhs
) const ) const
{ {
return flipStatus() == rhs.flipStatus(); return flipStatus_ == rhs.flipStatus_;
} }
inline bool Foam::patchFaceOrientation::operator!= inline bool Foam::patchFaceOrientation::operator!=
( (
const Foam::patchFaceOrientation& rhs const patchFaceOrientation& rhs
) const ) const
{ {
return !(*this == rhs); return !(*this == rhs);

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015-2019 OpenCFD Ltd. Copyright (C) 2015-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -77,9 +77,9 @@ private:
// Private Member Functions // Private Member Functions
//- Evaluate distance to point. Update distSqr, origin from whomever //- Evaluate distance to point.
// is nearer pt. Return true if w2 is closer to point, // Update distSqr, origin from whomever is nearer pt.
// false otherwise. // \return true if w2 is closer to point, false otherwise.
template<class TrackingData> template<class TrackingData>
inline bool update inline bool update
( (

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015 OpenCFD Ltd. Copyright (C) 2015-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -40,11 +40,11 @@ inline bool Foam::transportData::update
TrackingData& td TrackingData& td
) )
{ {
scalar dist2 = magSqr(pt - w2.origin()); const scalar dist2 = magSqr(pt - w2.origin());
if (valid(td)) if (valid(td))
{ {
scalar diff = distSqr() - dist2; const scalar diff = distSqr() - dist2;
if (diff < 0) if (diff < 0)
{ {

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018-2019 OpenCFD Ltd. Copyright (C) 2018-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,29 +27,29 @@ License
#include "wallPoints.H" #include "wallPoints.H"
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<< Foam::Ostream& Foam::operator<<
( (
Foam::Ostream& os, Ostream& os,
const Foam::wallPoints& wDist const wallPoints& rhs
) )
{ {
return os return os
<< wDist.origin_ << token::SPACE << wDist.distSqr_ << rhs.origin_ << token::SPACE << rhs.distSqr_
<< token::SPACE << wDist.surface_; // << token::SPACE << wDist.normal_; << token::SPACE << rhs.surface_; // << token::SPACE << rhs.normal_;
} }
Foam::Istream& Foam::operator>> Foam::Istream& Foam::operator>>
( (
Foam::Istream& is, Istream& is,
Foam::wallPoints& wDist wallPoints& rhs
) )
{ {
return is return is
>> wDist.origin_ >> wDist.distSqr_>> wDist.surface_; >> rhs.origin_ >> rhs.distSqr_ >> rhs.surface_;
//>> wDist.normal_; //>> rhs.normal_;
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018-2019 OpenCFD Ltd. Copyright (C) 2018-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -48,17 +48,13 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward Declarations
class polyPatch; class polyPatch;
class polyMesh; class polyMesh;
// Forward declaration of friend functions and operators
class wallPoints; class wallPoints;
Istream& operator>>(Istream&, wallPoints&); Istream& operator>>(Istream&, wallPoints&);
Ostream& operator<<(Ostream&, const wallPoints&); Ostream& operator<<(Ostream&, const wallPoints&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class wallPoints Declaration Class wallPoints Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -67,7 +63,7 @@ class wallPoints
{ {
protected: protected:
// Protected data // Protected Data
//- Starting points //- Starting points
DynamicList<point> origin_; DynamicList<point> origin_;
@ -84,9 +80,9 @@ protected:
// Protected Member Functions // Protected Member Functions
//- Evaluate distance to point. Update distSqr, origin from whomever //- Evaluate distance to point.
// is nearer pt. Return true if w2 is closer to point, // Update distSqr, origin from whomever is nearer pt.
// false otherwise. // \return true if w2 is closer to point, false otherwise.
template<class TrackingData> template<class TrackingData>
inline bool update inline bool update
( (
@ -104,7 +100,7 @@ public:
// Constructors // Constructors
//- Construct null //- Default construct
inline wallPoints(); inline wallPoints();
//- Construct from count //- Construct from count
@ -121,21 +117,21 @@ public:
// Access // Access
inline const List<point>& origin() const const List<point>& origin() const
{ {
return origin_; return origin_;
} }
inline const List<scalar>& distSqr() const const List<scalar>& distSqr() const
{ {
return distSqr_; return distSqr_;
} }
inline const List<FixedList<label, 3>>& surface() const const List<FixedList<label, 3>>& surface() const
{ {
return surface_; return surface_;
} }
//inline const List<vector>& normal() const //const List<vector>& normal() const
//{ //{
// return normal_; // return normal_;
//} //}
@ -143,12 +139,11 @@ public:
// Needed by FaceCellWave // Needed by FaceCellWave
//- Check whether origin has been changed at all or //- Changed or contains original (invalid) value
// still contains original (invalid) value.
template<class TrackingData> template<class TrackingData>
inline bool valid(TrackingData& td) const; inline bool valid(TrackingData& td) const;
//- Check for identical geometrical data. Used for cyclics checking. //- Check for identical geometrical data (eg, cyclics checking)
template<class TrackingData> template<class TrackingData>
inline bool sameGeometry inline bool sameGeometry
( (
@ -225,16 +220,17 @@ public:
TrackingData& td TrackingData& td
); );
//- Same (like operator==) //- Test for equality, with TrackingData
template<class TrackingData> template<class TrackingData>
inline bool equal(const wallPoints&, TrackingData&) const; inline bool equal(const wallPoints&, TrackingData&) const;
// Member Operators // Member Operators
// Needed for List IO //- Test for equality
inline bool operator==(const wallPoints&) const; inline bool operator==(const wallPoints&) const;
//- Test for inequality
inline bool operator!=(const wallPoints&) const; inline bool operator!=(const wallPoints&) const;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018-2019 OpenCFD Ltd. Copyright (C) 2018-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -42,7 +42,7 @@ inline bool Foam::wallPoints::update
TrackingData& td TrackingData& td
) )
{ {
scalar dist2 = magSqr(pt - w2.origin_[index2]); const scalar dist2 = magSqr(pt - w2.origin_[index2]);
if (!valid(td)) if (!valid(td))
{ {
@ -55,7 +55,7 @@ inline bool Foam::wallPoints::update
return true; return true;
} }
scalar diff = distSqr_[index1] - dist2; const scalar diff = distSqr_[index1] - dist2;
if (diff < 0) if (diff < 0)
{ {
@ -329,7 +329,7 @@ inline bool Foam::wallPoints::equal
inline bool Foam::wallPoints::operator== inline bool Foam::wallPoints::operator==
( (
const Foam::wallPoints& rhs const wallPoints& rhs
) const ) const
{ {
return return
@ -342,7 +342,7 @@ inline bool Foam::wallPoints::operator==
inline bool Foam::wallPoints::operator!= inline bool Foam::wallPoints::operator!=
( (
const Foam::wallPoints& rhs const wallPoints& rhs
) const ) const
{ {
return !(*this == rhs); return !(*this == rhs);

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018-2019 OpenCFD Ltd. Copyright (C) 2018-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -59,9 +59,7 @@ Istream& operator>>(Istream&, PointIntegrateData<DataType>&);
template<class DataType> template<class DataType>
class PointIntegrateData class PointIntegrateData
{ {
private: // Private Data
// Private data
//- Valid flag //- Valid flag
bool valid_; bool valid_;
@ -88,7 +86,7 @@ public:
// Constructors // Constructors
//- Construct null //- Default construct
inline PointIntegrateData(); inline PointIntegrateData();
//- Construct from data //- Construct from data
@ -99,8 +97,11 @@ public:
// Access // Access
//- Const access the data const DataType& data() const
inline const DataType& data() const {
return data_;
};
DataType& data()
{ {
return data_; return data_;
}; };
@ -108,11 +109,11 @@ public:
// Needed by PointEdgeWave // Needed by PointEdgeWave
//- Check whether original (invalid) value. //- Changed or contains original (invalid) value
template<class TrackingData> template<class TrackingData>
inline bool valid(TrackingData& td) const; inline bool valid(TrackingData& td) const;
//- Check for identical geometrical data. Used for cyclics checking. //- Check for identical geometrical data (eg, cyclics checking)
template<class TrackingData> template<class TrackingData>
inline bool sameGeometry inline bool sameGeometry
( (
@ -122,7 +123,7 @@ public:
) const; ) const;
//- Convert origin to relative vector to leaving point //- Convert origin to relative vector to leaving point
// (= point coordinate) //- (= point coordinate)
template<class TrackingData> template<class TrackingData>
inline void leaveDomain inline void leaveDomain
( (
@ -196,7 +197,7 @@ public:
TrackingData& td TrackingData& td
); );
//- Same (like operator==) //- Test for equality, with TrackingData
template<class TrackingData> template<class TrackingData>
inline bool equal inline bool equal
( (
@ -207,8 +208,10 @@ public:
// Member Operators // Member Operators
// Needed for List IO //- Test for equality
inline bool operator==(const PointIntegrateData<DataType>&) const; inline bool operator==(const PointIntegrateData<DataType>&) const;
//- Test for inequality
inline bool operator!=(const PointIntegrateData<DataType>&) const; inline bool operator!=(const PointIntegrateData<DataType>&) const;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018-2019 OpenCFD Ltd. Copyright (C) 2018-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -215,7 +215,6 @@ inline bool Foam::PointIntegrateData<DataType>::updateEdge
} }
//- Same (like operator==)
template<class DataType> template<class DataType>
template<class TrackingData> template<class TrackingData>
inline bool Foam::PointIntegrateData<DataType>::equal inline bool Foam::PointIntegrateData<DataType>::equal
@ -246,9 +245,8 @@ inline bool Foam::PointIntegrateData<DataType>::equal
template<class DataType> template<class DataType>
inline bool Foam::PointIntegrateData<DataType>::operator== inline bool Foam::PointIntegrateData<DataType>::operator==
( (
const Foam::PointIntegrateData<DataType>& rhs const PointIntegrateData<DataType>& rhs
) ) const
const
{ {
return this->data_ == rhs.data_; return this->data_ == rhs.data_;
} }
@ -257,30 +255,29 @@ const
template<class DataType> template<class DataType>
inline bool Foam::PointIntegrateData<DataType>::operator!= inline bool Foam::PointIntegrateData<DataType>::operator!=
( (
const Foam::PointIntegrateData<DataType>& rhs const PointIntegrateData<DataType>& rhs
) ) const
const
{ {
return !(*this == rhs); return !(*this == rhs);
} }
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class DataType> template<class DataType>
inline Foam::Ostream& Foam::operator<< inline Foam::Ostream& Foam::operator<<
( (
Ostream& os, Ostream& os,
const PointIntegrateData<DataType>& pd const PointIntegrateData<DataType>& rhs
) )
{ {
if (os.format() == IOstream::ASCII) if (os.format() == IOstream::ASCII)
{ {
return os << pd.valid_ << token::SPACE << pd.data(); return os << rhs.valid_ << token::SPACE << rhs.data();
} }
else else
{ {
return os << pd.valid_ << pd.data(); return os << rhs.valid_ << rhs.data();
} }
} }
@ -289,10 +286,10 @@ template<class DataType>
inline Foam::Istream& Foam::operator>> inline Foam::Istream& Foam::operator>>
( (
Istream& is, Istream& is,
PointIntegrateData<DataType>& pd PointIntegrateData<DataType>& rhs
) )
{ {
return is >> pd.valid_ >> pd.data_; return is >> rhs.valid_ >> rhs.data_;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -50,6 +50,7 @@ Foam::scalar Foam::FaceCellWave<Type, TrackingData>::propagationTol_ = 0.01;
template<class Type, class TrackingData> template<class Type, class TrackingData>
int Foam::FaceCellWave<Type, TrackingData>::dummyTrackData_ = 12345; int Foam::FaceCellWave<Type, TrackingData>::dummyTrackData_ = 12345;
namespace Foam namespace Foam
{ {
template<class Type, class TrackingData> template<class Type, class TrackingData>

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -60,7 +60,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declarations // Forward Declarations
class polyMesh; class polyMesh;
class polyPatch; class polyPatch;
@ -80,15 +80,6 @@ class FaceCellWave
: :
public FaceCellWaveName public FaceCellWaveName
{ {
// Private Member Functions
//- No copy construct
FaceCellWave(const FaceCellWave&) = delete;
//- No copy assignment
void operator=(const FaceCellWave&) = delete;
protected: protected:
//- Information tagged with a source or destination id. //- Information tagged with a source or destination id.
@ -96,6 +87,15 @@ protected:
typedef std::pair<label,Type> taggedInfoType; typedef std::pair<label,Type> taggedInfoType;
// Protected Static Data
static const scalar geomTol_;
static scalar propagationTol_;
//- Default trackdata value to satisfy default template argument.
static int dummyTrackData_;
// Protected Data // Protected Data
//- Reference to mesh //- Reference to mesh
@ -257,14 +257,11 @@ protected:
void handleExplicitConnections(); void handleExplicitConnections();
// Protected static data //- No copy construct
FaceCellWave(const FaceCellWave&) = delete;
static const scalar geomTol_; //- No copy assignment
static scalar propagationTol_; void operator=(const FaceCellWave&) = delete;
//- Used as default trackdata value to satisfy default template
// argument.
static int dummyTrackData_;
public: public:
@ -397,7 +394,6 @@ public:
//- Iterate until no changes or maxIter reached. //- Iterate until no changes or maxIter reached.
// \return the number of iterations taken. // \return the number of iterations taken.
virtual label iterate(const label maxIter); virtual label iterate(const label maxIter);
}; };

View File

@ -31,7 +31,7 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(FaceCellWaveName, 0); defineTypeNameAndDebug(FaceCellWaveName, 0);
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -60,7 +61,13 @@ class MeshWave
: :
public MeshWaveName public MeshWaveName
{ {
// Private data // Private Static Data
//- Default trackdata value to satisfy default template argument.
static int dummyTrackData_;
// Private Data
//- Wall information for all faces //- Wall information for all faces
List<Type> allFaceInfo_; List<Type> allFaceInfo_;
@ -71,6 +78,7 @@ class MeshWave
//- Wave calculation engine. //- Wave calculation engine.
FaceCellWave<Type, TrackingData> calc_; FaceCellWave<Type, TrackingData> calc_;
// Private Member Functions // Private Member Functions
//- No copy construct //- No copy construct
@ -79,18 +87,14 @@ class MeshWave
//- No copy assignment //- No copy assignment
void operator=(const MeshWave&) = delete; void operator=(const MeshWave&) = delete;
// Private static data
//- Used as default trackdata value to satisfy default template
// argument.
static int dummyTrackData_;
public: public:
// Constructors // Constructors
//- Construct from mesh and list of changed faces with the Type //- Construct from mesh and list of changed faces with the Type
// for these faces. Iterates until nothing changes or maxIter reached. //- for these faces.
// Iterates until nothing changes or maxIter reached.
// (maxIter can be 0) // (maxIter can be 0)
MeshWave MeshWave
( (
@ -102,7 +106,7 @@ public:
); );
//- Construct from mesh, list of changed faces with the Type //- Construct from mesh, list of changed faces with the Type
// for these faces and initial field. //- for these faces and initial field.
// Iterates until nothing changes or maxIter reached. // Iterates until nothing changes or maxIter reached.
// (maxIter can be 0) // (maxIter can be 0)
MeshWave MeshWave
@ -136,15 +140,17 @@ public:
return calc_.data(); return calc_.data();
} }
//- Iterate until no changes or maxIter reached. Returns actual //- Iterate until no changes or maxIter reached.
// number of iterations. // \return actual number of iterations.
label iterate(const label maxIter) label iterate(const label maxIter)
{ {
return calc_.iterate(maxIter); return calc_.iterate(maxIter);
} }
//- Number of unvisited cells, i.e. cells that were not (yet) //- Number of unvisited cells, i.e. cells that were not (yet)
// reached from walking across mesh. This can happen from //- reached from walking across mesh.
//
// This can happen from
// - not enough iterations done // - not enough iterations done
// - a disconnected mesh // - a disconnected mesh
// - a mesh without walls in it // - a mesh without walls in it

View File

@ -415,32 +415,6 @@ PatchEdgeFaceWave
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template
<
class PrimitivePatchType,
class Type,
class TrackingData
>
Foam::label Foam::PatchEdgeFaceWave<PrimitivePatchType, Type, TrackingData>::
nUnvisitedEdges() const
{
return nUnvisitedEdges_;
}
template
<
class PrimitivePatchType,
class Type,
class TrackingData
>
Foam::label Foam::PatchEdgeFaceWave<PrimitivePatchType, Type, TrackingData>::
nUnvisitedFaces() const
{
return nUnvisitedFaces_;
}
// Copy edge information into member data // Copy edge information into member data
template template
< <

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -49,7 +50,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes // Forward Declarations
class polyMesh; class polyMesh;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
@ -73,19 +74,18 @@ class PatchEdgeFaceWave
: :
public PatchEdgeFaceWaveName public PatchEdgeFaceWaveName
{ {
// Private static data // Private Static Data
//- Relative tolerance. Stop propagation if relative changes //- Relative tolerance.
// less than this tolerance (responsibility for checking this is // Stop propagation if relative changes less than this tolerance
// up to Type implementation) // (responsibility for checking this is up to Type implementation)
static scalar propagationTol_; static scalar propagationTol_;
//- Used as default trackdata value to satisfy default template //- Default trackdata value to satisfy default template argument.
// argument.
static label dummyTrackData_; static label dummyTrackData_;
// Private data // Private Data
//- Reference to mesh //- Reference to mesh
const polyMesh& mesh_; const polyMesh& mesh_;
@ -130,8 +130,8 @@ class PatchEdgeFaceWave
// Private Member Functions // Private Member Functions
//- Updates edgeInfo with information from neighbour. Updates all //- Updates edgeInfo with information from neighbour.
// statistics. // Updates all statistics.
bool updateEdge bool updateEdge
( (
const label edgeI, const label edgeI,
@ -140,8 +140,8 @@ class PatchEdgeFaceWave
Type& edgeInfo Type& edgeInfo
); );
//- Updates faceInfo with information from neighbour. Updates all //- Updates faceInfo with information from neighbour.
// statistics. // Updates all statistics.
bool updateFace bool updateFace
( (
const label facei, const label facei,
@ -180,7 +180,8 @@ public:
// Constructors // Constructors
//- Construct from patch, list of changed edges with the Type //- Construct from patch, list of changed edges with the Type
// for these edges. Gets work arrays to operate on, one of size //- for these edges.
// Obtains work arrays to operate on, one of size
// number of patch edges, the other number of patch faces. // number of patch edges, the other number of patch faces.
// Iterates until nothing changes or maxIter reached. // Iterates until nothing changes or maxIter reached.
// (maxIter can be 0) // (maxIter can be 0)
@ -196,8 +197,8 @@ public:
TrackingData& td = dummyTrackData_ TrackingData& td = dummyTrackData_
); );
//- Construct from patch. Use setEdgeInfo and iterate() to do //- Construct from patch.
// actual calculation // Use setEdgeInfo() and iterate() to do actual calculation
PatchEdgeFaceWave PatchEdgeFaceWave
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -229,13 +230,21 @@ public:
} }
//- Number of unvisited faces, i.e. faces that were not (yet) //- Number of unvisited faces, i.e. faces that were not (yet)
// reached from walking across patch. This can happen from //- reached from walking across patch.
//
// This can happen from
// - not enough iterations done // - not enough iterations done
// - a disconnected patch // - a disconnected patch
// - a patch without walls in it // - a patch without walls in it
label nUnvisitedFaces() const; label nUnvisitedFaces() const
{
return nUnvisitedFaces_;
}
label nUnvisitedEdges() const; label nUnvisitedEdges() const
{
return nUnvisitedEdges_;
}
//- Copy initial data into allEdgeInfo_ //- Copy initial data into allEdgeInfo_
void setEdgeInfo void setEdgeInfo
@ -244,16 +253,16 @@ public:
const List<Type>& changedEdgesInfo const List<Type>& changedEdgesInfo
); );
//- Propagate from edge to face. Returns total number of faces //- Propagate from edge to face.
// (over all processors) changed. // \return total number of faces (over all processors) changed.
label edgeToFace(); label edgeToFace();
//- Propagate from face to edge. Returns total number of edges //- Propagate from face to edge.
// (over all processors) changed. // \return total number of edges (over all processors) changed.
label faceToEdge(); label faceToEdge();
//- Iterate until no changes or maxIter reached. Returns actual //- Iterate until no changes or maxIter reached.
// number of iterations. // \return actual number of iterations.
label iterate(const label maxIter); label iterate(const label maxIter);
}; };
@ -276,6 +285,7 @@ class updateOp
TrackingData& td_; TrackingData& td_;
public: public:
updateOp updateOp
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -316,6 +326,7 @@ class transformOp
TrackingData& td_; TrackingData& td_;
public: public:
transformOp transformOp
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -31,7 +31,7 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(PatchEdgeFaceWaveName, 0); defineTypeNameAndDebug(PatchEdgeFaceWaveName, 0);
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,25 +28,25 @@ License
#include "patchEdgeFaceInfo.H" #include "patchEdgeFaceInfo.H"
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<< Foam::Ostream& Foam::operator<<
( (
Foam::Ostream& os, Ostream& os,
const Foam::patchEdgeFaceInfo& wDist const patchEdgeFaceInfo& rhs
) )
{ {
return os << wDist.origin() << wDist.distSqr(); return os << rhs.origin() << rhs.distSqr();
} }
Foam::Istream& Foam::operator>> Foam::Istream& Foam::operator>>
( (
Foam::Istream& is, Istream& is,
Foam::patchEdgeFaceInfo& wDist patchEdgeFaceInfo& rhs
) )
{ {
return is >> wDist.origin_ >> wDist.distSqr_; return is >> rhs.origin_ >> rhs.distSqr_;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -58,14 +58,13 @@ class patchEdgeFaceInfo;
Istream& operator>>(Istream&, patchEdgeFaceInfo&); Istream& operator>>(Istream&, patchEdgeFaceInfo&);
Ostream& operator<<(Ostream&, const patchEdgeFaceInfo&); Ostream& operator<<(Ostream&, const patchEdgeFaceInfo&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class patchEdgeFaceInfo Declaration Class patchEdgeFaceInfo Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class patchEdgeFaceInfo class patchEdgeFaceInfo
{ {
// Private data // Private Data
//- Position of nearest wall center //- Position of nearest wall center
point origin_; point origin_;
@ -76,9 +75,9 @@ class patchEdgeFaceInfo
// Private Member Functions // Private Member Functions
//- Evaluate distance to point. Update distSqr, origin from whomever //- Evaluate distance to point.
// is nearer pt. Return true if w2 is closer to point, // Update distSqr, origin from whomever is nearer pt.
// false otherwise. // \return true if w2 is closer to point, false otherwise.
template<class TrackingData> template<class TrackingData>
inline bool update inline bool update
( (
@ -103,29 +102,31 @@ public:
// Constructors // Constructors
//- Construct null //- Default construct
inline patchEdgeFaceInfo(); inline patchEdgeFaceInfo();
//- Construct from origin, distance //- Construct from origin, distance squared
inline patchEdgeFaceInfo(const point&, const scalar); inline patchEdgeFaceInfo(const point& origin, const scalar distSqr);
//- Construct as copy
inline patchEdgeFaceInfo(const patchEdgeFaceInfo&);
// Member Functions // Member Functions
// Access // Access
inline const point& origin() const; const point& origin() const
{
return origin_;
}
inline scalar distSqr() const; scalar distSqr() const
{
return distSqr_;
}
// Needed by meshWave // Needed by MeshWave
//- Check whether origin has been changed at all or //- Changed or contains original (invalid) value
// still contains original (invalid) value.
template<class TrackingData> template<class TrackingData>
inline bool valid(TrackingData& td) const; inline bool valid(TrackingData& td) const;
@ -178,15 +179,17 @@ public:
TrackingData& td TrackingData& td
); );
//- Same (like operator==) //- Test for equality, with TrackingData
template<class TrackingData> template<class TrackingData>
inline bool equal(const patchEdgeFaceInfo&, TrackingData& td) const; inline bool equal(const patchEdgeFaceInfo&, TrackingData& td) const;
// Member Operators // Member Operators
// Needed for List IO //- Test for equality
inline bool operator==(const patchEdgeFaceInfo&) const; inline bool operator==(const patchEdgeFaceInfo&) const;
//- Test for inequality
inline bool operator!=(const patchEdgeFaceInfo&) const; inline bool operator!=(const patchEdgeFaceInfo&) const;

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -40,7 +41,7 @@ inline bool Foam::patchEdgeFaceInfo::update
TrackingData& td TrackingData& td
) )
{ {
scalar dist2 = magSqr(pt - w2.origin()); const scalar dist2 = magSqr(pt - w2.origin());
if (!valid(td)) if (!valid(td))
{ {
@ -51,7 +52,7 @@ inline bool Foam::patchEdgeFaceInfo::update
return true; return true;
} }
scalar diff = distSqr_ - dist2; const scalar diff = distSqr_ - dist2;
if (diff < 0) if (diff < 0)
{ {
@ -93,7 +94,7 @@ inline bool Foam::patchEdgeFaceInfo::update
return true; return true;
} }
scalar diff = distSqr_ - w2.distSqr(); const scalar diff = distSqr_ - w2.distSqr();
if (diff < 0) if (diff < 0)
{ {
@ -119,15 +120,12 @@ inline bool Foam::patchEdgeFaceInfo::update
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor
inline Foam::patchEdgeFaceInfo::patchEdgeFaceInfo() inline Foam::patchEdgeFaceInfo::patchEdgeFaceInfo()
: :
origin_(point::max), patchEdgeFaceInfo(point::max, sqr(GREAT))
distSqr_(sqr(GREAT))
{} {}
// Construct from origin, distance
inline Foam::patchEdgeFaceInfo::patchEdgeFaceInfo inline Foam::patchEdgeFaceInfo::patchEdgeFaceInfo
( (
const point& origin, const point& origin,
@ -139,28 +137,8 @@ inline Foam::patchEdgeFaceInfo::patchEdgeFaceInfo
{} {}
// Construct as copy
inline Foam::patchEdgeFaceInfo::patchEdgeFaceInfo(const patchEdgeFaceInfo& wpt)
:
origin_(wpt.origin()),
distSqr_(wpt.distSqr())
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::point& Foam::patchEdgeFaceInfo::origin() const
{
return origin_;
}
inline Foam::scalar Foam::patchEdgeFaceInfo::distSqr() const
{
return distSqr_;
}
template<class TrackingData> template<class TrackingData>
inline bool Foam::patchEdgeFaceInfo::valid(TrackingData& td) const inline bool Foam::patchEdgeFaceInfo::valid(TrackingData& td) const
{ {
@ -195,11 +173,13 @@ inline bool Foam::patchEdgeFaceInfo::updateEdge
) )
{ {
const edge& e = patch.edges()[edgeI]; const edge& e = patch.edges()[edgeI];
point eMid = const point eMid
(
0.5 0.5
* ( * (
patch.points()[patch.meshPoints()[e[0]]] patch.points()[patch.meshPoints()[e[0]]]
+ patch.points()[patch.meshPoints()[e[1]]] + patch.points()[patch.meshPoints()[e[1]]]
)
); );
return update(eMid, faceInfo, tol, td); return update(eMid, faceInfo, tol, td);
} }
@ -251,10 +231,10 @@ inline bool Foam::patchEdgeFaceInfo::equal
inline bool Foam::patchEdgeFaceInfo::operator== inline bool Foam::patchEdgeFaceInfo::operator==
( (
const Foam::patchEdgeFaceInfo& rhs const patchEdgeFaceInfo& rhs
) const ) const
{ {
return origin() == rhs.origin(); return origin_ == rhs.origin_;
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2013 OpenFOAM Foundation Copyright (C) 2012-2013 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,25 +28,25 @@ License
#include "patchEdgeFaceRegion.H" #include "patchEdgeFaceRegion.H"
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<< Foam::Ostream& Foam::operator<<
( (
Foam::Ostream& os, Ostream& os,
const Foam::patchEdgeFaceRegion& wDist const patchEdgeFaceRegion& rhs
) )
{ {
return os << wDist.region_; return os << rhs.region_;
} }
Foam::Istream& Foam::operator>> Foam::Istream& Foam::operator>>
( (
Foam::Istream& is, Istream& is,
Foam::patchEdgeFaceRegion& wDist patchEdgeFaceRegion& rhs
) )
{ {
return is >> wDist.region_; return is >> rhs.region_;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -67,15 +67,16 @@ Ostream& operator<<(Ostream&, const patchEdgeFaceRegion&);
class patchEdgeFaceRegion class patchEdgeFaceRegion
{ {
// Private data // Private Data
//- region //- The region
label region_; label region_;
// Private Member Functions // Private Member Functions
//- Combine current with w2. Update region_ if w2 has smaller //- Combine current with w2.
// quantities and returns true. // Update region_ if w2 has smaller quantities and return true.
template<class TrackingData> template<class TrackingData>
inline bool update inline bool update
( (
@ -89,24 +90,26 @@ public:
// Constructors // Constructors
//- Construct null //- Default construct
inline patchEdgeFaceRegion(); inline patchEdgeFaceRegion();
//- Construct from origin, distance //- Construct from region
inline patchEdgeFaceRegion(const label); inline patchEdgeFaceRegion(const label regioni);
// Member Functions // Member Functions
// Access // Access
inline label region() const; label region() const
{
return region_;
}
// Needed by meshWave // Needed by MeshWave
//- Check whether origin has been changed at all or //- Changed or contains original (invalid) value
// still contains original (invalid) value.
template<class TrackingData> template<class TrackingData>
inline bool valid(TrackingData& td) const; inline bool valid(TrackingData& td) const;
@ -159,15 +162,17 @@ public:
TrackingData& td TrackingData& td
); );
//- Same (like operator==) //- Test for equality, with TrackingData
template<class TrackingData> template<class TrackingData>
inline bool equal(const patchEdgeFaceRegion&, TrackingData&) const; inline bool equal(const patchEdgeFaceRegion&, TrackingData&) const;
// Member Operators // Member Operators
// Needed for List IO //- Test for equality
inline bool operator==(const patchEdgeFaceRegion&) const; inline bool operator==(const patchEdgeFaceRegion&) const;
//- Test for inequality
inline bool operator!=(const patchEdgeFaceRegion&) const; inline bool operator!=(const patchEdgeFaceRegion&) const;

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -74,31 +75,23 @@ inline bool Foam::patchEdgeFaceRegion::update
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor
inline Foam::patchEdgeFaceRegion::patchEdgeFaceRegion() inline Foam::patchEdgeFaceRegion::patchEdgeFaceRegion()
: :
region_(-1) region_(-1)
{} {}
// Construct from origin, distance
inline Foam::patchEdgeFaceRegion::patchEdgeFaceRegion inline Foam::patchEdgeFaceRegion::patchEdgeFaceRegion
( (
const label region const label regioni
) )
: :
region_(region) region_(regioni)
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::label Foam::patchEdgeFaceRegion::region() const
{
return region_;
}
template<class TrackingData> template<class TrackingData>
inline bool Foam::patchEdgeFaceRegion::valid(TrackingData& td) const inline bool Foam::patchEdgeFaceRegion::valid(TrackingData& td) const
{ {
@ -180,16 +173,16 @@ inline bool Foam::patchEdgeFaceRegion::equal
inline bool Foam::patchEdgeFaceRegion::operator== inline bool Foam::patchEdgeFaceRegion::operator==
( (
const Foam::patchEdgeFaceRegion& rhs const patchEdgeFaceRegion& rhs
) const ) const
{ {
return region() == rhs.region(); return region_ == rhs.region_;
} }
inline bool Foam::patchEdgeFaceRegion::operator!= inline bool Foam::patchEdgeFaceRegion::operator!=
( (
const Foam::patchEdgeFaceRegion& rhs const patchEdgeFaceRegion& rhs
) const ) const
{ {
return !(*this == rhs); return !(*this == rhs);

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2013 OpenFOAM Foundation Copyright (C) 2012-2013 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,25 +28,25 @@ License
#include "patchEdgeFaceRegions.H" #include "patchEdgeFaceRegions.H"
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<< Foam::Ostream& Foam::operator<<
( (
Foam::Ostream& os, Ostream& os,
const Foam::patchEdgeFaceRegions& wDist const patchEdgeFaceRegions& rhs
) )
{ {
return os << wDist.regions_; return os << rhs.regions();
} }
Foam::Istream& Foam::operator>> Foam::Istream& Foam::operator>>
( (
Foam::Istream& is, Istream& is,
Foam::patchEdgeFaceRegions& wDist patchEdgeFaceRegions& rhs
) )
{ {
return is >> wDist.regions_; return is >> rhs.regions();
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -50,25 +51,19 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes // Forward Declarations
class polyMesh; class polyMesh;
// Forward declaration of friend functions and operators
class patchEdgeFaceRegions; class patchEdgeFaceRegions;
Istream& operator>>(Istream&, patchEdgeFaceRegions&); Istream& operator>>(Istream&, patchEdgeFaceRegions&);
Ostream& operator<<(Ostream&, const patchEdgeFaceRegions&); Ostream& operator<<(Ostream&, const patchEdgeFaceRegions&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class patchEdgeFaceRegions Declaration Class patchEdgeFaceRegions Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class patchEdgeFaceRegions class patchEdgeFaceRegions
{ {
// Private data // Private Data
//- Region per point //- Region per point
labelList regions_; labelList regions_;
@ -77,27 +72,33 @@ public:
// Constructors // Constructors
//- Construct null //- Default construct
inline patchEdgeFaceRegions(); inline patchEdgeFaceRegions();
//- Construct from regions //- Construct from regions
inline patchEdgeFaceRegions(const labelList&); inline patchEdgeFaceRegions(const labelList& regions);
//- Construct from regions (on edge) //- Construct from regions (on edge)
inline patchEdgeFaceRegions(const labelPair&); inline patchEdgeFaceRegions(const labelPair& regions);
// Member Functions // Member Functions
// Access // Access
inline const labelList& regions() const; const labelList& regions() const
{
return regions_;
}
labelList& regions()
{
return regions_;
}
// Needed by meshWave // Needed by MeshWave
//- Check whether origin has been changed at all or //- Changed or contains original (invalid) value
// still contains original (invalid) value.
template<class TrackingData> template<class TrackingData>
inline bool valid(TrackingData& td) const; inline bool valid(TrackingData& td) const;
@ -150,15 +151,17 @@ public:
TrackingData& td TrackingData& td
); );
//- Same (like operator==) //- Test for equality, with TrackingData
template<class TrackingData> template<class TrackingData>
inline bool equal(const patchEdgeFaceRegions&, TrackingData&) const; inline bool equal(const patchEdgeFaceRegions&, TrackingData&) const;
// Member Operators // Member Operators
// Needed for List IO //- Test for equality
inline bool operator==(const patchEdgeFaceRegions&) const; inline bool operator==(const patchEdgeFaceRegions&) const;
//- Test for inequality
inline bool operator!=(const patchEdgeFaceRegions&) const; inline bool operator!=(const patchEdgeFaceRegions&) const;

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -56,12 +57,6 @@ inline Foam::patchEdgeFaceRegions::patchEdgeFaceRegions
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::labelList& Foam::patchEdgeFaceRegions::regions() const
{
return regions_;
}
template<class TrackingData> template<class TrackingData>
inline bool Foam::patchEdgeFaceRegions::valid(TrackingData& td) const inline bool Foam::patchEdgeFaceRegions::valid(TrackingData& td) const
{ {
@ -265,16 +260,16 @@ inline bool Foam::patchEdgeFaceRegions::equal
inline bool Foam::patchEdgeFaceRegions::operator== inline bool Foam::patchEdgeFaceRegions::operator==
( (
const Foam::patchEdgeFaceRegions& rhs const patchEdgeFaceRegions& rhs
) const ) const
{ {
return regions() == rhs.regions(); return regions_ == rhs.regions_;
} }
inline bool Foam::patchEdgeFaceRegions::operator!= inline bool Foam::patchEdgeFaceRegions::operator!=
( (
const Foam::patchEdgeFaceRegions& rhs const patchEdgeFaceRegions& rhs
) const ) const
{ {
return !(*this == rhs); return !(*this == rhs);

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,30 +28,38 @@ License
#include "PointData.H" #include "PointData.H"
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class DataType> template<class T>
Foam::Ostream& Foam::operator<<(Ostream& os, const PointData<DataType>& pd) Foam::Ostream& Foam::operator<<
(
Ostream& os,
const PointData<T>& rhs
)
{ {
if (os.format() == IOstream::ASCII) if (os.format() == IOstream::ASCII)
{ {
return os return os
<< static_cast<const pointEdgePoint&>(pd) << static_cast<const pointEdgePoint&>(rhs)
<< token::SPACE << pd.data(); << token::SPACE << rhs.data();
} }
else else
{ {
return os return os
<< static_cast<const pointEdgePoint&>(pd) << static_cast<const pointEdgePoint&>(rhs)
<< pd.data(); << rhs.data();
} }
} }
template<class DataType> template<class T>
Foam::Istream& Foam::operator>>(Istream& is, PointData<DataType>& pd) Foam::Istream& Foam::operator>>
(
Istream& is,
PointData<T>& rhs
)
{ {
return is >> static_cast<pointEdgePoint&>(pd) >> pd.data_; return is >> static_cast<pointEdgePoint&>(rhs) >> rhs.data();
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -66,7 +66,7 @@ class PointData
: :
public pointEdgePoint public pointEdgePoint
{ {
// Private data // Private Data
//- Additional transported data //- Additional transported data
DataType data_; DataType data_;
@ -76,7 +76,7 @@ public:
// Constructors // Constructors
//- Construct null //- Default construct
inline PointData(); inline PointData();
//- Construct from origin, distance and data //- Construct from origin, distance and data
@ -87,19 +87,22 @@ public:
const DataType& data const DataType& data
); );
//- Construct as copy
inline PointData(const PointData&);
// Member Functions // Member Functions
// Access // Access
//- Const access the data const DataType& data() const
inline const DataType& data() const; {
return data_;
}
DataType& data()
{
return data_;
}
// Needed by meshWave // Needed by MeshWave
//- Apply rotation matrix to the data //- Apply rotation matrix to the data
template<class TrackingData> template<class TrackingData>
@ -155,9 +158,13 @@ public:
TrackingData& td TrackingData& td
); );
// Member Operators // Member Operators
//- Test for equality
inline bool operator==(const PointData<DataType>&) const; inline bool operator==(const PointData<DataType>&) const;
//- Test for inequality
inline bool operator!=(const PointData<DataType>&) const; inline bool operator!=(const PointData<DataType>&) const;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -51,23 +51,8 @@ inline Foam::PointData<DataType>::PointData
{} {}
template<class DataType>
inline Foam::PointData<DataType>::PointData(const PointData<DataType>& wpt)
:
pointEdgePoint(wpt),
data_(wpt.data())
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class DataType>
inline const DataType& Foam::PointData<DataType>::data() const
{
return data_;
}
template<class DataType> template<class DataType>
template<class TrackingData> template<class TrackingData>
inline void Foam::PointData<DataType>::transform inline void Foam::PointData<DataType>::transform
@ -207,9 +192,8 @@ inline bool Foam::PointData<DataType>::updateEdge
template<class DataType> template<class DataType>
inline bool Foam::PointData<DataType>::operator== inline bool Foam::PointData<DataType>::operator==
( (
const Foam::PointData<DataType>& rhs const PointData<DataType>& rhs
) ) const
const
{ {
return pointEdgePoint::operator==(rhs) && (data() == rhs.data()); return pointEdgePoint::operator==(rhs) && (data() == rhs.data());
} }
@ -218,9 +202,8 @@ const
template<class DataType> template<class DataType>
inline bool Foam::PointData<DataType>::operator!= inline bool Foam::PointData<DataType>::operator!=
( (
const Foam::PointData<DataType>& rhs const PointData<DataType>& rhs
) ) const
const
{ {
return !(*this == rhs); return !(*this == rhs);
} }

View File

@ -54,6 +54,7 @@ namespace Foam
TrackingData& td_; TrackingData& td_;
public: public:
combineEqOp(TrackingData& td) combineEqOp(TrackingData& td)
: :
td_(td) td_(td)
@ -705,16 +706,8 @@ Foam::PointEdgeWave<Type, TrackingData>::PointEdgeWave
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type, class TrackingData>
Foam::PointEdgeWave<Type, TrackingData>::~PointEdgeWave()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type, class TrackingData> template<class Type, class TrackingData>
Foam::label Foam::PointEdgeWave<Type, TrackingData>::nUnvisitedPoints() const Foam::label Foam::PointEdgeWave<Type, TrackingData>::nUnvisitedPoints() const
{ {

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -69,7 +70,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes // Forward Declarations
class polyMesh; class polyMesh;
class polyPatch; class polyPatch;
@ -89,19 +90,18 @@ class PointEdgeWave
: :
public PointEdgeWaveName public PointEdgeWaveName
{ {
// Private static data // Private Static Data
//- Relative tolerance. Stop propagation if relative changes //- Relative tolerance. Stop propagation if relative changes
// less than this tolerance (responsibility for checking this is // less than this tolerance (responsibility for checking this is
// up to Type implementation) // up to Type implementation)
static scalar propagationTol_; static scalar propagationTol_;
//- Used as default trackdata value to satisfy default template //- Default trackdata value to satisfy default template argument.
// argument.
static int dummyTrackData_; static int dummyTrackData_;
// Private data // Private Data
//- Reference to mesh //- Reference to mesh
const polyMesh& mesh_; const polyMesh& mesh_;
@ -167,8 +167,8 @@ class PointEdgeWave
List<Type>& pointInfo List<Type>& pointInfo
) const; ) const;
//- Updates pointInfo with information from neighbour. Updates all //- Updates pointInfo with information from neighbour.
// statistics. // Updates all statistics.
bool updatePoint bool updatePoint
( (
const label pointi, const label pointi,
@ -177,8 +177,8 @@ class PointEdgeWave
Type& pointInfo Type& pointInfo
); );
//- Updates pointInfo with information from same point. Updates all //- Updates pointInfo with information from same point.
// statistics. // Updates all statistics.
bool updatePoint bool updatePoint
( (
const label pointi, const label pointi,
@ -186,8 +186,8 @@ class PointEdgeWave
Type& pointInfo Type& pointInfo
); );
//- Updates edgeInfo with information from neighbour. Updates all //- Updates edgeInfo with information from neighbour.
// statistics. // Updates all statistics.
bool updateEdge bool updateEdge
( (
const label edgeI, const label edgeI,
@ -196,6 +196,7 @@ class PointEdgeWave
Type& edgeInfo Type& edgeInfo
); );
// Parallel, cyclic // Parallel, cyclic
//- Has patches of certain type? //- Has patches of certain type?
@ -266,7 +267,7 @@ public:
//- Destructor //- Destructor
~PointEdgeWave(); ~PointEdgeWave() = default;
// Member Functions // Member Functions
@ -336,6 +337,7 @@ class listUpdateOp
TrackingData& td_; TrackingData& td_;
public: public:
listUpdateOp(const scalar tol, TrackingData& td) listUpdateOp(const scalar tol, TrackingData& td)
: :
tol_(tol), tol_(tol),

View File

@ -31,7 +31,7 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(PointEdgeWaveName, 0); defineTypeNameAndDebug(PointEdgeWaveName, 0);
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,21 +28,25 @@ License
#include "pointEdgePoint.H" #include "pointEdgePoint.H"
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<< Foam::Ostream& Foam::operator<<
( (
Foam::Ostream& os, Ostream& os,
const Foam::pointEdgePoint& wDist const pointEdgePoint& rhs
) )
{ {
return os << wDist.origin() << wDist.distSqr(); return os << rhs.origin() << rhs.distSqr();
} }
Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::pointEdgePoint& wDist) Foam::Istream& Foam::operator>>
(
Istream& is,
pointEdgePoint& rhs
)
{ {
return is >> wDist.origin_ >> wDist.distSqr_; return is >> rhs.origin() >> rhs.distSqr();
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -60,14 +60,13 @@ class pointEdgePoint;
Istream& operator>>(Istream&, pointEdgePoint&); Istream& operator>>(Istream&, pointEdgePoint&);
Ostream& operator<<(Ostream&, const pointEdgePoint&); Ostream& operator<<(Ostream&, const pointEdgePoint&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class pointEdgePoint Declaration Class pointEdgePoint Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class pointEdgePoint class pointEdgePoint
{ {
// Private data // Private Data
//- Position of nearest wall center //- Position of nearest wall center
point origin_; point origin_;
@ -78,9 +77,9 @@ class pointEdgePoint
// Private Member Functions // Private Member Functions
//- Evaluate distance to point. Update distSqr, origin from whomever //- Evaluate distance to point.
// is nearer pt. Return true if w2 is closer to point, // Update distSqr, origin from whomever is nearer pt.
// false otherwise. // \return true if w2 is closer to point, false otherwise.
template<class TrackingData> template<class TrackingData>
inline bool update inline bool update
( (
@ -105,33 +104,43 @@ public:
// Constructors // Constructors
//- Construct null //- Default construct
inline pointEdgePoint(); inline pointEdgePoint();
//- Construct from origin, distance //- Construct from origin, distance
inline pointEdgePoint(const point&, const scalar); inline pointEdgePoint(const point& origin, const scalar distSqr);
//- Construct as copy
inline pointEdgePoint(const pointEdgePoint&);
// Member Functions // Member Functions
// Access // Access
inline const point& origin() const; const point& origin() const
{
return origin_;
}
point& origin()
{
return origin_;
}
inline scalar distSqr() const; scalar distSqr() const
{
return distSqr_;
}
scalar& distSqr()
{
return distSqr_;
}
// Needed by PointEdgeWave // Needed by PointEdgeWave
//- Check whether origin has been changed at all or //- Changed or contains original (invalid) value
// still contains original (invalid) value.
template<class TrackingData> template<class TrackingData>
inline bool valid(TrackingData& td) const; inline bool valid(TrackingData& td) const;
//- Check for identical geometrical data. Used for cyclics checking. //- Check for identical geometrical data (eg, cyclics checking)
template<class TrackingData> template<class TrackingData>
inline bool sameGeometry inline bool sameGeometry
( (
@ -215,15 +224,17 @@ public:
TrackingData& td TrackingData& td
); );
//- Same (like operator==) //- Test for equality, with TrackingData
template<class TrackingData> template<class TrackingData>
inline bool equal(const pointEdgePoint&, TrackingData& td) const; inline bool equal(const pointEdgePoint&, TrackingData& td) const;
// Member Operators // Member Operators
// Needed for List IO //- Test for equality
inline bool operator==(const pointEdgePoint&) const; inline bool operator==(const pointEdgePoint&) const;
//- Test for inequality
inline bool operator!=(const pointEdgePoint&) const; inline bool operator!=(const pointEdgePoint&) const;

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -40,7 +41,7 @@ inline bool Foam::pointEdgePoint::update
TrackingData& td TrackingData& td
) )
{ {
scalar dist2 = magSqr(pt - w2.origin()); const scalar dist2 = magSqr(pt - w2.origin());
if (!valid(td)) if (!valid(td))
{ {
@ -51,7 +52,7 @@ inline bool Foam::pointEdgePoint::update
return true; return true;
} }
scalar diff = distSqr_ - dist2; const scalar diff = distSqr_ - dist2;
if (diff < 0) if (diff < 0)
{ {
@ -93,7 +94,7 @@ inline bool Foam::pointEdgePoint::update
return true; return true;
} }
scalar diff = distSqr_ - w2.distSqr(); const scalar diff = distSqr_ - w2.distSqr();
if (diff < 0) if (diff < 0)
{ {
@ -119,7 +120,6 @@ inline bool Foam::pointEdgePoint::update
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor
inline Foam::pointEdgePoint::pointEdgePoint() inline Foam::pointEdgePoint::pointEdgePoint()
: :
origin_(point::max), origin_(point::max),
@ -127,7 +127,6 @@ inline Foam::pointEdgePoint::pointEdgePoint()
{} {}
// Construct from origin, distance
inline Foam::pointEdgePoint::pointEdgePoint inline Foam::pointEdgePoint::pointEdgePoint
( (
const point& origin, const point& origin,
@ -139,28 +138,8 @@ inline Foam::pointEdgePoint::pointEdgePoint
{} {}
// Construct as copy
inline Foam::pointEdgePoint::pointEdgePoint(const pointEdgePoint& wpt)
:
origin_(wpt.origin()),
distSqr_(wpt.distSqr())
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::point& Foam::pointEdgePoint::origin() const
{
return origin_;
}
inline Foam::scalar Foam::pointEdgePoint::distSqr() const
{
return distSqr_;
}
template<class TrackingData> template<class TrackingData>
inline bool Foam::pointEdgePoint::valid(TrackingData& td) const inline bool Foam::pointEdgePoint::valid(TrackingData& td) const
{ {
@ -177,7 +156,7 @@ inline bool Foam::pointEdgePoint::sameGeometry
TrackingData& td TrackingData& td
) const ) const
{ {
scalar diff = Foam::mag(distSqr() - w2.distSqr()); const scalar diff = Foam::mag(distSqr() - w2.distSqr());
if (diff < SMALL) if (diff < SMALL)
{ {
@ -311,15 +290,19 @@ inline bool Foam::pointEdgePoint::equal
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline bool Foam::pointEdgePoint::operator==(const Foam::pointEdgePoint& rhs) inline bool Foam::pointEdgePoint::operator==
const (
const pointEdgePoint& rhs
) const
{ {
return (origin() == rhs.origin()) && (distSqr() == rhs.distSqr()); return origin_ == rhs.origin_ && distSqr_ == rhs.distSqr_;
} }
inline bool Foam::pointEdgePoint::operator!=(const Foam::pointEdgePoint& rhs) inline bool Foam::pointEdgePoint::operator!=
const (
const pointEdgePoint& rhs
) const
{ {
return !(*this == rhs); return !(*this == rhs);
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,17 +28,26 @@ License
#include "cellInfo.H" #include "cellInfo.H"
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // Foam::Ostream& Foam::operator<<
(
Foam::Ostream& Foam::operator<<(Foam::Ostream& os, const Foam::cellInfo& wDist) Ostream& os,
const cellInfo& rhs
)
{ {
return os << wDist.type_; return os << rhs.type();
} }
Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::cellInfo& wDist)
Foam::Istream& Foam::operator>>
(
Istream& is,
cellInfo& rhs
)
{ {
return is >> wDist.type_; return is >> rhs.type();
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -64,16 +64,15 @@ Ostream& operator<<(Ostream&, const cellInfo&);
class cellInfo class cellInfo
{ {
// Private data // Private Data
label type_; label type_;
// Private Member Functions // Private Member Functions
//- Update current cell/face type with neighbouring //- Update current cell/face type with neighbouring type.
// type. Return true if information needs to propagate, // \return true if information needs to propagate, false otherwise.
// false otherwise.
template<class TrackingData> template<class TrackingData>
inline bool update inline bool update
( (
@ -85,38 +84,39 @@ class cellInfo
TrackingData& td TrackingData& td
); );
public: public:
// Constructors // Constructors
//- Construct null //- Default construct - as cellClassification::NOTSET
inline cellInfo(); inline cellInfo();
//- Construct from cType //- Construct from cellClassification type
inline cellInfo(const label); inline explicit cellInfo(const label ctype);
//- Construct as copy
inline cellInfo(const cellInfo&);
// Member Functions // Member Functions
// Access // Access
inline label type() const label type() const
{
return type_;
}
label& type()
{ {
return type_; return type_;
} }
// Needed by meshWave // Needed by MeshWave
//- Check whether origin has been changed at all or //- Changed or contains original (invalid) value
// still contains original (invalid) value.
template<class TrackingData> template<class TrackingData>
inline bool valid(TrackingData& td) const; inline bool valid(TrackingData& td) const;
//- Check for identical geometrical data. Used for cyclics checking. //- Check for identical geometrical data (eg, cyclics checking)
template<class TrackingData> template<class TrackingData>
inline bool sameGeometry inline bool sameGeometry
( (
@ -193,15 +193,17 @@ public:
TrackingData& td TrackingData& td
); );
//- Same (like operator==) //- Test for equality, with TrackingData
template<class TrackingData> template<class TrackingData>
inline bool equal(const cellInfo&, TrackingData& td) const; inline bool equal(const cellInfo&, TrackingData& td) const;
// Member Operators // Member Operators
//Note: Used to determine whether to call update. //- Test for equality
inline bool operator==(const cellInfo&) const; inline bool operator==(const cellInfo&) const;
//- Test for inequality
inline bool operator!=(const cellInfo&) const; inline bool operator!=(const cellInfo&) const;

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -94,24 +95,15 @@ inline bool Foam::cellInfo::update
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor
inline Foam::cellInfo::cellInfo() inline Foam::cellInfo::cellInfo()
: :
type_(cellClassification::NOTSET) type_(cellClassification::NOTSET)
{} {}
// Construct from components inline Foam::cellInfo::cellInfo(const label ctype)
inline Foam::cellInfo::cellInfo(const label type)
: :
type_(type) type_(ctype)
{}
// Construct as copy
inline Foam::cellInfo::cellInfo(const cellInfo& w2)
:
type_(w2.type())
{} {}
@ -132,8 +124,7 @@ inline bool Foam::cellInfo::sameGeometry
const cellInfo& w2, const cellInfo& w2,
const scalar tol, const scalar tol,
TrackingData& td TrackingData& td
) ) const
const
{ {
return true; return true;
} }
@ -223,6 +214,7 @@ inline bool Foam::cellInfo::updateFace
); );
} }
// Update this with neighbour information // Update this with neighbour information
template<class TrackingData> template<class TrackingData>
inline bool Foam::cellInfo::updateFace inline bool Foam::cellInfo::updateFace
@ -259,13 +251,19 @@ inline bool Foam::cellInfo::equal
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline bool Foam::cellInfo::operator==(const Foam::cellInfo& rhs) const inline bool Foam::cellInfo::operator==
(
const cellInfo& rhs
) const
{ {
return type() == rhs.type(); return type_ == rhs.type_;
} }
inline bool Foam::cellInfo::operator!=(const Foam::cellInfo& rhs) const inline bool Foam::cellInfo::operator!=
(
const cellInfo& rhs
) const
{ {
return !(*this == rhs); return !(*this == rhs);
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2013 OpenFOAM Foundation Copyright (C) 2011-2013 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,16 +28,26 @@ License
#include "wallPoint.H" #include "wallPoint.H"
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Foam::Ostream& os, const Foam::wallPoint& wDist) Foam::Ostream& Foam::operator<<
(
Ostream& os,
const wallPoint& rhs
)
{ {
return os << wDist.origin() << token::SPACE << wDist.distSqr(); return os << rhs.origin() << token::SPACE << rhs.distSqr();
} }
Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::wallPoint& wDist)
Foam::Istream& Foam::operator>>
(
Istream& is,
wallPoint& rhs
)
{ {
return is >> wDist.origin() >> wDist.distSqr(); return is >> rhs.origin() >> rhs.distSqr();
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -76,9 +76,9 @@ class wallPoint
// Private Member Functions // Private Member Functions
//- Evaluate distance to point. Update distSqr, origin from whomever //- Evaluate distance to point.
// is nearer pt. Return true if w2 is closer to point, // Update distSqr, origin from whomever is nearer pt.
// false otherwise. // \return true if w2 is closer to point, false otherwise.
template<class TrackingData> template<class TrackingData>
inline bool update inline bool update
( (
@ -93,37 +93,43 @@ public:
// Constructors // Constructors
//- Construct null //- Default construct
inline wallPoint(); inline wallPoint();
//- Construct from origin, distance //- Construct from origin, distance-squared
inline wallPoint(const point& origin, const scalar distSqr); inline wallPoint(const point& origin, const scalar distSqr);
//- Construct as copy
inline wallPoint(const wallPoint&);
// Member Functions // Member Functions
// Access // Access
inline const point& origin() const; const point& origin() const
{
return origin_;
}
point& origin()
{
return origin_;
}
inline point& origin(); scalar distSqr() const
{
inline scalar distSqr() const; return distSqr_;
}
inline scalar& distSqr(); scalar& distSqr()
{
return distSqr_;
}
// Needed by FaceCellWave // Needed by FaceCellWave
//- Check whether origin has been changed at all or //- Changed or contains original (invalid) value
// still contains original (invalid) value.
template<class TrackingData> template<class TrackingData>
inline bool valid(TrackingData& td) const; inline bool valid(TrackingData& td) const;
//- Check for identical geometrical data. Used for cyclics checking. //- Check for identical geometrical data (eg, cyclics checking)
template<class TrackingData> template<class TrackingData>
inline bool sameGeometry inline bool sameGeometry
( (
@ -134,7 +140,7 @@ public:
) const; ) const;
//- Convert any absolute coordinates into relative to (patch)face //- Convert any absolute coordinates into relative to (patch)face
// centre //- centre
template<class TrackingData> template<class TrackingData>
inline void leaveDomain inline void leaveDomain
( (
@ -200,15 +206,17 @@ public:
TrackingData& td TrackingData& td
); );
//- Same (like operator==) //- Test for equality, with TrackingData
template<class TrackingData> template<class TrackingData>
inline bool equal(const wallPoint&, TrackingData& td) const; inline bool equal(const wallPoint&, TrackingData& td) const;
// Member Operators // Member Operators
// Needed for List IO //- Test for equality
inline bool operator==(const wallPoint&) const; inline bool operator==(const wallPoint&) const;
//- Test for inequality
inline bool operator!=(const wallPoint&) const; inline bool operator!=(const wallPoint&) const;

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2013 OpenFOAM Foundation Copyright (C) 2011-2013 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,40 +28,31 @@ License
#include "wallPointData.H" #include "wallPointData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
template<class Type> template<class Type>
Ostream& operator<< Foam::Ostream& Foam::operator<<
( (
Ostream& os, Ostream& os,
const wallPointData<Type>& wDist const wallPointData<Type>& rhs
) )
{ {
return os return os
<< static_cast<const wallPoint&>(wDist) << static_cast<const wallPoint&>(rhs)
<< token::SPACE << token::SPACE
<< wDist.data(); << rhs.data();
} }
template<class Type> template<class Type>
Istream& operator>> Foam::Istream& Foam::operator>>
( (
Istream& is, Istream& is,
wallPointData<Type>& wDist wallPointData<Type>& rhs
) )
{ {
return is >> static_cast<wallPoint&>(wDist) >> wDist.data_; return is >> static_cast<wallPoint&>(rhs) >> rhs.data_;
} }
// ************************************************************************* //
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -65,7 +65,7 @@ class wallPointData
: :
public wallPoint public wallPoint
{ {
// Private data // Private Data
//- Data at nearest wall center //- Data at nearest wall center
Type data_; Type data_;
@ -73,9 +73,9 @@ class wallPointData
// Private Member Functions // Private Member Functions
//- Evaluate distance to point. Update distSqr, origin from whomever //- Evaluate distance to point.
// is nearer pt. Return true if w2 is closer to point, // Update distSqr, origin from whomever is nearer pt.
// false otherwise. // \return true if w2 is closer to point, false otherwise.
template<class TrackingData> template<class TrackingData>
inline bool update inline bool update
( (
@ -88,12 +88,15 @@ class wallPointData
public: public:
// Public Typedefs
//- Type of additional data carried
typedef Type dataType; typedef Type dataType;
// Constructors // Constructors
//- Construct null //- Default construct
inline wallPointData(); inline wallPointData();
//- Construct from origin, normal, distance //- Construct from origin, normal, distance
@ -109,10 +112,17 @@ public:
// Access // Access
inline const Type& data() const; const Type& data() const
inline Type& data(); {
return data_;
}
Type& data()
{
return data_;
}
// Needed by meshWave
// Needed by MeshWave
//- Influence of neighbouring face. //- Influence of neighbouring face.
// Calls update(...) with cellCentre of celli // Calls update(...) with cellCentre of celli
@ -153,7 +163,6 @@ public:
TrackingData& td TrackingData& td
); );
// Member Operators
// IOstream Operators // IOstream Operators

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -25,17 +26,12 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Update this with w2 if w2 nearer to pt. // Update this with w2 if w2 nearer to pt.
template<class Type> template<class Type>
template<class TrackingData> template<class TrackingData>
inline bool wallPointData<Type>::update inline bool Foam::wallPointData<Type>::update
( (
const point& pt, const point& pt,
const wallPointData<Type>& w2, const wallPointData<Type>& w2,
@ -43,11 +39,11 @@ inline bool wallPointData<Type>::update
TrackingData& td TrackingData& td
) )
{ {
scalar dist2 = magSqr(pt - w2.origin()); const scalar dist2 = magSqr(pt - w2.origin());
if (valid(td)) if (valid(td))
{ {
scalar diff = distSqr() - dist2; const scalar diff = distSqr() - dist2;
if (diff < 0) if (diff < 0)
{ {
@ -76,18 +72,16 @@ inline bool wallPointData<Type>::update
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor
template<class Type> template<class Type>
inline wallPointData<Type>::wallPointData() inline Foam::wallPointData<Type>::wallPointData()
: :
wallPoint(), wallPoint(),
data_() data_()
{} {}
// Construct from components
template<class Type> template<class Type>
inline wallPointData<Type>::wallPointData inline Foam::wallPointData<Type>::wallPointData
( (
const point& origin, const point& origin,
const Type& data, const Type& data,
@ -101,24 +95,10 @@ inline wallPointData<Type>::wallPointData
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
inline const Type& wallPointData<Type>::data() const
{
return data_;
}
template<class Type>
inline Type& wallPointData<Type>::data()
{
return data_;
}
// Update this with w2 if w2 nearer to pt. // Update this with w2 if w2 nearer to pt.
template<class Type> template<class Type>
template<class TrackingData> template<class TrackingData>
inline bool wallPointData<Type>::updateCell inline bool Foam::wallPointData<Type>::updateCell
( (
const polyMesh& mesh, const polyMesh& mesh,
const label thisCelli, const label thisCelli,
@ -143,7 +123,7 @@ inline bool wallPointData<Type>::updateCell
// Update this with w2 if w2 nearer to pt. // Update this with w2 if w2 nearer to pt.
template<class Type> template<class Type>
template<class TrackingData> template<class TrackingData>
inline bool wallPointData<Type>::updateFace inline bool Foam::wallPointData<Type>::updateFace
( (
const polyMesh& mesh, const polyMesh& mesh,
const label thisFacei, const label thisFacei,
@ -168,7 +148,7 @@ inline bool wallPointData<Type>::updateFace
// Update this with w2 if w2 nearer to pt. // Update this with w2 if w2 nearer to pt.
template<class Type> template<class Type>
template<class TrackingData> template<class TrackingData>
inline bool wallPointData<Type>::updateFace inline bool Foam::wallPointData<Type>::updateFace
( (
const polyMesh& mesh, const polyMesh& mesh,
const label thisFacei, const label thisFacei,
@ -189,8 +169,4 @@ inline bool wallPointData<Type>::updateFace
} }
// ************************************************************************* //
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -47,7 +48,7 @@ inline bool Foam::wallPoint::update
// return false; // return false;
//} //}
scalar dist2 = magSqr(pt - w2.origin()); const scalar dist2 = magSqr(pt - w2.origin());
if (!valid(td)) if (!valid(td))
{ {
@ -58,7 +59,7 @@ inline bool Foam::wallPoint::update
return true; return true;
} }
scalar diff = distSqr_ - dist2; const scalar diff = distSqr_ - dist2;
if (diff < 0) if (diff < 0)
{ {
@ -98,39 +99,8 @@ inline Foam::wallPoint::wallPoint(const point& origin, const scalar distSqr)
{} {}
inline Foam::wallPoint::wallPoint(const wallPoint& wpt)
:
origin_(wpt.origin()),
distSqr_(wpt.distSqr())
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::point& Foam::wallPoint::origin() const
{
return origin_;
}
inline Foam::point& Foam::wallPoint::origin()
{
return origin_;
}
inline Foam::scalar Foam::wallPoint::distSqr() const
{
return distSqr_;
}
inline Foam::scalar& Foam::wallPoint::distSqr()
{
return distSqr_;
}
template<class TrackingData> template<class TrackingData>
inline bool Foam::wallPoint::valid(TrackingData& td) const inline bool Foam::wallPoint::valid(TrackingData& td) const
{ {
@ -148,7 +118,7 @@ inline bool Foam::wallPoint::sameGeometry
TrackingData& td TrackingData& td
) const ) const
{ {
scalar diff = mag(distSqr() - w2.distSqr()); const scalar diff = mag(distSqr() - w2.distSqr());
if (diff < SMALL) if (diff < SMALL)
{ {
@ -231,7 +201,7 @@ inline bool Foam::wallPoint::updateCell
tol, tol,
td td
); );
} }
// Update this with w2 if w2 nearer to pt. // Update this with w2 if w2 nearer to pt.
@ -256,6 +226,7 @@ inline bool Foam::wallPoint::updateFace
); );
} }
// Update this with w2 if w2 nearer to pt. // Update this with w2 if w2 nearer to pt.
template<class TrackingData> template<class TrackingData>
inline bool Foam::wallPoint::updateFace inline bool Foam::wallPoint::updateFace
@ -291,13 +262,19 @@ inline bool Foam::wallPoint::equal
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline bool Foam::wallPoint::operator==(const Foam::wallPoint& rhs) const inline bool Foam::wallPoint::operator==
(
const wallPoint& rhs
) const
{ {
return origin() == rhs.origin(); return origin_ == rhs.origin_;
} }
inline bool Foam::wallPoint::operator!=(const Foam::wallPoint& rhs) const inline bool Foam::wallPoint::operator!=
(
const wallPoint& rhs
) const
{ {
return !(*this == rhs); return !(*this == rhs);
} }

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013 OpenFOAM Foundation Copyright (C) 2013 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,25 +28,25 @@ License
#include "pointTopoDistanceData.H" #include "pointTopoDistanceData.H"
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<< Foam::Ostream& Foam::operator<<
( (
Foam::Ostream& os, Ostream& os,
const Foam::pointTopoDistanceData& wDist const pointTopoDistanceData& rhs
) )
{ {
return os << wDist.data_ << token::SPACE << wDist.distance_; return os << rhs.data_ << token::SPACE << rhs.distance_;
} }
Foam::Istream& Foam::operator>> Foam::Istream& Foam::operator>>
( (
Foam::Istream& is, Istream& is,
Foam::pointTopoDistanceData& wDist pointTopoDistanceData& rhs
) )
{ {
return is >> wDist.data_ >> wDist.distance_; return is >> rhs.data_ >> rhs.distance_;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -56,14 +56,13 @@ class pointTopoDistanceData;
Istream& operator>>(Istream&, pointTopoDistanceData&); Istream& operator>>(Istream&, pointTopoDistanceData&);
Ostream& operator<<(Ostream&, const pointTopoDistanceData&); Ostream& operator<<(Ostream&, const pointTopoDistanceData&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class pointTopoDistanceData Declaration Class pointTopoDistanceData Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class pointTopoDistanceData class pointTopoDistanceData
{ {
// Private data // Private Data
//- Starting data //- Starting data
label data_; label data_;
@ -76,7 +75,7 @@ public:
// Constructors // Constructors
//- Construct null with invalid (-1) for data and distance //- Default construct, with invalid (-1) for data and distance
inline pointTopoDistanceData(); inline pointTopoDistanceData();
//- Construct from components //- Construct from components
@ -91,11 +90,12 @@ public:
// Access // Access
inline label data() const label data() const
{ {
return data_; return data_;
} }
inline label distance() const
label distance() const
{ {
return distance_; return distance_;
} }
@ -103,13 +103,11 @@ public:
// Needed by PointEdgeWave // Needed by PointEdgeWave
//- Changed or contains original (invalid) value
//- Check whether origin has been changed at all or
// still contains original (invalid) value.
template<class TrackingData> template<class TrackingData>
inline bool valid(TrackingData& td) const; inline bool valid(TrackingData& td) const;
//- Check for identical geometrical data. Used for cyclics checking. //- Check for identical geometrical data (eg, cyclics checking)
template<class TrackingData> template<class TrackingData>
inline bool sameGeometry inline bool sameGeometry
( (
@ -193,7 +191,7 @@ public:
TrackingData& td TrackingData& td
); );
//- Same (like operator==) //- Test for equality, with TrackingData
template<class TrackingData> template<class TrackingData>
inline bool equal(const pointTopoDistanceData&, TrackingData&) inline bool equal(const pointTopoDistanceData&, TrackingData&)
const; const;
@ -201,8 +199,10 @@ public:
// Member Operators // Member Operators
// Needed for List IO //- Test for equality
inline bool operator==(const pointTopoDistanceData&) const; inline bool operator==(const pointTopoDistanceData&) const;
//- Test for inequality
inline bool operator!=(const pointTopoDistanceData&) const; inline bool operator!=(const pointTopoDistanceData&) const;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -204,16 +204,16 @@ inline bool Foam::pointTopoDistanceData::equal
inline bool Foam::pointTopoDistanceData::operator== inline bool Foam::pointTopoDistanceData::operator==
( (
const Foam::pointTopoDistanceData& rhs const pointTopoDistanceData& rhs
) const ) const
{ {
return data() == rhs.data() && distance() == rhs.distance(); return data_ == rhs.data_ && distance_ == rhs.distance_;
} }
inline bool Foam::pointTopoDistanceData::operator!= inline bool Foam::pointTopoDistanceData::operator!=
( (
const Foam::pointTopoDistanceData& rhs const pointTopoDistanceData& rhs
) const ) const
{ {
return !(*this == rhs); return !(*this == rhs);

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2013 OpenFOAM Foundation Copyright (C) 2011-2013 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,25 +28,25 @@ License
#include "topoDistanceData.H" #include "topoDistanceData.H"
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<< Foam::Ostream& Foam::operator<<
( (
Foam::Ostream& os, Ostream& os,
const Foam::topoDistanceData& wDist const topoDistanceData& rhs
) )
{ {
return os << wDist.data_ << token::SPACE << wDist.distance_; return os << rhs.data_ << token::SPACE << rhs.distance_;
} }
Foam::Istream& Foam::operator>> Foam::Istream& Foam::operator>>
( (
Foam::Istream& is, Istream& is,
Foam::topoDistanceData& wDist topoDistanceData& rhs
) )
{ {
return is >> wDist.data_ >> wDist.distance_; return is >> rhs.data_ >> rhs.distance_;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -55,14 +55,13 @@ class topoDistanceData;
Istream& operator>>(Istream&, topoDistanceData&); Istream& operator>>(Istream&, topoDistanceData&);
Ostream& operator<<(Ostream&, const topoDistanceData&); Ostream& operator<<(Ostream&, const topoDistanceData&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class topoDistanceData Declaration Class topoDistanceData Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class topoDistanceData class topoDistanceData
{ {
// Private data // Private Data
//- Starting data //- Starting data
label data_; label data_;
@ -75,7 +74,7 @@ public:
// Constructors // Constructors
//- Construct null with invalid (-1) for data and distance //- Default construct, with invalid (-1) for data and distance
inline topoDistanceData(); inline topoDistanceData();
//- Construct from components //- Construct from components
@ -90,11 +89,12 @@ public:
// Access // Access
inline label data() const label data() const
{ {
return data_; return data_;
} }
inline label distance() const
label distance() const
{ {
return distance_; return distance_;
} }
@ -102,12 +102,11 @@ public:
// Needed by FaceCellWave // Needed by FaceCellWave
//- Check whether origin has been changed at all or //- Changed or contains original (invalid) value
// still contains original (invalid) value.
template<class TrackingData> template<class TrackingData>
inline bool valid(TrackingData& td) const; inline bool valid(TrackingData& td) const;
//- Check for identical geometrical data. Used for cyclics checking. //- Check for identical geometrical data (eg, cyclics checking)
template<class TrackingData> template<class TrackingData>
inline bool sameGeometry inline bool sameGeometry
( (
@ -184,16 +183,17 @@ public:
TrackingData& td TrackingData& td
); );
//- Same (like operator==) //- Test for equality, with TrackingData
template<class TrackingData> template<class TrackingData>
inline bool equal(const topoDistanceData&, TrackingData& td) const; inline bool equal(const topoDistanceData&, TrackingData& td) const;
// Member Operators // Member Operators
// Needed for List IO //- Test for equality
inline bool operator==(const topoDistanceData&) const; inline bool operator==(const topoDistanceData&) const;
//- Test for inequality
inline bool operator!=(const topoDistanceData&) const; inline bool operator!=(const topoDistanceData&) const;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -192,16 +192,16 @@ inline bool Foam::topoDistanceData::equal
inline bool Foam::topoDistanceData::operator== inline bool Foam::topoDistanceData::operator==
( (
const Foam::topoDistanceData& rhs const topoDistanceData& rhs
) const ) const
{ {
return data() == rhs.data() && distance() == rhs.distance(); return data_ == rhs.data_ && distance_ == rhs.distance_;
} }
inline bool Foam::topoDistanceData::operator!= inline bool Foam::topoDistanceData::operator!=
( (
const Foam::topoDistanceData& rhs const topoDistanceData& rhs
) const ) const
{ {
return !(*this == rhs); return !(*this == rhs);

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2014-2016 OpenFOAM Foundation Copyright (C) 2014-2016 OpenFOAM Foundation
Copyright (C) 2015-2019 OpenCFD Ltd. Copyright (C) 2015-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -46,8 +46,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declarations // Forward Declarations
class polyPatch; class polyPatch;
class polyMesh; class polyMesh;
class minData; class minData;
@ -55,14 +54,13 @@ class minData;
Istream& operator>>(Istream&, minData&); Istream& operator>>(Istream&, minData&);
Ostream& operator<<(Ostream&, const minData&); Ostream& operator<<(Ostream&, const minData&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class minData Declaration Class minData Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class minData class minData
{ {
// Private data // Private Data
//- Starting data //- Starting data
label data_; label data_;
@ -72,10 +70,10 @@ public:
// Constructors // Constructors
//- Construct null //- Default construct
inline minData(); inline minData();
//- Construct from count //- Construct from min value
inline minData(const label data); inline minData(const label data);
@ -83,7 +81,7 @@ public:
// Access // Access
inline label data() const label data() const
{ {
return data_; return data_;
} }
@ -91,12 +89,11 @@ public:
// Needed by FaceCellWave // Needed by FaceCellWave
//- Check whether origin has been changed at all or //- Changed or contains original (invalid) value
// still contains original (invalid) value.
template<class TrackingData> template<class TrackingData>
inline bool valid(TrackingData& td) const; inline bool valid(TrackingData& td) const;
//- Check for identical geometrical data. Used for cyclics checking. //- Check for identical geometrical data (eg, cyclics checking)
template<class TrackingData> template<class TrackingData>
inline bool sameGeometry inline bool sameGeometry
( (
@ -173,15 +170,17 @@ public:
TrackingData& td TrackingData& td
); );
//- Same (like operator==) //- Test for equality, with TrackingData
template<class TrackingData> template<class TrackingData>
inline bool equal(const minData&, TrackingData& td) const; inline bool equal(const minData&, TrackingData& td) const;
// Member Operators // Member Operators
// Needed for List IO //- Test for equality
inline bool operator==(const minData&) const; inline bool operator==(const minData&) const;
//- Test for inequality
inline bool operator!=(const minData&) const; inline bool operator!=(const minData&) const;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2014-2016 OpenFOAM Foundation Copyright (C) 2014-2016 OpenFOAM Foundation
Copyright (C) 2015-2019 OpenCFD Ltd. Copyright (C) 2015-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -177,16 +177,16 @@ inline bool Foam::minData::equal
inline bool Foam::minData::operator== inline bool Foam::minData::operator==
( (
const Foam::minData& rhs const minData& rhs
) const ) const
{ {
return data() == rhs.data(); return data_ == rhs.data_;
} }
inline bool Foam::minData::operator!= inline bool Foam::minData::operator!=
( (
const Foam::minData& rhs const minData& rhs
) const ) const
{ {
return !(*this == rhs); return !(*this == rhs);
@ -197,21 +197,21 @@ inline bool Foam::minData::operator!=
inline Foam::Ostream& Foam::operator<< inline Foam::Ostream& Foam::operator<<
( (
Foam::Ostream& os, Ostream& os,
const Foam::minData& wDist const minData& rhs
) )
{ {
return os << wDist.data_; return os << rhs.data_;
} }
inline Foam::Istream& Foam::operator>> inline Foam::Istream& Foam::operator>>
( (
Foam::Istream& is, Istream& is,
Foam::minData& wDist minData& rhs
) )
{ {
return is >> wDist.data_; return is >> rhs.data_;
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd. Copyright (C) 2017-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,25 +27,25 @@ License
#include "meshToMeshData.H" #include "meshToMeshData.H"
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<< Foam::Ostream& Foam::operator<<
( (
Foam::Ostream& os, Ostream& os,
const Foam::meshToMeshData& wDist const meshToMeshData& rhs
) )
{ {
return os << wDist.tgtCelli_; return os << rhs.tgtCelli_;
} }
Foam::Istream& Foam::operator>> Foam::Istream& Foam::operator>>
( (
Foam::Istream& is, Istream& is,
Foam::meshToMeshData& wDist meshToMeshData& rhs
) )
{ {
return is >> wDist.tgtCelli_; return is >> rhs.tgtCelli_;
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2017-2019 OpenCFD Ltd. Copyright (C) 2017-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -62,8 +62,16 @@ Ostream& operator<<(Ostream&, const meshToMeshData&);
class meshToMeshData class meshToMeshData
{ {
// Private Data
//- Corresponding cell in tgtMesh
label tgtCelli_;
public: public:
// Public Classes
//- Class used to pass non-cell data to the update function //- Class used to pass non-cell data to the update function
class trackData class trackData
{ {
@ -71,47 +79,31 @@ public:
const polyMesh& tgtMesh_; const polyMesh& tgtMesh_;
// Constructors
trackData(const polyMesh& tgtMesh) trackData(const polyMesh& tgtMesh)
: :
tgtMesh_(tgtMesh) tgtMesh_(tgtMesh)
{} {}
}; };
// Private data
// Corresponding cell in tgtMesh
label tgtCelli_;
public:
// Constructors // Constructors
//- Construct null //- Default construct
inline meshToMeshData(); inline meshToMeshData();
//- Construct from count //- Construct from target cell
inline meshToMeshData inline meshToMeshData(const label tgtCelli);
(
const label tgtCelli
);
// Member Functions // Member Functions
// Access // Access
inline label tgtCell() const label tgtCell() const
{ {
return tgtCelli_; return tgtCelli_;
} }
label& tgtCell()
inline label& tgtCell()
{ {
return tgtCelli_; return tgtCelli_;
} }
@ -119,12 +111,11 @@ public:
// Needed by FaceCellWave // Needed by FaceCellWave
//- Check whether origin has been changed at all or //- Changed or contains original (invalid) value
// still contains original (invalid) value.
template<class TrackingData> template<class TrackingData>
inline bool valid(TrackingData&) const; inline bool valid(TrackingData&) const;
//- Check for identical geometrical data. Used for cyclics checking. //- Check for identical geometrical data (eg, cyclics checking)
template<class TrackingData> template<class TrackingData>
inline bool sameGeometry inline bool sameGeometry
( (
@ -134,8 +125,8 @@ public:
TrackingData& TrackingData&
) const; ) const;
//- Convert any absolute coordinates into relative to (patch)face //- Convert absolute coordinates into relative
// centre //- to (patch)face centre
template<class TrackingData> template<class TrackingData>
inline void leaveDomain inline void leaveDomain
( (
@ -201,7 +192,7 @@ public:
TrackingData& TrackingData&
); );
//- Same (like operator==) //- Test for equality, with TrackingData
template<class TrackingData> template<class TrackingData>
inline bool equal inline bool equal
( (
@ -212,9 +203,10 @@ public:
// Member Operators // Member Operators
// Needed for List IO //- Test for equality
inline bool operator==(const meshToMeshData&) const; inline bool operator==(const meshToMeshData&) const;
//- Test for inequality
inline bool operator!=(const meshToMeshData&) const; inline bool operator!=(const meshToMeshData&) const;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2017-2019 OpenCFD Ltd. Copyright (C) 2017-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -116,7 +116,7 @@ inline bool Foam::meshToMeshData::updateCell
const point& cc = mesh.cellCentres()[thisCelli]; const point& cc = mesh.cellCentres()[thisCelli];
// See if we are in the neighbour // See if we are in the neighbour
label tgti = neighbourInfo.tgtCelli_; const label tgti = neighbourInfo.tgtCelli_;
// Try match of neighbour // Try match of neighbour
if (td.tgtMesh_.pointInCell(cc, tgti, polyMesh::CELL_TETS)) if (td.tgtMesh_.pointInCell(cc, tgti, polyMesh::CELL_TETS))
@ -127,10 +127,8 @@ inline bool Foam::meshToMeshData::updateCell
// Try match of neighbour's neighbours // Try match of neighbour's neighbours
const labelList& tgtNbrs = td.tgtMesh_.cellCells(tgti); const labelList& tgtNbrs = td.tgtMesh_.cellCells(tgti);
forAll(tgtNbrs, i) for (const label tgti : tgtNbrs)
{ {
label tgti = tgtNbrs[i];
// Try match of neighbour // Try match of neighbour
if (td.tgtMesh_.pointInCell(cc, tgti, polyMesh::CELL_TETS)) if (td.tgtMesh_.pointInCell(cc, tgti, polyMesh::CELL_TETS))
{ {
@ -211,7 +209,7 @@ inline bool Foam::meshToMeshData::equal
inline bool Foam::meshToMeshData::operator== inline bool Foam::meshToMeshData::operator==
( (
const Foam::meshToMeshData& rhs const meshToMeshData& rhs
) const ) const
{ {
return tgtCelli_ == rhs.tgtCelli_; return tgtCelli_ == rhs.tgtCelli_;
@ -220,7 +218,7 @@ inline bool Foam::meshToMeshData::operator==
inline bool Foam::meshToMeshData::operator!= inline bool Foam::meshToMeshData::operator!=
( (
const Foam::meshToMeshData& rhs const meshToMeshData& rhs
) const ) const
{ {
return !(*this == rhs); return !(*this == rhs);

View File

@ -140,7 +140,7 @@ void Foam::waveMethod::calculate
forAll(cellData, celli) forAll(cellData, celli)
{ {
srcToTgtAddr[celli] = cellData[celli].tgtCelli_; srcToTgtAddr[celli] = cellData[celli].tgtCell();
} }
} }
@ -172,6 +172,7 @@ Foam::waveMethod::waveMethod
Foam::waveMethod::~waveMethod() Foam::waveMethod::~waveMethod()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::waveMethod::calculate void Foam::waveMethod::calculate

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -72,7 +73,7 @@ class OppositeFaceCellWave
{ {
protected: protected:
// Protected data // Protected Data
//- For every entry in changedCells (i.e. the cell front) gives //- For every entry in changedCells (i.e. the cell front) gives
// the face that it needs to transfer to // the face that it needs to transfer to
@ -95,7 +96,8 @@ public:
// Constructors // Constructors
//- Construct from mesh and list of changed faces with the Type //- Construct from mesh and list of changed faces with the Type
// for these faces. Iterates until nothing changes or maxIter reached. //- for these faces.
// Iterates until nothing changes or maxIter reached.
// (maxIter can be 0) // (maxIter can be 0)
OppositeFaceCellWave OppositeFaceCellWave
( (