Commit 537e8bf9 authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: consolidate OpenFOAM field names (#926)

- Standard known field types in Foam::fieldTypes namespace
parent 414d78a3
......@@ -628,6 +628,7 @@ fields/cloud/cloud.C
Fields = fields/Fields
$(Fields)/Field/FieldBase.C
$(Fields)/fieldTypes.C
$(Fields)/labelField/labelField.C
$(Fields)/labelField/labelIOField.C
$(Fields)/labelField/labelFieldIOField.C
......
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "fieldTypes.H"
#include "labelIOField.H"
#include "scalarIOField.H"
#include "vectorIOField.H"
#include "sphericalTensorIOField.H"
#include "symmTensorIOField.H"
#include "tensorIOField.H"
// * * * * * * * * * * * * * * * * Global Data * * * * * * * * * * * * * * * //
const Foam::wordList Foam::fieldTypes::basic
({
Foam::labelIOField::typeName,
Foam::scalarIOField::typeName,
Foam::vectorIOField::typeName,
Foam::sphericalTensorIOField::typeName,
Foam::symmTensorIOField::typeName,
Foam::tensorIOField::typeName
});
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -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) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -22,8 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Include the header files for all the primitive types that Fields are
instantiated for.
Header files for all the primitive types that Fields are instantiated for.
\*---------------------------------------------------------------------------*/
......@@ -54,6 +53,22 @@ Description
Macro(symmTensor, __VA_ARGS__) \
Macro(tensor, __VA_ARGS__)
/*---------------------------------------------------------------------------*\
Namespace fieldTypes Declaration
\*---------------------------------------------------------------------------*/
namespace Foam
{
namespace fieldTypes
{
//- Standard basic field types (label, scalar, vector, tensor, etc)
// These also correspond to cloud output fields.
extern const wordList basic;
} // End namespace fieldTypes
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
......
......@@ -26,36 +26,44 @@ License
#include "polyMesh.H"
#include "pointFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTemplate2TypeNameAndDebug(pointScalarField::Internal, 0);
defineTemplate2TypeNameAndDebug(pointVectorField::Internal, 0);
defineTemplate2TypeNameAndDebug
(
pointSphericalTensorField::Internal,
0
);
defineTemplate2TypeNameAndDebug
(
pointSymmTensorField::Internal,
0
);
defineTemplate2TypeNameAndDebug(pointTensorField::Internal, 0);
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTemplate2TypeNameAndDebug(pointScalarField::Internal, 0);
defineTemplate2TypeNameAndDebug(pointVectorField::Internal, 0);
defineTemplate2TypeNameAndDebug
(
pointSphericalTensorField::Internal,
0
);
defineTemplate2TypeNameAndDebug
(
pointSymmTensorField::Internal,
0
);
defineTemplate2TypeNameAndDebug(pointTensorField::Internal, 0);
defineTemplateTypeNameAndDebug(pointScalarField, 0);
defineTemplateTypeNameAndDebug(pointVectorField, 0);
defineTemplateTypeNameAndDebug(pointSphericalTensorField, 0);
defineTemplateTypeNameAndDebug(pointSymmTensorField, 0);
defineTemplateTypeNameAndDebug(pointTensorField, 0);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineTemplateTypeNameAndDebug(pointScalarField, 0);
defineTemplateTypeNameAndDebug(pointVectorField, 0);
defineTemplateTypeNameAndDebug(pointSphericalTensorField, 0);
defineTemplateTypeNameAndDebug(pointSymmTensorField, 0);
defineTemplateTypeNameAndDebug(pointTensorField, 0);
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Global Data * * * * * * * * * * * * * * * //
const Foam::wordList Foam::fieldTypes::point
({
Foam::pointScalarField::typeName,
Foam::pointVectorField::typeName,
Foam::pointSphericalTensorField::typeName,
Foam::pointSymmTensorField::typeName,
Foam::pointTensorField::typeName
});
// ************************************************************************* //
......@@ -35,9 +35,9 @@ SourceFiles
#define pointFields_H
#include "GeometricFields.H"
#include "fieldTypes.H"
#include "pointPatchFields.H"
#include "pointMesh.H"
#include "pointPatchFields.H"
#include "pointFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -25,6 +25,7 @@ InClass
Foam::pointFields
Description
Forwards and collection of common point field types
SourceFiles
pointFields.C
......@@ -59,6 +60,19 @@ typedef GeometricField<symmTensor, pointPatchField, pointMesh>
pointSymmTensorField;
typedef GeometricField<tensor, pointPatchField, pointMesh> pointTensorField;
/*---------------------------------------------------------------------------*\
Namespace fieldTypes Declaration
\*---------------------------------------------------------------------------*/
namespace fieldTypes
{
//- Standard point field types (scalar, vector, tensor, etc)
extern const wordList point;
} // End namespace fieldTypes
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
......
......@@ -27,7 +27,6 @@ License
#define pointPatchFields_H
#include "pointPatchField.H"
#include "fieldTypes.H"
#include "pointPatchFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
| Copyright (C) 2016-2017 Wikki Ltd
-------------------------------------------------------------------------------
......@@ -28,24 +28,31 @@ License
#include "faMesh.H"
#include "areaFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTemplate2TypeNameAndDebug(areaScalarField::Internal, 0);
defineTemplate2TypeNameAndDebug(areaVectorField::Internal, 0);
defineTemplate2TypeNameAndDebug(areaSphericalTensorField::Internal, 0);
defineTemplate2TypeNameAndDebug(areaSymmTensorField::Internal, 0);
defineTemplate2TypeNameAndDebug(areaTensorField::Internal, 0);
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTemplateTypeNameAndDebug(areaScalarField, 0);
defineTemplateTypeNameAndDebug(areaVectorField, 0);
defineTemplateTypeNameAndDebug(areaSphericalTensorField, 0);
defineTemplateTypeNameAndDebug(areaSymmTensorField, 0);
defineTemplateTypeNameAndDebug(areaTensorField, 0);
defineTemplate2TypeNameAndDebug(areaScalarField::Internal, 0);
defineTemplate2TypeNameAndDebug(areaVectorField::Internal, 0);
defineTemplate2TypeNameAndDebug(areaSphericalTensorField::Internal, 0);
defineTemplate2TypeNameAndDebug(areaSymmTensorField::Internal, 0);
defineTemplate2TypeNameAndDebug(areaTensorField::Internal, 0);
} // End namespace Foam
defineTemplateTypeNameAndDebug(areaScalarField, 0);
defineTemplateTypeNameAndDebug(areaVectorField, 0);
defineTemplateTypeNameAndDebug(areaSphericalTensorField, 0);
defineTemplateTypeNameAndDebug(areaSymmTensorField, 0);
defineTemplateTypeNameAndDebug(areaTensorField, 0);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Specializations
namespace Foam
{
template<>
tmp<GeometricField<scalar, faPatchField, areaMesh>>
......@@ -67,8 +74,19 @@ void GeometricField<scalar, faPatchField, areaMesh>::replace
*this == gsf;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Global Data * * * * * * * * * * * * * * * //
const Foam::wordList Foam::fieldTypes::area
({
Foam::areaScalarField::typeName,
Foam::areaVectorField::typeName,
Foam::areaSphericalTensorField::typeName,
Foam::areaSymmTensorField::typeName,
Foam::areaTensorField::typeName
});
// ************************************************************************* //
......@@ -54,7 +54,7 @@ SourceFiles
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Specializations
template<>
tmp<GeometricField<scalar, faPatchField, areaMesh>>
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
| Copyright (C) 2016-2017 Wikki Ltd
-------------------------------------------------------------------------------
......@@ -23,10 +23,8 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
areaFields
Description
Forwards and collection of common area field types
SourceFiles
areaFields.C
......@@ -60,6 +58,20 @@ typedef GeometricField<sphericalTensor, faPatchField, areaMesh>
typedef GeometricField<symmTensor, faPatchField, areaMesh> areaSymmTensorField;
typedef GeometricField<tensor, faPatchField, areaMesh> areaTensorField;
/*---------------------------------------------------------------------------*\
Namespace fieldTypes Declaration
\*---------------------------------------------------------------------------*/
namespace fieldTypes
{
//- Standard area field types (scalar, vector, tensor, etc)
extern const wordList area;
} // End namespace fieldTypes
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
......
......@@ -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) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -25,37 +25,40 @@ License
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTemplate2TypeNameAndDebug(volScalarField::Internal, 0);
defineTemplate2TypeNameAndDebug(volVectorField::Internal, 0);
defineTemplate2TypeNameAndDebug
(
volSphericalTensorField::Internal,
0
);
defineTemplate2TypeNameAndDebug
(
volSymmTensorField::Internal,
0
);
defineTemplate2TypeNameAndDebug(volTensorField::Internal, 0);
defineTemplateTypeNameAndDebug(volScalarField, 0);
defineTemplateTypeNameAndDebug(volVectorField, 0);
defineTemplateTypeNameAndDebug(volSphericalTensorField, 0);
defineTemplateTypeNameAndDebug(volSymmTensorField, 0);
defineTemplateTypeNameAndDebug(volTensorField, 0);
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
} // End namespace Foam
defineTemplate2TypeNameAndDebug(volScalarField::Internal, 0);
defineTemplate2TypeNameAndDebug(volVectorField::Internal, 0);
defineTemplate2TypeNameAndDebug
(
volSphericalTensorField::Internal,
0
);
defineTemplate2TypeNameAndDebug
(
volSymmTensorField::Internal,
0
);
defineTemplate2TypeNameAndDebug(volTensorField::Internal, 0);
defineTemplateTypeNameAndDebug(volScalarField, 0);
defineTemplateTypeNameAndDebug(volVectorField, 0);
defineTemplateTypeNameAndDebug(volSphericalTensorField, 0);
defineTemplateTypeNameAndDebug(volSymmTensorField, 0);
defineTemplateTypeNameAndDebug(volTensorField, 0);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Specializations
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// specialization for scalar fields
template<>
tmp<GeometricField<scalar, fvPatchField, volMesh>>
GeometricField<scalar, fvPatchField, volMesh>::component
......@@ -67,7 +70,6 @@ GeometricField<scalar, fvPatchField, volMesh>::component
}
// specialization for scalar fields
template<>
void GeometricField<scalar, fvPatchField, volMesh>::replace
(
......@@ -78,8 +80,29 @@ void GeometricField<scalar, fvPatchField, volMesh>::replace
*this == gsf;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * Global Data * * * * * * * * * * * * * * * //
const Foam::wordList Foam::fieldTypes::internal
({
Foam::volScalarField::Internal::typeName,
Foam::volVectorField::Internal::typeName,
Foam::volSphericalTensorField::Internal::typeName,
Foam::volSymmTensorField::Internal::typeName,
Foam::volTensorField::Internal::typeName
});
const Foam::wordList Foam::fieldTypes::volume
({
Foam::volScalarField::typeName,
Foam::volVectorField::typeName,
Foam::volSphericalTensorField::typeName,
Foam::volSymmTensorField::typeName,
Foam::volTensorField::typeName
});
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -46,7 +46,7 @@ SourceFiles
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Specializations
template<>
tmp<GeometricField<scalar, fvPatchField, volMesh>>
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -21,10 +21,11 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
InClass
Foam::volFields
Namespace
Foam::fieldTypes
Description
Collection of common field types
SourceFiles
volFields.C
......@@ -35,6 +36,7 @@ SourceFiles
#define volFieldsFwd_H
#include "fieldTypes.H"
#include "wordList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -58,6 +60,22 @@ typedef GeometricField<sphericalTensor, fvPatchField, volMesh>
typedef GeometricField<symmTensor, fvPatchField, volMesh> volSymmTensorField;
typedef GeometricField<tensor, fvPatchField, volMesh> volTensorField;
/*---------------------------------------------------------------------------*\
Namespace fieldTypes Declaration
\*---------------------------------------------------------------------------*/
namespace fieldTypes
{
//- Standard dimensioned field types (scalar, vector, tensor, etc)
extern const wordList internal;
//- Standard volume field types (scalar, vector, tensor, etc)
extern const wordList volume;
} // End namespace fieldTypes
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
......
Markdown is supported
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