ENH: dimensionedScalar: add stabilise function

This commit is contained in:
Kutalmis Bercin
2022-04-28 11:42:00 +01:00
parent 293df98df9
commit 77ab7510a8
4 changed files with 38 additions and 4 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2017-2021 OpenCFD Ltd. Copyright (C) 2017-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -518,6 +518,21 @@ Foam::dimensionSet Foam::hypot(const dimensionSet& ds1, const dimensionSet& ds2)
} }
Foam::dimensionSet Foam::stabilise
(
const dimensionSet& ds1,
const dimensionSet& ds2
)
{
if (dimensionSet::checking())
{
checkDims("stabilise(a, b)", ds1, ds2);
}
return ds1;
}
Foam::dimensionSet Foam::transform(const dimensionSet& ds) Foam::dimensionSet Foam::transform(const dimensionSet& ds)
{ {
return ds; return ds;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2017-2021 OpenCFD Ltd. Copyright (C) 2017-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -397,6 +397,9 @@ dimensionSet atan2(const dimensionSet& ds1, const dimensionSet& ds2);
//- Arguments need the same dimensions. Does not change the dimension. //- Arguments need the same dimensions. Does not change the dimension.
dimensionSet hypot(const dimensionSet& ds1, const dimensionSet& ds2); dimensionSet hypot(const dimensionSet& ds1, const dimensionSet& ds2);
//- Arguments need the same dimensions. Does not change the dimension.
dimensionSet stabilise(const dimensionSet& ds1, const dimensionSet& ds2);
//- Return the argument; transformations do not change the dimensions //- Return the argument; transformations do not change the dimensions
dimensionSet transform(const dimensionSet& ds); dimensionSet transform(const dimensionSet& ds);

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -338,6 +338,21 @@ dimensionedScalar hypot
} }
dimensionedScalar stabilise
(
const dimensionedScalar& x,
const dimensionedScalar& y
)
{
return dimensionedScalar
(
"stabilise(" + x.name() + ',' + y.name() + ')',
stabilise(x.dimensions(), y.dimensions()),
stabilise(x.value(), y.value())
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -102,6 +102,7 @@ dimensionedScalar jn(const int, const dimensionedScalar&);
dimensionedScalar y0(const dimensionedScalar&); dimensionedScalar y0(const dimensionedScalar&);
dimensionedScalar y1(const dimensionedScalar&); dimensionedScalar y1(const dimensionedScalar&);
dimensionedScalar yn(const int, const dimensionedScalar&); dimensionedScalar yn(const int, const dimensionedScalar&);
dimensionedScalar stabilise(const dimensionedScalar&, const dimensionedScalar&);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //