fvMeshTools.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) 2012-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 Class
25  Foam::fvMeshTools
26 
27 Description
28  A collection of tools for operating on an fvMesh.
29 
30 SourceFiles
31  fvMeshTools.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef fvMeshTools_H
36 #define fvMeshTools_H
37 
38 #include "fvMesh.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class fvMeshTools Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 class fvMeshTools
50 {
51  //- Set patchFields according to dictionary
52  template<class GeoField>
53  static void setPatchFields
54  (
55  typename GeoField::Mesh& mesh,
56  const label patchi,
57  const dictionary& patchFieldDict
58  );
59 
60  //- Set patchFields to value
61  template<class GeoField>
62  static void setPatchFields
63  (
64  typename GeoField::Mesh& mesh,
65  const label patchi,
66  const typename GeoField::value_type& value
67  );
68 
69 
70 public:
71 
72  //- Add patch. Inserts patch before all processor patches.
73  // Supply per field the new patchField per field as a
74  // subdictionary or a default type. If validBoundary call is parallel
75  // synced and all add the same patch with same settings.
76  static label addPatch
77  (
78  fvMesh& mesh,
79  const polyPatch& patch,
80  const dictionary& patchFieldDict,
81  const word& defaultPatchFieldType,
82  const bool validBoundary
83  );
84 
85  //- Change patchField on registered fields according to dictionary
86  static void setPatchFields
87  (
88  fvMesh& mesh,
89  const label patchi,
90  const dictionary& patchFieldDict
91  );
92 
93  //- Change patchField to zero on registered fields
94  static void zeroPatchFields(fvMesh& mesh, const label patchi);
95 
96  //- Reorder and remove trailing patches. If validBoundary call is parallel
97  // synced and all add the same patch with same settings
98  static void reorderPatches
99  (
100  fvMesh&,
101  const labelList& oldToNew,
102  const label nPatches,
103  const bool validBoundary
104  );
105 };
106 
107 
108 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
109 
110 } // End namespace Foam
111 
112 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
113 
114 #ifdef NoRepository
115  #include "fvMeshToolsTemplates.C"
116 #endif
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
120 #endif
121 
122 // ************************************************************************* //
label nPatches
Definition: readKivaGrid.H:402
static void reorderPatches(fvMesh &, const labelList &oldToNew, const label nPatches, const bool validBoundary)
Reorder and remove trailing patches. If validBoundary call is parallel.
Definition: fvMeshTools.C:140
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
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
static void zeroPatchFields(fvMesh &mesh, const label patchi)
Change patchField to zero on registered fields.
Definition: fvMeshTools.C:113
dynamicFvMesh & mesh
A class for handling words, derived from string.
Definition: word.H:59
static label addPatch(fvMesh &mesh, const polyPatch &patch, const dictionary &patchFieldDict, const word &defaultPatchFieldType, const bool validBoundary)
Add patch. Inserts patch before all processor patches.
Definition: fvMeshTools.C:33
A collection of tools for operating on an fvMesh.
Definition: fvMeshTools.H:48
label patchi
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Namespace for OpenFOAM.