Skip to content
Snippets Groups Projects
Commit 8563f892 authored by Mark Olesen's avatar Mark Olesen
Browse files

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.
parent 8628ddac
Branches
Tags
No related merge requests found
......@@ -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;
return 0;
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
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 * * * * * * * * * * * * //
template<class Type>
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -117,9 +117,12 @@ public:
//- Construct from dictionary lookup with a given name and dimensions
dimensioned(const word&, const dimensionSet&, const dictionary&);
//- Null constructor
//- Null constructor - a dimensionless Zero, named "undefined"
dimensioned();
//- A dimensioned Zero, named "0"
explicit dimensioned(const dimensionSet&);
// Static member functions
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment