rawSurfaceWriter.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-2016 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::rawWriter
29 
30 Description
31  A surfaceWriter for raw output.
32 
33  The formatOptions for raw:
34  \table
35  Property | Description | Required | Default
36  compression | Use file compression | no | false
37  scale | output geometry scaling | no | 1
38  fieldScale | output field scaling (dictionary) | no | empty
39  \endtable
40 
41  For example,
42  \verbatim
43  formatOptions
44  {
45  raw
46  {
47  compression on;
48 
49  scale 1000; // [m] -> [mm]
50  fieldScale
51  {
52  "p.*" 0.01; // [Pa] -> [mbar]
53  }
54  }
55  }
56  \endverbatim
57 
58  \heading Output file locations
59 
60  The \c rootdir normally corresponds to something like
61  \c postProcessing/<name>
62 
63  \subheading Geometry
64  \verbatim
65  rootdir
66  `-- timeName
67  `-- surfaceName.{raw}
68  \endverbatim
69 
70  \subheading Fields
71  \verbatim
72  rootdir
73  `-- timeName
74  |-- <field0>_surfaceName.{raw}
75  `-- <field1>_surfaceName.{raw}
76  \endverbatim
77 
78 SourceFiles
79  rawSurfaceWriter.C
80 
81 \*---------------------------------------------------------------------------*/
82 
83 #ifndef rawSurfaceWriter_H
84 #define rawSurfaceWriter_H
85 
86 #include "surfaceWriter.H"
87 
88 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
89 
90 namespace Foam
91 {
92 namespace surfaceWriters
93 {
94 
95 /*---------------------------------------------------------------------------*\
96  Class rawWriter Declaration
97 \*---------------------------------------------------------------------------*/
98 
99 class rawWriter
100 :
101  public surfaceWriter
102 {
103  // Private Data
104 
105  //- Output stream option
106  IOstreamOption streamOpt_;
107 
108  //- Output geometry scaling
109  const scalar geometryScale_;
110 
111  //- Output field scaling
112  const dictionary fieldScale_;
113 
114 
115  // Private Member Functions
116 
117  //- Templated write operation
118  template<class Type>
119  fileName writeTemplate
120  (
121  const word& fieldName,
122  const Field<Type>& localValues
123  );
124 
125 
126 public:
127 
128  //- Declare type-name, virtual type (without debug switch)
129  TypeNameNoDebug("raw");
130 
131 
132  // Constructors
133 
134  //- Default construct
135  rawWriter();
136 
137  //- Construct with some output options
138  explicit rawWriter(const dictionary& options);
139 
140  //- Construct from components
141  rawWriter
142  (
143  const meshedSurf& surf,
144  const fileName& outputPath,
145  bool parallel = Pstream::parRun(),
146  const dictionary& options = dictionary()
147  );
148 
149  //- Construct from components
150  rawWriter
151  (
152  const pointField& points,
153  const faceList& faces,
154  const fileName& outputPath,
155  bool parallel = Pstream::parRun(),
156  const dictionary& options = dictionary()
157  );
158 
159 
160  //- Destructor
161  virtual ~rawWriter() = default;
162 
163 
164  // Member Functions
165 
166  //- Write surface geometry to file.
167  virtual fileName write(); // override
168 
175 };
176 
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 } // End namespace surfaceWriters
181 } // End namespace Foam
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 #endif
186 
187 // ************************************************************************* //
Foam::Tensor< scalar >
Foam::SymmTensor< scalar >
Foam::surfaceWriters::rawWriter::~rawWriter
virtual ~rawWriter()=default
Destructor.
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::rawWriter::TypeNameNoDebug
TypeNameNoDebug("raw")
Declare type-name, virtual type (without debug switch)
Foam::UPstream::parRun
static bool & parRun()
Test if this a parallel run, or allow modify access.
Definition: UPstream.H:434
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::IOstreamOption
The IOstreamOption is a simple container for options an IOstream can normally have.
Definition: IOstreamOption.H:63
Foam::surfaceWriters::rawWriter
A surfaceWriter for raw output.
Definition: rawSurfaceWriter.H:118
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::rawWriter::declareSurfaceWriterWriteMethod
declareSurfaceWriterWriteMethod(label)
Foam::surfaceWriters::rawWriter::rawWriter
rawWriter()
Default construct.
Definition: rawSurfaceWriter.C:72
Foam::Vector< scalar >
Foam::List< face >
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::surfaceWriters::rawWriter::write
virtual fileName write()
Write surface geometry to file.
Definition: rawSurfaceWriter.C:128