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-2021 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 STARCDedgeFormat_H
45#define 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{
59
60/*---------------------------------------------------------------------------*\
61 Class STARCDedgeFormat Declaration
62\*---------------------------------------------------------------------------*/
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
78
79 //- No copy construct
80 STARCDedgeFormat(const STARCDedgeFormat&) = delete;
81
82 //- No copy assignment
83 void operator=(const STARCDedgeFormat&) = delete;
84
85
86protected:
87
88 // Protected Member Functions
89
90 static void writeCase
91 (
92 Ostream& os,
93 const pointField& pointLst,
94 const label nEdges
95 );
96
97
98public:
99
100 // Constructors
101
102 //- Construct from file name
103 explicit STARCDedgeFormat(const fileName& filename);
104
105
106 // Selectors
107
108 //- Read file and return edgeMesh
109 static autoPtr<edgeMesh> New(const fileName& name)
110 {
112 }
113
114
115 //- Destructor
116 virtual ~STARCDedgeFormat() = default;
117
118
119 // Static Functions
120
121 //- Write edge mesh to file
122 static void write
123 (
124 const fileName& filename,
125 const edgeMesh& mesh,
126 IOstreamOption streamOpt = IOstreamOption(),
127 const dictionary& options = dictionary::null
128 );
129
130
131 // Member Functions
132
133 //- Read from file
134 virtual bool read(const fileName& name);
135
136 //- Write to file
137 virtual void write
138 (
139 const fileName& name,
140 IOstreamOption streamOpt = IOstreamOption(),
141 const dictionary& options = dictionary::null
142 ) const
143 {
144 write(name, *this, streamOpt, options);
145 }
146};
147
148
149// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150
151} // End namespace fileFormats
152} // End namespace Foam
153
154
155// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156
157#endif
158
159// ************************************************************************* //
The IOstreamOption is 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:62
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Mesh data needed to do the Finite Area discretisation.
Definition: edgeFaMesh.H:56
const edgeList & edges() const noexcept
Return edges.
Definition: edgeMeshI.H:105
Core routines used when reading/writing PROSTAR vrt/cel/bnd files.
Definition: STARCDCore.H:60
Read/write the lines from PROSTAR vrt/cel files.
static void writeCase(Ostream &os, const pointField &pointLst, const label nEdges)
virtual void write(const fileName &name, IOstreamOption streamOpt=IOstreamOption(), const dictionary &options=dictionary::null) const
Write to file.
virtual ~STARCDedgeFormat()=default
Destructor.
virtual bool read(const fileName &name)
Read from file.
static autoPtr< edgeMesh > New(const fileName &name)
Read file and return edgeMesh.
A class for handling file names.
Definition: fileName.H:76
dynamicFvMesh & mesh
OBJstream os(runTime.globalPath()/outputName)
const labelList nEdges(UPstream::listGatherValues< label >(aMesh.nEdges()))
Namespace for OpenFOAM.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
runTime write()