pointFieldDecomposer.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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::pointFieldDecomposer
29 
30 Description
31  Point field decomposer.
32 
33 SourceFiles
34  pointFieldDecomposer.C
35  pointFieldDecomposerFields.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef pointFieldDecomposer_H
40 #define pointFieldDecomposer_H
41 
42 #include "pointMesh.H"
44 #include "pointFields.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class pointFieldDecomposer Declaration
53 \*---------------------------------------------------------------------------*/
54 
56 {
57 public:
58 
59  //- Point patch field decomposer class
61  :
63  {
64  // Private data
65 
66  labelList directAddressing_;
67 
68  //- Does map contain any unmapped values
69  bool hasUnmapped_;
70 
71  public:
72 
73  // Constructors
74 
75  //- Construct given addressing
77  (
78  const pointPatch& completeMeshPatch,
79  const pointPatch& procMeshPatch,
80  const labelList& directAddr
81  );
82 
83 
84  // Member functions
85 
86  label size() const
87  {
88  return directAddressing_.size();
89  }
90 
91  bool direct() const
92  {
93  return true;
94  }
95 
96  bool hasUnmapped() const
97  {
98  return hasUnmapped_;
99  }
100 
101  const labelUList& directAddressing() const
102  {
103  return directAddressing_;
104  }
105  };
106 
107 
108 private:
109 
110  // Private Data
111 
112  //- Reference to processor mesh
113  const pointMesh& procMesh_;
114 
115  //- Reference to point addressing
116  const labelList& pointAddressing_;
117 
118  //- Reference to boundary addressing
119  const labelList& boundaryAddressing_;
120 
121  //- List of patch field decomposers
122  PtrList<patchFieldDecomposer> patchFieldDecomposerPtrs_;
123 
124 
125 public:
126 
127  //- No copy construct
129 
130  //- No copy assignment
131  void operator=(const pointFieldDecomposer&) = delete;
132 
133 
134  // Constructors
135 
136  //- Construct without mappers, added later with reset()
138  (
139  const Foam::zero,
140  const pointMesh& procMesh,
141  const labelList& pointAddressing,
142  const labelList& boundaryAddressing
143  );
144 
145  //- Construct from components
147  (
148  const pointMesh& completeMesh,
149  const pointMesh& procMesh,
150  const labelList& pointAddressing,
151  const labelList& boundaryAddressing
152  );
153 
154 
155  //- Destructor
156  ~pointFieldDecomposer() = default;
157 
158 
159  // Member Functions
160 
161  //- True if no mappers have been allocated
162  bool empty() const;
163 
164  //- Remove all mappers
165  void clear();
166 
167  //- Reset mappers using information from the complete mesh
168  void reset(const pointMesh& completeMesh);
169 
170 
171  // Mapping
172 
173  //- Decompose point field
174  template<class Type>
177  (
179  ) const;
180 
181  //- Decompose list of fields
182  template<class GeoField>
183  void decomposeFields(const PtrList<GeoField>& fields) const;
184 };
185 
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 } // End namespace Foam
190 
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 
193 #ifdef NoRepository
195 #endif
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 #endif
200 
201 // ************************************************************************* //
Foam::pointFieldDecomposer::pointFieldDecomposer
pointFieldDecomposer(const pointFieldDecomposer &)=delete
No copy construct.
Foam::pointFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
patchFieldDecomposer(const pointPatch &completeMeshPatch, const pointPatch &procMeshPatch, const labelList &directAddr)
Construct given addressing.
Definition: pointFieldDecomposer.C:34
Foam::pointFieldDecomposer::decomposeFields
void decomposeFields(const PtrList< GeoField > &fields) const
Decompose list of fields.
Definition: pointFieldDecomposerFields.C:101
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::pointFieldDecomposer::reset
void reset(const pointMesh &completeMesh)
Reset mappers using information from the complete mesh.
Definition: pointFieldDecomposer.C:131
Foam::pointPatch
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:58
Foam::pointFieldDecomposer::decomposeField
tmp< GeometricField< Type, pointPatchField, pointMesh > > decomposeField(const GeometricField< Type, pointPatchField, pointMesh > &) const
Decompose point field.
Foam::pointFieldDecomposer::patchFieldDecomposer::size
label size() const
Definition: pointFieldDecomposer.H:85
Foam::pointFieldDecomposer::patchFieldDecomposer::directAddressing
const labelUList & directAddressing() const
Definition: pointFieldDecomposer.H:100
Foam::pointFieldDecomposer::clear
void clear()
Remove all mappers.
Definition: pointFieldDecomposer.C:124
Foam::pointFieldDecomposer::~pointFieldDecomposer
~pointFieldDecomposer()=default
Destructor.
pointPatchFieldMapperPatchRef.H
pointFieldDecomposerFields.C
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:59
Foam::pointFieldDecomposer::patchFieldDecomposer::hasUnmapped
bool hasUnmapped() const
Are there unmapped values? I.e. do all size() elements get.
Definition: pointFieldDecomposer.H:95
Foam::pointFieldDecomposer::patchFieldDecomposer::direct
bool direct() const
Definition: pointFieldDecomposer.H:90
Foam::pointFieldDecomposer::operator=
void operator=(const pointFieldDecomposer &)=delete
No copy assignment.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::pointMesh
Mesh representing a set of points created from polyMesh.
Definition: pointMesh.H:51
Foam::pointFieldDecomposer::patchFieldDecomposer
Point patch field decomposer class.
Definition: pointFieldDecomposer.H:59
Foam::List< label >
Foam::UList< label >
Foam::pointPatchFieldMapperPatchRef
Foam::pointPatchFieldMapperPatchRef.
Definition: pointPatchFieldMapperPatchRef.H:47
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:53
Foam::pointFieldDecomposer::empty
bool empty() const
True if no mappers have been allocated.
Definition: pointFieldDecomposer.C:118
Foam::pointFieldDecomposer
Point field decomposer.
Definition: pointFieldDecomposer.H:54
pointFields.H
pointMesh.H
fields
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Definition: createFields.H:97
Foam::zero
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:62