mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add meshTools polyFields
- provides a simple means of writing an internal dimensioned field when fvMesh is not available (eg, during mesh creation).
This commit is contained in:
@ -76,6 +76,7 @@ meshSearch/meshSearch.C
|
|||||||
meshSearch/meshSearchFACE_CENTRE_TRISMeshObject.C
|
meshSearch/meshSearchFACE_CENTRE_TRISMeshObject.C
|
||||||
meshSearch/meshSearchMeshObject.C
|
meshSearch/meshSearchMeshObject.C
|
||||||
|
|
||||||
|
fields/polyFields.C
|
||||||
meshTools/meshTools.C
|
meshTools/meshTools.C
|
||||||
|
|
||||||
algorithms = algorithms
|
algorithms = algorithms
|
||||||
|
|||||||
71
src/meshTools/fields/polyFields.C
Normal file
71
src/meshTools/fields/polyFields.C
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 "polyFields.H"
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Naming to shadow volScalarField::Internal etc.
|
||||||
|
// keep synchronized with finiteVolume volFields.C
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const word DimensionedField<scalar, polyGeoMesh>::typeName
|
||||||
|
(
|
||||||
|
"volScalarField::Internal"
|
||||||
|
);
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const word DimensionedField<vector, polyGeoMesh>::typeName
|
||||||
|
(
|
||||||
|
"volVectorField::Internal"
|
||||||
|
);
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const word DimensionedField<sphericalTensor, polyGeoMesh>::typeName
|
||||||
|
(
|
||||||
|
"volSphericalTensorField::Internal"
|
||||||
|
);
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const word DimensionedField<symmTensor, polyGeoMesh>::typeName
|
||||||
|
(
|
||||||
|
"volSymmTensorField::Internal"
|
||||||
|
);
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const word DimensionedField<tensor, polyGeoMesh>::typeName
|
||||||
|
(
|
||||||
|
"volTensorField::Internal"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
63
src/meshTools/fields/polyFields.H
Normal file
63
src/meshTools/fields/polyFields.H
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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/>.
|
||||||
|
|
||||||
|
InClass
|
||||||
|
Foam::polyFields
|
||||||
|
|
||||||
|
Description
|
||||||
|
A polyMesh-based naming and storage for internal volume fields when a
|
||||||
|
Foam::fvMesh is unavailable. Use sparingly.
|
||||||
|
|
||||||
|
SourceFields
|
||||||
|
polyFields.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef polyFields_H
|
||||||
|
#define polyFields_H
|
||||||
|
|
||||||
|
#include "DimensionedField.H"
|
||||||
|
#include "polyGeoMesh.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
typedef DimensionedField<scalar,polyGeoMesh> polyScalarField;
|
||||||
|
typedef DimensionedField<vector,polyGeoMesh> polyVectorField;
|
||||||
|
typedef DimensionedField<sphericalTensor,polyGeoMesh> polySphericalTensorField;
|
||||||
|
typedef DimensionedField<symmTensor,polyGeoMesh> polySymmTensorField;
|
||||||
|
typedef DimensionedField<tensor,polyGeoMesh> polyTensorField;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
86
src/meshTools/fields/polyGeoMesh.H
Normal file
86
src/meshTools/fields/polyGeoMesh.H
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/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::polyGeoMesh
|
||||||
|
|
||||||
|
Description
|
||||||
|
The polyMesh GeoMesh for holding internal fields without an fvMesh.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef polyGeoMesh_H
|
||||||
|
#define polyGeoMesh_H
|
||||||
|
|
||||||
|
#include "GeoMesh.H"
|
||||||
|
#include "polyMesh.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class polyGeoMesh Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class polyGeoMesh
|
||||||
|
:
|
||||||
|
public GeoMesh<polyMesh>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from polyMesh reference
|
||||||
|
explicit polyGeoMesh(const polyMesh& mesh)
|
||||||
|
:
|
||||||
|
GeoMesh<polyMesh>(mesh)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return size
|
||||||
|
static label size(const polyMesh& mesh)
|
||||||
|
{
|
||||||
|
return mesh.nCells();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return size
|
||||||
|
label size() const
|
||||||
|
{
|
||||||
|
return size(mesh_);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user