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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
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>
inline bool Foam::pointEdgeStructuredWalk::valid(TrackingData& td) const
{
@ -125,7 +107,7 @@ inline bool Foam::pointEdgeStructuredWalk::sameGeometry
TrackingData& td
) const
{
scalar diff = Foam::mag(dist() - w2.dist());
const scalar diff = Foam::mag(dist() - w2.dist());
if (diff < SMALL)
{
@ -275,7 +257,7 @@ inline bool Foam::pointEdgeStructuredWalk::equal
inline bool Foam::pointEdgeStructuredWalk::operator==
(
const Foam::pointEdgeStructuredWalk& rhs
const pointEdgeStructuredWalk& rhs
) const
{
return previousPoint_ == rhs.previousPoint_;
@ -284,7 +266,7 @@ inline bool Foam::pointEdgeStructuredWalk::operator==
inline bool Foam::pointEdgeStructuredWalk::operator!=
(
const Foam::pointEdgeStructuredWalk& rhs
const pointEdgeStructuredWalk& rhs
) const
{
return !(*this == rhs);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,7 +31,6 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Update this with w2.
template<class TrackingData>
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
{
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>
inline bool Foam::pointEdgeCollapse::valid(TrackingData& td) const
{
@ -282,7 +261,7 @@ inline bool Foam::pointEdgeCollapse::equal
inline bool Foam::pointEdgeCollapse::operator==
(
const Foam::pointEdgeCollapse& rhs
const pointEdgeCollapse& rhs
) const
{
return
@ -294,7 +273,7 @@ inline bool Foam::pointEdgeCollapse::operator==
inline bool Foam::pointEdgeCollapse::operator!=
(
const Foam::pointEdgeCollapse& rhs
const pointEdgeCollapse& rhs
) const
{
return !(*this == rhs);

View File

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

View File

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

View File

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

View File

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

View File

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