fieldsDistributor.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2022 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
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 Class
27  fieldsDistributor
28 
29 Description
30  Common methods/utilities for field decomposers/distributors etc.
31 
32 SourceFiles
33  fieldsDistributorTemplates.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef Foam_fieldsDistributor_H
38 #define Foam_fieldsDistributor_H
39 
40 #include "IOobjectList.H"
41 #include "bitSet.H"
42 #include "boolList.H"
43 #include "PtrList.H"
44 #include "GeometricField.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class fieldsDistributor Declaration
53 \*---------------------------------------------------------------------------*/
54 
56 {
57  // Private Methods
58 
59  //- Read volume/surface/point/area fields that may or may not exist
60  //- on all processors
61  template<class BoolListType, class GeoField, class MeshSubsetter>
62  static void readFieldsImpl
63  (
64  const BoolListType& haveMeshOnProc,
65  const MeshSubsetter* subsetter,
66  const typename GeoField::Mesh& mesh,
67  IOobjectList& allObjects,
69  const bool deregister
70  );
71 
72 
73 public:
74 
75  // Reading helpers
76 
77  //- Generic mesh-based field reading
78  template<class GeoField>
79  static void readField
80  (
81  const IOobject& io,
82  const typename GeoField::Mesh& mesh,
83  const label i,
85  );
86 
87  //- Definition of readField for GeometricFields only
88  template<class Type, template<class> class PatchField, class GeoMesh>
89  static void readField
90  (
91  const IOobject& io,
92  const typename GeoMesh::Mesh& mesh,
93  const label i,
95  );
96 
97 
98  //- Read fields and store on the pointer list
99  template
100  <
101  class Type,
102  template<class> class PatchField,
103  class GeoMesh
104  >
105  static void readFields
106  (
107  const typename GeoMesh::Mesh& mesh,
108  const IOobjectList& objects,
110  const bool readOldTime
111  );
112 
113  //- Read fields and hold on the pointer list
114  template<class Mesh, class GeoField>
115  static void readFields
116  (
117  const Mesh& mesh,
118  const IOobjectList& objects,
120  );
121 
122 
123  //- Read volume/surface/point/area fields that may or may not exist
124  //- on all processors
125  template<class GeoField, class MeshSubsetter>
126  static void readFields
127  (
128  const bitSet& haveMeshOnProc,
129  const MeshSubsetter* subsetter,
130  const typename GeoField::Mesh& mesh,
131  IOobjectList& allObjects,
133  const bool deregister = false
134  );
135 
136  //- Read volume/surface/point/area fields that may or may not exist
137  //- on all processors
138  template<class GeoField, class MeshSubsetter>
139  static void readFields
140  (
141  const boolList& haveMeshOnProc,
142  const MeshSubsetter* subsetter,
143  const typename GeoField::Mesh& mesh,
144  IOobjectList& allObjects,
146  const bool deregister = false
147  );
148 
149  //- Read volume/surface/point/area fields that may or may not exist
150  //- on all processors
151  template<class GeoField, class MeshSubsetter>
152  static void readFields
153  (
154  const boolList& haveMeshOnProc,
155  const typename GeoField::Mesh& mesh,
156  const autoPtr<MeshSubsetter>& subsetter,
157  IOobjectList& allObjects,
159  const bool deregister = false
160  );
161 };
162 
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 } // End namespace Foam
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 #ifdef NoRepository
172 #endif
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 #endif
177 
178 // ************************************************************************* //
static void readField(const IOobject &io, const typename GeoField::Mesh &mesh, const label i, PtrList< GeoField > &fields)
Generic mesh-based field reading.
List of IOobjects with searching and retrieving facilities. Implemented as a HashTable, so the various sorted methods should be used if traversing in parallel.
Definition: IOobjectList.H:55
Generic GeometricField class.
Definition: areaFieldsFwd.H:50
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Definition: createFields.H:97
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
dynamicFvMesh & mesh
static void readFields(const typename GeoMesh::Mesh &mesh, const IOobjectList &objects, PtrList< GeometricField< Type, PatchField, GeoMesh >> &fields, const bool readOldTime)
Read fields and store on the pointer list.
MESH Mesh
Definition: GeoMesh.H:58
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:59
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Definition: List.H:55
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Definition: GeoMesh.H:42
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:166
Namespace for OpenFOAM.