mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: simplify Random constructors
COMP: use generated methods in a few more places
This commit is contained in:
@ -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.
|
||||||
@ -107,7 +107,7 @@ class indexedVertex
|
|||||||
public Foam::indexedVertexEnum,
|
public Foam::indexedVertexEnum,
|
||||||
public Vb
|
public Vb
|
||||||
{
|
{
|
||||||
// Private data
|
// Private Data
|
||||||
|
|
||||||
//- Type of pair-point
|
//- Type of pair-point
|
||||||
vertexType type_;
|
vertexType type_;
|
||||||
@ -144,6 +144,13 @@ public:
|
|||||||
typedef indexedVertex<Gt,Vb2> Other;
|
typedef indexedVertex<Gt,Vb2> Other;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Generated Methods
|
||||||
|
|
||||||
|
//- Copy construct
|
||||||
|
indexedVertex(const indexedVertex&) = default;
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
inline indexedVertex();
|
inline indexedVertex();
|
||||||
@ -261,6 +268,10 @@ public:
|
|||||||
//- Fix the vertex so that it can't be moved
|
//- Fix the vertex so that it can't be moved
|
||||||
inline bool& fixed();
|
inline bool& fixed();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Operators
|
||||||
|
|
||||||
|
//- Copy assignment
|
||||||
inline void operator=(const indexedVertex& rhs)
|
inline void operator=(const indexedVertex& rhs)
|
||||||
{
|
{
|
||||||
Vb::operator=(rhs);
|
Vb::operator=(rhs);
|
||||||
@ -291,10 +302,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Info
|
// IOstream Operators
|
||||||
|
|
||||||
//- Return info proxy.
|
//- Info proxy, to print information to a stream
|
||||||
// Used to print indexedVertex information to a stream
|
|
||||||
Foam::InfoProxy<indexedVertex<Gt, Vb>> info() const
|
Foam::InfoProxy<indexedVertex<Gt, Vb>> info() const
|
||||||
{
|
{
|
||||||
return *this;
|
return *this;
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -56,10 +57,16 @@ class valuePointPatchField
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Declare type-name, virtual type (with debug switch)
|
||||||
TypeName("value");
|
TypeName("value");
|
||||||
|
|
||||||
|
|
||||||
|
// Generated Methods
|
||||||
|
|
||||||
|
//- Copy construct
|
||||||
|
valuePointPatchField(const valuePointPatchField&) = default;
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from patch and internal field
|
//- Construct from patch and internal field
|
||||||
@ -123,7 +130,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member Functions
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
@ -168,7 +175,7 @@ public:
|
|||||||
virtual void write(Ostream&) const;
|
virtual void write(Ostream&) const;
|
||||||
|
|
||||||
|
|
||||||
// Member operators
|
// Member Operators
|
||||||
|
|
||||||
// Assignment operators
|
// Assignment operators
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
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.
|
||||||
@ -95,7 +95,7 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct with specified or default seed
|
//- Construct with specified or default seed
|
||||||
Rand48(uint32_t val = default_seed)
|
explicit Rand48(uint32_t val = default_seed)
|
||||||
:
|
:
|
||||||
engine_(convert(val))
|
engine_(convert(val))
|
||||||
{}
|
{}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017-2018 OpenCFD Ltd.
|
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -40,13 +40,9 @@ Foam::Random::Random(const label seedValue)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::Random::Random(const Random& r, const bool reset)
|
Foam::Random::Random(const Random& rnd, const bool reset)
|
||||||
:
|
:
|
||||||
seed_(r.seed_),
|
Random(rnd)
|
||||||
generator_(r.generator_),
|
|
||||||
uniform01_(),
|
|
||||||
hasGaussSample_(r.hasGaussSample_),
|
|
||||||
gaussSample_(r.gaussSample_)
|
|
||||||
{
|
{
|
||||||
if (reset)
|
if (reset)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
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.
|
||||||
@ -50,7 +50,7 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declarations
|
// Forward Declarations
|
||||||
template<class T> class UList;
|
template<class T> class UList;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
@ -85,7 +85,7 @@ class Random
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Forward declarations - generator classes
|
// Forward Declarations - generator classes
|
||||||
template<class T> class uniformGeneratorOp;
|
template<class T> class uniformGeneratorOp;
|
||||||
template<class T> class gaussianGeneratorOp;
|
template<class T> class gaussianGeneratorOp;
|
||||||
|
|
||||||
@ -101,12 +101,8 @@ public:
|
|||||||
//- Construct with seed value
|
//- Construct with seed value
|
||||||
explicit Random(const label seedValue = defaultSeed);
|
explicit Random(const label seedValue = defaultSeed);
|
||||||
|
|
||||||
//- Copy construct with optional reset of seed
|
//- Copy construct with possible reset of seed
|
||||||
Random(const Random& r, const bool reset = false);
|
Random(const Random& rnd, const bool reset);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
|
||||||
~Random() = default;
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -221,7 +217,7 @@ class Random::uniformGeneratorOp
|
|||||||
:
|
:
|
||||||
public Random
|
public Random
|
||||||
{
|
{
|
||||||
// Private data
|
// Private Data
|
||||||
|
|
||||||
//- The interval
|
//- The interval
|
||||||
const T min_;
|
const T min_;
|
||||||
@ -242,7 +238,7 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null or with seed value. Uses default [0,1] interval
|
//- Default construct or with seed value. Uses default [0,1] interval
|
||||||
explicit uniformGeneratorOp(const label seed = Random::defaultSeed)
|
explicit uniformGeneratorOp(const label seed = Random::defaultSeed)
|
||||||
:
|
:
|
||||||
uniformGeneratorOp(seed, pTraits<T>::zero, pTraits<T>::one)
|
uniformGeneratorOp(seed, pTraits<T>::zero, pTraits<T>::one)
|
||||||
@ -293,7 +289,6 @@ class Random::gaussianGeneratorOp
|
|||||||
:
|
:
|
||||||
public Random
|
public Random
|
||||||
{
|
{
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Generate a random number. Treat as mutable.
|
//- Generate a random number. Treat as mutable.
|
||||||
@ -308,7 +303,7 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null or with seed value. Uses default [0,1] interval
|
//- Default construct or with seed value. Uses default [0,1] interval
|
||||||
explicit gaussianGeneratorOp(const label seed = Random::defaultSeed)
|
explicit gaussianGeneratorOp(const label seed = Random::defaultSeed)
|
||||||
:
|
:
|
||||||
Random(seed)
|
Random(seed)
|
||||||
|
|||||||
@ -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.
|
||||||
@ -124,6 +125,11 @@ bool Foam::ignitionSite::ignited() const
|
|||||||
|
|
||||||
void Foam::ignitionSite::operator=(const ignitionSite& is)
|
void Foam::ignitionSite::operator=(const ignitionSite& is)
|
||||||
{
|
{
|
||||||
|
if (this == &is)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
location_ = is.location_;
|
location_ = is.location_;
|
||||||
diameter_ = is.diameter_;
|
diameter_ = is.diameter_;
|
||||||
time_ = is.time_;
|
time_ = is.time_;
|
||||||
|
|||||||
@ -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.
|
||||||
@ -50,6 +51,7 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Forward Declarations
|
||||||
class Time;
|
class Time;
|
||||||
class engineTime;
|
class engineTime;
|
||||||
class fvMesh;
|
class fvMesh;
|
||||||
@ -60,7 +62,7 @@ class fvMesh;
|
|||||||
|
|
||||||
class ignitionSite
|
class ignitionSite
|
||||||
{
|
{
|
||||||
// Private data
|
// Private Data
|
||||||
|
|
||||||
const Time& db_;
|
const Time& db_;
|
||||||
const fvMesh& mesh_;
|
const fvMesh& mesh_;
|
||||||
@ -88,10 +90,9 @@ class ignitionSite
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Public classes
|
// Public Classes
|
||||||
|
|
||||||
//- Class used for the read-construction of
|
//- Read-construction of PtrLists of ignitionSite
|
||||||
// PtrLists of ignitionSite
|
|
||||||
class iNew
|
class iNew
|
||||||
{
|
{
|
||||||
const Time& db_;
|
const Time& db_;
|
||||||
@ -112,6 +113,12 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Generated Methods
|
||||||
|
|
||||||
|
//- Copy construct
|
||||||
|
ignitionSite(const ignitionSite&) = default;
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from Istream and database
|
//- Construct from Istream and database
|
||||||
|
|||||||
@ -61,24 +61,4 @@ Foam::sixDoFRigidBodyMotionState::sixDoFRigidBodyMotionState
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::sixDoFRigidBodyMotionState::sixDoFRigidBodyMotionState
|
|
||||||
(
|
|
||||||
const sixDoFRigidBodyMotionState& sDoFRBMS
|
|
||||||
)
|
|
||||||
:
|
|
||||||
centreOfRotation_(sDoFRBMS.centreOfRotation()),
|
|
||||||
Q_(sDoFRBMS.Q()),
|
|
||||||
v_(sDoFRBMS.v()),
|
|
||||||
a_(sDoFRBMS.a()),
|
|
||||||
pi_(sDoFRBMS.pi()),
|
|
||||||
tau_(sDoFRBMS.tau())
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::sixDoFRigidBodyMotionState::~sixDoFRigidBodyMotionState()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2014 OpenFOAM Foundation
|
Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -52,11 +53,9 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
// Forward Declarations
|
||||||
class Istream;
|
class Istream;
|
||||||
class Ostream;
|
class Ostream;
|
||||||
|
|
||||||
// Forward declaration of friend functions and operators
|
|
||||||
class sixDoFRigidBodyMotionState;
|
class sixDoFRigidBodyMotionState;
|
||||||
Istream& operator>>(Istream&, sixDoFRigidBodyMotionState&);
|
Istream& operator>>(Istream&, sixDoFRigidBodyMotionState&);
|
||||||
Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotionState&);
|
Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotionState&);
|
||||||
@ -68,21 +67,22 @@ Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotionState&);
|
|||||||
|
|
||||||
class sixDoFRigidBodyMotionState
|
class sixDoFRigidBodyMotionState
|
||||||
{
|
{
|
||||||
// Private data
|
// Private Data
|
||||||
|
|
||||||
//- Current position of the centre of mass of the body
|
//- Current position of the centre of mass of the body
|
||||||
point centreOfRotation_;
|
point centreOfRotation_;
|
||||||
|
|
||||||
//- Orientation, stored as the rotation tensor to transform
|
//- Orientation, stored as the rotation tensor to transform
|
||||||
// from the body to the global reference frame, i.e.:
|
//- from the body to the global reference frame
|
||||||
|
// i.e.:
|
||||||
// globalVector = Q_ & bodyLocalVector
|
// globalVector = Q_ & bodyLocalVector
|
||||||
// bodyLocalVector = Q_.T() & globalVector
|
// bodyLocalVector = Q_.T() & globalVector
|
||||||
tensor Q_;
|
tensor Q_;
|
||||||
|
|
||||||
// Linear velocity of body
|
//- Linear velocity of body
|
||||||
vector v_;
|
vector v_;
|
||||||
|
|
||||||
// Total linear acceleration of body
|
//- Total linear acceleration of body
|
||||||
vector a_;
|
vector a_;
|
||||||
|
|
||||||
//- Angular momentum of body, in body local reference frame
|
//- Angular momentum of body, in body local reference frame
|
||||||
@ -96,19 +96,12 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct, zero-initialized with identity transformation
|
||||||
sixDoFRigidBodyMotionState();
|
sixDoFRigidBodyMotionState();
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
sixDoFRigidBodyMotionState(const dictionary& dict);
|
sixDoFRigidBodyMotionState(const dictionary& dict);
|
||||||
|
|
||||||
//- Construct as copy
|
|
||||||
sixDoFRigidBodyMotionState(const sixDoFRigidBodyMotionState&);
|
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
|
||||||
~sixDoFRigidBodyMotionState();
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
@ -158,7 +151,7 @@ public:
|
|||||||
void write(dictionary& dict) const;
|
void write(dictionary& dict) const;
|
||||||
|
|
||||||
//- Write to stream
|
//- Write to stream
|
||||||
void write(Ostream&) const;
|
void write(Ostream& os) const;
|
||||||
|
|
||||||
|
|
||||||
// IOstream Operators
|
// IOstream Operators
|
||||||
|
|||||||
Reference in New Issue
Block a user