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 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::ensightOutputSurface
28 
29 Description
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 
35 Note
36  The primary use is for the Foam::surfaceWriters::ensightWriter
37  but can be used independently as well.
38 
39 SourceFiles
40  ensightOutputSurface.C
41  ensightOutputSurfaceTemplates.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef Foam_ensightOutputSurface_H
46 #define Foam_ensightOutputSurface_H
47 
48 #include "ensightFaces.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 /*---------------------------------------------------------------------------*\
56  Class ensightOutputSurface Declaration
57 \*---------------------------------------------------------------------------*/
58 
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 public:
73 
74  // Generated Methods
75 
76  //- No copy construct
78 
79  //- No copy assignment
80  void operator=(const ensightOutputSurface&) = delete;
81 
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  //- No beginGeometry() marker.
103  void write(ensightGeoFile& os) const;
104 
105  //- Write a field of face or point values (serial-only)
106  template<class Type>
107  void writeData
108  (
109  ensightFile& os,
110  const Field<Type>& fld,
111  const bool isPointData = false
112  ) const;
113 
114  //- Write a field of face values (serial-only)
115  template<class Type>
116  void writeFaceData(ensightFile& os, const Field<Type>& fld) const;
117 
118  //- Write a field of point values (serial-only)
119  template<class Type>
120  void writePointData(ensightFile& os, const Field<Type>& fld) const;
121 
122 
123  // Housekeeping
124 
125  //- Cannot write geometry with a mesh reference.
126  //- No beginGeometry() marker.
127  virtual void write(ensightGeoFile&, const polyMesh&, bool) const
128  {}
129 };
130 
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 } // End namespace Foam
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 #ifdef NoRepository
140 #endif
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 #endif
145 
146 // ************************************************************************* //
A variant of OFstream with specialised handling for Ensight writing of strings, integers and floats (...
Definition: ensightFile.H:47
void writePointData(ensightFile &os, const Field< Type > &fld) const
Write a field of point values (serial-only)
A variant of ensightFile (Ensight writing) that includes the extra geometry file header information...
void writeData(ensightFile &os, const Field< Type > &fld, const bool isPointData=false) const
Write a field of face or point values (serial-only)
Sorting/classification of faces (2D) into corresponding ensight types.
Definition: ensightFaces.H:66
const pointField & points
void operator=(const ensightOutputSurface &)=delete
No copy assignment.
ensightOutputSurface(const ensightOutputSurface &)=delete
No copy construct.
void writeFaceData(ensightFile &os, const Field< Type > &fld) const
Write a field of face values (serial-only)
OBJstream os(runTime.globalPath()/outputName)
A variant of ensightFaces that holds references to contiguous points/faces with its own encapsulated ...
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
virtual ~ensightOutputSurface()=default
Destructor.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:75
void write(ensightGeoFile &os) const
Write processor-local geometry (serial-only). No beginGeometry() marker.
Namespace for OpenFOAM.