starcdSurfaceWriter.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) 2011 OpenFOAM Foundation
9  Copyright (C) 2015-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::surfaceWriters::starcdWriter
29 
30 Description
31  A surfaceWriter for STARCD files.
32 
33  The formatOptions for starcd:
34  \table
35  Property | Description | Required | Default
36  compression | Use file compression | no | false
37  \endtable
38 
39  The geometry is written via the MeshedSurfaceProxy, the fields
40  are written in a trivial ASCII format with ID and VALUE as
41  so-called user data. These \c .usr files can be read into proSTAR
42  with these types of commands. For element data:
43  \verbatim
44  getuser FILENAME.usr cell scalar free
45  getuser FILENAME.usr cell vector free
46  \endverbatim
47  and for vertex data:
48  \verbatim
49  getuser FILENAME.usr vertex scalar free
50  getuser FILENAME.usr vertex vector free
51  \endverbatim
52 
53  \heading Output file locations
54 
55  The \c rootdir normally corresponds to something like
56  \c postProcessing/<name>
57 
58  \subheading Geometry
59  \verbatim
60  rootdir
61  `-- timeName
62  `-- surfaceName.{cel,vrt,inp}
63  \endverbatim
64 
65  \subheading Fields
66  \verbatim
67  rootdir
68  `-- timeName
69  |-- <field0>_surfaceName.{usr}
70  `-- <field1>_surfaceName.{usr}
71  \endverbatim
72 
73 SourceFiles
74  starcdSurfaceWriter.C
75 
76 \*---------------------------------------------------------------------------*/
77 
78 #ifndef starcdSurfaceWriter_H
79 #define starcdSurfaceWriter_H
80 
81 #include "surfaceWriter.H"
82 
83 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
84 
85 namespace Foam
86 {
87 namespace surfaceWriters
88 {
89 
90 /*---------------------------------------------------------------------------*\
91  Class starcdWriter Declaration
92 \*---------------------------------------------------------------------------*/
93 
94 class starcdWriter
95 :
96  public surfaceWriter
97 {
98  // Private Data
99 
100  //- Output stream option
101  IOstreamOption streamOpt_;
102 
103 
104  // Private Member Functions
105 
106  //- Templated write operation
107  template<class Type>
108  fileName writeTemplate
109  (
110  const word& fieldName,
111  const Field<Type>& localValues
112  );
113 
114 
115 public:
116 
117  //- Declare type-name, virtual type (without debug switch)
118  TypeNameNoDebug("starcd");
119 
120 
121  // Constructors
122 
123  //- Default construct
124  starcdWriter();
125 
126  //- Construct with some output options
127  explicit starcdWriter(const dictionary& options);
128 
129  //- Construct from components
131  (
132  const meshedSurf& surf,
133  const fileName& outputPath,
134  bool parallel = Pstream::parRun(),
135  const dictionary& options = dictionary()
136  );
137 
138  //- Construct from components
140  (
141  const pointField& points,
142  const faceList& faces,
143  const fileName& outputPath,
144  bool parallel = Pstream::parRun(),
145  const dictionary& options = dictionary()
146  );
147 
148 
149  //- Destructor
150  virtual ~starcdWriter() = default;
151 
152 
153  // Member Functions
154 
155  //- True if the surface format supports geometry in a separate file.
156  // False if geometry and field must be in a single file
157  virtual bool separateGeometry() const
158  {
159  return true;
160  }
161 
162  //- Write surface geometry to file.
163  virtual fileName write(); // override
164 
171 };
172 
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 } // End namespace surfaceWriters
177 } // End namespace Foam
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 #endif
182 
183 // ************************************************************************* //
Foam::Tensor< scalar >
Foam::surfaceWriters::starcdWriter::write
virtual fileName write()
Write surface geometry to file.
Definition: starcdSurfaceWriter.C:120
Foam::SymmTensor< scalar >
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::surfaceWriter
Base class for surface writers.
Definition: surfaceWriter.H:111
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::surfaceWriters::starcdWriter::declareSurfaceWriterWriteMethod
declareSurfaceWriterWriteMethod(label)
Foam::UPstream::parRun
static bool & parRun()
Is this a parallel run?
Definition: UPstream.H:415
Foam::meshedSurf
Abstract definition of a meshed surface defined by faces and points.
Definition: meshedSurf.H:49
surfaceWriter.H
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::surfaceWriters::starcdWriter::~starcdWriter
virtual ~starcdWriter()=default
Destructor.
Foam::IOstreamOption
The IOstreamOption is a simple container for options an IOstream can normally have.
Definition: IOstreamOption.H:63
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::SphericalTensor< scalar >
Foam::surfaceWriters::starcdWriter::starcdWriter
starcdWriter()
Default construct.
Definition: starcdSurfaceWriter.C:68
Foam::surfaceWriters::starcdWriter::separateGeometry
virtual bool separateGeometry() const
True if the surface format supports geometry in a separate file.
Definition: starcdSurfaceWriter.H:166
Foam::surfaceWriters::starcdWriter::TypeNameNoDebug
TypeNameNoDebug("starcd")
Declare type-name, virtual type (without debug switch)
Foam::Vector< scalar >
Foam::List< face >
Foam::surfaceWriters::starcdWriter
A surfaceWriter for STARCD files.
Definition: starcdSurfaceWriter.H:103
points
const pointField & points
Definition: gmvOutputHeader.H:1