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 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.C
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  //- Redistribute and write fields of given type (file-scope use)
75  template<class GeoField>
76  static void redistributeAndWrite
77  (
78  const faMeshDistributor& distributor,
79  PtrList<GeoField>& fields,
80  const bool isWriteProc
81  );
82 
83 
84 public:
85 
86  // Constructors
87 
88  //- No copy construct
90 
91  //- No copy assignment
92  void operator=(const parFaFieldDistributorCache&) = delete;
93 
94  //- Default construct
95  parFaFieldDistributorCache() = default;
96 
97 
98  // Member Functions
99 
100  //- Read distributed fields
101  void read
102  (
103  const Time& baseRunTime,
104  const fileName& proc0CaseName,
105  const bool decompose, // i.e. read from undecomposed case
106 
107  const boolList& areaMeshOnProc,
108  const fileName& areaMeshInstance,
109  faMesh& mesh
110  );
111 
112  void redistributeAndWrite
113  (
114  const faMeshDistributor& distributor,
115  const bool isWriteProc
116  );
117 };
118 
119 
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 
122 } // End namespace Foam
123 
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 
126 #endif
127 
128 // ************************************************************************* //
Tensor< scalar > tensor
Definition: symmTensor.H:57
parFaFieldDistributorCache()=default
Default construct.
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Definition: createFields.H:97
void read(const Time &baseRunTime, const fileName &proc0CaseName, const bool decompose, const boolList &areaMeshOnProc, const fileName &areaMeshInstance, faMesh &mesh)
Read distributed fields.
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 operator=(const parFaFieldDistributorCache &)=delete
No copy assignment.
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
List< bool > boolList
A List of bools.
Definition: List.H:60
Forwards and collection of common area field types.
Namespace for OpenFOAM.