MapFvVolField.H
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) 2011-2019 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 Description
25  Map volume internal field on topology change. This is a partial
26  template specialisation, see MapGeometricFields.
27 
28 \*---------------------------------------------------------------------------*/
29 
30 #ifndef MapFvVolField_H
31 #define MapFvVolField_H
32 
33 #include "Field.H"
34 #include "volMesh.H"
35 
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 
38 namespace Foam
39 {
40 
41 template<class Type, class MeshMapper>
42 class MapInternalField<Type, MeshMapper, volMesh>
43 {
44 public:
45 
47  {}
48 
49  void operator()
50  (
51  Field<Type>& field,
52  const MeshMapper& mapper
53  ) const;
54 };
55 
56 
57 template<class Type, class MeshMapper>
59 (
60  Field<Type>& field,
61  const MeshMapper& mapper
62 ) const
63 {
64  if (field.size() != mapper.volMap().sizeBeforeMapping())
65  {
67  << "Incompatible size before mapping. Field size: " << field.size()
68  << " map size: " << mapper.volMap().sizeBeforeMapping()
69  << abort(FatalError);
70  }
71 
72  mapper.volMap()(field, field);
73 }
74 
75 
76 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
77 
78 } // End namespace Foam
79 
80 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
81 
82 #endif
83 
84 // ************************************************************************* //
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:163
Mesh data needed to do the Finite Volume discretisation.
Definition: volMesh.H:53
Pre-declare SubField and related Field type.
Definition: Field.H:56
errorManip< error > abort(error &err)
Definition: errorManip.H:131
Generic internal field mapper. For "real" mapping, add template specialisations for mapping of intern...
Namespace for OpenFOAM.