sampledTriSurfaceMesh.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-2016 OpenFOAM Foundation
9  Copyright (C) 2016-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 "sampledTriSurfaceMesh.H"
30 #include "meshSearch.H"
31 #include "Tuple2.H"
32 #include "globalIndex.H"
33 #include "treeDataCell.H"
34 #include "treeDataFace.H"
35 #include "meshTools.H"
36 
38 
39 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
40 
41 const Foam::Enum
42 <
44 >
45 Foam::sampledTriSurfaceMesh::samplingSourceNames_
46 ({
47  { samplingSource::cells, "cells" },
48  { samplingSource::insideCells, "insideCells" },
49  { samplingSource::boundaryFaces, "boundaryFaces" },
50 });
51 
52 
53 namespace Foam
54 {
55  defineTypeNameAndDebug(sampledTriSurfaceMesh, 0);
57  (
58  sampledSurface,
59  sampledTriSurfaceMesh,
60  word
61  );
62 
63  //- Private class for finding nearest
64  // Comprising:
65  // - global index
66  // - sqr(distance)
68 
69  class nearestEqOp
70  {
71  public:
72 
73  void operator()(nearInfo& x, const nearInfo& y) const
74  {
75  if (y.first() < x.first())
76  {
77  x = y;
78  }
79  }
80  };
81 }
82 
83 
84 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
85 
87 (
88  const surfZoneList& zoneLst,
89  labelList& zoneIds
90 )
91 {
92  label sz = 0;
93  for (const surfZone& zn : zoneLst)
94  {
95  sz += zn.size();
96  }
97 
98  zoneIds.setSize(sz);
99  forAll(zoneLst, zonei)
100  {
101  const surfZone& zn = zoneLst[zonei];
102 
103  // Assign sub-zone Ids
104  SubList<label>(zoneIds, zn.size(), zn.start()) = zonei;
105  }
106 }
107 
108 
109 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
110 
112 Foam::sampledTriSurfaceMesh::nonCoupledboundaryTree() const
113 {
114  // Variant of meshSearch::boundaryTree() that only does non-coupled
115  // boundary faces.
116 
117  if (!boundaryTreePtr_.valid())
118  {
119  // all non-coupled boundary faces (not just walls)
121 
122  labelList bndFaces(patches.nFaces());
123  label bndI = 0;
124  for (const polyPatch& pp : patches)
125  {
126  if (!pp.coupled())
127  {
128  forAll(pp, i)
129  {
130  bndFaces[bndI++] = pp.start()+i;
131  }
132  }
133  }
134  bndFaces.setSize(bndI);
135 
136 
137  treeBoundBox overallBb(mesh().points());
138  Random rndGen(123456);
139  // Extend slightly and make 3D
140  overallBb = overallBb.extend(rndGen, 1e-4);
141  overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
142  overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
143 
144  boundaryTreePtr_.reset
145  (
146  new indexedOctree<treeDataFace>
147  (
148  treeDataFace // all information needed to search faces
149  (
150  false, // do not cache bb
151  mesh(),
152  bndFaces // boundary faces only
153  ),
154  overallBb, // overall search domain
155  8, // maxLevel
156  10, // leafsize
157  3.0 // duplicity
158  )
159  );
160  }
161 
162  return *boundaryTreePtr_;
163 }
164 
165 
166 bool Foam::sampledTriSurfaceMesh::update(const meshSearch& meshSearcher)
167 {
168  // Find the cells the triangles of the surface are in.
169  // Does approximation by looking at the face centres only
170  const pointField& fc = surface_.faceCentres();
171 
172  List<nearInfo> nearest(fc.size());
173 
174  // Global numbering for cells/faces - only used to uniquely identify local
175  // elements
176  globalIndex globalCells(onBoundary() ? mesh().nFaces() : mesh().nCells());
177 
178  for (nearInfo& near : nearest)
179  {
180  near.first() = GREAT;
181  near.second() = labelMax;
182  }
183 
184  if (sampleSource_ == cells)
185  {
186  // Search for nearest cell
187 
188  const indexedOctree<treeDataCell>& cellTree = meshSearcher.cellTree();
189 
190  forAll(fc, triI)
191  {
192  pointIndexHit nearInfo = cellTree.findNearest
193  (
194  fc[triI],
195  sqr(GREAT)
196  );
197  if (nearInfo.hit())
198  {
199  nearest[triI].first() = magSqr(nearInfo.hitPoint()-fc[triI]);
200  nearest[triI].second() = globalCells.toGlobal(nearInfo.index());
201  }
202  }
203  }
204  else if (sampleSource_ == insideCells)
205  {
206  // Search for cell containing point
207 
208  const indexedOctree<treeDataCell>& cellTree = meshSearcher.cellTree();
209 
210  forAll(fc, triI)
211  {
212  if (cellTree.bb().contains(fc[triI]))
213  {
214  const label index = cellTree.findInside(fc[triI]);
215  if (index != -1)
216  {
217  nearest[triI].first() = 0.0;
218  nearest[triI].second() = globalCells.toGlobal(index);
219  }
220  }
221  }
222  }
223  else
224  {
225  // Search for nearest boundaryFace
226 
228  //const indexedOctree<treeDataFace>& bTree = meshSearcher.boundaryTree()
229  //- Search on all non-coupled boundary faces
230  const indexedOctree<treeDataFace>& bTree = nonCoupledboundaryTree();
231 
232  forAll(fc, triI)
233  {
234  pointIndexHit nearInfo = bTree.findNearest
235  (
236  fc[triI],
237  sqr(GREAT)
238  );
239  if (nearInfo.hit())
240  {
241  nearest[triI].first() = magSqr(nearInfo.hitPoint()-fc[triI]);
242  nearest[triI].second() = globalCells.toGlobal
243  (
244  bTree.shapes().faceLabels()[nearInfo.index()]
245  );
246  }
247  }
248  }
249 
250 
251  // See which processor has the nearest. Mark and subset
252  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
253 
254  Pstream::listCombineGather(nearest, nearestEqOp());
256 
257  labelList cellOrFaceLabels(fc.size(), -1);
258 
259  label nFound = 0;
260  forAll(nearest, triI)
261  {
262  if (nearest[triI].second() == labelMax)
263  {
264  // Not found on any processor. How to map?
265  }
266  else if (globalCells.isLocal(nearest[triI].second()))
267  {
268  cellOrFaceLabels[triI] = globalCells.toLocal
269  (
270  nearest[triI].second()
271  );
272  nFound++;
273  }
274  }
275 
276 
277  if (debug)
278  {
279  Pout<< "Local out of faces:" << cellOrFaceLabels.size()
280  << " keeping:" << nFound << endl;
281  }
282 
283  // Now subset the surface. Do not use triSurface::subsetMesh since requires
284  // original surface to be in compact numbering.
285 
286  const triSurface& s = surface_;
287 
288  // Compact to original triangle
289  labelList faceMap(s.size());
290  // Compact to original points
291  labelList pointMap(s.points().size());
292  // From original point to compact points
293  labelList reversePointMap(s.points().size(), -1);
294 
295  // Handle region-wise sorting (makes things slightly more complicated)
296  zoneIds_.setSize(s.size(), -1);
297 
298  // Better not to use triSurface::sortedZones here,
299  // since we'll sort ourselves
300 
301  // Get zone/region sizes used, store under the original region Id
302  Map<label> zoneSizes;
303 
304  // Recover region names from the input surface
305  Map<word> zoneNames;
306  {
307  const geometricSurfacePatchList& patches = s.patches();
308 
309  forAll(patches, patchi)
310  {
311  zoneNames.set
312  (
313  patchi,
314  (
315  patches[patchi].name().empty()
316  ? word::printf("patch%d", patchi)
317  : patches[patchi].name()
318  )
319  );
320 
321  zoneSizes.set(patchi, 0);
322  }
323  }
324 
325 
326  {
327  label newPointi = 0;
328  label newFacei = 0;
329 
330  forAll(s, facei)
331  {
332  if (cellOrFaceLabels[facei] != -1)
333  {
334  const triSurface::FaceType& f = s[facei];
335  const label regionid = f.region();
336 
337  auto fnd = zoneSizes.find(regionid);
338  if (fnd.found())
339  {
340  ++(*fnd);
341  }
342  else
343  {
344  // This shouldn't happen
345  zoneSizes.insert(regionid, 1);
346  zoneNames.set(regionid, word::printf("patch%d", regionid));
347  }
348 
349  // Store new faces compact
350  faceMap[newFacei] = facei;
351  zoneIds_[newFacei] = regionid;
352  ++newFacei;
353 
354  // Renumber face points
355  for (const label labi : f)
356  {
357  if (reversePointMap[labi] == -1)
358  {
359  pointMap[newPointi] = labi;
360  reversePointMap[labi] = newPointi++;
361  }
362  }
363  }
364  }
365 
366  // Trim
367  faceMap.setSize(newFacei);
368  zoneIds_.setSize(newFacei);
369  pointMap.setSize(newPointi);
370  }
371 
372 
373  // Assign start/size (and name) to the newZones
374  // re-use the lookup to map (zoneId => zoneI)
375  surfZoneList zoneLst(zoneSizes.size());
376  label start = 0;
377  label zoneI = 0;
378  forAllIters(zoneSizes, iter)
379  {
380  // No negative regionids, so Map<label> usually sorts properly
381  const label regionid = iter.key();
382 
383  word name;
384  auto fnd = zoneNames.cfind(regionid);
385  if (fnd.found())
386  {
387  name = *fnd;
388  }
389  if (name.empty())
390  {
391  name = word::printf("patch%d", regionid);
392  }
393 
394  zoneLst[zoneI] = surfZone
395  (
396  name,
397  0, // initialize with zero size
398  start,
399  zoneI
400  );
401 
402  // Adjust start for the next zone and save (zoneId => zoneI) mapping
403  start += iter();
404  iter() = zoneI++;
405  }
406 
407 
408  // At this stage:
409  // - faceMap to map the (unsorted) compact to original triangle
410  // - zoneIds for the next sorting
411  // - zoneSizes contains region -> count information
412 
413  // Rebuild the faceMap for the sorted order
414  labelList sortedFaceMap(faceMap.size());
415 
416  forAll(zoneIds_, facei)
417  {
418  const label zonei = zoneIds_[facei];
419  label sortedFacei = zoneLst[zonei].start() + zoneLst[zonei].size()++;
420  sortedFaceMap[sortedFacei] = faceMap[facei];
421  }
422 
423  // zoneIds are now simply flat values
424  setZoneMap(zoneLst, zoneIds_);
425 
426  // Replace the faceMap with the properly sorted face map
427  faceMap.transfer(sortedFaceMap);
428 
429  if (keepIds_)
430  {
431  originalIds_ = faceMap;
432  }
433 
434  // Subset cellOrFaceLabels (for compact faces)
435  cellOrFaceLabels = labelUIndList(cellOrFaceLabels, faceMap)();
436 
437  // Store any face per point (without using pointFaces())
438  labelList pointToFace(pointMap.size());
439 
440  // Create faces and points for subsetted surface
441  faceList& surfFaces = this->storedFaces();
442  surfFaces.setSize(faceMap.size());
443 
444  this->storedZones().transfer(zoneLst);
445 
446  forAll(faceMap, facei)
447  {
448  const labelledTri& origF = s[faceMap[facei]];
449  face& f = surfFaces[facei];
450 
451  f = triFace
452  (
453  reversePointMap[origF[0]],
454  reversePointMap[origF[1]],
455  reversePointMap[origF[2]]
456  );
457 
458  for (const label labi : f)
459  {
460  pointToFace[labi] = facei;
461  }
462  }
463 
464  this->storedPoints() = pointField(s.points(), pointMap);
465 
466  if (debug)
467  {
468  print(Pout);
469  Pout<< endl;
470  }
471 
472 
473 
474  // Collect the samplePoints and sampleElements
475  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
476 
478  {
479  samplePoints_.setSize(pointMap.size());
480  sampleElements_.setSize(pointMap.size(), -1);
481 
482  if (sampleSource_ == cells)
483  {
484  // samplePoints_ : per surface point a location inside the cell
485  // sampleElements_ : per surface point the cell
486 
487  forAll(points(), pointi)
488  {
489  const point& pt = points()[pointi];
490  label celli = cellOrFaceLabels[pointToFace[pointi]];
491  sampleElements_[pointi] = celli;
492 
493  // Check if point inside cell
494  if
495  (
496  mesh().pointInCell
497  (
498  pt,
499  sampleElements_[pointi],
500  meshSearcher.decompMode()
501  )
502  )
503  {
504  samplePoints_[pointi] = pt;
505  }
506  else
507  {
508  // Find nearest point on faces of cell
509  const cell& cFaces = mesh().cells()[celli];
510 
511  scalar minDistSqr = VGREAT;
512 
513  forAll(cFaces, i)
514  {
515  const face& f = mesh().faces()[cFaces[i]];
516  pointHit info = f.nearestPoint(pt, mesh().points());
517  if (info.distance() < minDistSqr)
518  {
519  minDistSqr = info.distance();
520  samplePoints_[pointi] = info.rawPoint();
521  }
522  }
523  }
524  }
525  }
526  else if (sampleSource_ == insideCells)
527  {
528  // samplePoints_ : per surface point a location inside the cell
529  // sampleElements_ : per surface point the cell
530 
531  forAll(points(), pointi)
532  {
533  const point& pt = points()[pointi];
534  label celli = cellOrFaceLabels[pointToFace[pointi]];
535  sampleElements_[pointi] = celli;
536  samplePoints_[pointi] = pt;
537  }
538  }
539  else
540  {
541  // samplePoints_ : per surface point a location on the boundary
542  // sampleElements_ : per surface point the boundary face containing
543  // the location
544 
545  forAll(points(), pointi)
546  {
547  const point& pt = points()[pointi];
548  label facei = cellOrFaceLabels[pointToFace[pointi]];
549  sampleElements_[pointi] = facei;
550  samplePoints_[pointi] = mesh().faces()[facei].nearestPoint
551  (
552  pt,
553  mesh().points()
554  ).rawPoint();
555  }
556  }
557  }
558  else
559  {
560  // if sampleSource_ == cells:
561  // sampleElements_ : per surface triangle the cell
562  // samplePoints_ : n/a
563  // if sampleSource_ == insideCells:
564  // sampleElements_ : -1 or per surface triangle the cell
565  // samplePoints_ : n/a
566  // else:
567  // sampleElements_ : per surface triangle the boundary face
568  // samplePoints_ : n/a
569  sampleElements_.transfer(cellOrFaceLabels);
570  samplePoints_.clear();
571  }
572 
573 
574  if (debug)
575  {
576  this->clearOut();
577  OFstream str(mesh().time().path()/"surfaceToMesh.obj");
578  Info<< "Dumping correspondence from local surface (points or faces)"
579  << " to mesh (cells or faces) to " << str.name() << endl;
580 
581  const vectorField& centres =
582  (
583  onBoundary()
584  ? mesh().faceCentres()
585  : mesh().cellCentres()
586  );
587 
589  {
590  label vertI = 0;
591  forAll(samplePoints_, pointi)
592  {
593  meshTools::writeOBJ(str, points()[pointi]);
594  vertI++;
595 
596  meshTools::writeOBJ(str, samplePoints_[pointi]);
597  vertI++;
598 
599  label elemi = sampleElements_[pointi];
600  meshTools::writeOBJ(str, centres[elemi]);
601  vertI++;
602  str << "l " << vertI-2 << ' ' << vertI-1 << ' ' << vertI << nl;
603  }
604  }
605  else
606  {
607  label vertI = 0;
608  forAll(sampleElements_, triI)
609  {
610  meshTools::writeOBJ(str, faceCentres()[triI]);
611  vertI++;
612 
613  label elemi = sampleElements_[triI];
614  meshTools::writeOBJ(str, centres[elemi]);
615  vertI++;
616  str << "l " << vertI-1 << ' ' << vertI << nl;
617  }
618  }
619  }
620 
621  needsUpdate_ = false;
622  return true;
623 }
624 
625 
626 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
627 
629 (
630  const word& name,
631  const polyMesh& mesh,
632  const word& surfaceName,
633  const samplingSource sampleSource
634 )
635 :
637  MeshStorage(),
638  surface_
639  (
640  IOobject
641  (
642  surfaceName,
643  mesh.time().constant(), // instance
644  "triSurface", // local
645  mesh.time(), // registry
648  false
649  )
650  ),
651  sampleSource_(sampleSource),
652  needsUpdate_(true),
653  keepIds_(false),
654  originalIds_(),
655  zoneIds_(),
656  sampleElements_(),
657  samplePoints_()
658 {}
659 
660 
662 (
663  const word& name,
664  const polyMesh& mesh,
665  const dictionary& dict
666 )
667 :
669  MeshStorage(),
670  surface_
671  (
672  IOobject
673  (
674  dict.get<word>("surface"),
675  mesh.time().constant(), // instance
676  "triSurface", // local
677  mesh.time(), // registry
680  false
681  ),
682  dict
683  ),
684  sampleSource_(samplingSourceNames_.get("source", dict)),
685  needsUpdate_(true),
686  keepIds_(dict.lookupOrDefault("keepIds", false)),
687  originalIds_(),
688  zoneIds_(),
689  sampleElements_(),
690  samplePoints_()
691 {}
692 
693 
695 (
696  const word& name,
697  const polyMesh& mesh,
698  const triSurface& surface,
699  const word& sampleSourceName
700 )
701 :
703  MeshStorage(),
704  surface_
705  (
706  IOobject
707  (
708  name,
709  mesh.time().constant(), // instance
710  "triSurface", // local
711  mesh.time(), // registry
714  false
715  ),
716  surface
717  ),
718  sampleSource_(samplingSourceNames_[sampleSourceName]),
719  needsUpdate_(true),
720  keepIds_(false),
721  originalIds_(),
722  zoneIds_(),
723  sampleElements_(),
724  samplePoints_()
725 {}
726 
727 
728 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
729 
731 {}
732 
733 
734 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
735 
737 {
738  return needsUpdate_;
739 }
740 
741 
743 {
744  // already marked as expired
745  if (needsUpdate_)
746  {
747  return false;
748  }
749 
752  zoneIds_.clear();
753 
754  originalIds_.clear();
755  boundaryTreePtr_.clear();
756  sampleElements_.clear();
757  samplePoints_.clear();
758 
759  needsUpdate_ = true;
760  return true;
761 }
762 
763 
765 {
766  if (!needsUpdate_)
767  {
768  return false;
769  }
770 
771  // Calculate surface and mesh overlap bounding box
772  treeBoundBox bb
773  (
774  surface_.triSurface::points(),
775  surface_.triSurface::meshPoints()
776  );
777 
778  // Check for overlap with (global!) mesh bb
779  const bool intersect = bb.intersect(mesh().bounds());
780 
781  if (!intersect)
782  {
783  // Surface and mesh do not overlap at all. Guarantee a valid
784  // bounding box so we don't get any 'invalid bounding box' errors.
785 
787  << "Surface " << surface_.searchableSurface::name()
788  << " does not overlap bounding box of mesh " << mesh().bounds()
789  << endl;
790 
791  bb = treeBoundBox(mesh().bounds());
792  const vector span(bb.span());
793 
794  bb.min() += (0.5-1e-6)*span;
795  bb.max() -= (0.5-1e-6)*span;
796  }
797  else
798  {
799  // Extend a bit
800  const vector span(bb.span());
801  bb.min() -= 0.5*span;
802  bb.max() += 0.5*span;
803 
804  bb.inflate(1e-6);
805  }
806 
807  // Mesh search engine, no triangulation of faces.
808  meshSearch meshSearcher(mesh(), bb, polyMesh::FACE_PLANES);
809 
810  return update(meshSearcher);
811 }
812 
813 
815 {
816  if (!needsUpdate_)
817  {
818  return false;
819  }
820 
821  // Mesh search engine on subset, no triangulation of faces.
822  meshSearch meshSearcher(mesh(), bb, polyMesh::FACE_PLANES);
823 
824  return update(meshSearcher);
825 }
826 
827 
829 (
830  const interpolation<scalar>& sampler
831 ) const
832 {
833  return sampleOnFaces(sampler);
834 }
835 
836 
838 (
839  const interpolation<vector>& sampler
840 ) const
841 {
842  return sampleOnFaces(sampler);
843 }
844 
845 
847 (
848  const interpolation<sphericalTensor>& sampler
849 ) const
850 {
851  return sampleOnFaces(sampler);
852 }
853 
854 
856 (
857  const interpolation<symmTensor>& sampler
858 ) const
859 {
860  return sampleOnFaces(sampler);
861 }
862 
863 
865 (
866  const interpolation<tensor>& sampler
867 ) const
868 {
869  return sampleOnFaces(sampler);
870 }
871 
872 
874 (
875  const interpolation<scalar>& interpolator
876 ) const
877 {
878  return sampleOnPoints(interpolator);
879 }
880 
881 
883 (
884  const interpolation<vector>& interpolator
885 ) const
886 {
887  return sampleOnPoints(interpolator);
888 }
889 
891 (
892  const interpolation<sphericalTensor>& interpolator
893 ) const
894 {
895  return sampleOnPoints(interpolator);
896 }
897 
898 
900 (
901  const interpolation<symmTensor>& interpolator
902 ) const
903 {
904  return sampleOnPoints(interpolator);
905 }
906 
907 
909 (
910  const interpolation<tensor>& interpolator
911 ) const
912 {
913  return sampleOnPoints(interpolator);
914 }
915 
916 
918 {
919  os << "sampledTriSurfaceMesh: " << name() << " :"
920  << " surface:" << surface_.objectRegistry::name()
921  << " faces:" << faces().size()
922  << " points:" << points().size()
923  << " zoneids:" << zoneIds().size();
924 }
925 
926 
927 // ************************************************************************* //
Foam::sampledTriSurfaceMesh::points
virtual const pointField & points() const
Points of surface.
Definition: sampledTriSurfaceMesh.H:282
Foam::expressions::patchExpr::debug
int debug
Static debugging option.
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Foam::IOobject::NO_WRITE
Definition: IOobject.H:130
Foam::surfZone::start
label start() const
Return start label of this zone in the face list.
Definition: surfZone.H:138
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:74
Foam::pointField
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
meshTools.H
Foam::nearInfo
Tuple2< scalar, label > nearInfo
Private class for finding nearest.
Definition: sampledTriSurfaceMesh.C:67
Foam::Enum
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: IOstreamOption.H:51
Foam::faceMap
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Definition: blockMeshMergeFast.C:94
Foam::labelMax
constexpr label labelMax
Definition: label.H:65
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::meshSearch
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search.
Definition: meshSearch.H:60
Foam::nearestEqOp
Definition: distributedTriSurfaceMesh.C:124
Foam::sampledTriSurfaceMesh::needsUpdate
virtual bool needsUpdate() const
Does the surface need an update?
Definition: sampledTriSurfaceMesh.C:736
Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh
sampledTriSurfaceMesh(const word &name, const polyMesh &mesh, const word &surfaceName, const samplingSource sampleSource)
Construct from components.
Definition: sampledTriSurfaceMesh.C:629
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::polyBoundaryMesh
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
Definition: polyBoundaryMesh.H:62
update
mesh update()
Foam::sampledTriSurfaceMesh::update
virtual bool update()
Update the surface as required.
Definition: sampledTriSurfaceMesh.C:764
Tuple2.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
Foam::sampledTriSurfaceMesh::sample
virtual tmp< scalarField > sample(const interpolation< scalar > &sampler) const
Sample volume field onto surface faces.
Definition: sampledTriSurfaceMesh.C:829
Foam::sampledTriSurfaceMesh::samplingSource
samplingSource
Types of communications.
Definition: sampledTriSurfaceMesh.H:148
Foam::meshTools::writeOBJ
void writeOBJ(Ostream &os, const point &pt)
Write obj representation of a point.
Definition: meshTools.C:203
Foam::SubList
A List obtained as a section of another List.
Definition: SubList.H:53
globalIndex.H
Foam::treeBoundBox
Standard boundBox with extra functionality for use in octree.
Definition: treeBoundBox.H:87
Foam::primitiveMesh::cells
const cellList & cells() const
Definition: primitiveMeshCells.C:138
Foam::polyMesh::boundaryMesh
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Definition: polyMesh.H:435
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:337
Foam::dictionary::get
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:81
Foam::dictionary::lookupOrDefault
T lookupOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionary.H:1241
Foam::Pout
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:290
Foam::vectorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
Definition: primitiveFieldsFwd.H:54
Foam::magSqr
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
sampledTriSurfaceMesh.H
Foam::boundBox::intersect
bool intersect(const boundBox &bb)
Intersection (union) with the second box.
Definition: boundBox.C:191
Foam::geometricSurfacePatchList
List< geometricSurfacePatch > geometricSurfacePatchList
Definition: geometricSurfacePatchList.H:46
treeDataFace.H
Foam::VectorSpace::min
static const Form min
Definition: VectorSpace.H:118
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::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::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::List::transfer
void transfer(List< T > &list)
Definition: List.C:436
Foam::indexedOctree< Foam::treeDataFace >
Foam::sampledSurface
An abstract class for surfaces with sampling.
Definition: sampledSurface.H:120
Foam::PrimitivePatch< labelledTri, ::Foam::List, pointField, point >::FaceType
labelledTri FaceType
Definition: PrimitivePatch.H:100
forAllIters
#define forAllIters(container, iter)
Iterate across all elements in the container object.
Definition: stdFoam.H:217
Foam::interpolation< scalar >
newPointi
label newPointi
Definition: readKivaGrid.H:496
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::surfZone::size
label size() const
Return size of this zone in the face list.
Definition: surfZone.H:150
Foam::pointHit
PointHit< point > pointHit
Definition: pointHit.H:43
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
treeDataCell.H
Foam::Pstream::listCombineGather
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
Definition: combineGatherScatter.C:290
Foam::polyMesh::bounds
const boundBox & bounds() const
Return mesh bounding box.
Definition: polyMesh.H:441
Foam::primitiveMesh::cellCentres
const vectorField & cellCentres() const
Definition: primitiveMeshCellCentresAndVols.C:176
Foam::polyMesh::faces
virtual const faceList & faces() const
Return raw faces.
Definition: polyMesh.C:1063
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:51
Foam::pointIndexHit
PointIndexHit< point > pointIndexHit
Definition: pointIndexHit.H:45
Foam::sampledTriSurfaceMesh::setZoneMap
static void setZoneMap(const surfZoneList &zoneLst, labelList &zoneIds)
Set new zoneIds list based on the surfZoneList information.
Definition: sampledTriSurfaceMesh.C:87
meshSearch.H
clear
patchWriters clear()
Foam::nl
constexpr char nl
Definition: Ostream.H:372
Foam::VectorSpace::max
static const Form max
Definition: VectorSpace.H:117
f
labelList f(nPoints)
Foam::faceList
List< face > faceList
A List of faces.
Definition: faceListFwd.H:47
Foam::Vector< scalar >
Foam::List< surfZone >
Foam::surfZone
A surface zone on a MeshedSurface.
Definition: surfZone.H:65
Foam::start
label ListType::const_reference const label start
Definition: ListOps.H:408
Foam::primitiveMesh::faceCentres
const vectorField & faceCentres() const
Definition: primitiveMeshFaceCentresAndAreas.C:145
Foam::BitOps::print
Ostream & print(Ostream &os, UIntType value, char off='0', char on='1')
Print 0/1 bits in the (unsigned) integral type.
Definition: BitOps.H:172
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::constant::electromagnetic::e
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11
path
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
patches
const polyBoundaryMesh & patches
Definition: convertProcessorPatches.H:65
x
x
Definition: LISASMDCalcMethod2.H:52
Foam::sampledSurface::clearGeom
virtual void clearGeom() const
Additional cleanup when clearing the geometry.
Definition: sampledSurface.C:55
Foam::nearestEqOp::operator()
void operator()(nearInfo &x, const nearInfo &y) const
Definition: sampledTriSurfaceMesh.C:73
Foam::surfZoneList
List< surfZone > surfZoneList
Definition: surfZoneList.H:47
Foam::List::set
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
Definition: List.H:320
Foam::sampledTriSurfaceMesh::~sampledTriSurfaceMesh
virtual ~sampledTriSurfaceMesh()
Destructor.
Definition: sampledTriSurfaceMesh.C:730
rndGen
Random rndGen
Definition: createFields.H:23
Foam::word::printf
static word printf(const char *fmt, const PrimitiveType &val)
Use a printf-style formatter for a primitive.
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:246
Foam::polyMesh::FACE_PLANES
Definition: polyMesh.H:103
Foam::sampledSurface::mesh
const polyMesh & mesh() const
Access to the underlying mesh.
Definition: sampledSurface.H:302
cells
const cellShapeList & cells
Definition: gmvOutputHeader.H:3
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::Tuple2
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
Definition: Tuple2.H:57
Foam::Pstream::listCombineScatter
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
Definition: combineGatherScatter.C:432
Foam::point
vector point
Point is a vector.
Definition: point.H:43
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::MeshedSurface< face >
Foam::IOobject::NO_READ
Definition: IOobject.H:123
Foam::sampledTriSurfaceMesh::expire
virtual bool expire()
Mark the surface as needing an update.
Definition: sampledTriSurfaceMesh.C:742
Foam::sampledSurface::interpolate
bool interpolate() const
Interpolation to nodes requested for surface.
Definition: sampledSurface.H:326
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
triFace
face triFace(3)
WarningInFunction
#define WarningInFunction
Report a warning using Foam::Warning.
Definition: messageStream.H:294
Foam::sampledTriSurfaceMesh::print
virtual void print(Ostream &os) const
Write.
Definition: sampledTriSurfaceMesh.C:917
y
scalar y
Definition: LISASMDCalcMethod1.H:14
Foam::IOobject::MUST_READ
Definition: IOobject.H:120
Foam::labelUIndList
UIndirectList< label > labelUIndList
UIndirectList of labels.
Definition: UIndirectList.H:59