Loading...
Searching...
No Matches
SlicedDimensionedField.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2022 OpenFOAM Foundation
9 Copyright (C) 2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::SlicedDimensionedField
29
30Description
31 Specialisation of DimensionedField that holds a slice of a given
32 field so that it acts as a DimensionedField.
33
34\*---------------------------------------------------------------------------*/
35
36#ifndef Foam_SlicedDimensionedField_H
37#define Foam_SlicedDimensionedField_H
38
39#include "DimensionedField.H"
40
41// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42
43namespace Foam
45
46/*---------------------------------------------------------------------------*\
47 Class SlicedDimensionedField Declaration
48\*---------------------------------------------------------------------------*/
49
50template<class Type, class GeoMesh>
52:
53 public DimensionedField<Type, GeoMesh>
54{
55public:
56
57 // Public Typedefs
58
59 //- Type of mesh on which this SlicedDimensionedField is instantiated
60 typedef typename GeoMesh::Mesh Mesh;
61
62
63 // Constructors
64
65 //- Construct from components and field to slice
67 (
68 const IOobject& io,
69 const Mesh& mesh,
70 const dimensionSet& dims,
71 const Field<Type>& iField
72 )
73 :
74 DimensionedField<Type, GeoMesh>(io, mesh, dims, Field<Type>())
75 {
76 // Set internalField to the slice of the complete field
78 (
79 SubList<Type>(iField, GeoMesh::size(mesh))
80 );
81 }
82
83
84 //- Destructor
86 {
87 // Set internalField to nullptr to avoid deletion of underlying field
89 }
90};
91
92
93// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
94
95} // End namespace Foam
96
97// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
98
99#endif
100
101// ************************************************************************* //
DimensionedField(const IOobject &io, const Mesh &mesh, const dimensionSet &dims, const Field< Type > &field)
Construct from components, copy initial field content.
const Mesh & mesh() const noexcept
Return const reference to mesh.
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Definition GeoMesh.H:46
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
GeoMesh::Mesh Mesh
Type of mesh on which this SlicedDimensionedField is instantiated.
SlicedDimensionedField(const IOobject &io, const Mesh &mesh, const dimensionSet &dims, const Field< Type > &iField)
Construct from components and field to slice.
A non-owning sub-view of a List (allocated or unallocated storage).
Definition SubList.H:61
void shallowCopy(T *__restrict__ ptr, const label len) noexcept
Copy the pointer and size.
Definition UListI.H:318
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
const auto & io
Namespace for OpenFOAM.