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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2015-2018 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
29 #include "triSurfaceMesh.H"
30 #include "Random.H"
32 #include "edgeHashes.H"
33 #include "triSurfaceFields.H"
34 #include "Time.H"
35 #include "PatchTools.H"
36 
37 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
38 
39 namespace Foam
40 {
41  defineTypeNameAndDebug(triSurfaceMesh, 0);
42  addToRunTimeSelectionTable(searchableSurface, triSurfaceMesh, dict);
43 }
44 
46 
47 
48 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
49 
51 (
52  const IOobject& io,
53  const bool isGlobal
54 )
55 {
56  const fileName fName
57  (
58  isGlobal
59  ? io.globalFilePath(typeName)
60  : io.localFilePath(typeName)
61  );
62  if (fName.empty())
63  {
65  << "Cannot find triSurfaceMesh starting from "
66  << io.objectPath() << exit(FatalError);
67  }
68 
69  return fName;
70 }
71 
72 
74 (
75  const IOobject& io,
76  const fileName& f,
77  const bool isGlobal
78 )
79 {
80  fileName fName(f);
81  fName.expand();
82  if (!fName.isAbsolute())
83  {
84  // Is the specified file:
85  // - local to the cwd?
86  // - local to the case dir?
87  // - or just another name?
88  fName = fileHandler().filePath
89  (
90  isGlobal,
91  IOobject(io, fName),
92  word::null
93  );
94  }
95  return fName;
96 }
97 
99 (
100  const IOobject& io,
101  const dictionary& dict,
102  const bool isGlobal
103 )
104 {
105  fileName fName;
106  if (dict.readIfPresent("file", fName, keyType::LITERAL))
107  {
108  const fileName rawFName(fName);
109 
110  fName = relativeFilePath(io, rawFName, isGlobal);
111 
112  if (!exists(fName))
113  {
115  << "Cannot find triSurfaceMesh " << rawFName
116  << " starting from " << io.objectPath()
117  << exit(FatalError);
118  }
119  }
120  else
121  {
122  fName =
123  (
124  isGlobal
125  ? io.globalFilePath(typeName)
126  : io.localFilePath(typeName)
127  );
128 
129  if (!exists(fName))
130  {
132  << "Cannot find triSurfaceMesh starting from "
133  << io.objectPath() << exit(FatalError);
134  }
135  }
136 
137  return fName;
138 }
139 
140 
142 (
143  const edge& e,
144  EdgeMap<label>& facesPerEdge
145 )
146 {
147  label& count = facesPerEdge(e, 0); // lookup or new entry
148  if (count == 2)
149  {
150  return false;
151  }
152 
153  ++count;
154  return true;
155 }
156 
157 
159 {
160  if (debug)
161  {
162  Pout<< "triSurfaceMesh::isSurfaceClosed:"
163  << " determining closedness for surface with "
164  << triSurface::size() << " triangles" << endl;
165  }
166 
167  const pointField& pts = triSurface::points();
168 
169  // Construct pointFaces. Let's hope surface has compact point
170  // numbering ...
172  invertManyToMany(pts.size(), *this, pointFaces);
173 
174  // Loop over all faces surrounding point. Count edges emanating from point.
175  // Every edge should be used by two faces exactly.
176  // To prevent doing work twice per edge only look at edges to higher
177  // point
178  EdgeMap<label> facesPerEdge(128);
179  forAll(pointFaces, pointi)
180  {
181  const labelList& pFaces = pointFaces[pointi];
182 
183  facesPerEdge.clear();
184  for (const label facei : pFaces)
185  {
186  const triSurface::FaceType& f = triSurface::operator[](facei);
187  const label fp = f.find(pointi);
188 
189  // Something weird: if I expand the code of addFaceToEdge in both
190  // below instances it gives a segmentation violation on some
191  // surfaces. Compiler (4.3.2) problem?
192 
193 
194  // Forward edge
195  const label nextPointi = f[f.fcIndex(fp)];
196 
197  if (nextPointi > pointi)
198  {
199  bool okFace = addFaceToEdge
200  (
201  edge(pointi, nextPointi),
202  facesPerEdge
203  );
204 
205  if (!okFace)
206  {
207  if (debug)
208  {
209  Pout<< "triSurfaceMesh::isSurfaceClosed :"
210  << " surface is open" << endl;
211  }
212  return false;
213  }
214  }
215 
216  // Reverse edge
217  const label prevPointi = f[f.rcIndex(fp)];
218 
219  if (prevPointi > pointi)
220  {
221  bool okFace = addFaceToEdge
222  (
223  edge(pointi, prevPointi),
224  facesPerEdge
225  );
226 
227  if (!okFace)
228  {
229  if (debug)
230  {
231  Pout<< "triSurfaceMesh::isSurfaceClosed :"
232  << " surface is open" << endl;
233  }
234  return false;
235  }
236  }
237  }
238 
239  // Check for any edges used only once.
240  forAllConstIters(facesPerEdge, iter)
241  {
242  if (iter.val() != 2)
243  {
244  if (debug)
245  {
246  Pout<< "triSurfaceMesh::isSurfaceClosed :"
247  << " surface is open" << endl;
248  }
249  return false;
250  }
251  }
252  }
253 
254  if (debug)
255  {
256  Pout<< "triSurfaceMesh::isSurfaceClosed :"
257  << " surface is closed" << endl;
258  }
259  return true;
260 }
261 
262 
263 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
264 
266 :
267  searchableSurface(io),
269  (
270  IOobject
271  (
272  io.name(),
273  io.instance(),
274  io.local(),
275  io.db(),
276  io.readOpt(),
277  io.writeOpt(),
278  false // searchableSurface already registered under name
279  )
280  ),
281  triSurface(s),
282  triSurfaceRegionSearch(static_cast<const triSurface&>(*this)),
283  minQuality_(-1),
284  surfaceClosed_(-1),
285  outsideVolType_(volumeType::UNKNOWN)
286 {
287  const pointField& pts = triSurface::points();
288 
289  bounds() = boundBox(pts, false);
290 }
291 
292 
294 :
295  // Find instance for triSurfaceMesh
296  searchableSurface(io),
297  // Reused found instance in objectRegistry
299  (
300  IOobject
301  (
302  io.name(),
303  searchableSurface::instance(),
304  io.local(),
305  io.db(),
306  io.readOpt(),
307  io.writeOpt(),
308  false // searchableSurface already registered under name
309  )
310  ),
311  triSurface(checkFile(static_cast<const searchableSurface&>(*this), true)),
312  triSurfaceRegionSearch(static_cast<const triSurface&>(*this)),
313  minQuality_(-1),
314  surfaceClosed_(-1),
315  outsideVolType_(volumeType::UNKNOWN)
316 {
317  const pointField& pts = triSurface::points();
318 
319  bounds() = boundBox(pts, false);
320 }
321 
322 
324 (
325  const IOobject& io,
326  const dictionary& dict
327 )
328 :
329  searchableSurface(io),
330  // Reused found instance in objectRegistry
332  (
333  IOobject
334  (
335  io.name(),
337  io.local(),
338  io.db(),
339  io.readOpt(),
340  io.writeOpt(),
341  false // searchableSurface already registered under name
342  )
343  ),
344  triSurface
345  (
346  checkFile(static_cast<const searchableSurface&>(*this), dict, true)
347  ),
348  triSurfaceRegionSearch(static_cast<const triSurface&>(*this), dict),
349  minQuality_(-1),
350  surfaceClosed_(-1),
351  outsideVolType_(volumeType::UNKNOWN)
352 {
353  // Reading from supplied file name instead of objectPath/filePath
354  if (dict.readIfPresent("file", fName_, keyType::LITERAL))
355  {
356  fName_ = relativeFilePath
357  (
358  static_cast<const searchableSurface&>(*this),
359  fName_,
360  true
361  );
362  }
363 
364  scalar scaleFactor = 0;
365 
366  // Allow rescaling of the surface points
367  // eg, CAD geometries are often done in millimeters
368  if (dict.readIfPresent("scale", scaleFactor) && scaleFactor > 0)
369  {
370  Info<< searchableSurface::name() << " : using scale " << scaleFactor
371  << endl;
372  triSurface::scalePoints(scaleFactor);
373  }
374 
375  const pointField& pts = triSurface::points();
376 
377  bounds() = boundBox(pts, false);
378 
379  // Have optional minimum quality for normal calculation
380  if (dict.readIfPresent("minQuality", minQuality_) && minQuality_ > 0)
381  {
383  << " : ignoring triangles with quality < "
384  << minQuality_ << " for normals calculation." << endl;
385  }
386 }
387 
388 
390 :
391  // Find instance for triSurfaceMesh
392  searchableSurface(io),
393  // Reused found instance in objectRegistry
395  (
396  IOobject
397  (
398  io.name(),
399  searchableSurface::instance(),
400  io.local(),
401  io.db(),
402  io.readOpt(),
403  io.writeOpt(),
404  false // searchableSurface already registered under name
405  )
406  ),
407  triSurface(), // construct null
408  triSurfaceRegionSearch(static_cast<const triSurface&>(*this)),
409  minQuality_(-1),
410  surfaceClosed_(-1),
411  outsideVolType_(volumeType::UNKNOWN)
412 {
413  // Check IO flags
414  if (io.readOpt() != IOobject::NO_READ)
415  {
416  const bool searchGlobal(r == localOrGlobal || r == masterOnly);
417 
418  const fileName actualFile
419  (
420  searchGlobal
421  ? io.globalFilePath(typeName)
422  : io.localFilePath(typeName)
423  );
424 
425  if (debug)
426  {
427  Pout<< "triSurfaceMesh(const IOobject& io) :"
428  << " loading surface " << io.objectPath()
429  << " local filePath:" << io.localFilePath(typeName)
430  << " from:" << actualFile << endl;
431  }
432 
433  if (searchGlobal && Pstream::parRun())
434  {
435  // Check where surface was found
436  const fileName localFile(io.localFilePath(typeName));
437 
438  if (r == masterOnly && (actualFile != localFile))
439  {
440  // Found undecomposed surface. Load on master only
441  if (Pstream::master())
442  {
443  triSurface s2(actualFile);
445  }
447  if (debug)
448  {
449  Pout<< "triSurfaceMesh(const IOobject& io) :"
450  << " loaded triangles:" << triSurface::size() << endl;
451  }
452  }
453  else
454  {
455  // Read on all processors
456  triSurface s2(actualFile);
458  if (debug)
459  {
460  Pout<< "triSurfaceMesh(const IOobject& io) :"
461  << " loaded triangles:" << triSurface::size() << endl;
462  }
463  }
464  }
465  else
466  {
467  // Read on all processors
468  triSurface s2(actualFile);
470  if (debug)
471  {
472  Pout<< "triSurfaceMesh(const IOobject& io) :"
473  << " loaded triangles:" << triSurface::size() << endl;
474  }
475  }
476  }
477 
478  const pointField& pts = triSurface::points();
479  bounds() = boundBox(pts, false);
480 }
481 
482 
484 (
485  const IOobject& io,
486  const dictionary& dict,
487  const readAction r
488 )
489 :
490  searchableSurface(io),
491  // Reused found instance in objectRegistry
493  (
494  IOobject
495  (
496  io.name(),
498  io.local(),
499  io.db(),
500  io.readOpt(),
501  io.writeOpt(),
502  false // searchableSurface already registered under name
503  )
504  ),
505  triSurface(), // construct null
506  triSurfaceRegionSearch(static_cast<const triSurface&>(*this), dict),
507  minQuality_(-1),
508  surfaceClosed_(-1),
509  outsideVolType_(volumeType::UNKNOWN)
510 {
511  // Check IO flags
512  if (io.readOpt() != IOobject::NO_READ)
513  {
514  const bool searchGlobal(r == localOrGlobal || r == masterOnly);
515 
516  fileName actualFile
517  (
518  searchGlobal
519  ? io.globalFilePath(typeName)
520  : io.localFilePath(typeName)
521  );
522 
523  // Reading from supplied file name instead of objectPath/filePath
524  if (dict.readIfPresent("file", fName_, keyType::LITERAL))
525  {
526  fName_ = relativeFilePath
527  (
528  static_cast<const searchableSurface&>(*this),
529  fName_,
530  searchGlobal
531  );
532  actualFile = fName_;
533  }
534 
535  if (debug)
536  {
537  Pout<< "triSurfaceMesh(const IOobject& io, const dictionary&) :"
538  << " loading surface " << io.objectPath()
539  << " local filePath:" << io.localFilePath(typeName)
540  << " from:" << actualFile << endl;
541  }
542 
543  if (searchGlobal && Pstream::parRun())
544  {
545  // Check where surface was found
546  const fileName localFile(io.localFilePath(typeName));
547 
548  if (r == masterOnly && (actualFile != localFile))
549  {
550  // Surface not loaded from processor directories -> undecomposed
551  // surface. Load on master only
552  if (Pstream::master())
553  {
554  triSurface s2(actualFile);
556  }
558  if (debug)
559  {
560  Pout<< "triSurfaceMesh(const IOobject& io) :"
561  << " loaded triangles:" << triSurface::size() << endl;
562  }
563  }
564  else
565  {
566  // Read on all processors
567  triSurface s2(actualFile);
569  if (debug)
570  {
571  Pout<< "triSurfaceMesh(const IOobject& io) :"
572  << " loaded triangles:" << triSurface::size() << endl;
573  }
574  }
575  }
576  else
577  {
578  // Read on all processors
579  triSurface s2(actualFile);
581  if (debug)
582  {
583  Pout<< "triSurfaceMesh(const IOobject& io) :"
584  << " loaded triangles:" << triSurface::size() << endl;
585  }
586  }
587  }
588 
589 
590  scalar scaleFactor = 0;
591 
592  // Allow rescaling of the surface points
593  // eg, CAD geometries are often done in millimeters
594  if (dict.readIfPresent("scale", scaleFactor) && scaleFactor > 0)
595  {
596  Info<< searchableSurface::name() << " : using scale " << scaleFactor
597  << endl;
598  triSurface::scalePoints(scaleFactor);
599  }
600 
601  const pointField& pts = triSurface::points();
602  bounds() = boundBox(pts, false);
603 
604  // Have optional minimum quality for normal calculation
605  if (dict.readIfPresent("minQuality", minQuality_) && minQuality_ > 0)
606  {
608  << " : ignoring triangles with quality < "
609  << minQuality_ << " for normals calculation." << endl;
610  }
611 }
612 
613 
614 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
615 
617 {
618  clearOut();
619 }
620 
621 
623 {
624  // Do not clear closedness status
626  edgeTree_.clear();
628 }
629 
630 
631 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
632 
634 {
635  auto tpts = tmp<pointField>::New(8);
636  auto& pts = tpts.ref();
637 
638  // Use copy to calculate face centres so they don't get stored
640  (
641  SubList<triSurface::FaceType>(*this, triSurface::size()),
643  ).faceCentres();
644 
645  return tpts;
646 }
647 
648 
650 (
651  pointField& centres,
652  scalarField& radiusSqr
653 ) const
654 {
655  centres = coordinates();
656  radiusSqr.setSize(size());
657  radiusSqr = 0.0;
658 
659  const pointField& pts = triSurface::points();
660 
661  forAll(*this, facei)
662  {
663  const labelledTri& f = triSurface::operator[](facei);
664  const point& fc = centres[facei];
665  for (const label pointi : f)
666  {
667  const point& pt = pts[pointi];
668  radiusSqr[facei] = max(radiusSqr[facei], Foam::magSqr(fc-pt));
669  }
670  }
671 
672  // Add a bit to make sure all points are tested inside
673  radiusSqr += Foam::sqr(SMALL);
674 }
675 
676 
678 {
679  return triSurface::points();
680 }
681 
682 
684 {
685  const indexedOctree<treeDataTriSurface>& octree = tree();
686 
687  labelList indices = octree.findBox(treeBoundBox(bb));
688 
689  return !indices.empty();
690 }
691 
692 
694 {
695  if (debug)
696  {
697  Pout<< "triSurfaceMesh::movePoints :"
698  << " moving at time " << objectRegistry::time().timeName()
699  << endl;
700  }
701 
702  // Preserve topological point status (surfaceClosed_, outsideVolType_)
703 
704  // Update local information (instance, event number)
707 
708  const label event = getEvent();
709  searchableSurface::eventNo() = event;
711 
712  // Clear additional addressing
714  edgeTree_.clear();
715  triSurface::movePoints(newPoints);
716 
717  bounds() = boundBox(triSurface::points(), false);
718  if (debug)
719  {
720  Pout<< "triSurfaceMesh::movePoints: finished moving points" << endl;
721  }
722 }
723 
724 
727 {
728  if (edgeTree_.empty())
729  {
730  if (debug)
731  {
732  Pout<< "triSurfaceMesh::edgeTree :"
733  << " constructing tree for " << nEdges() - nInternalEdges()
734  << " boundary edges" << endl;
735  }
736 
737  // Boundary edges
738  labelList bEdges
739  (
740  identity(nEdges() - nInternalEdges(), nInternalEdges())
741  );
742 
743  treeBoundBox bb(Zero, Zero);
744 
745  if (bEdges.size())
746  {
747  label nPoints;
749  (
750  *this,
751  bb,
752  nPoints
753  );
754 
755  // Random number generator. Bit dodgy since not exactly random ;-)
756  Random rndGen(65431);
757 
758  // Slightly extended bb. Slightly off-centred just so on symmetric
759  // geometry there are less face/edge aligned items.
760 
761  bb = bb.extend(rndGen, 1e-4);
762  bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
763  bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
764  }
765 
766 
767  if (debug)
768  {
769  Pout<< "triSurfaceMesh::edgeTree : "
770  << "calculating edge tree for bb:" << bb << endl;
771  }
772 
773  scalar oldTol = indexedOctree<treeDataEdge>::perturbTol();
775 
776  edgeTree_.reset
777  (
779  (
781  (
782  false, // cachebb
783  edges(), // edges
784  localPoints(), // points
785  bEdges // selected edges
786  ),
787  bb, // bb
788  maxTreeDepth(), // maxLevel
789  10, // leafsize
790  3.0 // duplicity
791  )
792  );
793 
795 
796  if (debug)
797  {
798  Pout<< "triSurfaceMesh::edgeTree :"
799  << " finished constructing tree for "
800  << nEdges() - nInternalEdges()
801  << " boundary edges" << endl;
802  }
803  }
804 
805  return *edgeTree_;
806 }
807 
808 
810 {
811  if (regions_.empty())
812  {
813  regions_.setSize(patches().size());
814  forAll(regions_, regioni)
815  {
816  regions_[regioni] = patches()[regioni].name();
817  }
818  }
819  return regions_;
820 }
821 
822 
824 {
825  if (surfaceClosed_ == -1)
826  {
827  if (isSurfaceClosed())
828  {
829  surfaceClosed_ = 1;
830  }
831  else
832  {
833  surfaceClosed_ = 0;
834  }
835  }
836 
837  return surfaceClosed_ == 1;
838 }
839 
840 
842 {
843  if (outsideVolType_ == volumeType::UNKNOWN)
844  {
845  // Get point outside bounds()
846  const point outsidePt(bounds().max() + 0.5*bounds().span());
847 
848  if (debug)
849  {
850  Pout<< "triSurfaceMesh::outsideVolumeType :"
851  << " triggering outsidePoint:" << outsidePt
852  << " orientation" << endl;
853  }
854 
855  //outsideVolType_ = tree().shapes().getVolumeType(tree(), outsidePt);
856  // Note: do not use tree directly so e.g. distributedTriSurfaceMesh
857  // has opportunity to intercept
858  List<volumeType> outsideVolTypes;
859  getVolumeType(pointField(1, outsidePt), outsideVolTypes);
860  outsideVolType_ = outsideVolTypes[0];
861 
862  if (debug)
863  {
864  Pout<< "triSurfaceMesh::outsideVolumeType :"
865  << " finished outsidePoint:" << outsidePt
866  << " orientation:" << volumeType::names[outsideVolType_]
867  << endl;
868  }
869  }
870 
871  return outsideVolType_;
872 }
873 
874 
876 (
877  const pointField& samples,
878  const scalarField& nearestDistSqr,
879  List<pointIndexHit>& info
880 ) const
881 {
882  if (debug)
883  {
884  Pout<< "triSurfaceMesh::findNearest :"
885  << " trying to find nearest for " << samples.size()
886  << " samples with max sphere "
887  << (samples.size() ? Foam::sqrt(max(nearestDistSqr)) : Zero)
888  << endl;
889  }
890  triSurfaceSearch::findNearest(samples, nearestDistSqr, info);
891  if (debug)
892  {
893  Pout<< "triSurfaceMesh::findNearest :"
894  << " finished trying to find nearest for " << samples.size()
895  << " samples" << endl;
896  }
897 }
898 
899 
901 (
902  const pointField& samples,
903  const scalarField& nearestDistSqr,
904  const labelList& regionIndices,
905  List<pointIndexHit>& info
906 ) const
907 {
908  if (debug)
909  {
910  Pout<< "triSurfaceMesh::findNearest :"
911  << " trying to find nearest and region for " << samples.size()
912  << " samples with max sphere "
913  << (samples.size() ? Foam::sqrt(max(nearestDistSqr)) : Zero)
914  << endl;
915  }
917  (
918  samples,
919  nearestDistSqr,
920  regionIndices,
921  info
922  );
923  if (debug)
924  {
925  Pout<< "triSurfaceMesh::findNearest :"
926  << " finished trying to find nearest and region for "
927  << samples.size() << " samples" << endl;
928  }
929 }
930 
931 
933 (
934  const pointField& start,
935  const pointField& end,
936  List<pointIndexHit>& info
937 ) const
938 {
939  if (debug)
940  {
941  Pout<< "triSurfaceMesh::findLine :"
942  << " intersecting with "
943  << start.size() << " rays" << endl;
944  }
946  if (debug)
947  {
948  Pout<< "triSurfaceMesh::findLine :"
949  << " finished intersecting with "
950  << start.size() << " rays" << endl;
951  }
952 }
953 
954 
956 (
957  const pointField& start,
958  const pointField& end,
959  List<pointIndexHit>& info
960 ) const
961 {
962  if (debug)
963  {
964  Pout<< "triSurfaceMesh::findLineAny :"
965  << " intersecting with "
966  << start.size() << " rays" << endl;
967  }
969  if (debug)
970  {
971  Pout<< "triSurfaceMesh::findLineAny :"
972  << " finished intersecting with "
973  << start.size() << " rays" << endl;
974  }
975 }
976 
977 
979 (
980  const pointField& start,
981  const pointField& end,
983 ) const
984 {
985  if (debug)
986  {
987  Pout<< "triSurfaceMesh::findLineAll :"
988  << " intersecting with "
989  << start.size() << " rays" << endl;
990  }
992  if (debug)
993  {
994  Pout<< "triSurfaceMesh::findLineAll :"
995  << " finished intersecting with "
996  << start.size() << " rays" << endl;
997  }
998 }
999 
1000 
1003  const List<pointIndexHit>& info,
1004  labelList& region
1005 ) const
1006 {
1007  if (debug)
1008  {
1009  Pout<< "triSurfaceMesh::getRegion :"
1010  << " getting region for "
1011  << info.size() << " triangles" << endl;
1012  }
1013  region.setSize(info.size());
1014  forAll(info, i)
1015  {
1016  if (info[i].hit())
1017  {
1018  region[i] = triSurface::operator[](info[i].index()).region();
1019  }
1020  else
1021  {
1022  region[i] = -1;
1023  }
1024  }
1025  if (debug)
1026  {
1027  Pout<< "triSurfaceMesh::getRegion :"
1028  << " finished getting region for "
1029  << info.size() << " triangles" << endl;
1030  }
1031 }
1032 
1033 
1036  const List<pointIndexHit>& info,
1037  vectorField& normal
1038 ) const
1039 {
1040  if (debug)
1041  {
1042  Pout<< "triSurfaceMesh::getNormal :"
1043  << " getting normal for "
1044  << info.size() << " triangles" << endl;
1045  }
1046 
1047  const triSurface& s = *this;
1048  const pointField& pts = s.points();
1049 
1050  normal.setSize(info.size());
1051 
1052  if (minQuality_ >= 0)
1053  {
1054  // Make sure we don't use triangles with low quality since
1055  // normal is not reliable.
1056 
1057  const labelListList& faceFaces = s.faceFaces();
1058 
1059  forAll(info, i)
1060  {
1061  if (info[i].hit())
1062  {
1063  const label facei = info[i].index();
1064  normal[i] = s[facei].unitNormal(pts);
1065 
1066  scalar qual = s[facei].tri(pts).quality();
1067 
1068  if (qual < minQuality_)
1069  {
1070  // Search neighbouring triangles
1071  const labelList& fFaces = faceFaces[facei];
1072 
1073  for (const label nbri : fFaces)
1074  {
1075  scalar nbrQual = s[nbri].tri(pts).quality();
1076  if (nbrQual > qual)
1077  {
1078  qual = nbrQual;
1079  normal[i] = s[nbri].unitNormal(pts);
1080  }
1081  }
1082  }
1083  }
1084  else
1085  {
1086  // Set to what?
1087  normal[i] = Zero;
1088  }
1089  }
1090  }
1091  else
1092  {
1093  forAll(info, i)
1094  {
1095  if (info[i].hit())
1096  {
1097  const label facei = info[i].index();
1098 
1099  // Uncached
1100  normal[i] = s[facei].unitNormal(pts);
1101  }
1102  else
1103  {
1104  // Set to what?
1105  normal[i] = Zero;
1106  }
1107  }
1108  }
1109  if (debug)
1110  {
1111  Pout<< "triSurfaceMesh::getNormal :"
1112  << " finished getting normal for "
1113  << info.size() << " triangles" << endl;
1114  }
1115 }
1116 
1117 
1119 {
1120  auto* fldPtr = getObjectPtr<triSurfaceLabelField>("values");
1121 
1122  if (fldPtr)
1123  {
1124  (*fldPtr).field() = values;
1125  }
1126  else
1127  {
1128  fldPtr = new triSurfaceLabelField
1129  (
1130  IOobject
1131  (
1132  "values",
1133  objectRegistry::time().timeName(), // instance
1134  meshSubDir, // local
1135  *this,
1138  ),
1139  *this,
1140  dimless,
1142  );
1143 
1144  // Store field on triMesh
1145  fldPtr->store();
1146  }
1147  if (debug)
1148  {
1149  Pout<< "triSurfaceMesh::setField :"
1150  << " finished setting field for "
1151  << values.size() << " triangles" << endl;
1152  }
1153 }
1154 
1155 
1158  const List<pointIndexHit>& info,
1159  labelList& values
1160 ) const
1161 {
1162  const auto* fldPtr = getObjectPtr<triSurfaceLabelField>("values");
1163 
1164  if (fldPtr)
1165  {
1166  const auto& fld = *fldPtr;
1167 
1168  values.setSize(info.size());
1169 
1170  forAll(info, i)
1171  {
1172  if (info[i].hit())
1173  {
1174  values[i] = fld[info[i].index()];
1175  }
1176  }
1177  }
1178  if (debug)
1179  {
1180  Pout<< "triSurfaceMesh::setField :"
1181  << " finished getting field for "
1182  << info.size() << " triangles" << endl;
1183  }
1184 }
1185 
1186 
1189  const pointField& points,
1190  List<volumeType>& volType
1191 ) const
1192 {
1193  const scalar oldTol = indexedOctree<treeDataTriSurface>::perturbTol();
1195 
1196  if (debug)
1197  {
1198  Pout<< "triSurfaceMesh::getVolumeType :"
1199  << " finding orientation for " << points.size()
1200  << " samples" << endl;
1201  }
1202 
1203  volType.setSize(points.size());
1204 
1205  forAll(points, pointi)
1206  {
1207  const point& pt = points[pointi];
1208 
1209  if (tree().bb().contains(pt))
1210  {
1211  // Use cached volume type per each tree node
1212  volType[pointi] = tree().getVolumeType(pt);
1213  }
1214  else if (hasVolumeType())
1215  {
1216  // Precalculate and cache value for this outside point
1217  if (outsideVolType_ == volumeType::UNKNOWN)
1218  {
1219  outsideVolType_ = tree().shapes().getVolumeType(tree(), pt);
1220  }
1221  volType[pointi] = outsideVolType_;
1222  }
1223  else
1224  {
1225  // Have to calculate directly as outside the octree
1226  volType[pointi] = tree().shapes().getVolumeType(tree(), pt);
1227  }
1228  }
1229 
1231  if (debug)
1232  {
1233  Pout<< "triSurfaceMesh::getVolumeType :"
1234  << " finished finding orientation for " << points.size()
1235  << " samples" << endl;
1236  }
1237 }
1238 
1239 
1245  const bool valid
1246 ) const
1247 {
1249  const fileName& instance = searchableSurface::instance();
1250 
1251  if
1252  (
1253  instance != runTime.timeName()
1254  && instance != runTime.system()
1255  && instance != runTime.caseSystem()
1256  && instance != runTime.constant()
1257  && instance != runTime.caseConstant()
1258  )
1259  {
1260  const_cast<triSurfaceMesh&>(*this).searchableSurface::instance() =
1261  runTime.timeName();
1262  const_cast<triSurfaceMesh&>(*this).objectRegistry::instance() =
1263  runTime.timeName();
1264  }
1265 
1266  fileName fullPath;
1267  if (fName_.size())
1268  {
1269  // Override file name
1270 
1271  fullPath = fName_;
1272 
1273  fullPath.expand();
1274  if (!fullPath.isAbsolute())
1275  {
1276  // Add directory from regIOobject
1277  fullPath = searchableSurface::objectPath().path()/fullPath;
1278  }
1279  }
1280  else
1281  {
1282  fullPath = searchableSurface::objectPath();
1283  }
1284 
1285  if (!mkDir(fullPath.path()))
1286  {
1287  return false;
1288  }
1289 
1290  triSurface::write(fullPath);
1291 
1292  if (!isFile(fullPath))
1293  {
1294  return false;
1295  }
1296 
1297  return true;
1298 }
1299 
1300 
1301 // ************************************************************************* //
Foam::expressions::patchExpr::debug
int debug
Static debugging option.
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Foam::pointField
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::Random
Random number generator.
Definition: Random.H:59
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
Foam::treeBoundBox::extend
treeBoundBox extend(Random &rndGen, const scalar s) const
Return slightly wider bounding box.
Definition: treeBoundBoxI.H:325
Foam::PrimitivePatch< labelledTri, ::Foam::List, pointField, point >::pointFaces
const labelListList & pointFaces() const
Return point-face addressing.
Definition: PrimitivePatch.C:378
Foam::IOobject::AUTO_WRITE
Definition: IOobject.H:129
Foam::dimless
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Dimensionless.
Definition: dimensionSets.H:50
Foam::exists
bool exists(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist (as DIRECTORY or FILE) in the file system?
Definition: MSwindows.C:625
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::triSurfaceMesh::relativeFilePath
static fileName relativeFilePath(const IOobject &, const fileName &, const bool isGlobal)
Return fileName. If fileName is relative gets treated local to.
Definition: triSurfaceMesh.C:74
Foam::IOobject::name
const word & name() const
Return name.
Definition: IOobjectI.H:46
Foam::PrimitivePatch< labelledTri, ::Foam::List, pointField, point >::points
const Field< point > & points() const
Return reference to global points.
Definition: PrimitivePatch.H:300
Foam::triSurface::clearOut
void clearOut()
Definition: triSurface.C:542
Foam::IOobject::localFilePath
fileName localFilePath(const word &typeName, const bool search=true) const
Helper for filePath that searches locally.
Definition: IOobject.C:482
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
s
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.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))
Definition: gmvOutputSpray.H:25
Foam::triSurfaceMesh::localOrGlobal
Definition: triSurfaceMesh.H:214
Foam::fileName::path
static std::string path(const std::string &str)
Return directory path name (part before last /)
Definition: fileNameI.H:186
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
Foam::PatchTools::calcBounds
static void calcBounds(const PrimitivePatch< Face, FaceList, PointField, PointType > &p, boundBox &bb, label &nPoints)
Definition: PatchToolsSearch.C:207
Foam::Zero
static constexpr const zero Zero
Global zero.
Definition: zero.H:128
PatchTools.H
Foam::triSurfaceMesh::getNormal
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
Definition: triSurfaceMesh.C:1035
Foam::triSurfaceRegionSearch::findNearest
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.
Definition: triSurfaceRegionSearch.C:191
Foam::HashTableOps::values
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
Definition: HashOps.H:149
Foam::triSurfaceMesh::getRegion
virtual void getRegion(const List< pointIndexHit > &, labelList &region) const
From a set of points and indices get the region.
Definition: triSurfaceMesh.C:1002
Foam::triSurfaceSearch::findLineAll
void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit >> &info) const
Calculate all intersections from start to end.
Definition: triSurfaceSearch.C:379
Foam::SubList
A List obtained as a section of another List.
Definition: SubList.H:53
Foam::IOobject::instance
const fileName & instance() const
Definition: IOobjectI.H:167
Foam::treeBoundBox
Standard boundBox with extra functionality for use in octree.
Definition: treeBoundBox.H:87
Foam::triSurfaceMesh::edgeTree
const indexedOctree< treeDataEdge > & edgeTree() const
Demand driven construction of octree for boundary edges.
Definition: triSurfaceMesh.C:726
Foam::objectRegistry::time
const Time & time() const
Return time.
Definition: objectRegistry.H:186
Foam::UPstream::parRun
static bool & parRun()
Is this a parallel run?
Definition: UPstream.H:414
Foam::Time::timeName
static word timeName(const scalar t, const int precision=precision_)
Definition: Time.C:764
Foam::edge
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:63
Foam::triSurfaceRegionSearch::clearOut
void clearOut()
Clear storage.
Definition: triSurfaceRegionSearch.C:64
Foam::fileOperation::filePath
virtual fileName filePath(const bool checkGlobal, const IOobject &, const word &typeName, const bool search=true) const =0
Search for an object. checkGlobal : also check undecomposed case.
Foam::TimePaths::caseSystem
fileName caseSystem() const
Definition: TimePathsI.H:111
Foam::triSurfaceSearch::findNearest
void findNearest(const pointField &samples, const scalarField &nearestDistSqr, List< pointIndexHit > &info) const
Definition: triSurfaceSearch.C:290
Foam::Pstream::scatter
static void scatter(const List< commsStruct > &comms, T &Value, const int tag, const label comm)
Scatter data. Distribute without modification. Reverse of gather.
Definition: gatherScatter.C:150
triSurfaceFields.H
Fields for triSurface.
Foam::isFile
bool isFile(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist as a FILE in the file system?
Definition: MSwindows.C:658
Foam::fileHandler
const fileOperation & fileHandler()
Get current file handler.
Definition: fileOperation.C:1181
Foam::triSurfaceMesh
IOoject and searching on triSurface.
Definition: triSurfaceMesh.H:100
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:337
Foam::boundBox::max
const point & max() const
Maximum describing the bounding box.
Definition: boundBoxI.H:97
Foam::regIOobject::eventNo
label eventNo() const
Event number at last update.
Definition: regIOobjectI.H:83
Foam::triSurfaceRegionSearch
Helper class to search on triSurface. Creates an octree for each region of the surface and only searc...
Definition: triSurfaceRegionSearch.H:57
Foam::Pout
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
Foam::triSurfaceMesh::readAction
readAction
Definition: triSurfaceMesh.H:211
Foam::triSurface::patches
const geometricSurfacePatchList & patches() const
Definition: triSurface.H:322
Foam::IOobject::time
const Time & time() const
Return time.
Definition: IOobject.C:438
Foam::triSurfaceMesh::outsideVolumeType
virtual volumeType outsideVolumeType() const
If surface is closed, what is type of points outside bounds.
Definition: triSurfaceMesh.C:841
Foam::triSurfaceMesh::findLineAny
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
Definition: triSurfaceMesh.C:956
Foam::triSurfaceMesh::triSurfaceMesh
triSurfaceMesh(const triSurfaceMesh &)=delete
No copy construct.
Foam::boundBox::min
const point & min() const
Minimum describing the bounding box.
Definition: boundBoxI.H:91
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:290
Foam::indexedOctree::perturbTol
static scalar & perturbTol()
Get the perturbation tolerance.
Definition: indexedOctree.C:2383
Foam::magSqr
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
Foam::invertManyToMany
void invertManyToMany(const label len, const UList< InputIntListType > &input, List< OutputIntListType > &output)
Invert many-to-many.
Definition: ListOpsTemplates.C:727
Foam::IOobject::db
const objectRegistry & db() const
Return the local objectRegistry.
Definition: IOobject.C:432
Foam::triSurfaceMesh::movePoints
virtual void movePoints(const pointField &)
Move points.
Definition: triSurfaceMesh.C:693
Foam::triSurfaceMesh::checkFile
static fileName checkFile(const IOobject &io, const bool isGlobal)
Return fileName to load IOobject from.
Definition: triSurfaceMesh.C:51
nPoints
label nPoints
Definition: gmvOutputHeader.H:2
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
Foam::IOobject::local
const fileName & local() const
Definition: IOobjectI.H:179
Foam::triSurface::scalePoints
virtual void scalePoints(const scalar scaleFactor)
Scale points. A non-positive factor is ignored.
Definition: triSurface.C:614
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:62
Foam::volumeType
An enumeration wrapper for classification of a location as being inside/outside of a volume.
Definition: volumeType.H:60
pFaces
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=cellModel::ref(cellModel::HEX);labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){ pointMap[i]=i;}for(label i=0;i< nPoints;i++){ if(f[i] > 0.0) { hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells]=cellShape(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei) { if(edges[ei].mag(points)< SMALL) { label start=pointMap[edges[ei].start()];while(start !=pointMap[start]) { start=pointMap[start];} label end=pointMap[edges[ei].end()];while(end !=pointMap[end]) { end=pointMap[end];} label minLabel=min(start, end);pointMap[start]=pointMap[end]=minLabel;} } cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){ cellShape &cs=cellShapes[celli];forAll(cs, i) { cs[i]=pointMap[cs[i]];} cs.collapse();}label bcIDs[11]={-1, 0, 2, 4, -1, 5, -1, 6, 7, 8, 9};const label nBCs=12;const word *kivaPatchTypes[nBCs]={ &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &symmetryPolyPatch::typeName, &wedgePolyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &symmetryPolyPatch::typeName, &oldCyclicPolyPatch::typeName};enum patchTypeNames{ PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={ "piston", "valve", "liner", "cylinderHead", "axis", "wedge", "inflow", "outflow", "presin", "presout", "symmetryPlane", "cyclic"};List< SLList< face > > pFaces[nBCs]
Definition: readKivaGrid.H:235
Foam::triSurface::movePoints
virtual void movePoints(const pointField &pts)
Move points.
Definition: triSurface.C:588
Foam::IOstreamOption::versionNumber
Representation of a major/minor version number.
Definition: IOstreamOption.H:79
Foam::Field< vector >
Foam::labelField
Field< label > labelField
Specialisation of Field<T> for label.
Definition: labelField.H:52
Foam::IOobject::writeOpt
writeOption writeOpt() const
The write option.
Definition: IOobjectI.H:153
Foam::triSurface
Triangulated surface description with patch information.
Definition: triSurface.H:70
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::volumeType::UNKNOWN
Unknown state.
Definition: volumeType.H:67
Foam::volumeType::names
static const Enum< volumeType::type > names
Names for the classification enumeration.
Definition: volumeType.H:76
Foam::searchableSurface
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
Definition: searchableSurface.H:69
coordinates
PtrList< coordinateSystem > coordinates(solidRegions.size())
Foam::triSurfaceMesh::findLine
virtual void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Find first intersection on segment from start to end.
Definition: triSurfaceMesh.C:933
Foam::indexedOctree
Non-pointer based hierarchical recursive searching.
Definition: treeDataEdge.H:50
Foam::triSurface::transfer
void transfer(triSurface &surf)
Alter contents by transferring (triangles, points) components.
Definition: triSurface.C:878
Foam::treeDataEdge
Holds data for octree to work on an edges subset.
Definition: treeDataEdge.H:56
samples
scalarField samples(nIntervals, Zero)
Foam::triSurfaceMesh::getField
virtual void getField(const List< pointIndexHit > &, labelList &) const
WIP. From a set of hits (points and.
Definition: triSurfaceMesh.C:1157
Foam::triSurfaceMesh::regions
virtual const wordList & regions() const
Names of regions.
Definition: triSurfaceMesh.C:809
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
fld
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputLagrangian.H:23
Foam::triSurfaceMesh::boundingSpheres
virtual void boundingSpheres(pointField &centres, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared). Any point.
Definition: triSurfaceMesh.C:650
timeName
word timeName
Definition: getTimeIndex.H:3
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::triSurfaceMesh::clearOut
void clearOut()
Clear storage.
Definition: triSurfaceMesh.C:622
Foam::IOstreamOption::streamFormat
streamFormat
Data format (ascii | binary)
Definition: IOstreamOption.H:64
Foam::FatalError
error FatalError
Foam::IOobject::globalFilePath
fileName globalFilePath(const word &typeName, const bool search=true) const
Helper for filePath that searches up if in parallel.
Definition: IOobject.C:493
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
stdFoam::end
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
Definition: stdFoam.H:115
Foam::triSurfaceMesh::points
virtual tmp< pointField > points() const
Get the points that define the surface.
Definition: triSurfaceMesh.C:677
Foam::triSurfaceMesh::coordinates
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
Definition: triSurfaceMesh.C:633
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::triSurfaceMesh::setField
virtual void setField(const labelList &values)
WIP. Store element-wise field.
Definition: triSurfaceMesh.C:1118
Random.H
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::UPstream::master
static bool master(const label communicator=0)
Am I the master process.
Definition: UPstream.H:438
Time.H
Foam::EdgeMap< label >
Foam::TimePaths::system
const word & system() const
Return system name.
Definition: TimePathsI.H:94
Foam::triSurfaceSearch::findLine
void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &info) const
Definition: triSurfaceSearch.C:333
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:355
edgeHashes.H
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:51
Foam::triSurfaceMesh::~triSurfaceMesh
virtual ~triSurfaceMesh()
Destructor.
Definition: triSurfaceMesh.C:616
forAllConstIters
forAllConstIters(mixture.phases(), phase)
Definition: pEqn.H:28
f
labelList f(nPoints)
Foam::BitOps::count
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
Definition: BitOps.H:74
Foam::triSurfaceMesh::findNearest
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const
Definition: triSurfaceMesh.C:876
Foam::Vector< scalar >
Foam::List< labelList >
Foam::sqrt
dimensionedScalar sqrt(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:144
Foam::TimePaths::caseConstant
fileName caseConstant() const
Definition: TimePathsI.H:100
Foam::IOobject::readOpt
readOption readOpt() const
The read option.
Definition: IOobjectI.H:141
Foam::triSurfaceMesh::addFaceToEdge
static bool addFaceToEdge(const edge &, EdgeMap< label > &)
Helper function for isSurfaceClosed.
Definition: triSurfaceMesh.C:142
Foam::start
label ListType::const_reference const label start
Definition: ListOps.H:408
Foam::string::expand
string & expand(const bool allowEmpty=false)
Definition: string.C:159
Foam::triSurfaceMesh::meshSubDir
static word meshSubDir
Return the mesh sub-directory name (usually "triSurface")
Definition: triSurfaceMesh.H:188
Foam::PrimitivePatch::faceCentres
const Field< PointType > & faceCentres() const
Return face centres for patch.
Definition: PrimitivePatch.C:517
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::constant::electromagnetic::e
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11
Foam::triSurfaceMesh::overlaps
virtual bool overlaps(const boundBox &bb) const
Does any part of the surface overlap the supplied bound box?
Definition: triSurfaceMesh.C:683
Foam::identity
labelList identity(const label len, label start=0)
Create identity map of the given length with (map[i] == i)
Definition: labelList.C:38
Foam::List::clear
void clear()
Clear the list, i.e. set size to zero.
Definition: ListI.H:115
Foam::tmp::New
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.
patches
const polyBoundaryMesh & patches
Definition: convertProcessorPatches.H:65
Foam::triSurfaceLabelField
Foam::DimensionedField< label, triSurfaceGeoMesh > triSurfaceLabelField
Definition: triSurfaceFieldsFwd.H:44
Foam::labelledTri
Triangle with additional region number.
Definition: labelledTri.H:58
Foam::triSurfaceMesh::isSurfaceClosed
bool isSurfaceClosed() const
Check whether surface is closed without calculating any permanent.
Definition: triSurfaceMesh.C:158
Foam::boundBox
A bounding box defined in terms of min/max extrema points.
Definition: boundBox.H:63
rndGen
Random rndGen
Definition: createFields.H:23
Foam::IOstreamOption::compressionType
compressionType
Compression treatment (UNCOMPRESSED | COMPRESSED)
Definition: IOstreamOption.H:71
Foam::triSurfaceSearch::findLineAny
void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &info) const
Definition: triSurfaceSearch.C:356
Foam::searchableSurface::bounds
virtual const boundBox & bounds() const
Return const reference to boundBox.
Definition: searchableSurface.H:179
Foam::keyType::LITERAL
String literal.
Definition: keyType.H:73
Foam::triSurfaceMesh::getVolumeType
virtual void getVolumeType(const pointField &points, List< volumeType > &volType) const
Determine type (inside/outside/mixed) for point.
Definition: triSurfaceMesh.C:1188
Foam::point
vector point
Point is a vector.
Definition: point.H:43
Foam::IOobject::objectPath
fileName objectPath() const
The complete path + object name.
Definition: IOobjectI.H:185
Foam::triSurfaceMesh::masterOnly
Definition: triSurfaceMesh.H:215
Foam::List::setSize
void setSize(const label newSize)
Alias for resize(const label)
Definition: ListI.H:146
Foam::TimePaths::constant
const word & constant() const
Return constant name.
Definition: TimePathsI.H:88
Foam::IOobject::NO_READ
Definition: IOobject.H:123
Foam::mkDir
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
Definition: MSwindows.C:507
Foam::triSurfaceMesh::writeObject
virtual bool writeObject(IOstream::streamFormat fmt, IOstream::versionNumber ver, IOstream::compressionType cmp, const bool valid) const
Write using given format, version and compression.
Definition: triSurfaceMesh.C:1241
triSurfaceMesh.H
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::triSurfaceMesh::hasVolumeType
virtual bool hasVolumeType() const
Whether supports volume type (below) - i.e. whether is closed.
Definition: triSurfaceMesh.C:823
Foam::fileName::isAbsolute
static bool isAbsolute(const std::string &str)
Return true if string starts with a '/'.
Definition: fileNameI.H:136
Foam::triSurfaceMesh::findLineAll
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit >> &) const
Get all intersections in order from start to end.
Definition: triSurfaceMesh.C:979
Foam::dictionary::readIfPresent
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:417
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:90