singleCellFvMesh.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) 2011-2014 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::singleCellFvMesh
26 
27 Description
28  fvMesh as subset of other mesh. Consists of one cell and all original
29  bounday faces. Useful when manipulating boundary data. Single internal
30  cell only needed to be able to manipulate in a standard way.
31 
32 SourceFiles
33  singleCellFvMesh.C
34  singleCellFvMeshInterpolate.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef singleCellFvMesh_H
39 #define singleCellFvMesh_H
40 
41 #include "fvPatchFieldMapper.H"
42 #include "fvMesh.H"
43 #include "labelListIOList.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class singleCellFvMesh Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class singleCellFvMesh
55 :
56  public fvMesh
57 {
58  // Private data
59 
61 
62  //- From patch faces back to agglomeration or fine mesh
64 
65  //- From fine mesh faces to coarse mesh
67 
68  //- From coarse points back to original mesh
70 
71  //- From fine points to coarse mesh
73 
74 
75  // Private Member Functions
76 
77  //- Calculate agglomerated mesh
78  void agglomerateMesh(const fvMesh&, const labelListList&);
79 
80 
81  //- Disallow default bitwise copy construct
83 
84  //- Disallow default bitwise assignment
85  void operator=(const singleCellFvMesh&);
86 
87 
88 public:
89 
90  //- Patch field mapper class for agglomerated meshes
92  :
93  public fvPatchFieldMapper
94  {
95  // Private data
96 
99  bool hasUnmapped_;
100 
101  public:
102 
103  //- Construct given addressing
105  (
106  const labelListList& addressing,
107  const scalarListList& weights
108  )
109  :
111  weights_(weights),
112  hasUnmapped_(false)
113  {
114  forAll(addressing_, i)
115  {
116  if (addressing_[i].empty())
117  {
118  hasUnmapped_ = true;
119  break;
120  }
121  }
122  }
123 
124  virtual label size() const
125  {
126  return addressing_.size();
127  }
128 
129  virtual bool direct() const
130  {
131  return false;
132  }
133 
134  bool hasUnmapped() const
135  {
136  return hasUnmapped_;
137  }
138 
139  virtual const labelListList& addressing() const
140  {
141  return addressing_;
142  }
143 
144  virtual const scalarListList& weights() const
145  {
146  return weights_;
147  }
148  };
149 
150 
151 
152  // Constructors
153 
154  //- Construct from fvMesh and no agglomeration
155  singleCellFvMesh(const IOobject& io, const fvMesh&);
156 
157  //- Construct from fvMesh and agglomeration of boundary faces.
158  // agglomeration is per patch, per patch face index the agglomeration
159  // the face goes into.
161  (
162  const IOobject& io,
163  const fvMesh&,
164  const labelListList& patchFaceAgglomeration
165  );
166 
167  //- Read from IOobject
168  singleCellFvMesh(const IOobject& io);
169 
170  // Member Functions
171 
172  bool agglomerate() const
173  {
174  return patchFaceAgglomeration_.size() > 0;
175  }
176 
177  //- From patchFace on this back to original mesh or agglomeration
178  const labelListList& patchFaceMap() const
179  {
180  return patchFaceMap_;
181  }
182 
183  //- From point on this back to original mesh
184  const labelList& pointMap() const
185  {
186  return pointMap_;
187  }
188 
189  //- From face on original mesh to face on this
190  const labelList& reverseFaceMap() const
191  {
192  return reverseFaceMap_;
193  }
194 
195  //- From point on original mesh to point on this (or -1 for removed
196  // points)
197  const labelList& reversePointMap() const
198  {
199  return reversePointMap_;
200  }
201 
202  //- Map volField. Internal field set to average, patch fields straight
203  // copies.
204  template<class Type>
207  (
209  ) const;
210 
211 };
212 
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 } // End namespace Foam
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 #ifdef NoRepository
222 #endif
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 #endif
227 
228 // ************************************************************************* //
Foam::singleCellFvMesh::agglomPatchFieldMapper::hasUnmapped
bool hasUnmapped() const
Are there unmapped values? I.e. do all size() elements get.
Definition: singleCellFvMesh.H:133
singleCellFvMeshInterpolate.C
Foam::singleCellFvMesh::reverseFaceMap_
labelIOList reverseFaceMap_
From fine mesh faces to coarse mesh.
Definition: singleCellFvMesh.H:65
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::singleCellFvMesh::agglomPatchFieldMapper::direct
virtual bool direct() const
Definition: singleCellFvMesh.H:128
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::singleCellFvMesh::agglomPatchFieldMapper::size
virtual label size() const
Definition: singleCellFvMesh.H:123
Foam::singleCellFvMesh::reverseFaceMap
const labelList & reverseFaceMap() const
From face on original mesh to face on this.
Definition: singleCellFvMesh.H:189
Foam::singleCellFvMesh::singleCellFvMesh
singleCellFvMesh(const singleCellFvMesh &)
Disallow default bitwise copy construct.
Foam::singleCellFvMesh::agglomPatchFieldMapper
Patch field mapper class for agglomerated meshes.
Definition: singleCellFvMesh.H:90
fvPatchFieldMapper.H
Foam::singleCellFvMesh::pointMap
const labelList & pointMap() const
From point on this back to original mesh.
Definition: singleCellFvMesh.H:183
labelListIOList.H
Foam::singleCellFvMesh::agglomPatchFieldMapper::addressing
virtual const labelListList & addressing() const
Definition: singleCellFvMesh.H:138
Foam::singleCellFvMesh::agglomPatchFieldMapper::weights
virtual const scalarListList & weights() const
Definition: singleCellFvMesh.H:143
Foam::singleCellFvMesh
fvMesh as subset of other mesh. Consists of one cell and all original bounday faces....
Definition: singleCellFvMesh.H:53
Foam::label
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
Foam::singleCellFvMesh::interpolate
tmp< GeometricField< Type, fvPatchField, volMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &) const
Map volField. Internal field set to average, patch fields straight.
Definition: singleCellFvMeshInterpolate.C:40
Foam::singleCellFvMesh::operator=
void operator=(const singleCellFvMesh &)
Disallow default bitwise assignment.
Foam::HashTable< regIOobject * >::empty
bool empty() const
Return true if the hash table is empty.
Definition: HashTableI.H:72
Foam::singleCellFvMesh::agglomPatchFieldMapper::agglomPatchFieldMapper
agglomPatchFieldMapper(const labelListList &addressing, const scalarListList &weights)
Construct given addressing.
Definition: singleCellFvMesh.H:104
Foam::singleCellFvMesh::agglomPatchFieldMapper::weights_
const scalarListList & weights_
Definition: singleCellFvMesh.H:97
Foam::singleCellFvMesh::reversePointMap_
labelIOList reversePointMap_
From fine points to coarse mesh.
Definition: singleCellFvMesh.H:71
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::singleCellFvMesh::agglomPatchFieldMapper::hasUnmapped_
bool hasUnmapped_
Definition: singleCellFvMesh.H:98
Foam::singleCellFvMesh::patchFaceMap
const labelListList & patchFaceMap() const
From patchFace on this back to original mesh or agglomeration.
Definition: singleCellFvMesh.H:177
Foam::singleCellFvMesh::patchFaceAgglomeration_
const labelListIOList patchFaceAgglomeration_
Definition: singleCellFvMesh.H:59
Foam::singleCellFvMesh::agglomerateMesh
void agglomerateMesh(const fvMesh &, const labelListList &)
Calculate agglomerated mesh.
Definition: singleCellFvMesh.C:37
Foam::singleCellFvMesh::agglomerate
bool agglomerate() const
Definition: singleCellFvMesh.H:171
Foam::singleCellFvMesh::patchFaceMap_
labelListIOList patchFaceMap_
From patch faces back to agglomeration or fine mesh.
Definition: singleCellFvMesh.H:62
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::IOList< labelList >
Foam::singleCellFvMesh::agglomPatchFieldMapper::addressing_
const labelListList & addressing_
Definition: singleCellFvMesh.H:96
Foam::singleCellFvMesh::pointMap_
labelIOList pointMap_
From coarse points back to original mesh.
Definition: singleCellFvMesh.H:68
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:45
Foam::List::size
void size(const label)
Override size to be inconsistent with allocated storage.
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::singleCellFvMesh::reversePointMap
const labelList & reversePointMap() const
From point on original mesh to point on this (or -1 for removed.
Definition: singleCellFvMesh.H:196