parFaFieldDistributorCache.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-2026 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  Foam::parFaFieldDistributorCache
28 
29 Description
30  Simple container to manage read/write, redistribute finiteArea fields.
31 
32 SourceFiles
33  parFaFieldDistributorCache.cxx
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef Foam_parFaFieldDistributorCache_H
38 #define Foam_parFaFieldDistributorCache_H
39 
40 #include "faMesh.H"
41 #include "faMeshDistributor.H"
42 #include "areaFieldsFwd.H"
43 #include "edgeFieldsFwd.H"
44 #include "PtrList.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class parFaFieldDistributorCache Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 class parFaFieldDistributorCache
56 {
57  // Private Data
58 
59  #undef declareField
60  #define declareField(Type) \
61  PtrList<GeometricField<Type, faPatchField, areaMesh>> Type##AreaFields_; \
62  PtrList<GeometricField<Type, faePatchField, edgeMesh>> Type##EdgeFields_;
63 
64  declareField(scalar);
69  #undef declareField
70 
71 
72  // Private Member Functions
73 
74  //- Read distributed fields
75  template<class BoolListType>
76  void readImpl
77  (
78  const Time& baseRunTime,
79  const fileName& proc0CaseName,
80  const bool decompose, // i.e. read from undecomposed case
81 
82  const BoolListType& areaMeshOnProc,
83  const refPtr<fileOperation>& readHandler,
84  const fileName& areaMeshInstance,
85  faMesh& mesh
86  );
87 
88 
89 public:
90 
91  // Constructors
92 
93  //- No copy construct
95 
96  //- No copy assignment
97  void operator=(const parFaFieldDistributorCache&) = delete;
98 
99  //- Default construct
100  parFaFieldDistributorCache() = default;
101 
102 
103  // Member Functions
104 
105  //- Nothing in the cache
106  bool empty() const;
107 
108  //- Report names of cached fields
109  void info(Ostream& os) const;
110 
111  //- Read distributed fields
112  void read
113  (
114  const Time& baseRunTime,
115  const fileName& proc0CaseName,
117  const bool decompose,
119  const bitSet& areaMeshOnProc,
120  const refPtr<fileOperation>& readHandler,
121  const fileName& areaMeshInstance,
122  faMesh& mesh
123  );
124 
125  //- Read distributed fields
126  void read
127  (
128  const Time& baseRunTime,
129  const fileName& proc0CaseName,
131  const bool decompose,
133  const boolUList& areaMeshOnProc,
134  const refPtr<fileOperation>& readHandler,
135  const fileName& areaMeshInstance,
136  faMesh& mesh
137  );
138 
139  //- Redistribute and write all cached area, edge fields
140  void redistributeAndWrite(const faMeshDistributor& distributor);
141 };
142 
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 } // End namespace Foam
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 #endif
151 
152 // ************************************************************************* //
void redistributeAndWrite(const faMeshDistributor &distributor)
Redistribute and write all cached area, edge fields.
Tensor< scalar > tensor
Definition: symmTensor.H:57
UList< bool > boolUList
A UList of bools.
Definition: UList.H:74
parFaFieldDistributorCache()=default
Default construct.
void read(const Time &baseRunTime, const fileName &proc0CaseName, const bool decompose, const bitSet &areaMeshOnProc, const refPtr< fileOperation > &readHandler, const fileName &areaMeshInstance, faMesh &mesh)
Read distributed fields.
bool empty() const
Nothing in the cache.
Forwards for edge field types.
dynamicFvMesh & mesh
SymmTensor< scalar > symmTensor
SymmTensor of scalars, i.e. SymmTensor<scalar>.
Definition: symmTensor.H:55
Vector< scalar > vector
Definition: vector.H:57
#define declareField(Type)
void info(Ostream &os) const
Report names of cached fields.
void operator=(const parFaFieldDistributorCache &)=delete
No copy assignment.
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
Forwards and collection of common area field types.
Namespace for OpenFOAM.