1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
28 Base class for ensightPartCells and ensightPartFaces
33 ensightPartTemplates.C
35 \*---------------------------------------------------------------------------*/
40 #include "ensightFile.H"
41 #include "ensightGeoFile.H"
43 #include "labelList.H"
46 #include "IOPtrList.H"
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 /*---------------------------------------------------------------------------*\
55 Class ensightPart Declaration
56 \*---------------------------------------------------------------------------*/
62 // Static data members
63 static const List<word> elemTypes_;
73 //- part name (or description)
76 //- simple labelList with a name
77 labelListList elemLists_;
79 //- start offset for elemLists_
82 //- number of elements in this part
88 //- material id (numeric)
91 //- pointField referenced
92 const pointField& points_;
97 //- track the points used by the part and map global to local indices
101 //- number of points used
104 //- map global to local indices
114 //- construct for mesh points
115 localPoints(const pointField& pts)
123 // Protected Member Functions
125 //- Reconstruct part characteristics (eg, element types) from Istream
126 // A part reconstructed in this manner can be used when writing fields,
127 // but cannot be used to write a new geometry
128 void reconstruct(Istream&);
130 //- check for fully defined fields
131 bool isFieldDefined(const List<scalar>&) const;
133 //- write the part header
134 void writeHeader(ensightFile&, bool withDescription=false) const;
136 //- write a scalar field for idList
137 // A null reference for idList writes the perNode values
141 const List<scalar>& field,
142 const labelUList& idList
145 //- track points used
146 virtual localPoints calcLocalPoints() const
148 return localPoints();
151 //- write connectivities
152 virtual void writeConnectivity
156 const labelUList& idList,
157 const labelUList& pointMap
164 //- Runtime type information
165 TypeName("ensightPart");
173 //- Construct empty part with number and description
174 ensightPart(label partNumber, const string& partDescription);
176 //- Construct part with number, description and points reference
180 const string& partDescription,
181 const pointField& points
184 //- Construct as copy
185 ensightPart(const ensightPart&);
190 // Declare run-time constructor selection table
191 declareRunTimeSelectionTable
202 //- Construct and return clone
203 autoPtr<ensightPart> clone() const
205 return autoPtr<ensightPart>(new ensightPart(*this));
208 //- Reconstruct part characteristics on freestore from Istream
210 static autoPtr<ensightPart> New(Istream&);
214 virtual ~ensightPart();
219 virtual const List<word>& elementTypes() const
227 //- number of elements in this part
233 //- represents cell data
234 bool isCellData() const
239 //- represents face data
240 bool isFaceData() const
251 //- part name or description
252 const string& name() const
258 label materialId() const
263 //- non-const access to part name or description
264 void name(const string& value)
269 //- non-const access to material id
270 void materialId(const label value)
275 //- simple labelList with a name
276 const labelListList& elemLists() const
281 //- offset for element ids
290 //- renumber elements
291 void renumber(const labelUList&);
293 //- write summary information about the object
294 bool writeSummary(Ostream&) const;
296 //- write reconstruction information for the object
297 bool writeData(Ostream&) const;
300 virtual void writeGeometry(ensightGeoFile&) const
303 //- Helper: write geometry given the pointField
304 void writeGeometry(ensightGeoFile&, const pointField&) const;
306 //- write scalar field
307 // optionally write data per node
308 void writeScalarField
311 const List<scalar>& field,
312 const bool perNode = false
315 //- write vector field components
316 // optionally write data per node
317 void writeVectorField
320 const List<scalar>& field0,
321 const List<scalar>& field1,
322 const List<scalar>& field2,
323 const bool perNode = false
327 //- write generalized field components
328 // optionally write data per node
334 const bool perNode = false
340 //- Disallow default bitwise assignment
341 void operator=(const ensightPart&)
343 notImplemented("ensightPart::operator=(const ensightPart&)");
347 // IOstream Operators
349 //- write data (reconstruction information)
350 friend Ostream& operator<<(Ostream&, const ensightPart&);
353 friend ensightGeoFile& operator<<(ensightGeoFile&, const ensightPart&);
358 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
360 } // End namespace Foam
362 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
365 # include "ensightPartTemplates.C"
368 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
372 // ************************************************************************* //