mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: remove duplicate dimensionSet dictionary read constructor
STYLE: make dimensionedTypes access inline noexcept
This commit is contained in:
@ -223,7 +223,7 @@ void Foam::solverTemplate::setRegionProperties
|
||||
fieldDimensions_[regionI].set
|
||||
(
|
||||
i,
|
||||
new dimensionSet(dict, "dimensions")
|
||||
new dimensionSet("dimensions", dict)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,8 +50,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef dimensionSet_H
|
||||
#define dimensionSet_H
|
||||
#ifndef Foam_dimensionSet_H
|
||||
#define Foam_dimensionSet_H
|
||||
|
||||
#include "bool.H"
|
||||
#include "dimensionedScalarFwd.H"
|
||||
@ -187,7 +187,7 @@ public:
|
||||
|
||||
//- Turn dimension checking on/off.
|
||||
// \return the previous value
|
||||
static bool checking(const bool on) noexcept
|
||||
static bool checking(bool on) noexcept
|
||||
{
|
||||
bool old(debug);
|
||||
debug = static_cast<int>(on);
|
||||
@ -233,14 +233,6 @@ public:
|
||||
const bool mandatory = true
|
||||
);
|
||||
|
||||
//- Construct from dictionary entry (usually "dimensions")
|
||||
dimensionSet
|
||||
(
|
||||
const dictionary& dict,
|
||||
const word& entryName, //!< Lookup key. LITERAL (not REGEX)
|
||||
const bool mandatory = true
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
autoPtr<dimensionSet> clone() const
|
||||
{
|
||||
@ -283,7 +275,8 @@ public:
|
||||
const bool mandatory = true //!< The entry is mandatory
|
||||
);
|
||||
|
||||
//- Read using provided units. Used only in initial parsing
|
||||
//- Read using provided units, return scaling in multiplier.
|
||||
//- Used only in initial parsing
|
||||
Istream& read
|
||||
(
|
||||
Istream& is,
|
||||
@ -291,7 +284,7 @@ public:
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Read using provided units
|
||||
//- Read using provided units, return scaling in multiplier
|
||||
Istream& read
|
||||
(
|
||||
Istream& is,
|
||||
@ -299,27 +292,23 @@ public:
|
||||
const HashTable<dimensionedScalar>&
|
||||
);
|
||||
|
||||
//- Read using system units
|
||||
//- Read using system units, return scaling in multiplier
|
||||
Istream& read
|
||||
(
|
||||
Istream& is,
|
||||
scalar& multiplier
|
||||
);
|
||||
|
||||
//- Write using provided units
|
||||
//- Write using provided write units, return scaling in multiplier
|
||||
Ostream& write
|
||||
(
|
||||
Ostream& os,
|
||||
scalar& multiplier,
|
||||
const dimensionSets&
|
||||
const dimensionSets& writeUnits
|
||||
) const;
|
||||
|
||||
//- Write using system units
|
||||
Ostream& write
|
||||
(
|
||||
Ostream& os,
|
||||
scalar& multiplier
|
||||
) const;
|
||||
//- Write using system units, return scaling in multiplier
|
||||
Ostream& write(Ostream& os, scalar& multiplier) const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
@ -43,20 +43,7 @@ Foam::dimensionSet::dimensionSet
|
||||
:
|
||||
exponents_(Zero)
|
||||
{
|
||||
this->readEntry(entryName, dict, mandatory);
|
||||
}
|
||||
|
||||
|
||||
Foam::dimensionSet::dimensionSet
|
||||
(
|
||||
const dictionary& dict,
|
||||
const word& entryName,
|
||||
const bool mandatory
|
||||
)
|
||||
:
|
||||
exponents_(Zero)
|
||||
{
|
||||
this->readEntry(entryName, dict, mandatory);
|
||||
readEntry(entryName, dict, mandatory);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -81,6 +81,10 @@ extern const dimensionSet dimViscosity;
|
||||
extern const dimensionSet dimDynamicViscosity;
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class dimensionSets Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
//- Construction of unit sets
|
||||
class dimensionSets
|
||||
{
|
||||
|
||||
@ -402,48 +402,6 @@ Foam::dimensioned<Type> Foam::dimensioned<Type>::getOrAddToDict
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
const Foam::word& Foam::dimensioned<Type>::name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::word& Foam::dimensioned<Type>::name()
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
const Foam::dimensionSet& Foam::dimensioned<Type>::dimensions() const
|
||||
{
|
||||
return dimensions_;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::dimensionSet& Foam::dimensioned<Type>::dimensions()
|
||||
{
|
||||
return dimensions_;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
const Type& Foam::dimensioned<Type>::value() const
|
||||
{
|
||||
return value_;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Type& Foam::dimensioned<Type>::value()
|
||||
{
|
||||
return value_;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::dimensioned<typename Foam::dimensioned<Type>::cmptType>
|
||||
Foam::dimensioned<Type>::component
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -283,22 +283,22 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Return const reference to name.
|
||||
const word& name() const;
|
||||
const word& name() const noexcept { return name_; }
|
||||
|
||||
//- Return non-const reference to name.
|
||||
word& name();
|
||||
word& name() noexcept { return name_; }
|
||||
|
||||
//- Return const reference to dimensions.
|
||||
const dimensionSet& dimensions() const;
|
||||
const dimensionSet& dimensions() const noexcept { return dimensions_; }
|
||||
|
||||
//- Return non-const reference to dimensions.
|
||||
dimensionSet& dimensions();
|
||||
dimensionSet& dimensions() noexcept { return dimensions_; }
|
||||
|
||||
//- Return const reference to value.
|
||||
const Type& value() const;
|
||||
const Type& value() const noexcept { return value_; }
|
||||
|
||||
//- Return non-const reference to value.
|
||||
Type& value();
|
||||
Type& value() noexcept { return value_; }
|
||||
|
||||
//- Return a component as a dimensioned<cmptType>
|
||||
dimensioned<cmptType> component(const direction d) const;
|
||||
|
||||
Reference in New Issue
Block a user