Commit 09aa322d authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: add meshTools polyFields

- provides a simple means of writing an internal dimensioned field
  when fvMesh is not available (eg, during mesh creation).
parent ffd0e81b
......@@ -76,6 +76,7 @@ meshSearch/meshSearch.C
meshSearch/meshSearchFACE_CENTRE_TRISMeshObject.C
meshSearch/meshSearchMeshObject.C
fields/polyFields.C
meshTools/meshTools.C
algorithms = algorithms
......
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
// ************************************************************************* //
Supports Markdown
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