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 ensightOutputSurface_H
46 #define 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  // Private Member Functions
73 
74  //- No copy construct
76 
77  //- No copy assignment
78  void operator=(const ensightOutputSurface&) = delete;
79 
80 
81 public:
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  (
108  ensightFile& os,
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 // ************************************************************************* //
ensightFaces.H
Foam::ensightOutputSurface::write
virtual void write(ensightGeoFile &, const polyMesh &, bool) const
Cannot write geometry with a mesh reference.
Definition: ensightOutputSurface.H:124
Foam::ensightOutputSurface::writeFaceData
void writeFaceData(ensightFile &os, const Field< Type > &fld) const
Write a field of face values (serial-only)
Definition: ensightOutputSurfaceTemplates.C:54
Foam::ensightFaces
Sorting/classification of faces (2D) into corresponding ensight types.
Definition: ensightFaces.H:71
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::ensightGeoFile
Specialized Ensight output with extra geometry file header.
Definition: ensightGeoFile.H:48
Foam::ensightOutputSurface::writePointData
void writePointData(ensightFile &os, const Field< Type > &fld) const
Write a field of point values (serial-only)
Definition: ensightOutputSurfaceTemplates.C:71
Foam::Field< vector >
Foam::ensightOutputSurface::~ensightOutputSurface
virtual ~ensightOutputSurface()=default
Destructor.
Foam::ensightOutputSurface::write
void write(ensightGeoFile &os) const
Write processor-local geometry (serial-only)
Definition: ensightOutputSurface.C:51
ensightOutputSurfaceTemplates.C
fld
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))
Definition: gmvOutputLagrangian.H:23
os
OBJstream os(runTime.globalPath()/outputName)
Foam::ensightOutputSurface::writeData
void writeData(ensightFile &os, const Field< Type > &fld, const bool isPointData=false) const
Write a field of face or point values (serial-only)
Definition: ensightOutputSurfaceTemplates.C:35
Foam::ensightFile
Ensight output with specialized write() for strings, integers and floats. Correctly handles binary wr...
Definition: ensightFile.H:52
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::ensightOutputSurface
A variant of ensightFaces that holds references to contiguous points/faces with its own encapsulated ...
Definition: ensightOutputSurface.H:58
Foam::List< face >
points
const pointField & points
Definition: gmvOutputHeader.H:1