Loading...
Searching...
No Matches
STARCDedgeFormat.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-2017 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::STARCDedgeFormat
29
30Description
31 Read/write the lines from PROSTAR vrt/cel files.
32
33Note
34 Uses the extension \a .inp (input) to denote the format.
35
36See also
37 Foam::meshReaders::STARCD
38
39SourceFiles
40 STARCDedgeFormat.C
41
42\*---------------------------------------------------------------------------*/
43
44#ifndef Foam_STARCDedgeFormat_H
45#define Foam_STARCDedgeFormat_H
46
47#include "edgeMesh.H"
48#include "STARCDCore.H"
49
50#include "Fstream.H"
51#include "Ostream.H"
52
53// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54
55namespace Foam
56{
57namespace fileFormats
58{
60/*---------------------------------------------------------------------------*\
61 Class STARCDedgeFormat Declaration
62\*---------------------------------------------------------------------------*/
63
65:
66 public edgeMesh,
67 protected STARCDCore
68{
69 // Private Member Functions
70
71 static inline void writeLines
72 (
73 Ostream& os,
74 const edgeList& edges,
75 label starCellId = 1 // 1-based cellId
76 );
77
78protected:
79
80 // Protected Member Functions
81
82 static void writeCase
83 (
84 Ostream& os,
85 const pointField& pointLst,
86 const label nEdges
87 );
88
89
90public:
91
92 // Constructors
93
94 //- Construct from file name
95 explicit STARCDedgeFormat(const fileName& filename);
96
97
98 // Selectors
99
100 //- Read file and return edgeMesh
101 static autoPtr<edgeMesh> New(const fileName& name)
102 {
104 }
105
106
107 //- Destructor
108 virtual ~STARCDedgeFormat() = default;
110
111 // Static Functions
112
113 //- Write edge mesh to file in STARCD format
114 static void write
115 (
116 const fileName& filename,
117 const edgeMesh& mesh,
118 IOstreamOption streamOpt = IOstreamOption(),
119 const dictionary& options = dictionary::null
120 );
121
122
123 // Member Functions
124
125 //- Read from file
126 virtual bool read(const fileName& name) override;
127
128 //- Write to file
129 virtual void write
130 (
131 const fileName& name,
132 IOstreamOption streamOpt = IOstreamOption(),
133 const dictionary& options = dictionary::null
134 ) const override
135 {
136 write(name, *this, streamOpt, options);
137 }
138
139 //- Write to file
140 virtual void write
141 (
142 const fileName& name,
143 const word& fileType, /* ignored */
144 IOstreamOption streamOpt = IOstreamOption(),
145 const dictionary& options = dictionary::null
146 ) const override
147 {
148 write(name, *this, streamOpt, options);
150};
151
152
153// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154
155} // End namespace fileFormats
156} // End namespace Foam
157
158
159// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160
161#endif
162
163// ************************************************************************* //
A simple container for options an IOstream can normally have.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
static autoPtr< T > NewFrom(Args &&... args)
Construct autoPtr from derived type with forwarding arguments.
Definition autoPtr.H:193
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
edgeMesh(const faMesh &mesh)
Construct finite-area edge mesh faMesh reference.
Definition edgeFaMesh.H:58
const edgeList & edges() const noexcept
Return edges.
Definition edgeMeshI.H:98
STARCDCore()=default
Construct null.
static void writeCase(Ostream &os, const pointField &pointLst, const label nEdges)
virtual ~STARCDedgeFormat()=default
Destructor.
virtual bool read(const fileName &name) override
Read from file.
virtual void write(const fileName &name, const word &fileType, IOstreamOption streamOpt=IOstreamOption(), const dictionary &options=dictionary::null) const override
Write to file.
STARCDedgeFormat(const fileName &filename)
Construct from file name.
static autoPtr< edgeMesh > New(const fileName &name)
Read file and return edgeMesh.
virtual void write(const fileName &name, IOstreamOption streamOpt=IOstreamOption(), const dictionary &options=dictionary::null) const override
Write to file.
A class for handling file names.
Definition fileName.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
dynamicFvMesh & mesh
OBJstream os(runTime.globalPath()/outputName)
Namespace to isolate specifics for file formats, and some common utilities.
Namespace for OpenFOAM.
List< edge > edgeList
List of edge.
Definition edgeList.H:32
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
vectorField pointField
pointField is a vectorField.
runTime write()