Loading...
Searching...
No Matches
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-2022 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 (isReadRequired() || (isReadOptional() && headerOk()))
47 {
48 // Warn for MUST_READ_IF_MODIFIED
50
51 readStream(typeName) >> *this;
52 close();
53
54 {
55 // Calculate edgeDirections
56
57 const edgeList& eds(edges());
58
59 const pointField& pts(points());
60
61 edgeDirections_.setSize(eds.size());
62
63 forAll(eds, eI)
64 {
65 edgeDirections_[eI] = eds[eI].vec(pts);
66 }
67
69 }
70 }
71
72 if (debug)
73 {
74 Pout<< "extendedFeatureEdgeMesh::extendedFeatureEdgeMesh :"
75 << " constructed from IOobject :"
76 << " points:" << points().size()
77 << " edges:" << edges().size()
78 << endl;
79 }
80}
81
82
84(
85 const IOobject& io,
86 const extendedEdgeMesh& em
88:
91{}
92
93
95(
96 const surfaceFeatures& sFeat,
97 const objectRegistry& obr,
98 const fileName& sFeatFileName,
99 const boolList& surfBaffleRegions
100)
101:
103 (
105 (
106 sFeatFileName,
107 obr.time().constant(),
108 "extendedFeatureEdgeMesh",
109 obr,
110 IOobject::NO_READ,
112 )
113 ),
114 extendedEdgeMesh(sFeat, surfBaffleRegions)
115{}
116
117
119(
120 const IOobject& io,
122 const labelUList& featureEdges,
123 const labelUList& regionFeatureEdges,
124 const labelUList& featurePoints
126:
128 extendedEdgeMesh(surf, featureEdges, regionFeatureEdges, featurePoints)
129{}
130
131
133(
134 const IOobject& io,
135 const pointField& pts,
136 const edgeList& eds,
137 label concaveStart,
138 label mixedStart,
139 label nonFeatureStart,
140 label internalStart,
141 label flatStart,
142 label openStart,
143 label multipleStart,
144 const vectorField& normals,
145 const List<sideVolumeType>& normalVolumeTypes,
146 const vectorField& edgeDirections,
147 const labelListList& normalDirections,
148 const labelListList& edgeNormals,
149 const labelListList& featurePointNormals,
150 const labelListList& featurePointEdges,
151 const labelList& regionEdges
152)
153:
156 (
157 pts,
158 eds,
159 concaveStart,
160 mixedStart,
161 nonFeatureStart,
162 internalStart,
163 flatStart,
164 openStart,
165 multipleStart,
166 normals,
167 normalVolumeTypes,
168 edgeDirections,
169 normalDirections,
170 edgeNormals,
171 featurePointNormals,
172 featurePointEdges,
174 )
175{}
176
177
178// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
179
181{
182 is >> *this;
183 return !is.bad();
184}
185
186
188{
189 os << *this;
190 return os.good();
191}
192
193
194
195//bool Foam::extendedFeatureEdgeMesh::writeData(Ostream& os) const
196//{
197// os << "// points" << nl
198// << points() << nl
199// << "// edges" << nl
200// << edges() << nl
201// << "// concaveStart mixedStart nonFeatureStart" << nl
202// << concaveStart_ << token::SPACE
203// << mixedStart_ << token::SPACE
204// << nonFeatureStart_ << nl
205// << "// internalStart flatStart openStart multipleStart" << nl
206// << internalStart_ << token::SPACE
207// << flatStart_ << token::SPACE
208// << openStart_ << token::SPACE
209// << multipleStart_ << nl
210// << "// normals" << nl
211// << normals_ << nl
212// << "// normal volume types" << nl
213// << normalVolumeTypes_ << nl
214// << "// normalDirections" << nl
215// << normalDirections_ << nl
216// << "// edgeNormals" << nl
217// << edgeNormals_ << nl
218// << "// featurePointNormals" << nl
219// << featurePointNormals_ << nl
220// << "// featurePointEdges" << nl
221// << featurePointEdges_ << nl
222// << "// regionEdges" << nl
223// << regionEdges_
224// << endl;
225//
226// return os.good();
227//}
228
229//
230//Foam::Istream& Foam::operator>>
231//(
232// Istream& is,
233// Foam::extendedFeatureEdgeMesh::sideVolumeType& vt
234//)
235//{
236// label type;
237// is >> type;
238//
239// vt = static_cast<Foam::extendedFeatureEdgeMesh::sideVolumeType>(type);
240//
241// is.check(FUNCTION_NAME);
242// return is;
243//}
244//
245//
246//Foam::Ostream& Foam::operator<<
247//(
248// Ostream& os,
249// const Foam::extendedFeatureEdgeMesh::sideVolumeType& vt
250//)
251//{
252// os << static_cast<label>(vt);
253//
254// return os;
255//}
256
257
258// ************************************************************************* //
bool isReadOptional() const noexcept
True if (LAZY_READ) bits are set [same as READ_IF_PRESENT].
bool isReadRequired() const noexcept
True if (MUST_READ | READ_MODIFIED) bits are set.
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
const Time & time() const noexcept
Return Time associated with the objectRegistry.
Definition IOobject.C:456
void warnNoRereading() const
Helper: warn that type does not support re-reading.
bool bad() const noexcept
True if stream is corrupted.
Definition IOstream.H:305
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
void setSize(label n)
Alias for resize().
Definition List.H:536
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A list of faces which address into the list of points.
void size(const label n)
Older name for setAddressableSize.
Definition UList.H:118
const pointField & points() const noexcept
Return points.
Definition edgeMeshI.H:92
const edgeList & edges() const noexcept
Return edges.
Definition edgeMeshI.H:98
Description of feature edges and points.
const labelListList & normalDirections() const
label openStart() const
Return the index of the start of the open feature edges.
label nonFeatureStart() const
Return the index of the start of the non-feature points.
const vectorField & edgeDirections() const
Return the edgeDirection vectors.
const List< sideVolumeType > & normalVolumeTypes() const
Return.
label flatStart() const
Return the index of the start of the flat feature edges.
const labelListList & featurePointEdges() const
Return the edge labels for a given feature point. Edges are.
const labelList & regionEdges() const
Return the feature edges which are on the boundary between.
const labelListList & edgeNormals() const
Return the indices of the normals that are adjacent to the.
vectorField edgeDirections_
Flat and open edges require the direction of the edge.
const vectorField & normals() const
Return the normals of the surfaces adjacent to the feature edges.
label multipleStart() const
Return the index of the start of the multiply-connected feature.
extendedEdgeMesh(std::nullptr_t)
Construct null, initializing start indices with -1.
label internalStart() const
Return the index of the start of the internal feature edges.
const labelListList & featurePointNormals() const
Return the indices of the normals that are adjacent to the.
label mixedStart() const
Return the index of the start of the mixed type feature points.
label concaveStart() const
Return the index of the start of the concave feature points.
virtual bool writeData(Ostream &) const
WriteData function required for regIOobject write operation.
extendedFeatureEdgeMesh(const IOobject &io)
Construct (read) given an IOobject.
virtual bool readData(Istream &)
ReadData function required for regIOobject read operation.
A class for handling file names.
Definition fileName.H:75
Registry of regIOobjects.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition regIOobject.H:71
void close()
Close Istream.
regIOobject(const IOobject &io, const bool isTimeObject=false)
Construct from IOobject. The optional flag adds special handling if the object is the top-level regIO...
Definition regIOobject.C:43
bool headerOk()
Read and check header info. Does not check the headerClassName.
Holds feature edges/points of surface.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
OBJstream os(runTime.globalPath()/outputName)
const auto & io
Different types of constants.
Namespace for handling debugging switches.
Definition debug.C:45
Namespace for OpenFOAM.
List< edge > edgeList
List of edge.
Definition edgeList.H:32
List< labelList > labelListList
List of labelList.
Definition labelList.H:38
List< label > labelList
A List of labels.
Definition List.H:62
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Field< vector > vectorField
Specialisation of Field<T> for vector.
List< bool > boolList
A List of bools.
Definition List.H:60
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
vectorField pointField
pointField is a vectorField.
UList< label > labelUList
A UList of labels.
Definition UList.H:75
const pointField & pts
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299