surfMeshTemplates.C
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) 2019-2022 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
28#include "surfMesh.H"
29#include "surfFields.H"
30
31// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
32
33template<class Type, class GeoMeshType>
35(
36 const word& fieldName,
37 const dimensionSet& dims,
38 const Field<Type>& values
39)
40{
41 const objectRegistry& fieldDb = *this;
42
43 auto* dimfield =
45
46 if (dimfield)
47 {
48 dimfield->dimensions().reset(dims); // Dimensions may have changed
49 dimfield->field() = values;
50 }
51 else
52 {
54 (
56 (
57 fieldName,
58 fieldDb,
61 true
62 ),
63 *this,
64 dims,
65 values
66 );
67
68 dimfield->store();
69 }
70}
71
72
73template<class Type, class GeoMeshType>
75(
76 const word& fieldName,
77 const dimensionSet& dims,
78 Field<Type>&& values
79)
80{
81 const objectRegistry& fieldDb = *this;
82
83 auto* dimfield =
85
86 if (dimfield)
87 {
88 dimfield->dimensions().reset(dims); // Dimensions may have changed
89 dimfield->field() = std::move(values);
90 }
91 else
92 {
94 (
96 (
97 fieldName,
98 fieldDb,
101 true
102 ),
103 *this,
104 dims,
105 std::move(values)
106 );
107
108 dimfield->store();
109 }
110}
111
112
113// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const dimensionSet & dimensions() const
Return dimensions.
Generic templated field type.
Definition: Field.H:82
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Definition: dimensionSet.H:109
void reset(const dimensionSet &ds)
Copy assign the exponents from the dimensionSet.
Definition: dimensionSet.C:149
Registry of regIOobjects.
Type * getObjectPtr(const word &name, const bool recursive=false) const
void storeField(const word &fieldName, const dimensionSet &dims, const Field< Type > &values)
Copy/store named field as face or point data (template parameter).
A class for handling words, derived from Foam::string.
Definition: word.H:68