fieldMapper.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "fieldMapper.H"
27 
28 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
29 
30 template<class Type>
31 void Foam::fieldMapper::mapOrAssign
32 (
33  Field<Type>& f,
34  const Field<Type>& mapF,
35  const Type& unmappedVal
36 ) const
37 {
38  // By default, field mappers do not assign anything. Derivations may
39  // override this behaviour.
40  this->operator()(f, mapF);
41 }
42 
43 
44 template<class Type>
45 Foam::tmp<Foam::Field<Type>> Foam::fieldMapper::mapOrAssign
46 (
47  const Field<Type>& mapF,
48  const Type& unmappedVal
49 ) const
50 {
51  // By default, field mappers do not assign anything. Derivations may
52  // override this behaviour.
53  return this->operator()(mapF);
54 }
55 
56 
57 template<class Type>
58 void Foam::fieldMapper::mapOrAssign
59 (
60  Field<Type>& f,
61  const Field<Type>& mapF,
62  const FieldFunctor<Type>& unmappedFunc
63 ) const
64 {
65  // By default, field mappers do not assign anything. Derivations may
66  // override this behaviour.
67  this->operator()(f, mapF);
68 }
69 
70 
71 template<class Type>
72 Foam::tmp<Foam::Field<Type>> Foam::fieldMapper::mapOrAssign
73 (
74  const Field<Type>& mapF,
75  const FieldFunctor<Type>& unmappedFunc
76 ) const
77 {
78  // By default, field mappers do not assign anything. Derivations may
79  // override this behaviour.
80  return this->operator()(mapF);
81 }
82 
83 
84 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
85 
87 
88 
90 
91 
92 // ************************************************************************* //
Pre-declare SubField and related Field type.
Definition: Field.H:83
Class used to lazily evaluate fields.
Definition: fieldMapper.H:176
Abstract base class for field mapping.
Definition: fieldMapper.H:48
virtual void operator()(Field< label > &f, const Field< label > &mapF) const =0
Map a label field.
A class for managing temporary objects.
Definition: tmp.H:55
#define IMPLEMENT_FIELD_MAPPER_MAP_OR_ASSIGN_OPERATOR(Type, mapperType)
Definition: fieldMapperM.H:89
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
FOR_ALL_FIELD_TYPES(makeFieldSourceTypedef)
labelList f(nPoints)