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-2019 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 geometry is written via the MeshedSurfaceProxy, the fields
34  are written in a trivial ASCII format with ID and VALUE as
35  so-called user data. These \c .usr files can be read into proSTAR
36  with these types of commands. For element data:
37  \verbatim
38  getuser FILENAME.usr cell scalar free
39  getuser FILENAME.usr cell vector free
40  \endverbatim
41  and for vertex data:
42  \verbatim
43  getuser FILENAME.usr vertex scalar free
44  getuser FILENAME.usr vertex vector free
45  \endverbatim
46 
47  \heading Output file locations
48 
49  The \c rootdir normally corresponds to something like
50  \c postProcessing/<name>
51 
52  \subheading Geometry
53  \verbatim
54  rootdir
55  `-- timeName
56  `-- surfaceName.{cel,vrt,inp}
57  \endverbatim
58 
59  \subheading Fields
60  \verbatim
61  rootdir
62  `-- timeName
63  |-- <field0>_surfaceName.{usr}
64  `-- <field1>_surfaceName.{usr}
65  \endverbatim
66 
67 SourceFiles
68  starcdSurfaceWriter.C
69 
70 \*---------------------------------------------------------------------------*/
71 
72 #ifndef starcdSurfaceWriter_H
73 #define starcdSurfaceWriter_H
74 
75 #include "surfaceWriter.H"
76 
77 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
78 
79 namespace Foam
80 {
81 namespace surfaceWriters
82 {
83 
84 /*---------------------------------------------------------------------------*\
85  Class starcdWriter Declaration
86 \*---------------------------------------------------------------------------*/
87 
88 class starcdWriter
89 :
90  public surfaceWriter
91 {
92  // Private Member Functions
93 
94  //- Templated write operation
95  template<class Type>
96  fileName writeTemplate
97  (
98  const word& fieldName,
99  const Field<Type>& localValues
100  );
101 
102 
103 public:
104 
105  //- Runtime type information
106  TypeNameNoDebug("starcd");
107 
108 
109  // Constructors
110 
111  //- Construct null
112  starcdWriter();
113 
114  //- Construct with some output options
115  explicit starcdWriter(const dictionary& options);
116 
117  //- Construct from components
119  (
120  const meshedSurf& surf,
121  const fileName& outputPath,
122  bool parallel = Pstream::parRun(),
123  const dictionary& options = dictionary()
124  );
125 
126  //- Construct from components
128  (
129  const pointField& points,
130  const faceList& faces,
131  const fileName& outputPath,
132  bool parallel = Pstream::parRun(),
133  const dictionary& options = dictionary()
134  );
135 
136 
137  //- Destructor
138  virtual ~starcdWriter() = default;
139 
140 
141  // Member Functions
142 
143  //- True if the surface format supports geometry in a separate file.
144  // False if geometry and field must be in a single file
145  virtual bool separateGeometry() const
146  {
147  return true;
148  }
149 
150  //- Write surface geometry to file.
151  virtual fileName write(); // override
152 
159 };
160 
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 } // End namespace surfaceWriters
165 } // End namespace Foam
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 #endif
170 
171 // ************************************************************************* //
Foam::Tensor< scalar >
Foam::surfaceWriters::starcdWriter::write
virtual fileName write()
Write surface geometry to file.
Definition: starcdSurfaceWriter.C:114
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:414
Foam::meshedSurf
Abstract definition of a meshed surface defined by faces and points.
Definition: meshedSurf.H:49
surfaceWriter.H
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::surfaceWriters::starcdWriter::~starcdWriter
virtual ~starcdWriter()=default
Destructor.
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()
Construct null.
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:144
Foam::surfaceWriters::starcdWriter::TypeNameNoDebug
TypeNameNoDebug("starcd")
Runtime type information.
Foam::Vector< scalar >
Foam::List< face >
Foam::surfaceWriters::starcdWriter
A surfaceWriter for STARCD files.
Definition: starcdSurfaceWriter.H:87
points
const pointField & points
Definition: gmvOutputHeader.H:1