1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 Base class for ensightPartCells and ensightPartFaces
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 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 //- mesh reference used
92 const polyMesh* meshPtr_;
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 polyMesh& pMesh)
118 list(pMesh.points().size(), -1)
123 // Protected Member Functions
125 //- reconstruct contents from Istream
126 void reconstruct(Istream&);
128 //- check for fully defined fields
129 bool isFieldDefined(const List<scalar>&) const;
131 //- write the part header
132 void writeHeader(ensightFile&, bool withDescription=false) const;
134 //- write a scalar field for idList
138 const List<scalar>& field,
139 const labelList& idList
142 //- track points used
143 virtual localPoints calcLocalPoints() const
145 return localPoints();
148 //- write connectivities
149 virtual void writeConnectivity
153 const labelList& idList,
154 const labelList& pointMap
161 //- Runtime type information
162 TypeName("ensightPart");
170 //- Construct empty part with number and description
171 ensightPart(label partNumber, const string& partDescription);
173 //- Construct empty part with number and description
177 const string& partDescription,
178 const polyMesh& pMesh
181 //- Construct as copy
182 ensightPart(const ensightPart&);
187 // Declare run-time constructor selection table
188 declareRunTimeSelectionTable
199 //- Construct and return clone
200 autoPtr<ensightPart> clone() const
202 return autoPtr<ensightPart>(new ensightPart(*this));
205 //- Construct on freestore from Istream
206 static autoPtr<ensightPart> New(Istream& is);
210 virtual ~ensightPart();
215 virtual List<word> const& elementTypes() const
223 //- number of elements in this part
229 //- represents cell data
230 bool isCellData() const
235 //- represents face data
236 bool isFaceData() const
247 //- part name or description
248 const string& name() const
254 label materialId() const
260 void name(const string& value)
265 void materialId(const label value)
270 //- offset for element ids
279 //- renumber elements
280 void renumber(labelList const&);
282 //- write summary information about the object
283 bool writeSummary(Ostream&) const;
285 //- write reconstruction information for the object
286 bool writeData(Ostream&) const;
289 void writeGeometry(ensightGeoFile&) const;
291 //- write scalar field
292 void writeScalarField
295 const List<scalar>& field
298 //- write vector field components
299 void writeVectorField
302 const List<scalar>& field0,
303 const List<scalar>& field1,
304 const List<scalar>& field2
308 //- write generalized field components
309 template <class Type>
319 //- Disallow default bitwise assignment
320 void operator=(const ensightPart&)
322 notImplemented("ensightPart::operator=(const ensightPart&)");
326 // IOstream Operators
328 //- write data (reconstruction information)
329 friend Ostream& operator<<(Ostream&, const ensightPart&);
332 friend ensightGeoFile& operator<<
340 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
342 } // End namespace Foam
344 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
347 # include "ensightPartI.H"
350 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
354 // ************************************************************************* //