ensightOutputSurface.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) 2020 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::ensightOutputSurface
28
29Description
30 A variant of ensightFaces that holds references to contiguous
31 points/faces with its own encapsulated write methods.
32 The surface is assumed to have been merged prior, thus the output is
33 serial-only.
34
35Note
36 The primary use is for the Foam::surfaceWriters::ensightWriter
37 but can be used independently as well.
38
39SourceFiles
40 ensightOutputSurface.C
41 ensightOutputSurfaceTemplates.C
42
43\*---------------------------------------------------------------------------*/
44
45#ifndef ensightOutputSurface_H
46#define ensightOutputSurface_H
47
48#include "ensightFaces.H"
49
50// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51
52namespace Foam
53{
54
55/*---------------------------------------------------------------------------*\
56 Class ensightOutputSurface Declaration
57\*---------------------------------------------------------------------------*/
60:
61 public ensightFaces
62{
63 // Private Data
64
65 //- The referenced pointField
66 const pointField& points_;
67
68 //- The referenced faces
69 const faceList& faces_;
70
71
72 // Private Member Functions
73
74 //- No copy construct
76
77 //- No copy assignment
78 void operator=(const ensightOutputSurface&) = delete;
79
80
81public:
82
83 // Constructors
84
85 //- Construct from points and faces.
86 //- Part receives the specified name (default: "surface").
88 (
89 const pointField& points,
90 const faceList& faces,
91 const string& description = "surface"
92 );
93
94
95 //- Destructor
96 virtual ~ensightOutputSurface() = default;
97
98
99 // Member Functions
100
101 //- Write processor-local geometry (serial-only)
102 void write(ensightGeoFile& os) const;
103
104 //- Write a field of face or point values (serial-only)
105 template<class Type>
106 void writeData
107 (
109 const Field<Type>& fld,
110 const bool isPointData = false
111 ) const;
112
113 //- Write a field of face values (serial-only)
114 template<class Type>
115 void writeFaceData(ensightFile& os, const Field<Type>& fld) const;
116
117 //- Write a field of point values (serial-only)
118 template<class Type>
119 void writePointData(ensightFile& os, const Field<Type>& fld) const;
120
121
122 // Housekeeping
123
124 //- Cannot write geometry with a mesh reference
125 virtual void write(ensightGeoFile&, const polyMesh&, bool) const
126 {}
127};
128
129
130// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131
132} // End namespace Foam
133
134// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135
136#ifdef NoRepository
138#endif
139
140// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141
142#endif
143
144// ************************************************************************* //
Info<< nl<< "Wrote faMesh in vtk format: "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.mesh().time().globalPath()/"finiteArea-edges"));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
Sorting/classification of faces (2D) into corresponding ensight types.
Definition: ensightFaces.H:75
Ensight output with specialized write() for strings, integers and floats. Correctly handles binary wr...
Definition: ensightFile.H:55
Specialized Ensight output with extra geometry file header.
A variant of ensightFaces that holds references to contiguous points/faces with its own encapsulated ...
void writePointData(ensightFile &os, const Field< Type > &fld) const
Write a field of point values (serial-only)
virtual ~ensightOutputSurface()=default
Destructor.
void writeFaceData(ensightFile &os, const Field< Type > &fld) const
Write a field of face values (serial-only)
void writeData(ensightFile &os, const Field< Type > &fld, const bool isPointData=false) const
Write a field of face or point values (serial-only)
virtual void write(ensightGeoFile &, const polyMesh &, bool) const
Cannot write geometry with a mesh reference.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
OBJstream os(runTime.globalPath()/outputName)
const pointField & points
Namespace for OpenFOAM.
runTime write()