1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Base class for ensightPartCells and ensightPartFaces
36 \*---------------------------------------------------------------------------*/
41 #include "ensightFile.H"
42 #include "ensightGeoFile.H"
44 #include "labelList.H"
47 #include "IOPtrList.H"
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 /*---------------------------------------------------------------------------*\
56 Class ensightPart Declaration
57 \*---------------------------------------------------------------------------*/
63 // Static data members
64 static List<word> elemTypes_;
74 //- part name (or description)
77 //- simple labelList with a name
78 labelListList elemLists_;
80 //- start offset for elemLists_
83 //- number of elements in this part
89 //- material id (numeric)
92 //- mesh reference used
93 const polyMesh* meshPtr_;
98 //- track the points used by the part and map global to local indices
102 //- number of points used
105 //- map global to local indices
115 // construct for mesh points
116 localPoints(const polyMesh& pMesh)
119 list(pMesh.points().size(), -1)
124 // Protected Member Functions
126 //- reconstruct contents from Istream
127 void reconstruct(Istream&);
129 //- check for fully defined fields
130 bool isFieldDefined(const List<scalar>&) const;
132 //- write the part header
133 void writeHeader(ensightFile&, bool withDescription=false) const;
135 //- write a scalar field for idList
139 const List<scalar>& field,
140 const List<label>& idList
143 //- track points used
144 virtual localPoints calcLocalPoints() const
146 return localPoints();
149 //- write connectivities
150 virtual void writeConnectivity
154 const labelList& idList,
155 const labelList& pointMap
162 //- Runtime type information
163 TypeName("ensightPart");
171 //- Construct empty part with number and description
172 ensightPart(label partNumber, const string& partDescription);
174 //- Construct empty part with number and description
178 const string& partDescription,
179 const polyMesh& pMesh
182 //- Construct as copy
183 ensightPart(const ensightPart&);
188 // Declare run-time constructor selection table
189 declareRunTimeSelectionTable
200 //- Construct and return clone
201 autoPtr<ensightPart> clone() const
203 return autoPtr<ensightPart>(new ensightPart(*this));
206 //- Construct on freestore from Istream
207 static autoPtr<ensightPart> New(Istream& is);
211 virtual ~ensightPart();
216 virtual List<word> const& elementTypes() const
224 //- number of elements in this part
230 //- represents cell data
231 bool isCellData() const
236 //- represents face data
237 bool isFaceData() const
248 //- part name or description
249 const string& name() const
255 label materialId() const
261 void name(const string& value)
266 void materialId(const label value)
271 //- offset for element ids
280 //- renumber elements
281 void renumber(labelList const&);
283 //- write summary information about the object
284 bool writeSummary(Ostream&) const;
286 //- write reconstruction information for the object
287 bool writeData(Ostream&) const;
290 void writeGeometry(ensightGeoFile&) const;
292 //- write scalar field
293 void writeScalarField
296 const List<scalar>& field
299 //- write vector field components
300 void writeVectorField
303 const List<scalar>& field0,
304 const List<scalar>& field1,
305 const List<scalar>& field2
309 //- write generalized field components
310 template <class Type>
320 //- Disallow default bitwise assignment
321 void operator=(const ensightPart&)
323 notImplemented("ensightPart::operator=(const ensightPart&)");
327 // IOstream Operators
329 //- write data (reconstruction information)
330 friend Ostream& operator<<(Ostream&, const ensightPart&);
333 friend ensightGeoFile& operator<<
341 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
343 } // End namespace Foam
345 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
348 # include "ensightPartI.H"
351 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
355 // ************************************************************************* //