triSurfaceMesh.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-2013 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 
26 #include "triSurfaceMesh.H"
27 #include "Random.H"
29 #include "EdgeMap.H"
30 #include "triSurfaceFields.H"
31 #include "Time.H"
32 #include "PatchTools.H"
33 
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38 
39 defineTypeNameAndDebug(triSurfaceMesh, 0);
40 addToRunTimeSelectionTable(searchableSurface, triSurfaceMesh, dict);
41 
42 }
43 
44 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
45 
48 //Foam::word Foam::triSurfaceMesh::findRawInstance
49 //(
50 // const Time& runTime,
51 // const fileName& dir,
52 // const word& name
53 //)
54 //{
55 // // Check current time first
56 // if (isFile(runTime.path()/runTime.timeName()/dir/name))
57 // {
58 // return runTime.timeName();
59 // }
60 // instantList ts = runTime.times();
61 // label instanceI;
62 //
63 // for (instanceI = ts.size()-1; instanceI >= 0; --instanceI)
64 // {
65 // if (ts[instanceI].value() <= runTime.timeOutputValue())
66 // {
67 // break;
68 // }
69 // }
70 //
71 // // continue searching from here
72 // for (; instanceI >= 0; --instanceI)
73 // {
74 // if (isFile(runTime.path()/ts[instanceI].name()/dir/name))
75 // {
76 // return ts[instanceI].name();
77 // }
78 // }
79 //
80 //
81 // // not in any of the time directories, try constant
82 //
83 // // Note. This needs to be a hard-coded constant, rather than the
84 // // constant function of the time, because the latter points to
85 // // the case constant directory in parallel cases
86 //
87 // if (isFile(runTime.path()/runTime.constant()/dir/name))
88 // {
89 // return runTime.constant();
90 // }
91 //
92 // FatalErrorIn
93 // (
94 // "searchableSurfaces::findRawInstance"
95 // "(const Time&, const fileName&, const word&)"
96 // ) << "Cannot find file \"" << name << "\" in directory "
97 // << runTime.constant()/dir
98 // << exit(FatalError);
99 //
100 // return runTime.constant();
101 //}
102 
103 
104 //- Check file existence
105 const Foam::fileName& Foam::triSurfaceMesh::checkFile
106 (
107  const fileName& fName,
108  const fileName& objectName
109 )
110 {
111  if (fName.empty())
112  {
114  (
115  "triSurfaceMesh::checkFile(const fileName&, const fileName&)"
116  ) << "Cannot find triSurfaceMesh starting from "
117  << objectName << exit(FatalError);
118  }
119  return fName;
120 }
121 
122 
123 bool Foam::triSurfaceMesh::addFaceToEdge
124 (
125  const edge& e,
126  EdgeMap<label>& facesPerEdge
127 )
128 {
129  EdgeMap<label>::iterator eFnd = facesPerEdge.find(e);
130  if (eFnd != facesPerEdge.end())
131  {
132  if (eFnd() == 2)
133  {
134  return false;
135  }
136  eFnd()++;
137  }
138  else
139  {
140  facesPerEdge.insert(e, 1);
141  }
142  return true;
143 }
144 
145 
146 bool Foam::triSurfaceMesh::isSurfaceClosed() const
147 {
148  const pointField& pts = triSurface::points();
149 
150  // Construct pointFaces. Let's hope surface has compact point
151  // numbering ...
152  labelListList pointFaces;
153  invertManyToMany(pts.size(), *this, pointFaces);
154 
155  // Loop over all faces surrounding point. Count edges emanating from point.
156  // Every edge should be used by two faces exactly.
157  // To prevent doing work twice per edge only look at edges to higher
158  // point
159  EdgeMap<label> facesPerEdge(100);
160  forAll(pointFaces, pointI)
161  {
162  const labelList& pFaces = pointFaces[pointI];
163 
164  facesPerEdge.clear();
165  forAll(pFaces, i)
166  {
167  const triSurface::FaceType& f = triSurface::operator[](pFaces[i]);
168  label fp = findIndex(f, pointI);
169 
170  // Something weird: if I expand the code of addFaceToEdge in both
171  // below instances it gives a segmentation violation on some
172  // surfaces. Compiler (4.3.2) problem?
173 
174 
175  // Forward edge
176  label nextPointI = f[f.fcIndex(fp)];
177 
178  if (nextPointI > pointI)
179  {
180  bool okFace = addFaceToEdge
181  (
182  edge(pointI, nextPointI),
183  facesPerEdge
184  );
185 
186  if (!okFace)
187  {
188  return false;
189  }
190  }
191  // Reverse edge
192  label prevPointI = f[f.rcIndex(fp)];
193 
194  if (prevPointI > pointI)
195  {
196  bool okFace = addFaceToEdge
197  (
198  edge(pointI, prevPointI),
199  facesPerEdge
200  );
201 
202  if (!okFace)
203  {
204  return false;
205  }
206  }
207  }
208 
209  // Check for any edges used only once.
210  forAllConstIter(EdgeMap<label>, facesPerEdge, iter)
211  {
212  if (iter() != 2)
213  {
214  return false;
215  }
216  }
217  }
218 
219  return true;
220 }
221 
222 
223 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
224 
225 Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io, const triSurface& s)
226 :
227  searchableSurface(io),
229  (
230  IOobject
231  (
232  io.name(),
233  io.instance(),
234  io.local(),
235  io.db(),
236  io.readOpt(),
237  io.writeOpt(),
238  false // searchableSurface already registered under name
239  )
240  ),
241  triSurface(s),
243  minQuality_(-1),
244  surfaceClosed_(-1)
245 {
246  const pointField& pts = triSurface::points();
247 
248  bounds() = boundBox(pts);
249 }
250 
251 
252 Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io)
253 :
254  // Find instance for triSurfaceMesh
255  searchableSurface(io),
256  //(
257  // IOobject
258  // (
259  // io.name(),
260  // io.time().findInstance(io.local(), word::null),
261  // io.local(),
262  // io.db(),
263  // io.readOpt(),
264  // io.writeOpt(),
265  // io.registerObject()
266  // )
267  //),
268  // Reused found instance in objectRegistry
270  (
271  IOobject
272  (
273  io.name(),
274  static_cast<const searchableSurface&>(*this).instance(),
275  io.local(),
276  io.db(),
277  io.readOpt(),
278  io.writeOpt(),
279  false // searchableSurface already registered under name
280  )
281  ),
282  triSurface
283  (
284  checkFile
285  (
288  )
289  ),
290  triSurfaceRegionSearch(static_cast<const triSurface&>(*this)),
291  minQuality_(-1),
292  surfaceClosed_(-1)
293 {
294  const pointField& pts = triSurface::points();
295 
296  bounds() = boundBox(pts);
297 }
298 
299 
300 Foam::triSurfaceMesh::triSurfaceMesh
301 (
302  const IOobject& io,
303  const dictionary& dict
304 )
305 :
306  searchableSurface(io),
307  //(
308  // IOobject
309  // (
310  // io.name(),
311  // io.time().findInstance(io.local(), word::null),
312  // io.local(),
313  // io.db(),
314  // io.readOpt(),
315  // io.writeOpt(),
316  // io.registerObject()
317  // )
318  //),
319  // Reused found instance in objectRegistry
321  (
322  IOobject
323  (
324  io.name(),
325  static_cast<const searchableSurface&>(*this).instance(),
326  io.local(),
327  io.db(),
328  io.readOpt(),
329  io.writeOpt(),
330  false // searchableSurface already registered under name
331  )
332  ),
333  triSurface
334  (
335  checkFile
336  (
339  )
340  ),
341  triSurfaceRegionSearch(static_cast<const triSurface&>(*this), dict),
342  minQuality_(-1),
343  surfaceClosed_(-1)
344 {
345  scalar scaleFactor = 0;
346 
347  // allow rescaling of the surface points
348  // eg, CAD geometries are often done in millimeters
349  if (dict.readIfPresent("scale", scaleFactor) && scaleFactor > 0)
350  {
351  Info<< searchableSurface::name() << " : using scale " << scaleFactor
352  << endl;
353  triSurface::scalePoints(scaleFactor);
354  }
355 
356  const pointField& pts = triSurface::points();
357 
358  bounds() = boundBox(pts);
359 
360  // Have optional minimum quality for normal calculation
361  if (dict.readIfPresent("minQuality", minQuality_) && minQuality_ > 0)
362  {
364  << " : ignoring triangles with quality < "
365  << minQuality_ << " for normals calculation." << endl;
366  }
367 }
368 
369 
370 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
371 
373 {
374  clearOut();
375 }
376 
377 
379 {
381  edgeTree_.clear();
383 }
384 
385 
386 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
387 
389 {
390  tmp<pointField> tPts(new pointField(8));
391  pointField& pt = tPts();
392 
393  // Use copy to calculate face centres so they don't get stored
395  (
398  ).faceCentres();
399 
400  return tPts;
401 }
402 
403 
405 (
406  pointField& centres,
407  scalarField& radiusSqr
408 ) const
409 {
410  centres = coordinates();
411  radiusSqr.setSize(size());
412  radiusSqr = 0.0;
413 
414  const pointField& pts = triSurface::points();
415 
416  forAll(*this, faceI)
417  {
418  const labelledTri& f = triSurface::operator[](faceI);
419  const point& fc = centres[faceI];
420  forAll(f, fp)
421  {
422  const point& pt = pts[f[fp]];
423  radiusSqr[faceI] = max(radiusSqr[faceI], Foam::magSqr(fc-pt));
424  }
425  }
426 
427  // Add a bit to make sure all points are tested inside
428  radiusSqr += Foam::sqr(SMALL);
429 }
430 
431 
433 {
434  return triSurface::points();
435 }
436 
437 
439 {
440  const indexedOctree<treeDataTriSurface>& octree = tree();
441 
442  labelList indices = octree.findBox(treeBoundBox(bb));
443 
444  return !indices.empty();
445 }
446 
447 
449 {
451  edgeTree_.clear();
452  triSurface::movePoints(newPoints);
453 }
454 
455 
458 {
459  if (edgeTree_.empty())
460  {
461  // Boundary edges
462  labelList bEdges
463  (
464  identity
465  (
466  nEdges()
467  -nInternalEdges()
468  )
469  + nInternalEdges()
470  );
471 
473 
474  if (bEdges.size())
475  {
476  label nPoints;
478  (
479  static_cast<const triSurface&>(*this),
480  bb,
481  nPoints
482  );
483 
484  // Random number generator. Bit dodgy since not exactly random ;-)
485  Random rndGen(65431);
486 
487  // Slightly extended bb. Slightly off-centred just so on symmetric
488  // geometry there are less face/edge aligned items.
489 
490  bb = bb.extend(rndGen, 1e-4);
491  bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
492  bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
493  }
494 
495  scalar oldTol = indexedOctree<treeDataEdge>::perturbTol();
497 
498  edgeTree_.reset
499  (
501  (
503  (
504  false, // cachebb
505  edges(), // edges
506  localPoints(), // points
507  bEdges // selected edges
508  ),
509  bb, // bb
510  maxTreeDepth(), // maxLevel
511  10, // leafsize
512  3.0 // duplicity
513  )
514  );
515 
517  }
518  return edgeTree_();
519 }
520 
521 
523 {
524  if (regions_.empty())
525  {
526  regions_.setSize(patches().size());
527  forAll(regions_, regionI)
528  {
529  regions_[regionI] = patches()[regionI].name();
530  }
531  }
532  return regions_;
533 }
534 
535 
536 // Find out if surface is closed.
538 {
539  if (surfaceClosed_ == -1)
540  {
541  if (isSurfaceClosed())
542  {
543  surfaceClosed_ = 1;
544  }
545  else
546  {
547  surfaceClosed_ = 0;
548  }
549  }
550 
551  return surfaceClosed_ == 1;
552 }
553 
554 
556 (
557  const pointField& samples,
558  const scalarField& nearestDistSqr,
559  List<pointIndexHit>& info
560 ) const
561 {
562  triSurfaceSearch::findNearest(samples, nearestDistSqr, info);
563 }
564 
565 
567 (
568  const pointField& samples,
569  const scalarField& nearestDistSqr,
570  const labelList& regionIndices,
571  List<pointIndexHit>& info
572 ) const
573 {
575  (
576  samples,
577  nearestDistSqr,
578  regionIndices,
579  info
580  );
581 }
582 
583 
585 (
586  const pointField& start,
587  const pointField& end,
588  List<pointIndexHit>& info
589 ) const
590 {
591  triSurfaceSearch::findLine(start, end, info);
592 }
593 
594 
596 (
597  const pointField& start,
598  const pointField& end,
599  List<pointIndexHit>& info
600 ) const
601 {
602  triSurfaceSearch::findLineAny(start, end, info);
603 }
604 
605 
607 (
608  const pointField& start,
609  const pointField& end,
610  List<List<pointIndexHit> >& info
611 ) const
612 {
613  triSurfaceSearch::findLineAll(start, end, info);
614 }
615 
616 
618 (
619  const List<pointIndexHit>& info,
620  labelList& region
621 ) const
622 {
623  region.setSize(info.size());
624  forAll(info, i)
625  {
626  if (info[i].hit())
627  {
628  region[i] = triSurface::operator[](info[i].index()).region();
629  }
630  else
631  {
632  region[i] = -1;
633  }
634  }
635 }
636 
637 
639 (
640  const List<pointIndexHit>& info,
641  vectorField& normal
642 ) const
643 {
644  const triSurface& s = static_cast<const triSurface&>(*this);
645  const pointField& pts = s.points();
646 
647  normal.setSize(info.size());
648 
649  if (minQuality_ >= 0)
650  {
651  // Make sure we don't use triangles with low quality since
652  // normal is not reliable.
653 
654  const labelListList& faceFaces = s.faceFaces();
655 
656  forAll(info, i)
657  {
658  if (info[i].hit())
659  {
660  label faceI = info[i].index();
661  normal[i] = s[faceI].normal(pts);
662 
663  scalar qual = s[faceI].tri(pts).quality();
664 
665  if (qual < minQuality_)
666  {
667  // Search neighbouring triangles
668  const labelList& fFaces = faceFaces[faceI];
669 
670  forAll(fFaces, j)
671  {
672  label nbrI = fFaces[j];
673  scalar nbrQual = s[nbrI].tri(pts).quality();
674  if (nbrQual > qual)
675  {
676  qual = nbrQual;
677  normal[i] = s[nbrI].normal(pts);
678  }
679  }
680  }
681 
682  normal[i] /= mag(normal[i]) + VSMALL;
683  }
684  else
685  {
686  // Set to what?
687  normal[i] = vector::zero;
688  }
689  }
690  }
691  else
692  {
693  forAll(info, i)
694  {
695  if (info[i].hit())
696  {
697  label faceI = info[i].index();
698  //- Cached:
699  //normal[i] = faceNormals()[faceI];
700 
701  //- Uncached
702  normal[i] = s[faceI].normal(pts);
703  normal[i] /= mag(normal[i]) + VSMALL;
704  }
705  else
706  {
707  // Set to what?
708  normal[i] = vector::zero;
709  }
710  }
711  }
712 }
713 
714 
716 {
718  (
720  (
721  IOobject
722  (
723  "values",
724  objectRegistry::time().timeName(), // instance
725  "triSurface", // local
726  *this,
729  ),
730  *this,
731  dimless,
732  labelField(values)
733  )
734  );
735 
736  // Store field on triMesh
737  fldPtr.ptr()->store();
738 }
739 
740 
742 (
743  const List<pointIndexHit>& info,
744  labelList& values
745 ) const
746 {
747  if (foundObject<triSurfaceLabelField>("values"))
748  {
749  values.setSize(info.size());
750 
751  const triSurfaceLabelField& fld = lookupObject<triSurfaceLabelField>
752  (
753  "values"
754  );
755 
756  forAll(info, i)
757  {
758  if (info[i].hit())
759  {
760  values[i] = fld[info[i].index()];
761  }
762  }
763  }
764 }
765 
766 
768 (
769  const pointField& points,
770  List<volumeType>& volType
771 ) const
772 {
773  volType.setSize(points.size());
774 
777 
778  forAll(points, pointI)
779  {
780  const point& pt = points[pointI];
781 
782  if (!tree().bb().contains(pt))
783  {
784  // Have to calculate directly as outside the octree
785  volType[pointI] = tree().shapes().getVolumeType(tree(), pt);
786  }
787  else
788  {
789  // - use cached volume type per each tree node
790  volType[pointI] = tree().getVolumeType(pt);
791  }
792 
793 // Info<< "octree : " << pt << " = "
794 // << volumeType::names[volType[pointI]] << endl;
795  }
796 
798 }
799 
800 
801 //- Write using given format, version and compression
803 (
807 ) const
808 {
810 
811  if (!mkDir(fullPath.path()))
812  {
813  return false;
814  }
815 
816  triSurface::write(fullPath);
817 
818  if (!isFile(fullPath))
819  {
820  return false;
821  }
822 
823  //return objectRegistry::writeObject(fmt, ver, cmp);
824  return true;
825 }
826 
827 
828 // ************************************************************************* //
void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit > > &info) const
Calculate all intersections from start to end.
Simple random number generator.
Definition: Random.H:49
cachedRandom rndGen(label(0),-1)
const point & min() const
Minimum describing the bounding box.
Definition: boundBoxI.H:54
T * ptr()
Return object pointer for reuse.
Definition: autoPtrI.H:90
static scalar & perturbTol()
Get the perturbation tolerance.
const labelListList & faceFaces() const
Return face-face addressing.
readOption readOpt() const
Definition: IOobject.H:304
void invertManyToMany(const label len, const UList< InList > &, List< OutList > &)
Invert many-to-many.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
vector point
Point is a vector.
Definition: point.H:41
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
fileName filePath() const
Return complete path + object name if the file exists.
Definition: IOobject.C:323
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject( name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE ))
virtual void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Find first intersection on segment from start to end.
const indexedOctree< treeDataEdge > & edgeTree() const
Demand driven construction of octree for boundary edges.
virtual void getField(const List< pointIndexHit > &, labelList &) const
WIP. From a set of hits (points and.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines. WIP.
dimensioned< scalar > mag(const dimensioned< Type > &)
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
virtual label size() const
Range of local indices that can be returned.
bool empty() const
Return true if the UList is empty (ie, size() is zero).
Definition: UListI.H:313
dimensioned< scalar > magSqr(const dimensioned< Type > &)
virtual void boundingSpheres(pointField &centres, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared). Any point.
Triangulated surface description with patch information.
Definition: triSurface.H:57
Field< label > labelField
Specialisation of Field<T> for label.
Definition: labelField.H:49
virtual bool hasVolumeType() const
Whether supports volume type below. I.e. whether is closed.
const fileName & local() const
Definition: IOobject.H:347
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
Standard boundBox + extra functionality for use in octree.
Definition: treeBoundBox.H:75
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:76
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
const fileName & instance() const
Definition: IOobject.H:337
triSurface()
Construct null.
Definition: triSurface.C:611
const boundBox & bounds() const
Return const reference to boundBox.
void clearOut()
Clear storage.
messageStream Info
fileName path() const
Return directory path name (part before last /)
Definition: fileName.C:287
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
virtual void movePoints(const pointField &)
Move points.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Helper class to search on triSurface. Creates an octree for each region of the surface and only searc...
virtual ~triSurfaceMesh()
Destructor.
label nPoints() const
Return number of points supporting patch faces.
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:42
Namespace for OpenFOAM.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Definition: pEqn.H:39
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit > > &) const
Get all intersections in order from start to end.
T & operator[](const label)
Return element of UList.
Definition: UListI.H:163
const Field< point > & localPoints() const
Return pointField of points in patch.
void clear()
Clear the list, i.e. set size to zero.
Definition: List.C:379
scalar tolerance() const
Return tolerance to use in searches.
Triangle with additional region number.
Definition: labelledTri.H:49
const Field< point > & faceCentres() const
Return face centres for patch.
void setSize(const label)
Reset size of List.
Definition: List.C:318
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
const geometricSurfacePatchList & patches() const
Definition: triSurface.H:306
void findNearest(const pointField &samples, const scalarField &nearestDistSqr, const labelList &regionIndices, List< pointIndexHit > &info) const
Find the nearest point on the surface out of the regions.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
const indexedOctree< treeDataTriSurface > & tree() const
Demand driven construction of the octree.
treeBoundBox extend(Random &, const scalar s) const
Return slightly wider bounding box.
streamFormat
Enumeration for the format of data in the stream.
Definition: IOstream.H:86
virtual void getRegion(const List< pointIndexHit > &, labelList &region) const
From a set of points and indices get the region.
void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &info) const
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define forAll(list, i)
Definition: UList.H:421
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
writeOption writeOpt() const
Definition: IOobject.H:314
fileName objectPath() const
Return complete path + object name.
Definition: IOobject.H:363
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const
virtual bool writeObject(IOstream::streamFormat fmt, IOstream::versionNumber ver, IOstream::compressionType cmp) const
Write using given format, version and compression.
Macros for easy insertion into run-time selection tables.
virtual tmp< pointField > points() const
Get the points that define the surface.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
Definition: ListOps.C:104
const point & max() const
Maximum describing the bounding box.
Definition: boundBoxI.H:60
static void calcBounds(const PrimitivePatch< Face, FaceList, PointField, PointType > &p, boundBox &bb, label &nPoints)
const word & name() const
Return name.
Definition: IOobject.H:260
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().x()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().y()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().z()<< ' ';}gmvFile<< nl;forAll(lagrangianScalarNames, i){const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject( name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE ))
void findNearest(const pointField &samples, const scalarField &nearestDistSqr, List< pointIndexHit > &info) const
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:314
A bounding box defined in terms of the points at its extremities.
Definition: boundBox.H:55
Fields for triSurface.
Non-pointer based hierarchical recursive searching.
Definition: treeDataEdge.H:47
A list of faces which address into the list of points.
compressionType
Enumeration for the format of data in the stream.
Definition: IOstream.H:193
Holds data for octree to work on an edges subset.
Definition: treeDataEdge.H:53
virtual void getVolumeType(const pointField &, List< volumeType > &) const
Determine type (inside/outside/mixed) for point. unknown if.
error FatalError
Registry of regIOobjects.
List< label > labelList
A List of labels.
Definition: labelList.H:56
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
A class for handling file names.
Definition: fileName.H:69
static const Vector zero
Definition: Vector.H:80
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
label size() const
Return the number of elements in the UList.
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
virtual void movePoints(const pointField &)
Move points.
Definition: triSurface.C:805
void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &info) const
A List obtained as a section of another List.
Definition: SubList.H:53
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
label maxTreeDepth() const
Return max tree depth of octree.
const Time & time() const
Return time.
bool isFile(const fileName &, const bool checkGzip=true)
Does the name exist as a FILE in the file system?
Definition: POSIX.C:623
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
Definition: POSIX.C:420
dimensionedSymmTensor sqr(const dimensionedVector &dv)
label nEdges() const
Return number of edges in patch.
Version number type.
Definition: IOstream.H:96
List< labelList > labelListList
A List of labelList.
Definition: labelList.H:57
const objectRegistry & db() const
Return the local objectRegistry.
Definition: IOobject.C:245
friend class iterator
Declare friendship with the iterator.
Definition: HashTable.H:189
virtual bool overlaps(const boundBox &bb) const
Does any part of the surface overlap the supplied bound box?
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
A class for managing temporary objects.
Definition: PtrList.H:118
const Field< point > & points() const
Return reference to global points.
virtual void setField(const labelList &values)
WIP. Store element-wise field.
virtual void scalePoints(const scalar)
Scale points. A non-positive factor is ignored.
Definition: triSurface.C:818
virtual const wordList & regions() const
Names of regions.
defineTypeNameAndDebug(combustionModel, 0)
word timeName
Definition: getTimeIndex.H:3