ensightPart.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) 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::ensightPart
29 
30 Description
31  Base class for ensightPartCells and ensightPartFaces
32 
33 SourceFiles
34  ensightPart.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef ensightPart_H
39 #define ensightPart_H
40 
41 #include "ensightGeoFile.H"
42 #include "typeInfo.H"
43 #include "labelList.H"
44 #include "polyMesh.H"
45 #include "Field.H"
46 #include "IOstream.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class ensightPart Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class ensightPart
58 {
59  // Private Data
60 
61  //- Part name (or description)
62  string name_;
63 
64 
65  // Private Member Functions
66 
67  //- No copy construct
68  ensightPart(const ensightPart&) = delete;
69 
70  //- No copy assignment
71  void operator=(const ensightPart&) = delete;
72 
73 
74 protected:
75 
76  // Protected Classes
77 
78  //- Track the points used by the part and map global to local indices
79  struct localPoints
80  {
81  //- Number of points used
82  label nPoints;
83 
84  //- Map global to local indices
86 
87  //- Null constructor
88  localPoints()
89  :
90  nPoints(0),
91  list()
92  {}
93 
94  //- Construct for mesh points
95  localPoints(const pointField& pts)
96  :
97  nPoints(0),
98  list(pts.size(), -1)
99  {}
100  };
101 
102 public:
103 
104  //- Runtime type information
105  TypeName("ensightPart");
106 
107 
108  // Constructors
109 
110  //- Construct with description
111  explicit ensightPart(const string& description);
112 
113 
114  //- Destructor
115  virtual ~ensightPart() = default;
116 
117 
118  // Access
119 
120  //- Part index (0-based)
121  virtual label index() const = 0;
122 
123  //- Number of elements in this part
124  virtual label size() const
125  {
126  return 0;
127  }
128 
129  //- Return the part name or description
130  const string& name() const
131  {
132  return name_;
133  }
134 
135  //- Change the part name or description
136  void rename(string value)
137  {
138  name_ = std::move(value);
139  }
140 
141 
142  // Output
143 
144  //- Write summary information about the object
145  virtual void writeSummary(Ostream& os) const = 0;
146 
147  //- Print various types of debugging information
148  virtual void dumpInfo(Ostream& os) const = 0;
149 
150  //- Write geometry
151  virtual void write(ensightGeoFile& os) const = 0;
152 
153  //- Helper: write geometry with given pointField
154  virtual void write(ensightGeoFile& os, const pointField&) const = 0;
155 
156 
157  // Housekeeping
158 
159  //- Deprecated(2019-12) - use rename() method
160  // \deprecated(2019-12) - use rename() method
161  void FOAM_DEPRECATED_FOR(2019-12, "rename() method")
162  name(string value)
163  {
164  name_ = std::move(value);
165  }
166 };
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 
171 //- IOstream Operator to write geometry
172 ensightGeoFile& operator<<(ensightGeoFile& os, const ensightPart& part);
173 
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 } // End namespace Foam
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 #endif
182 
183 // ************************************************************************* //
Foam::ensightPart::write
virtual void write(ensightGeoFile &os) const =0
Write geometry.
Foam::ensightPart::localPoints
Track the points used by the part and map global to local indices.
Definition: ensightPart.H:78
Foam::ensightPart::name
const string & name() const
Return the part name or description.
Definition: ensightPart.H:129
typeInfo.H
Foam::ensightPart::localPoints::localPoints
localPoints(const pointField &pts)
Construct for mesh points.
Definition: ensightPart.H:94
Foam::ensightPart::rename
void rename(string value)
Change the part name or description.
Definition: ensightPart.H:135
polyMesh.H
Foam::ensightPart::FOAM_DEPRECATED_FOR
void FOAM_DEPRECATED_FOR(2019-12, "rename() method") name(string value)
Deprecated(2019-12) - use rename() method.
Definition: ensightPart.H:160
Foam::ensightGeoFile
Specialized Ensight output with extra geometry file header.
Definition: ensightGeoFile.H:48
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::ensightPart::index
virtual label index() const =0
Part index (0-based)
labelList.H
Foam::Field< vector >
IOstream.H
Field.H
Foam::ensightPart::TypeName
TypeName("ensightPart")
Runtime type information.
Foam::ensightPart::size
virtual label size() const
Number of elements in this part.
Definition: ensightPart.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::ensightPart::~ensightPart
virtual ~ensightPart()=default
Destructor.
ensightGeoFile.H
Foam::ensightPart::localPoints::list
labelList list
Map global to local indices.
Definition: ensightPart.H:84
Foam::ensightPart::localPoints::localPoints
localPoints()
Null constructor.
Definition: ensightPart.H:87
Foam::List< label >
Foam::ensightPart
Base class for ensightPartCells and ensightPartFaces.
Definition: ensightPart.H:56
Foam::ensightPart::dumpInfo
virtual void dumpInfo(Ostream &os) const =0
Print various types of debugging information.
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::ensightPart::localPoints::nPoints
label nPoints
Number of points used.
Definition: ensightPart.H:81
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &)
Definition: boundaryPatch.C:102
Foam::ensightPart::writeSummary
virtual void writeSummary(Ostream &os) const =0
Write summary information about the object.