polyMeshGenFaces.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6  \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of cfMesh.
10 
11  cfMesh is free software; you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by the
13  Free Software Foundation; either version 3 of the License, or (at your
14  option) any later version.
15 
16  cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  polyMeshGenFaces
26 
27 Description
28  Mesh with geometry and faces. It can be used for volume and surface meshes
29 
30 SourceFiles
31  polyMeshGenFaces.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef polyMeshGenFaces_H
36 #define polyMeshGenFaces_H
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 #include "polyMeshGenPoints.H"
41 #include "faceListPMG.H"
42 #include "labelIOList.H"
43 #include "processorBoundaryPatch.H"
44 #include "boundaryPatch.H"
45 
46 namespace Foam
47 {
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 class polyMeshGenFaces
52 : public polyMeshGenPoints
53 {
54 protected:
55 
56  // Protected data
57  //- list of faces
59 
60  //- inter-processor boundaries. These faces are located after the other
61  //- boundary faces in the list of faces. The processor
62  //- boundaries are internal faces in the end.
64 
65  //- boundary data
67 
68  //- face subsets
69  std::map<label, meshSubset> faceSubsets_;
70 
71  // Addressing data
72  //- number of internal faces, owner and neighbour
73  mutable label nIntFaces_;
75  mutable labelIOList* neighbourPtr_;
76 
77  // Private member functions
78 
79  //- calculate owner and neighbour addressing
80  virtual void calculateOwnersAndNeighbours() const = 0;
81 
82  //- clear all pointer data
83  void clearOut() const;
84 
85  // Disallow bitwise assignment
86  void operator=(const polyMeshGenFaces&);
87 
89 
90 public:
91 
92  friend class polyMeshGenModifier;
93 
94  // Constructors
95  //- Null constructor
96  polyMeshGenFaces(const Time&);
97 
98  //- Construct from components without the boundary
100  (
101  const Time&,
102  const pointField& points,
103  const faceList& faces
104  );
105 
106  //- Construct from components with the boundary
108  (
109  const Time&,
110  const pointField& points,
111  const faceList& faces,
112  const wordList& patchNames,
113  const labelList& patchStart,
114  const labelList& nFacesInPatch
115  );
116 
117  // Destructor
118  virtual ~polyMeshGenFaces();
119 
120  // Member functions
121 
122  //- access to faces
123  inline const faceListPMG& faces() const;
124 
125  //- return number of internal faces
126  inline label nInternalFaces() const;
127 
128  //- owner and neighbour cells for faces
129  inline const labelList& owner() const;
130  inline const labelList& neighbour() const;
131 
132  // Boundary data
133 
134  //- inter-processor boundaries
135  inline const PtrList<processorBoundaryPatch>& procBoundaries() const;
136 
137  //- return processor patch label for the given face label
138  label faceIsInProcPatch(const label faceLabel) const;
139 
140  //- ordinary boundaries
141  inline const PtrList<boundaryPatch>& boundaries() const;
142 
143  //- return patch label for the given face label
144  label faceIsInPatch(const label faceLabel) const;
145 
146  //- return list of patches in the boundary
147  wordList patchNames() const;
148 
149  //- return the index of a patch given its name
150  label getPatchID(const word& patchName) const;
151 
152  //- return the name of a patch given its ID
153  word getPatchName(const label patchID) const;
154 
155  //- return a list of patch indices corresponding to the given
156  // name, expanding regular expressions
157  labelList findPatches(const word& patchName) const;
158 
159  // Subsets
160 
161  label addFaceSubset(const word&);
162  void removeFaceSubset(const label);
163  word faceSubsetName(const label) const;
164  label faceSubsetIndex(const word&) const;
165  inline void addFaceToSubset(const label, const label);
166  inline void removeFaceFromSubset(const label, const label);
167  inline void faceInSubsets(const label, DynList<label>&) const;
168  inline void faceSubsetIndices(DynList<label>&) const;
169  template<class ListType>
170  inline void facesInSubset(const label, ListType&) const;
171  template<class ListType>
172  inline void updateFaceSubsets(const ListType&);
173  inline void updateFaceSubsets(const VRWGraph&);
174 
175  // Read mesh
176  void read();
177 
178  // Write mesh
179  void write() const;
180 };
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 } // End namespace Foam
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 #include "polyMeshGenFacesI.H"
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 #endif
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::polyMeshGenFaces::neighbour
const labelList & neighbour() const
Definition: polyMeshGenFacesI.H:86
Foam::polyMeshGenFaces::owner
const labelList & owner() const
owner and neighbour cells for faces
Definition: polyMeshGenFacesI.H:67
Foam::polyMeshGenFaces::ownerPtr_
labelIOList * ownerPtr_
Definition: polyMeshGenFaces.H:73
Foam::polyMeshGenFaces::removeFaceFromSubset
void removeFaceFromSubset(const label, const label)
Definition: polyMeshGenFacesI.H:130
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::polyMeshGenFaces::faceSubsetName
word faceSubsetName(const label) const
Definition: polyMeshGenFaces.C:300
Foam::polyMeshGenFaces::removeFaceSubset
void removeFaceSubset(const label)
Definition: polyMeshGenFaces.C:292
polyMeshGenFacesI.H
Foam::polyMeshGenFaces::findPatches
labelList findPatches(const word &patchName) const
return a list of patch indices corresponding to the given
Definition: polyMeshGenFaces.C:247
Foam::polyMeshGenFaces::patchNames
wordList patchNames() const
return list of patches in the boundary
Definition: polyMeshGenFaces.C:203
Foam::polyMeshGenFaces::faceSubsetIndex
label faceSubsetIndex(const word &) const
Definition: polyMeshGenFaces.C:313
Foam::polyMeshGenFaces::addFaceSubset
label addFaceSubset(const word &)
Definition: polyMeshGenFaces.C:262
Foam::polyMeshGenFaces::faceSubsets_
std::map< label, meshSubset > faceSubsets_
face subsets
Definition: polyMeshGenFaces.H:68
Foam::polyMeshGenFaces::faceIsInPatch
label faceIsInPatch(const label faceLabel) const
return patch label for the given face label
Definition: polyMeshGenFaces.C:190
Foam::polyMeshGenPoints::points
const pointFieldPMG & points() const
access to points
Definition: polyMeshGenPointsI.H:44
Foam::polyMeshGenFaces::facesInSubset
void facesInSubset(const label, ListType &) const
Definition: polyMeshGenFacesI.H:178
Foam::polyMeshGenPoints
Definition: polyMeshGenPoints.H:55
faceListPMG.H
Foam::polyMeshGenFaces::updateFaceSubsets
void updateFaceSubsets(const ListType &)
Definition: polyMeshGenFacesI.H:194
Foam::polyMeshGenFaces::faces
const faceListPMG & faces() const
access to faces
Definition: polyMeshGenFacesI.H:43
Foam::polyMeshGenFaces::nInternalFaces
label nInternalFaces() const
return number of internal faces
Definition: polyMeshGenFacesI.H:48
Foam::polyMeshGenFaces::read
void read()
Definition: polyMeshGenFaces.C:325
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::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::polyMeshGenFaces::getPatchID
label getPatchID(const word &patchName) const
return the index of a patch given its name
Definition: polyMeshGenFaces.C:215
Foam::polyMeshGenFaces::procBoundaries_
PtrList< processorBoundaryPatch > procBoundaries_
Definition: polyMeshGenFaces.H:62
Foam::polyMeshGenFaces::faceIsInProcPatch
label faceIsInProcPatch(const label faceLabel) const
return processor patch label for the given face label
Definition: polyMeshGenFaces.C:168
Foam::polyMeshGenFaces::~polyMeshGenFaces
virtual ~polyMeshGenFaces()
Definition: polyMeshGenFaces.C:161
Foam::PtrList
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:61
Foam::polyMeshGenFaces::getPatchName
word getPatchName(const label patchID) const
return the name of a patch given its ID
Definition: polyMeshGenFaces.C:233
Foam::polyMeshGenFaces::polyMeshGenFaces
polyMeshGenFaces(const polyMeshGenFaces &)
Foam::polyMeshGenFaces::neighbourPtr_
labelIOList * neighbourPtr_
Definition: polyMeshGenFaces.H:74
Foam::polyMeshGenFaces::write
void write() const
Definition: polyMeshGenFaces.C:451
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::DynList< label >
Foam::polyMeshGenModifier
Definition: polyMeshGenModifier.H:52
Foam::polyMeshGenFaces::nIntFaces_
label nIntFaces_
number of internal faces, owner and neighbour
Definition: polyMeshGenFaces.H:72
Foam::polyMeshGenFaces::calculateOwnersAndNeighbours
virtual void calculateOwnersAndNeighbours() const =0
calculate owner and neighbour addressing
Foam::polyMeshGenFaces::faceInSubsets
void faceInSubsets(const label, DynList< label > &) const
Definition: polyMeshGenFacesI.H:142
Foam::polyMeshGenFaces::faces_
faceListPMG faces_
list of faces
Definition: polyMeshGenFaces.H:57
Foam::polyMeshGenFaces::boundaries
const PtrList< boundaryPatch > & boundaries() const
ordinary boundaries
Definition: polyMeshGenFacesI.H:111
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
labelIOList.H
Foam::IOList< label >
Foam::polyMeshGenFaces::procBoundaries
const PtrList< processorBoundaryPatch > & procBoundaries() const
inter-processor boundaries
Definition: polyMeshGenFacesI.H:106
Foam::polyMeshGenFaces::addFaceToSubset
void addFaceToSubset(const label, const label)
Definition: polyMeshGenFacesI.H:117
Foam::polyMeshGenFaces::faceSubsetIndices
void faceSubsetIndices(DynList< label > &) const
Definition: polyMeshGenFacesI.H:162
Foam::polyMeshGenFaces
Definition: polyMeshGenFaces.H:50
Foam::polyMeshGenFaces::clearOut
void clearOut() const
clear all pointer data
Definition: polyMeshGenFaces.C:41
Foam::faceListPMG
Definition: faceListPMG.H:50
polyMeshGenPoints.H
Foam::polyMeshGenFaces::boundaries_
PtrList< boundaryPatch > boundaries_
boundary data
Definition: polyMeshGenFaces.H:65
Foam::VRWGraph
Definition: VRWGraph.H:101
Foam::polyMeshGenFaces::operator=
void operator=(const polyMeshGenFaces &)
processorBoundaryPatch.H