ensightSurfaceWriter.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::ensightSurfaceWriter
26 
27 Description
28  A surfaceWriter for Ensight format.
29 
30 SourceFiles
31  ensightSurfaceWriter.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef ensightSurfaceWriter_H
36 #define ensightSurfaceWriter_H
37 
38 #include "surfaceWriter.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class ensightSurfaceWriter Declaration
47 \*---------------------------------------------------------------------------*/
48 
50 :
51  public surfaceWriter
52 {
53  // Private Member Functions
54 
55  //- Templated write operation
56  template<class Type>
57  void Write
58  (
59  const fileName& outputDir,
60  const fileName& surfaceName,
61  const pointField& points,
62  const faceList& faces,
63  const word& fieldName,
64  const Field<Type>& values,
65  const bool isNodeValues
66  ) const;
67 
68 
69 public:
70 
71  //- Runtime type information
72  TypeName("ensight");
73 
74 
75  // Constructors
76 
77  //- Construct given write format
79 
80  //- Construct with some output options
81  ensightSurfaceWriter(const dictionary& optDict);
82 
83 
84  //- Destructor
85  virtual ~ensightSurfaceWriter();
86 
87 
88  // Member Functions
89 
90  //- True if the surface format supports geometry in a separate file.
91  // False if geometry and field must be in a single file
92  virtual bool separateGeometry()
93  {
94  return true;
95  }
96 
97 
98  //- Write single surface geometry to file.
99  virtual void write
100  (
101  const fileName& outputDir,
102  const fileName& surfaceName,
103  const pointField& points,
104  const faceList& faces
105  ) const;
106 
107 
108  //- Write scalarField for a single surface to file.
109  // One value per face or vertex (isNodeValues = true)
110  virtual void write
111  (
112  const fileName& outputDir, // <case>/surface/TIME
113  const fileName& surfaceName, // name of surface
114  const pointField& points,
115  const faceList& faces,
116  const word& fieldName, // name of field
117  const Field<scalar>& values,
118  const bool isNodeValues
119  ) const;
120 
121  //- Write vectorField for a single surface to file.
122  // One value per face or vertex (isNodeValues = true)
123  virtual void write
124  (
125  const fileName& outputDir, // <case>/surface/TIME
126  const fileName& surfaceName, // name of surface
127  const pointField& points,
128  const faceList& faces,
129  const word& fieldName, // name of field
130  const Field<vector>& values,
131  const bool isNodeValues
132  ) const;
133 
134  //- Write sphericalTensorField for a single surface to file.
135  // One value per face or vertex (isNodeValues = true)
136  virtual void write
137  (
138  const fileName& outputDir, // <case>/surface/TIME
139  const fileName& surfaceName, // name of surface
140  const pointField& points,
141  const faceList& faces,
142  const word& fieldName, // name of field
143  const Field<sphericalTensor>& values,
144  const bool isNodeValues
145  ) const;
146 
147  //- Write symmTensorField for a single surface to file.
148  // One value per face or vertex (isNodeValues = true)
149  virtual void write
150  (
151  const fileName& outputDir, // <case>/surface/TIME
152  const fileName& surfaceName, // name of surface
153  const pointField& points,
154  const faceList& faces,
155  const word& fieldName, // name of field
156  const Field<symmTensor>& values,
157  const bool isNodeValues
158  ) const;
159 
160  //- Write tensorField for a single surface to file.
161  // One value per face or vertex (isNodeValues = true)
162  virtual void write
163  (
164  const fileName& outputDir, // <case>/surface/TIME
165  const fileName& surfaceName, // name of surface
166  const pointField& points,
167  const faceList& faces,
168  const word& fieldName, // name of field
169  const Field<tensor>& values,
170  const bool isNodeValues
171  ) const;
172 };
173 
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 } // End namespace Foam
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 #endif
182 
183 // ************************************************************************* //
A class for handling file names.
Definition: fileName.H:79
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
virtual ~ensightSurfaceWriter()
Destructor.
const pointField & points
A class for handling words, derived from string.
Definition: word.H:59
streamFormat
Enumeration for the format of data in the stream.
Definition: IOstream.H:86
A surfaceWriter for Ensight format.
virtual bool separateGeometry()
True if the surface format supports geometry in a separate file.
Base class for surface writers.
Definition: surfaceWriter.H:54
TypeName("ensight")
Runtime type information.
virtual void write(const fileName &outputDir, const fileName &surfaceName, const pointField &points, const faceList &faces) const
Write single surface geometry to file.
Namespace for OpenFOAM.
ensightSurfaceWriter(const IOstream::streamFormat writeFormat)
Construct given write format.