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