mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: provide a 'dimensioned' null-like constructor for dimensionedType
- The null constructor already creates a dimensionless Zero, but named "undefined". Provide an constructor for a dimensioned Zero, but named "0" for universal clarity to its value.
This commit is contained in:
@ -81,6 +81,10 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Pout<< "zero scalar (time): " << dimensionedScalar(dimTime) << endl;
|
||||||
|
Pout<< "zero vector: " << dimensionedVector(dimLength) << endl;
|
||||||
|
Pout<< "zero tensor: " << dimensionedTensor(dimLength) << endl;
|
||||||
|
|
||||||
Info<< "End\n" << endl;
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -169,6 +169,18 @@ Foam::dimensioned<Type>::dimensioned
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::dimensioned<Type>::dimensioned
|
||||||
|
(
|
||||||
|
const dimensionSet& dimSet
|
||||||
|
)
|
||||||
|
:
|
||||||
|
name_("0"),
|
||||||
|
dimensions_(dimSet),
|
||||||
|
value_(Zero)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -117,9 +117,12 @@ public:
|
|||||||
//- Construct from dictionary lookup with a given name and dimensions
|
//- Construct from dictionary lookup with a given name and dimensions
|
||||||
dimensioned(const word&, const dimensionSet&, const dictionary&);
|
dimensioned(const word&, const dimensionSet&, const dictionary&);
|
||||||
|
|
||||||
//- Null constructor
|
//- Null constructor - a dimensionless Zero, named "undefined"
|
||||||
dimensioned();
|
dimensioned();
|
||||||
|
|
||||||
|
//- A dimensioned Zero, named "0"
|
||||||
|
explicit dimensioned(const dimensionSet&);
|
||||||
|
|
||||||
|
|
||||||
// Static member functions
|
// Static member functions
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user