ensightPartFaces.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-2015 OpenFOAM Foundation
9  Copyright (C) 2016-2019 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::ensightPartFaces
29 
30 Description
31  An implementation of ensightPart to hold mesh faces.
32 
33 SourceFiles
34  ensightPartFaces.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef ensightPartFaces_H
39 #define ensightPartFaces_H
40 
41 #include "ensightPart.H"
42 #include "ensightFaces.H"
43 #include "typeInfo.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class ensightPartFaces Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class ensightPartFaces
55 :
56  public ensightFaces,
57  public ensightPart
58 {
59  // Private data
60 
61  //- Start offset for patch
62  const label start_;
63 
64  //- Patch index
65  const label patchIndex_;
66 
67  //- The referenced faces
68  const faceList& faces_;
69 
70  //- The referenced pointField
71  const pointField& points_;
72 
73  //- Can skip local point renumbering when points are contiguous
74  const bool contiguousPoints_;
75 
76 
77  // Private Member Functions
78 
79  //- Track points used
80  localPoints calcLocalPoints() const;
81 
82  //- Element connectivity
83  void writeConnectivity
84  (
86  const word& key,
87  const labelUList& idList,
88  const labelUList& pointMap
89  ) const;
90 
91 
92  //- Helper: write connectivity
93  void writeConnectivity
94  (
96  const word& key,
97  const faceList&,
98  const labelUList& idList,
99  const labelUList& pointMap
100  ) const;
101 
102 
103  //- No copy construct
104  ensightPartFaces(const ensightPartFaces&) = delete;
105 
106  //- No copy assignment
107  void operator=(const ensightPartFaces&) = delete;
108 
109 
110 public:
111 
112  //- Runtime type information
113  TypeName("ensightFaces");
114 
115 
116  // Constructors
117 
118  //- Construct part with 0-based index, description, points and faces
119  // Can skip local point renumbering when points are contiguous
121  (
122  label partIndex,
123  const string& description,
124  const pointField& points,
125  const faceList& faces,
126  const bool contiguousPoints = false
127  );
128 
129  //- Construct from polyMesh and polyPatch
130  //- Part receives the name of the patch unless otherwise specified.
132  (
133  label partIndex,
134  const polyMesh& mesh,
135  const polyPatch& patch,
136  const string& partName = ""
137  );
138 
139  //- Construct from polyPatch
140  //- Part receives the name of the patch unless otherwise specified.
142  (
143  label partIndex,
144  const polyPatch& patch,
145  const string& partName = ""
146  );
147 
148 
149  //- Destructor
150  virtual ~ensightPartFaces() = default;
151 
152 
153  // Member Functions
154 
155  // Access
156 
157  //- Part index (0-based)
158  virtual label index() const
159  {
160  return ensightFaces::index();
161  }
162 
163 
164  //- Number of elements in this part
165  virtual label size() const
166  {
167  return ensightFaces::size();
168  }
169 
170 
171  //- Return the patch index, -1 when not in use.
172  inline label patchIndex() const
173  {
174  return patchIndex_;
175  }
176 
177 
178  // Output
179 
180  //- Write summary information about the object
181  virtual void writeSummary(Ostream& os) const;
182 
183  //- Print various types of debugging information
184  virtual void dumpInfo(Ostream& os) const;
185 
186  //- Write geometry
187  virtual void write(ensightGeoFile& os) const;
188 
189  //- Helper: write geometry given the pointField
190  virtual void write(ensightGeoFile& os, const pointField& points) const;
191 };
192 
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 
196 } // End namespace Foam
197 
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 
200 #endif
201 
202 // ************************************************************************* //
Foam::ensightPart::localPoints
Track the points used by the part and map global to local indices.
Definition: ensightPart.H:78
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
typeInfo.H
ensightFaces.H
Foam::ensightFaces::key
static const char * key(const enum elemType)
Return the ensight element name for the specified type.
Definition: ensightFacesI.H:32
Foam::ensightPartFaces::dumpInfo
virtual void dumpInfo(Ostream &os) const
Print various types of debugging information.
Definition: ensightPartFaces.C:279
Foam::ensightPartFaces::TypeName
TypeName("ensightFaces")
Runtime type information.
Foam::ensightPartFaces::~ensightPartFaces
virtual ~ensightPartFaces()=default
Destructor.
Foam::ensightPartFaces::patchIndex
label patchIndex() const
Return the patch index, -1 when not in use.
Definition: ensightPartFaces.H:171
Foam::ensightFaces
Sorting/classification of faces (2D) into corresponding ensight types.
Definition: ensightFaces.H:51
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::ensightGeoFile
Specialized Ensight output with extra geometry file header.
Definition: ensightGeoFile.H:48
Foam::ensightPartFaces::size
virtual label size() const
Number of elements in this part.
Definition: ensightPartFaces.H:164
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:62
Foam::Field< vector >
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::ensightFaces::size
label size() const
The processor local size of all elements.
Definition: ensightFacesI.H:50
Foam::ensightFaces::index
label index() const
The index in a list.
Definition: ensightFacesI.H:38
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::List< face >
Foam::ensightPart
Base class for ensightPartCells and ensightPartFaces.
Definition: ensightPart.H:56
Foam::UList< label >
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::ensightPartFaces::index
virtual label index() const
Part index (0-based)
Definition: ensightPartFaces.H:157
Foam::ensightPartFaces
An implementation of ensightPart to hold mesh faces.
Definition: ensightPartFaces.H:53
ensightPart.H
Foam::ensightPartFaces::writeSummary
virtual void writeSummary(Ostream &os) const
Write summary information about the object.
Definition: ensightPartFaces.C:266
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::ensightPartFaces::write
virtual void write(ensightGeoFile &os) const
Write geometry.
Definition: ensightPartFaces.C:260