The open source CFD toolbox
nastranCoordSetWriter.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) 2018-2022 OpenCFD Ltd.
9-------------------------------------------------------------------------------
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
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
26Class
27 Foam::coordSetWriters::nastranWriter
28
29Description
30 Write coordSet(s) as Nastran plot lines. Does not do field data.
31
32 The formatOptions for nastran:
33 \table
34 Property | Description | Required | Default
35 format | short / long / free | no | free
36 \endtable
37
38 \section Output file locations
39
40 The \c rootdir normally corresponds to something like
41 \c postProcessing/<name>
42
43 \subsection Geometry
44 \verbatim
45 rootdir
46 -- <time>
47 |-- setName0.{nas}
48 -- setName1.{nas}
49 \endverbatim
50
51SourceFiles
52 nastranCoordSetWriter.C
53
54\*---------------------------------------------------------------------------*/
55
56#ifndef Foam_coordSetWriters_nastranWriter_H
57#define Foam_coordSetWriters_nastranWriter_H
58
59#include "coordSetWriter.H"
60#include "NASCore.H"
61
62// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
63
64namespace Foam
65{
66namespace coordSetWriters
67{
68
69/*---------------------------------------------------------------------------*\
70 Class nastranWriter Declaration
71\*---------------------------------------------------------------------------*/
72
73class nastranWriter
74:
75 public coordSetWriter
76{
77public:
78
79 //- File field formats
81
84
85
86private:
87
88 //- Field format (width and separator)
89 fieldFormat writeFormat_;
90
92 word separator_;
93
94
95 // Private Member Functions
96
97 //- Write the formatted keyword to the output stream
98 Ostream& writeKeyword(Ostream& os, const word& keyword) const;
99
100 //- Templated write operation
101 template<class Type>
102 fileName writeTemplate
103 (
104 const word& fieldName,
105 const Field<Type>& values
106 );
107
108 //- Templated write operation
109 template<class Type>
110 fileName writeTemplate
111 (
112 const word& fieldName,
113 const List<Field<Type>>& fieldValues
114 );
115
116 //- Write geometry to file.
117 void writeGeometry(Ostream& os, label nTracks) const;
118
119
120public:
121
122 //- Runtime type information (no debug)
123 TypeNameNoDebug("nastran");
124
125
126 // Constructors
127
128 //- Default construct
130
131 //- Default construct with specified options
132 explicit nastranWriter(const dictionary& options);
133
134 //- Construct from components
136 (
137 const coordSet& coords,
138 const fileName& outputPath,
139 const dictionary& options = dictionary()
140 );
141
142 //- Construct from components
144 (
145 const UPtrList<coordSet>& tracks,
146 const fileName& outputPath,
147 const dictionary& options = dictionary()
148 );
149
150
151 //- Destructor. Calls close()
152 virtual ~nastranWriter();
153
154
155 // Member Functions
156
157 //- Characteristic output file name - information only
158 virtual fileName path() const; // override
159
166};
167
168
169// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171} // End namespace coordSetWriters
172} // End namespace Foam
174// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175
176#endif
177
178// ************************************************************************* //
writer writeGeometry()
Generic templated field type.
Definition: Field.H:82
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:77
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition: UPtrList.H:71
Base class for writing coordSet(s) and tracks with fields.
Write coordSet(s) as Nastran plot lines. Does not do field data.
TypeNameNoDebug("nastran")
Runtime type information (no debug)
Foam::fileFormats::NASCore::fieldFormat fieldFormat
File field formats.
declareCoordSetWriterWriteMethod(sphericalTensor)
virtual fileName path() const
Characteristic output file name - information only.
virtual ~nastranWriter()
Destructor. Calls close()
Holds list of sampling positions.
Definition: coordSet.H:56
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
fieldFormat
File field formats.
Definition: NASCore.H:64