fvMeshTools.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 | Copyright (C) 2012-2016 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  template<class GeoField>
52  static void addPatchFields
53  (
54  fvMesh&,
55  const dictionary& patchFieldDict,
56  const word& defaultPatchFieldType,
57  const typename GeoField::value_type& defaultPatchValue
58  );
59 
60  //- Set patchFields according to dictionary
61  template<class GeoField>
62  static void setPatchFields
63  (
64  fvMesh& mesh,
65  const label patchi,
66  const dictionary& patchFieldDict
67  );
68 
69  //- Set patchFields to value
70  template<class GeoField>
71  static void setPatchFields
72  (
73  fvMesh& mesh,
74  const label patchi,
75  const typename GeoField::value_type& value
76  );
77 
78  // Remove last patch fields
79  template<class GeoField>
80  static void trimPatchFields(fvMesh&, const label nPatches);
81 
82  template<class GeoField>
83  static void reorderPatchFields(fvMesh&, const labelList& oldToNew);
84 
85  // Remove trialing patches
86  static void trimPatches(fvMesh&, const label nPatches);
87 
88 
89 public:
90 
91  //- Add patch. Inserts patch before all processor patches.
92  // Supply per field the new patchField per field as a
93  // subdictionary or a default type. If validBoundary call is parallel
94  // synced and all add the same patch with same settings.
95  static label addPatch
96  (
97  fvMesh& mesh,
98  const polyPatch& patch,
99  const dictionary& patchFieldDict,
100  const word& defaultPatchFieldType,
101  const bool validBoundary
102  );
103 
104  //- Change patchField on registered fields according to dictionary
105  static void setPatchFields
106  (
107  fvMesh& mesh,
108  const label patchi,
109  const dictionary& patchFieldDict
110  );
111 
112  //- Change patchField to zero on registered fields
113  static void zeroPatchFields(fvMesh& mesh, const label patchi);
114 
115  //- Reorder and remove trailing patches. If validBoundary call is parallel
116  // synced and all add the same patch with same settings
117  static void reorderPatches
118  (
119  fvMesh&,
120  const labelList& oldToNew,
121  const label nPatches,
122  const bool validBoundary
123  );
124 };
125 
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 } // End namespace Foam
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 #ifdef NoRepository
134  #include "fvMeshToolsTemplates.C"
135 #endif
136 
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 
139 #endif
140 
141 // ************************************************************************* //
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:324
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:137
static void zeroPatchFields(fvMesh &mesh, const label patchi)
Change patchField to zero on registered fields.
Definition: fvMeshTools.C:238
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:32
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.