ensightParts.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 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::ensightParts
26 
27 Description
28  A collection of several ensightPart elements
29 
30 SourceFiles
31  ensightParts.C
32  ensightPartsTemplates.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef ensightParts_H
37 #define ensightParts_H
38 
39 #include "ensightPart.H"
40 #include "ensightPartFaces.H"
41 #include "ensightPartCells.H"
42 #include "volFields.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Forward declaration of friend functions and operators
50 
51 class ensightParts;
52 
53 ensightGeoFile& operator<<(ensightGeoFile&, const ensightParts&);
54 
55 
56 /*---------------------------------------------------------------------------*\
57  Class ensightParts Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 class ensightParts
61 {
62  // Private Data
63 
64  //- List of parts
65  PtrList<ensightPart> partsList_;
66 
67  // Private Member Functions
68 
69  //- Disallow default bitwise copy construct
70  ensightParts(const ensightParts&);
71 
72  //- Disallow default bitwise assignment
73  void operator=(const ensightParts&);
74 
75 
76 public:
77 
78  // Constructors
79 
80  //- Construct from polyMesh
81  ensightParts(const polyMesh&);
82 
83  //- Construct from IOobject
84  ensightParts(const IOobject&);
85 
86 
87  //- Destructor
88  ~ensightParts();
89 
90 
91  // Member functions
92 
93  //- Clear old information and construct anew from polyMesh
94  void recalculate(const polyMesh&);
95 
96  //- Renumber elements
97  void renumber
98  (
99  const labelUList& origCellId,
100  const labelUList& origFaceId
101  );
102 
103  //- Number of parts
104  label size() const
105  {
106  return partsList_.size();
107  }
108 
109  //- Write the geometry
110  void writeGeometry(ensightGeoFile&) const;
111 
112  //- Write summary information about the objects
113  bool writeSummary(Ostream&) const;
114 
115  //- Write the lists
116  void writeData(Ostream&) const;
117 
118  //- Write (volume) scalar field
119  // optionally write data for face parts
120  // optionally write data per node
121  void writeScalarField
122  (
123  ensightFile&,
124  const List<scalar>& field,
125  const bool useFaceData = false,
126  const bool perNode = false
127  ) const;
128 
129  //- Write (volume) vector field components
130  // optionally write data for face parts
131  // optionally write data per node
132  void writeVectorField
133  (
134  ensightFile&,
135  const List<scalar>& field0,
136  const List<scalar>& field1,
137  const List<scalar>& field2,
138  const bool useFaceData = false,
139  const bool perNode = false
140  ) const;
141 
142 
143  //- Write generalized volume field components
144  template<class Type>
145  void writeField
146  (
147  ensightFile&,
149  ) const;
150 
151 
152  // Friend Operators
153 
154  //- Write geometry
156 };
157 
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 } // End namespace Foam
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 #ifdef NoRepository
166  #include "ensightPartsTemplates.C"
167 #endif
168 
169 #endif
170 
171 // ************************************************************************* //
void writeGeometry(ensightGeoFile &) const
Write the geometry.
Definition: ensightParts.C:183
void writeField(ensightFile &, const GeometricField< Type, fvPatchField, volMesh > &) const
Write generalized volume field components.
Ensight output with specialized write() for strings, integers and floats. Correctly handles binary wr...
Definition: ensightFile.H:47
void writeScalarField(ensightFile &, const List< scalar > &field, const bool useFaceData=false, const bool perNode=false) const
Write (volume) scalar field.
Definition: ensightParts.C:228
void recalculate(const polyMesh &)
Clear old information and construct anew from polyMesh.
Definition: ensightParts.C:55
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
A collection of several ensightPart elements.
Definition: ensightParts.H:59
void writeVectorField(ensightFile &, const List< scalar > &field0, const List< scalar > &field1, const List< scalar > &field2, const bool useFaceData=false, const bool perNode=false) const
Write (volume) vector field components.
Definition: ensightParts.C:251
Template to write generalized field components.
Specialized Ensight output with extra geometry file header.
friend ensightGeoFile & operator<<(ensightGeoFile &, const ensightParts &)
Write geometry.
Generic GeometricField class.
void writeData(Ostream &) const
Write the lists.
Definition: ensightParts.C:207
~ensightParts()
Destructor.
Definition: ensightParts.C:49
label size() const
Number of parts.
Definition: ensightParts.H:103
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:61
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
bool writeSummary(Ostream &) const
Write summary information about the objects.
Definition: ensightParts.C:196
label size() const
Return the number of elements in the UPtrList.
Definition: UPtrListI.H:29
void renumber(const labelUList &origCellId, const labelUList &origFaceId)
Renumber elements.
Definition: ensightParts.C:164
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:63
Ostream & operator<<(Ostream &, const ensightPart &)
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
Namespace for OpenFOAM.