Loading...
Searching...
No Matches
NASsurfaceFormat.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) 2016-2024 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::fileFormats::NASsurfaceFormat
29
30Description
31 Nastran surface reader/writer.
32
33 - Uses the Ansa "$ANSA_NAME" or the Hypermesh "$HMNAME COMP" extensions
34 to obtain zone names.
35 - Handles Nastran short, long formats and comma-separated free format.
36 - Properly handles the Nastran compact floating point notation: \n
37 \verbatim
38 GRID 28 10.20269-.030265-2.358-8
39 \endverbatim
40
41 The Nastran writer uses FREE format only.
42
43 Output stream options:
44 - ASCII only
45 - compression on/off
46
47 Output dictionary options: ignored
48
49SourceFiles
50 NASsurfaceFormat.C
51
52\*---------------------------------------------------------------------------*/
53
54#ifndef Foam_NASsurfaceFormat_H
55#define Foam_NASsurfaceFormat_H
56
57#include "MeshedSurface.H"
58#include "MeshedSurfaceProxy.H"
60#include "NASCore.H"
61
62// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
63
64namespace Foam
65{
66namespace fileFormats
67{
68
69/*---------------------------------------------------------------------------*\
70 Class fileFormats::NASsurfaceFormat Declaration
71\*---------------------------------------------------------------------------*/
72
73template<class Face>
75:
76 public MeshedSurface<Face>,
77 public NASCore
78{
79 // Private Member Functions
80
81 //- Output CTRIA3 or CQUAD4
82 inline static label writeShell
83 (
84 Ostream& os,
85 const Face& f,
86 label elemId,
87 const label groupId
88 );
89
90
91public:
92
93 // Constructors
94
95 //- Construct from file name
96 explicit NASsurfaceFormat(const fileName& filename);
97
98
99 //- Destructor
100 virtual ~NASsurfaceFormat() = default;
102
103 // Static Functions
104
105 //- Write surface mesh components (by proxy) in NAS format
106 static void write
107 (
108 const fileName& filename,
109 const MeshedSurfaceProxy<Face>& surf,
110 IOstreamOption streamOpt = IOstreamOption(),
111 const dictionary& /*unused*/ = dictionary::null
112 );
113
114
115 // Member Functions
116
117 //- Read from file
118 virtual bool read(const fileName& filename) override;
119
120 //- Write surface mesh to file (by proxy)
121 virtual void write
122 (
123 const fileName& name,
124 IOstreamOption streamOpt = IOstreamOption(),
125 const dictionary& options = dictionary::null
126 ) const override
127 {
128 write(name, MeshedSurfaceProxy<Face>(*this), streamOpt, options);
129 }
130
131 //- Write surface mesh to file (by proxy)
132 virtual void write
133 (
134 const fileName& name,
135 const word& fileType, /* ignored */
136 IOstreamOption streamOpt = IOstreamOption(),
137 const dictionary& options = dictionary::null
138 ) const override
139 {
140 write(name, MeshedSurfaceProxy<Face>(*this), streamOpt, options);
142};
143
144
145// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146
147} // End namespace fileFormats
148} // End namespace Foam
149
150// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151
152#ifdef NoRepository
153 #include "NASsurfaceFormat.C"
154#endif
155
156// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157
158#endif
159
160// ************************************************************************* //
A simple container for options an IOstream can normally have.
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats.
friend class MeshedSurface
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
Definition dictionary.H:487
NASCore() noexcept=default
Default construct.
virtual ~NASsurfaceFormat()=default
Destructor.
virtual bool read(const fileName &filename) override
Read from file.
virtual void write(const fileName &name, const word &fileType, IOstreamOption streamOpt=IOstreamOption(), const dictionary &options=dictionary::null) const override
Write surface mesh to file (by proxy).
NASsurfaceFormat(const fileName &filename)
Construct from file name.
virtual void write(const fileName &name, IOstreamOption streamOpt=IOstreamOption(), const dictionary &options=dictionary::null) const override
Write surface mesh to file (by proxy).
A class for handling file names.
Definition fileName.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
OBJstream os(runTime.globalPath()/outputName)
Namespace to isolate specifics for file formats, and some common utilities.
Namespace for OpenFOAM.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
runTime write()
labelList f(nPoints)