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 | Copyright (C) 2011-2015 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  {
51  {
53  << "Specified IOobject::MUST_READ_IF_MODIFIED but class"
54  << " does not support automatic rereading."
55  << endl;
56  }
57 
58  readStream(typeName) >> *this;
59  close();
60 
61  {
62  // Calculate edgeDirections
63 
64  const edgeList& eds(edges());
65 
66  const pointField& pts(points());
67 
68  edgeDirections_.setSize(eds.size());
69 
70  forAll(eds, eI)
71  {
72  edgeDirections_[eI] = eds[eI].vec(pts);
73  }
74 
75  edgeDirections_ /= (mag(edgeDirections_) + SMALL);
76  }
77  }
78 
79  if (debug)
80  {
81  Pout<< "extendedFeatureEdgeMesh::extendedFeatureEdgeMesh :"
82  << " constructed from IOobject :"
83  << " points:" << points().size()
84  << " edges:" << edges().size()
85  << endl;
86  }
87 }
88 
89 
91 (
92  const IOobject& io,
93  const extendedEdgeMesh& em
94 )
95 :
96  regIOobject(io),
98 {}
99 
100 
102 (
103  const surfaceFeatures& sFeat,
104  const objectRegistry& obr,
105  const fileName& sFeatFileName,
106  const boolList& surfBaffleRegions
107 )
108 :
110  (
111  IOobject
112  (
113  sFeatFileName,
114  obr.time().constant(),
115  "extendedFeatureEdgeMesh",
116  obr,
119  )
120  ),
121  extendedEdgeMesh(sFeat, surfBaffleRegions)
122 {}
123 
124 
126 (
127  const IOobject& io,
129  const labelList& featureEdges,
130  const labelList& regionFeatureEdges,
131  const labelList& featurePoints
132 )
133 :
134  regIOobject(io),
135  extendedEdgeMesh(surf, featureEdges, regionFeatureEdges, featurePoints)
136 {}
137 
138 
140 (
141  const IOobject& io,
142  const pointField& pts,
143  const edgeList& eds,
144  label concaveStart,
145  label mixedStart,
146  label nonFeatureStart,
147  label internalStart,
148  label flatStart,
149  label openStart,
150  label multipleStart,
151  const vectorField& normals,
152  const List<sideVolumeType>& normalVolumeTypes,
153  const vectorField& edgeDirections,
154  const labelListList& normalDirections,
155  const labelListList& edgeNormals,
156  const labelListList& featurePointNormals,
157  const labelListList& featurePointEdges,
158  const labelList& regionEdges
159 )
160 :
161  regIOobject(io),
163  (
164  pts,
165  eds,
166  concaveStart,
167  mixedStart,
168  nonFeatureStart,
169  internalStart,
170  flatStart,
171  openStart,
172  multipleStart,
173  normals,
174  normalVolumeTypes,
175  edgeDirections,
176  normalDirections,
177  edgeNormals,
178  featurePointNormals,
179  featurePointEdges,
180  regionEdges
181  )
182 {}
183 
184 
185 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
186 
188 {}
189 
190 
191 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
192 
193 
194 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
195 
197 {
198  is >> *this;
199  return !is.bad();
200 }
201 
202 
204 {
205  os << *this;
206 
207  return os.good();
208 }
209 
210 
211 
212 //bool Foam::extendedFeatureEdgeMesh::writeData(Ostream& os) const
213 //{
214 // os << "// points" << nl
215 // << points() << nl
216 // << "// edges" << nl
217 // << edges() << nl
218 // << "// concaveStart mixedStart nonFeatureStart" << nl
219 // << concaveStart_ << token::SPACE
220 // << mixedStart_ << token::SPACE
221 // << nonFeatureStart_ << nl
222 // << "// internalStart flatStart openStart multipleStart" << nl
223 // << internalStart_ << token::SPACE
224 // << flatStart_ << token::SPACE
225 // << openStart_ << token::SPACE
226 // << multipleStart_ << nl
227 // << "// normals" << nl
228 // << normals_ << nl
229 // << "// normal volume types" << nl
230 // << normalVolumeTypes_ << nl
231 // << "// normalDirections" << nl
232 // << normalDirections_ << nl
233 // << "// edgeNormals" << nl
234 // << edgeNormals_ << nl
235 // << "// featurePointNormals" << nl
236 // << featurePointNormals_ << nl
237 // << "// featurePointEdges" << nl
238 // << featurePointEdges_ << nl
239 // << "// regionEdges" << nl
240 // << regionEdges_
241 // << endl;
242 //
243 // return os.good();
244 //}
245 
246 //
247 //Foam::Istream& Foam::operator>>
248 //(
249 // Istream& is,
250 // Foam::extendedFeatureEdgeMesh::sideVolumeType& vt
251 //)
252 //{
253 // label type;
254 // is >> type;
255 //
256 // vt = static_cast<Foam::extendedFeatureEdgeMesh::sideVolumeType>(type);
257 //
258 // // Check state of Istream
259 // is.check("operator>>(Istream&, sideVolumeType&)");
260 //
261 // return is;
262 //}
263 //
264 //
265 //Foam::Ostream& Foam::operator<<
266 //(
267 // Ostream& os,
268 // const Foam::extendedFeatureEdgeMesh::sideVolumeType& vt
269 //)
270 //{
271 // os << static_cast<label>(vt);
272 //
273 // return os;
274 //}
275 //
276 
277 // ************************************************************************* //
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::extendedFeatureEdgeMesh::writeData
virtual bool writeData(Ostream &) const
WriteData function required for regIOobject write operation.
Definition: extendedFeatureEdgeMesh.C:203
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::objectRegistry::time
const Time & time() const
Return time.
Definition: objectRegistry.H:117
Foam::IOobject::MUST_READ
@ MUST_READ
Definition: IOobject.H:108
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::mag
dimensioned< scalar > mag(const dimensioned< Type > &)
extendedFeatureEdgeMesh.H
Foam::IOobject::NO_WRITE
@ NO_WRITE
Definition: IOobject.H:118
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:50
Foam::IOobject::headerOk
bool headerOk()
Read and check header info.
Definition: IOobject.C:439
Foam::IOobject::MUST_READ_IF_MODIFIED
@ MUST_READ_IF_MODIFIED
Definition: IOobject.H:109
Foam::label
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
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::IOobject::readOpt
readOption readOpt() const
Definition: IOobject.H:317
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::IOobject::NO_READ
@ NO_READ
Definition: IOobject.H:111
Foam::extendedEdgeMesh::edgeDirections_
vectorField edgeDirections_
Flat and open edges require the direction of the edge.
Definition: extendedEdgeMesh.H:171
Foam::edgeMesh::points
const pointField & points() const
Return points.
Definition: edgeMeshI.H:39
Foam::surfaceFeatures
Holds feature edges/points of surface.
Definition: surfaceFeatures.H:68
Foam::edgeMesh::edges
const edgeList & edges() const
Return edges.
Definition: edgeMeshI.H:45
Foam::IOstream::bad
bool bad() const
Return true if stream is corrupted.
Definition: IOstream.H:351
Foam::extendedFeatureEdgeMesh::extendedFeatureEdgeMesh
extendedFeatureEdgeMesh(const IOobject &)
Construct (read) given an IOobject.
Definition: extendedFeatureEdgeMesh.C:38
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::extendedEdgeMesh
Description of feature edges and points.
Definition: extendedEdgeMesh.H:81
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:60
Foam::extendedFeatureEdgeMesh::~extendedFeatureEdgeMesh
virtual ~extendedFeatureEdgeMesh()
Destructor.
Definition: extendedFeatureEdgeMesh.C:187
Foam::regIOobject::readStream
Istream & readStream()
Return Istream.
Definition: regIOobjectRead.C:34
Foam::Pout
prefixOSstream Pout(cout, "Pout")
Definition: IOstreams.H:53
Foam::regIOobject::close
void close()
Close Istream.
Definition: regIOobjectRead.C:148
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::extendedFeatureEdgeMesh::readData
virtual bool readData(Istream &)
ReadData function required for regIOobject read operation.
Definition: extendedFeatureEdgeMesh.C:196
Foam::TimePaths::constant
const word & constant() const
Return constant name.
Definition: TimePaths.H:130
Foam::List::size
void size(const label)
Override size to be inconsistent with allocated storage.
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::IOstream::good
bool good() const
Return true if next operation might succeed.
Definition: IOstream.H:333
Foam::IOobject::READ_IF_PRESENT
@ READ_IF_PRESENT
Definition: IOobject.H:110
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
WarningInFunction
#define WarningInFunction
Report a warning using Foam::Warning.
Definition: messageStream.H:259
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatchTemplate.H:88