mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add explicit doubleVector, doubleTensor typedefs
- the counterpart to floatVector, doubleTensor, which can be useful
for connecting to programs that always expect double precision for
the arguments, when using single-precision for OpenFOAM itself.
Eg,
doubleVector pos = ...;
vtkcamera->SetPosition(pos.v_);
This commit is contained in:
@ -70,6 +70,10 @@ primitives/Tensor/lists/symmTensorList.C
|
|||||||
primitives/Tensor/lists/tensorList.C
|
primitives/Tensor/lists/tensorList.C
|
||||||
|
|
||||||
primitives/Vector/complexVector/complexVector.C
|
primitives/Vector/complexVector/complexVector.C
|
||||||
|
#if !defined(WM_DP)
|
||||||
|
primitives/Vector/doubleVector/doubleVector.C
|
||||||
|
primitives/Tensor/doubleTensor/doubleTensor.C
|
||||||
|
#endif
|
||||||
#if !defined(WM_SP)
|
#if !defined(WM_SP)
|
||||||
primitives/Vector/floatVector/floatVector.C
|
primitives/Vector/floatVector/floatVector.C
|
||||||
primitives/Tensor/floatTensor/floatTensor.C
|
primitives/Tensor/floatTensor/floatTensor.C
|
||||||
|
|||||||
86
src/OpenFOAM/primitives/Tensor/doubleTensor/doubleTensor.C
Normal file
86
src/OpenFOAM/primitives/Tensor/doubleTensor/doubleTensor.C
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "doubleTensor.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const char* const Foam::doubleTensor::vsType::typeName = "doubleTensor";
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const char* const Foam::doubleTensor::vsType::componentNames[] =
|
||||||
|
{
|
||||||
|
"xx", "xy", "xz",
|
||||||
|
"yx", "yy", "yz",
|
||||||
|
"zx", "zy", "zz"
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const Foam::doubleTensor Foam::doubleTensor::vsType::zero
|
||||||
|
(
|
||||||
|
doubleTensor::uniform(0)
|
||||||
|
);
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const Foam::doubleTensor Foam::doubleTensor::vsType::one
|
||||||
|
(
|
||||||
|
doubleTensor::uniform(1)
|
||||||
|
);
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const Foam::doubleTensor Foam::doubleTensor::vsType::max
|
||||||
|
(
|
||||||
|
doubleTensor::uniform(doubleScalarVGREAT)
|
||||||
|
);
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const Foam::doubleTensor Foam::doubleTensor::vsType::min
|
||||||
|
(
|
||||||
|
doubleTensor::uniform(-doubleScalarVGREAT)
|
||||||
|
);
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const Foam::doubleTensor Foam::doubleTensor::vsType::rootMax
|
||||||
|
(
|
||||||
|
doubleTensor::uniform(doubleScalarROOTVGREAT)
|
||||||
|
);
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const Foam::doubleTensor Foam::doubleTensor::vsType::rootMin
|
||||||
|
(
|
||||||
|
doubleTensor::uniform(-doubleScalarROOTVGREAT)
|
||||||
|
);
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const Foam::doubleTensor Foam::doubleTensor::I
|
||||||
|
(
|
||||||
|
1, 0, 0,
|
||||||
|
0, 1, 0,
|
||||||
|
0, 0, 1
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
64
src/OpenFOAM/primitives/Tensor/doubleTensor/doubleTensor.H
Normal file
64
src/OpenFOAM/primitives/Tensor/doubleTensor/doubleTensor.H
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Typedef
|
||||||
|
Foam::doubleTensor
|
||||||
|
|
||||||
|
Description
|
||||||
|
A Tensor of values with double precision
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
doubleTensor.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef doubleTensor_H
|
||||||
|
#define doubleTensor_H
|
||||||
|
|
||||||
|
#include "Tensor.H"
|
||||||
|
#include "contiguous.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
typedef Tensor<double> doubleTensor;
|
||||||
|
|
||||||
|
//- Data associated with doubleTensor type are contiguous
|
||||||
|
#if !defined(WM_DP)
|
||||||
|
template<>
|
||||||
|
inline bool contiguous<doubleTensor>() {return true;}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -25,7 +25,7 @@ Typedef
|
|||||||
Foam::floatTensor
|
Foam::floatTensor
|
||||||
|
|
||||||
Description
|
Description
|
||||||
FloatTensor of scalars.
|
A Tensor of values with float precision
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
floatTensor.C
|
floatTensor.C
|
||||||
@ -48,9 +48,10 @@ namespace Foam
|
|||||||
typedef Tensor<float> floatTensor;
|
typedef Tensor<float> floatTensor;
|
||||||
|
|
||||||
//- Data associated with floatTensor type are contiguous
|
//- Data associated with floatTensor type are contiguous
|
||||||
|
#if !defined(WM_SP)
|
||||||
template<>
|
template<>
|
||||||
inline bool contiguous<floatTensor>() {return true;}
|
inline bool contiguous<floatTensor>() {return true;}
|
||||||
|
#endif
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@ Typedef
|
|||||||
Foam::labelTensor
|
Foam::labelTensor
|
||||||
|
|
||||||
Description
|
Description
|
||||||
3D labelTensor obtained from generic Tensor
|
A Tensor of values using label (integer) representation.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
labelTensor.C
|
labelTensor.C
|
||||||
|
|||||||
76
src/OpenFOAM/primitives/Vector/doubleVector/doubleVector.C
Normal file
76
src/OpenFOAM/primitives/Vector/doubleVector/doubleVector.C
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "doubleVector.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const char* const Foam::doubleVector::vsType::typeName = "doubleVector";
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const char* const Foam::doubleVector::vsType::componentNames[] =
|
||||||
|
{
|
||||||
|
"x", "y", "z"
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const Foam::doubleVector Foam::doubleVector::vsType::zero
|
||||||
|
(
|
||||||
|
doubleVector::uniform(0)
|
||||||
|
);
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const Foam::doubleVector Foam::doubleVector::vsType::one
|
||||||
|
(
|
||||||
|
doubleVector::uniform(1)
|
||||||
|
);
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const Foam::doubleVector Foam::doubleVector::vsType::max
|
||||||
|
(
|
||||||
|
doubleVector::uniform(doubleScalarVGREAT)
|
||||||
|
);
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const Foam::doubleVector Foam::doubleVector::vsType::min
|
||||||
|
(
|
||||||
|
doubleVector::uniform(-doubleScalarVGREAT)
|
||||||
|
);
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const Foam::doubleVector Foam::doubleVector::vsType::rootMax
|
||||||
|
(
|
||||||
|
doubleVector::uniform(doubleScalarROOTVGREAT)
|
||||||
|
);
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const Foam::doubleVector Foam::doubleVector::vsType::rootMin
|
||||||
|
(
|
||||||
|
doubleVector::uniform(-doubleScalarROOTVGREAT)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
64
src/OpenFOAM/primitives/Vector/doubleVector/doubleVector.H
Normal file
64
src/OpenFOAM/primitives/Vector/doubleVector/doubleVector.H
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Typedef
|
||||||
|
Foam::doubleVector
|
||||||
|
|
||||||
|
Description
|
||||||
|
A Vector of values with double precision.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
doubleVector.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef doubleVector_H
|
||||||
|
#define doubleVector_H
|
||||||
|
|
||||||
|
#include "Vector.H"
|
||||||
|
#include "contiguous.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
typedef Vector<double> doubleVector;
|
||||||
|
|
||||||
|
//- Data associated with doubleVector type are contiguous
|
||||||
|
#if !defined(WM_DP)
|
||||||
|
template<>
|
||||||
|
inline bool contiguous<doubleVector>() {return true;}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -21,9 +21,6 @@ License
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Description
|
|
||||||
Vector of floats.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "floatVector.H"
|
#include "floatVector.H"
|
||||||
|
|||||||
@ -25,7 +25,7 @@ Typedef
|
|||||||
Foam::floatVector
|
Foam::floatVector
|
||||||
|
|
||||||
Description
|
Description
|
||||||
A float version of vector
|
A Vector of values with float precision.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
floatVector.C
|
floatVector.C
|
||||||
|
|||||||
Reference in New Issue
Block a user