extendedFeatureEdgeMesh.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 #include "Time.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33  defineTypeNameAndDebug(extendedFeatureEdgeMesh, 0);
34 }
35 
36 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 
39 :
40  regIOobject(io),
42 {
43  if
44  (
48  )
49  {
50  // Warn for MUST_READ_IF_MODIFIED
51  warnNoRereading<extendedFeatureEdgeMesh>();
52 
53  readStream(typeName) >> *this;
54  close();
55 
56  {
57  // Calculate edgeDirections
58 
59  const edgeList& eds(edges());
60 
61  const pointField& pts(points());
62 
64 
65  forAll(eds, eI)
66  {
67  edgeDirections_[eI] = eds[eI].vec(pts);
68  }
69 
70  edgeDirections_ /= (mag(edgeDirections_) + small);
71  }
72  }
73 
74  if (debug)
75  {
76  Pout<< "extendedFeatureEdgeMesh::extendedFeatureEdgeMesh :"
77  << " constructed from IOobject :"
78  << " points:" << points().size()
79  << " edges:" << edges().size()
80  << endl;
81  }
82 }
83 
84 
86 (
87  const IOobject& io,
88  const extendedEdgeMesh& em
89 )
90 :
91  regIOobject(io),
93 {}
94 
95 
97 (
98  const surfaceFeatures& sFeat,
99  const objectRegistry& obr,
100  const fileName& sFeatFileName,
101  const boolList& surfBaffleRegions
102 )
103 :
105  (
106  IOobject
107  (
108  sFeatFileName,
109  obr.time().constant(),
110  "extendedFeatureEdgeMesh",
111  obr,
114  )
115  ),
116  extendedEdgeMesh(sFeat, surfBaffleRegions)
117 {}
118 
119 
121 (
122  const IOobject& io,
124  const labelList& featureEdges,
125  const labelList& regionFeatureEdges,
126  const labelList& featurePoints
127 )
128 :
129  regIOobject(io),
130  extendedEdgeMesh(surf, featureEdges, regionFeatureEdges, featurePoints)
131 {}
132 
133 
135 (
136  const IOobject& io,
137  const pointField& pts,
138  const edgeList& eds,
139  label concaveStart,
140  label mixedStart,
141  label nonFeatureStart,
142  label internalStart,
143  label flatStart,
144  label openStart,
145  label multipleStart,
146  const vectorField& normals,
147  const List<sideVolumeType>& normalVolumeTypes,
148  const vectorField& edgeDirections,
149  const labelListList& normalDirections,
150  const labelListList& edgeNormals,
151  const labelListList& featurePointNormals,
152  const labelListList& featurePointEdges,
153  const labelList& regionEdges
154 )
155 :
156  regIOobject(io),
158  (
159  pts,
160  eds,
161  concaveStart,
162  mixedStart,
163  nonFeatureStart,
164  internalStart,
165  flatStart,
166  openStart,
167  multipleStart,
168  normals,
169  normalVolumeTypes,
170  edgeDirections,
171  normalDirections,
172  edgeNormals,
173  featurePointNormals,
174  featurePointEdges,
175  regionEdges
176  )
177 {}
178 
179 
180 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
181 
183 {}
184 
185 
186 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
187 
188 
189 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
190 
192 {
193  is >> *this;
194  return !is.bad();
195 }
196 
197 
199 {
200  os << *this;
201 
202  return os.good();
203 }
204 
205 
206 
207 //bool Foam::extendedFeatureEdgeMesh::writeData(Ostream& os) const
208 //{
209 // os << "// points" << nl
210 // << points() << nl
211 // << "// edges" << nl
212 // << edges() << nl
213 // << "// concaveStart mixedStart nonFeatureStart" << nl
214 // << concaveStart_ << token::SPACE
215 // << mixedStart_ << token::SPACE
216 // << nonFeatureStart_ << nl
217 // << "// internalStart flatStart openStart multipleStart" << nl
218 // << internalStart_ << token::SPACE
219 // << flatStart_ << token::SPACE
220 // << openStart_ << token::SPACE
221 // << multipleStart_ << nl
222 // << "// normals" << nl
223 // << normals_ << nl
224 // << "// normal volume types" << nl
225 // << normalVolumeTypes_ << nl
226 // << "// normalDirections" << nl
227 // << normalDirections_ << nl
228 // << "// edgeNormals" << nl
229 // << edgeNormals_ << nl
230 // << "// featurePointNormals" << nl
231 // << featurePointNormals_ << nl
232 // << "// featurePointEdges" << nl
233 // << featurePointEdges_ << nl
234 // << "// regionEdges" << nl
235 // << regionEdges_
236 // << endl;
237 //
238 // return os.good();
239 //}
240 
241 //
242 //Foam::Istream& Foam::operator>>
243 //(
244 // Istream& is,
245 // Foam::extendedFeatureEdgeMesh::sideVolumeType& vt
246 //)
247 //{
248 // label type;
249 // is >> type;
250 //
251 // vt = static_cast<Foam::extendedFeatureEdgeMesh::sideVolumeType>(type);
252 //
253 // // Check state of Istream
254 // is.check("operator>>(Istream&, sideVolumeType&)");
255 //
256 // return is;
257 //}
258 //
259 //
260 //Foam::Ostream& Foam::operator<<
261 //(
262 // Ostream& os,
263 // const Foam::extendedFeatureEdgeMesh::sideVolumeType& vt
264 //)
265 //{
266 // os << static_cast<label>(vt);
267 //
268 // return os;
269 //}
270 //
271 
272 // ************************************************************************* //
extendedEdgeMesh()
Construct null.
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:428
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
A class for handling file names.
Definition: fileName.H:69
bool bad() const
Return true if stream is corrupted.
Definition: IOstream.H:351
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:163
Description of feature edges and points.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:256
bool headerOk()
Read and check header info.
Definition: regIOobject.C:430
bool good() const
Return true if next operation might succeed.
Definition: IOstream.H:333
virtual ~extendedFeatureEdgeMesh()
Destructor.
regIOobject(const IOobject &, const bool isTime=false)
Construct from IOobject. Optional flag for if IOobject is the.
Definition: regIOobject.C:56
Istream & readStream(const word &, const bool valid=true)
Return Istream and check object type against that given.
A list of faces which address into the list of points.
void close()
Close Istream.
const edgeList & edges() const
Return edges.
Definition: edgeMeshI.H:59
const word & constant() const
Return constant name.
Definition: TimePaths.H:124
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
const pointField & points() const
Return points.
Definition: edgeMeshI.H:53
const Time & time() const
Return time.
defineTypeNameAndDebug(combustionModel, 0)
virtual bool writeData(Ostream &) const
WriteData function required for regIOobject write operation.
extendedFeatureEdgeMesh(const IOobject &)
Construct (read) given an IOobject.
void setSize(const label)
Reset size of List.
Definition: List.C:281
prefixOSstream Pout(cout, "Pout")
Definition: IOstreams.H:53
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:65
dimensioned< scalar > mag(const dimensioned< Type > &)
Registry of regIOobjects.
readOption readOpt() const
Definition: IOobject.H:359
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
virtual bool readData(Istream &)
ReadData function required for regIOobject read operation.
vectorField edgeDirections_
Flat and open edges require the direction of the edge.
Holds feature edges/points of surface.
Namespace for OpenFOAM.