extendedFeatureEdgeMesh.C
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) 2020 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
27\*---------------------------------------------------------------------------*/
28
30#include "Time.H"
31
32// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33
34namespace Foam
35{
37}
38
39// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40
42:
45{
46 if
47 (
51 )
52 {
53 // Warn for MUST_READ_IF_MODIFIED
54 warnNoRereading<extendedFeatureEdgeMesh>();
55
56 readStream(typeName) >> *this;
57 close();
58
59 {
60 // Calculate edgeDirections
61
62 const edgeList& eds(edges());
63
64 const pointField& pts(points());
65
67
68 forAll(eds, eI)
69 {
70 edgeDirections_[eI] = eds[eI].vec(pts);
71 }
72
74 }
75 }
76
77 if (debug)
78 {
79 Pout<< "extendedFeatureEdgeMesh::extendedFeatureEdgeMesh :"
80 << " constructed from IOobject :"
81 << " points:" << points().size()
82 << " edges:" << edges().size()
83 << endl;
84 }
85}
86
87
89(
90 const IOobject& io,
91 const extendedEdgeMesh& em
92)
93:
96{}
97
98
100(
101 const surfaceFeatures& sFeat,
102 const objectRegistry& obr,
103 const fileName& sFeatFileName,
104 const boolList& surfBaffleRegions
105)
106:
108 (
110 (
111 sFeatFileName,
112 obr.time().constant(),
113 "extendedFeatureEdgeMesh",
114 obr,
115 IOobject::NO_READ,
116 IOobject::NO_WRITE
117 )
118 ),
119 extendedEdgeMesh(sFeat, surfBaffleRegions)
120{}
121
122
124(
125 const IOobject& io,
127 const labelUList& featureEdges,
128 const labelUList& regionFeatureEdges,
129 const labelUList& featurePoints
130)
131:
133 extendedEdgeMesh(surf, featureEdges, regionFeatureEdges, featurePoints)
134{}
135
136
138(
139 const IOobject& io,
140 const pointField& pts,
141 const edgeList& eds,
142 label concaveStart,
143 label mixedStart,
144 label nonFeatureStart,
145 label internalStart,
146 label flatStart,
147 label openStart,
148 label multipleStart,
149 const vectorField& normals,
150 const List<sideVolumeType>& normalVolumeTypes,
151 const vectorField& edgeDirections,
152 const labelListList& normalDirections,
153 const labelListList& edgeNormals,
154 const labelListList& featurePointNormals,
155 const labelListList& featurePointEdges,
156 const labelList& regionEdges
157)
158:
161 (
162 pts,
163 eds,
164 concaveStart,
165 mixedStart,
166 nonFeatureStart,
167 internalStart,
168 flatStart,
169 openStart,
170 multipleStart,
171 normals,
172 normalVolumeTypes,
173 edgeDirections,
174 normalDirections,
175 edgeNormals,
176 featurePointNormals,
177 featurePointEdges,
178 regionEdges
179 )
180{}
181
182
183// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
184
186{
187 is >> *this;
188 return !is.bad();
189}
190
191
193{
194 os << *this;
195 return os.good();
196}
197
198
199
200//bool Foam::extendedFeatureEdgeMesh::writeData(Ostream& os) const
201//{
202// os << "// points" << nl
203// << points() << nl
204// << "// edges" << nl
205// << edges() << nl
206// << "// concaveStart mixedStart nonFeatureStart" << nl
207// << concaveStart_ << token::SPACE
208// << mixedStart_ << token::SPACE
209// << nonFeatureStart_ << nl
210// << "// internalStart flatStart openStart multipleStart" << nl
211// << internalStart_ << token::SPACE
212// << flatStart_ << token::SPACE
213// << openStart_ << token::SPACE
214// << multipleStart_ << nl
215// << "// normals" << nl
216// << normals_ << nl
217// << "// normal volume types" << nl
218// << normalVolumeTypes_ << nl
219// << "// normalDirections" << nl
220// << normalDirections_ << nl
221// << "// edgeNormals" << nl
222// << edgeNormals_ << nl
223// << "// featurePointNormals" << nl
224// << featurePointNormals_ << nl
225// << "// featurePointEdges" << nl
226// << featurePointEdges_ << nl
227// << "// regionEdges" << nl
228// << regionEdges_
229// << endl;
230//
231// return os.good();
232//}
233
234//
235//Foam::Istream& Foam::operator>>
236//(
237// Istream& is,
238// Foam::extendedFeatureEdgeMesh::sideVolumeType& vt
239//)
240//{
241// label type;
242// is >> type;
243//
244// vt = static_cast<Foam::extendedFeatureEdgeMesh::sideVolumeType>(type);
245//
246// is.check(FUNCTION_NAME);
247// return is;
248//}
249//
250//
251//Foam::Ostream& Foam::operator<<
252//(
253// Ostream& os,
254// const Foam::extendedFeatureEdgeMesh::sideVolumeType& vt
255//)
256//{
257// os << static_cast<label>(vt);
258//
259// return os;
260//}
261
262
263// ************************************************************************* //
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
readOption readOpt() const noexcept
The read option.
Definition: IOobjectI.H:164
@ MUST_READ_IF_MODIFIED
Definition: IOobject.H:180
bool good() const noexcept
True if next operation might succeed.
Definition: IOstream.H:233
bool bad() const noexcept
True if stream is corrupted.
Definition: IOstream.H:251
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
void setSize(const label n)
Alias for resize()
Definition: List.H:218
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A list of faces which address into the list of points.
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
const pointField & points() const noexcept
Return points.
Definition: edgeMeshI.H:99
const edgeList & edges() const noexcept
Return edges.
Definition: edgeMeshI.H:105
Description of feature edges and points.
vectorField edgeDirections_
Flat and open edges require the direction of the edge.
virtual bool writeData(Ostream &) const
WriteData function required for regIOobject write operation.
virtual bool readData(Istream &)
ReadData function required for regIOobject read operation.
A class for handling file names.
Definition: fileName.H:76
Registry of regIOobjects.
constant condensation/saturation model.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:76
void close()
Close Istream.
Istream & readStream(const word &, const bool valid=true)
Return Istream and check object type against that given.
bool headerOk()
Read and check header info. Does not check the headerClassName.
Definition: regIOobject.C:438
Holds feature edges/points of surface.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
OBJstream os(runTime.globalPath()/outputName)
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
Namespace for OpenFOAM.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333