Commit f4ee841c authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: adjust code format for trackingData

- rationalized some layout and comments
parent 0a9295b2
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -59,15 +59,18 @@ class smoothDelta
{
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
{
scalar delta_;
// Private Data
scalar delta_;
// Private Member Functions
//- Update. Gets information from neighbouring face/cell and
// uses this to update itself (if necessary) and return true.
//- Update gets information from neighbouring face/cell and
//- uses this to update itself (if necessary) and return true.
template<class TrackingData>
inline bool update
(
......@@ -82,7 +85,7 @@ public:
// Constructors
//- Construct null
//- Default construct
inline deltaData();
//- Construct from delta value
......@@ -93,21 +96,19 @@ public:
// Access
scalar delta() const
{
return delta_;
}
scalar delta() const
{
return delta_;
}
// 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
(
......@@ -118,7 +119,7 @@ public:
) const;
//- Convert any absolute coordinates into relative to
// (patch)face centre
//- (patch)face centre
template<class TrackingData>
inline void leaveDomain
(
......@@ -184,40 +185,40 @@ public:
TrackingData& td
);
//- Same (like operator==)
//- Test for equality, with TrackingData
template<class TrackingData>
inline bool equal(const deltaData&, TrackingData& td) const;
// Member Operators
// Needed for List IO
inline bool operator==(const deltaData&) const;
// Member Operators
inline bool operator!=(const deltaData&) const;
//- Test for equality
inline bool operator==(const deltaData&) const;
// IOstream Operators
//- Test for inequality
inline bool operator!=(const deltaData&) const;
friend Ostream& operator<<
(
Ostream& os,
const deltaData& wDist
)
{
return os << wDist.delta_;
}
friend Istream& operator>>(Istream& is, deltaData& wDist)
{
return is >> wDist.delta_;
}
// IOstream Operators
friend Ostream& operator<<(Ostream& os, const deltaData& rhs)
{
return os << rhs.delta_;
}
friend Istream& operator>>(Istream& is, deltaData& rhs)
{
return is >> rhs.delta_;
}
};
private:
// Private data
// Private Data
autoPtr<LESdelta> geometricDelta_;
scalar maxDeltaRatio_;
......@@ -253,10 +254,9 @@ private:
DynamicList<deltaData>& changedFacesInfo
);
public:
//- Runtime type information
//- Declare type-name, virtual type (with debug switch)
TypeName("smooth");
......@@ -278,7 +278,7 @@ public:
// Member Functions
//- Read the LESdelta dictionary
virtual void read(const dictionary&);
virtual void read(const dictionary& dict);
// Correct values
virtual void correct();
......
......@@ -198,7 +198,7 @@ inline bool Foam::LESModels::smoothDelta::deltaData::operator==
const deltaData& rhs
) const
{
return delta_ == rhs.delta();
return delta_ == rhs.delta_;
}
......
......@@ -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)
);
}
......
......@@ -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;
......
......@@ -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);
}
......
......@@ -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)
);
}
......
......@@ -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;