discreteSurface.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-2019 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 "discreteSurface.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::discreteSurface::samplingSourceNames_
46 ({
47  { samplingSource::cells, "cells" },
48  { samplingSource::insideCells, "insideCells" },
49  { samplingSource::boundaryFaces, "boundaryFaces" },
50 });
51 
52 
53 namespace Foam
54 {
55  defineTypeNameAndDebug(discreteSurface, 0);
56 
57  //- Private class for finding nearest
58  // Comprising:
59  // - global index
60  // - sqr(distance)
61  typedef Tuple2<scalar, label> nearInfo;
62 
63  class nearestEqOp
64  {
65  public:
66 
67  void operator()(nearInfo& x, const nearInfo& y) const
68  {
69  if (y.first() < x.first())
70  {
71  x = y;
72  }
73  }
74  };
75 }
76 
77 
78 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
79 
81 (
82  const surfZoneList& zoneLst,
83  labelList& zoneIds
84 )
85 {
86  label sz = 0;
87  for (const surfZone& zn : zoneLst)
88  {
89  sz += zn.size();
90  }
91 
92  zoneIds.setSize(sz);
93  forAll(zoneLst, zonei)
94  {
95  const surfZone& zn = zoneLst[zonei];
96 
97  // Assign sub-zone Ids
98  SubList<label>(zoneIds, zn.size(), zn.start()) = zonei;
99  }
100 }
101 
102 
103 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
104 
106 Foam::discreteSurface::nonCoupledboundaryTree() const
107 {
108  // Variant of meshSearch::boundaryTree() that only does non-coupled
109  // boundary faces.
110 
111  if (!boundaryTreePtr_.valid())
112  {
113  // all non-coupled boundary faces (not just walls)
115 
116  labelList bndFaces(patches.nFaces());
117  label bndI = 0;
118  for (const polyPatch& pp : patches)
119  {
120  if (!pp.coupled())
121  {
122  forAll(pp, i)
123  {
124  bndFaces[bndI++] = pp.start()+i;
125  }
126  }
127  }
128  bndFaces.setSize(bndI);
129 
130 
131  treeBoundBox overallBb(mesh().points());
132  Random rndGen(123456);
133  // Extend slightly and make 3D
134  overallBb = overallBb.extend(rndGen, 1e-4);
135  overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
136  overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
137 
138  boundaryTreePtr_.reset
139  (
140  new indexedOctree<treeDataFace>
141  (
142  treeDataFace // all information needed to search faces
143  (
144  false, // do not cache bb
145  mesh(),
146  bndFaces // boundary faces only
147  ),
148  overallBb, // overall search domain
149  8, // maxLevel
150  10, // leafsize
151  3.0 // duplicity
152  )
153  );
154  }
155 
156  return *boundaryTreePtr_;
157 }
158 
159 
160 bool Foam::discreteSurface::update(const meshSearch& meshSearcher)
161 {
162  // Find the cells the triangles of the surface are in.
163  // Does approximation by looking at the face centres only
164  const pointField& fc = surface_.faceCentres();
165 
166  List<nearInfo> nearest(fc.size());
167 
168  // Global numbering for cells/faces - only used to uniquely identify local
169  // elements
170  globalIndex globalCells(onBoundary() ? mesh().nFaces() : mesh().nCells());
171 
172  forAll(nearest, i)
173  {
174  nearest[i].first() = GREAT;
175  nearest[i].second() = labelMax;
176  }
177 
178  if (sampleSource_ == cells)
179  {
180  // Search for nearest cell
181 
182  const indexedOctree<treeDataCell>& cellTree = meshSearcher.cellTree();
183 
184  forAll(fc, triI)
185  {
186  pointIndexHit nearInfo = cellTree.findNearest
187  (
188  fc[triI],
189  sqr(GREAT)
190  );
191  if (nearInfo.hit())
192  {
193  nearest[triI].first() = magSqr(nearInfo.hitPoint()-fc[triI]);
194  nearest[triI].second() = globalCells.toGlobal(nearInfo.index());
195  }
196  }
197  }
198  else if (sampleSource_ == insideCells)
199  {
200  // Search for cell containing point
201 
202  const indexedOctree<treeDataCell>& cellTree = meshSearcher.cellTree();
203 
204  forAll(fc, triI)
205  {
206  if (cellTree.bb().contains(fc[triI]))
207  {
208  const label index = cellTree.findInside(fc[triI]);
209  if (index != -1)
210  {
211  nearest[triI].first() = 0.0;
212  nearest[triI].second() = globalCells.toGlobal(index);
213  }
214  }
215  }
216  }
217  else
218  {
219  // Search for nearest boundaryFace
220 
222  //const indexedOctree<treeDataFace>& bTree = meshSearcher.boundaryTree()
223  //- Search on all non-coupled boundary faces
224  const indexedOctree<treeDataFace>& bTree = nonCoupledboundaryTree();
225 
226  forAll(fc, triI)
227  {
228  pointIndexHit nearInfo = bTree.findNearest
229  (
230  fc[triI],
231  sqr(GREAT)
232  );
233  if (nearInfo.hit())
234  {
235  nearest[triI].first() = magSqr(nearInfo.hitPoint()-fc[triI]);
236  nearest[triI].second() = globalCells.toGlobal
237  (
238  bTree.shapes().faceLabels()[nearInfo.index()]
239  );
240  }
241  }
242  }
243 
244 
245  // See which processor has the nearest. Mark and subset
246  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
247 
248  Pstream::listCombineGather(nearest, nearestEqOp());
250 
251  labelList cellOrFaceLabels(fc.size(), -1);
252 
253  label nFound = 0;
254  forAll(nearest, triI)
255  {
256  if (nearest[triI].second() == labelMax)
257  {
258  // Not found on any processor. How to map?
259  }
260  else if (globalCells.isLocal(nearest[triI].second()))
261  {
262  cellOrFaceLabels[triI] = globalCells.toLocal
263  (
264  nearest[triI].second()
265  );
266  nFound++;
267  }
268  }
269 
270 
271  if (debug)
272  {
273  Pout<< "Local out of faces:" << cellOrFaceLabels.size()
274  << " keeping:" << nFound << endl;
275  }
276 
277  // Now subset the surface. Do not use triSurface::subsetMesh since requires
278  // original surface to be in compact numbering.
279 
280  const triSurface& s = surface_;
281 
282  // Compact to original triangle
283  labelList faceMap(s.size());
284  // Compact to original points
285  labelList pointMap(s.points().size());
286  // From original point to compact points
287  labelList reversePointMap(s.points().size(), -1);
288 
289  // Handle region-wise sorting (makes things slightly more complicated)
290  zoneIds_.setSize(s.size(), -1);
291 
292  // Better not to use triSurface::sortedZones here,
293  // since we'll sort ourselves
294 
295  // Get zone/region sizes used, store under the original region Id
296  Map<label> zoneSizes;
297 
298  // Recover region names from the input surface
299  Map<word> zoneNames;
300  {
301  const geometricSurfacePatchList& patches = s.patches();
302 
303  forAll(patches, patchi)
304  {
305  zoneNames.set
306  (
307  patchi,
308  (
309  patches[patchi].name().empty()
310  ? word::printf("patch%d", patchi)
311  : patches[patchi].name()
312  )
313  );
314 
315  zoneSizes.set(patchi, 0);
316  }
317  }
318 
319 
320  {
321  label newPointi = 0;
322  label newFacei = 0;
323 
324  forAll(s, facei)
325  {
326  if (cellOrFaceLabels[facei] != -1)
327  {
328  const triSurface::FaceType& f = s[facei];
329  const label regionid = f.region();
330 
331  Map<label>::iterator fnd = zoneSizes.find(regionid);
332  if (fnd != zoneSizes.end())
333  {
334  fnd()++;
335  }
336  else
337  {
338  // This shouldn't happen
339  zoneSizes.insert(regionid, 1);
340  zoneNames.set
341  (
342  regionid,
343  word::printf("patch%d", regionid)
344  );
345  }
346 
347  // Store new faces compact
348  faceMap[newFacei] = facei;
349  zoneIds_[newFacei] = regionid;
350  ++newFacei;
351 
352  // Renumber face points
353  forAll(f, fp)
354  {
355  const label labI = f[fp];
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> sorts properly
381  const label regionid = iter.key();
382 
383  word name;
384  Map<word>::const_iterator fnd = zoneNames.find(regionid);
385  if (fnd != zoneNames.end())
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.val();
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  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  forAll(f, fp)
459  {
460  pointToFace[f[fp]] = 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  // Collect the samplePoints and sampleElements
474  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
475 
476  if (interpolate())
477  {
478  samplePoints_.setSize(pointMap.size());
479  sampleElements_.setSize(pointMap.size(), -1);
480 
481  if (sampleSource_ == cells)
482  {
483  // samplePoints_ : per surface point a location inside the cell
484  // sampleElements_ : per surface point the cell
485 
486  forAll(points(), pointi)
487  {
488  const point& pt = points()[pointi];
489  label celli = cellOrFaceLabels[pointToFace[pointi]];
490  sampleElements_[pointi] = celli;
491 
492  // Check if point inside cell
493  if
494  (
495  mesh().pointInCell
496  (
497  pt,
498  sampleElements_[pointi],
499  meshSearcher.decompMode()
500  )
501  )
502  {
503  samplePoints_[pointi] = pt;
504  }
505  else
506  {
507  // Find nearest point on faces of cell
508  const cell& cFaces = mesh().cells()[celli];
509 
510  scalar minDistSqr = VGREAT;
511 
512  forAll(cFaces, i)
513  {
514  const face& f = mesh().faces()[cFaces[i]];
515  pointHit info = f.nearestPoint(pt, mesh().points());
516  if (info.distance() < minDistSqr)
517  {
518  minDistSqr = info.distance();
519  samplePoints_[pointi] = info.rawPoint();
520  }
521  }
522  }
523  }
524  }
525  else if (sampleSource_ == insideCells)
526  {
527  // samplePoints_ : per surface point a location inside the cell
528  // sampleElements_ : per surface point the cell
529 
530  forAll(points(), pointi)
531  {
532  const point& pt = points()[pointi];
533  label celli = cellOrFaceLabels[pointToFace[pointi]];
534  sampleElements_[pointi] = celli;
535  samplePoints_[pointi] = pt;
536  }
537  }
538  else
539  {
540  // samplePoints_ : per surface point a location on the boundary
541  // sampleElements_ : per surface point the boundary face containing
542  // the location
543 
544  forAll(points(), pointi)
545  {
546  const point& pt = points()[pointi];
547  label facei = cellOrFaceLabels[pointToFace[pointi]];
548  sampleElements_[pointi] = facei;
549  samplePoints_[pointi] = mesh().faces()[facei].nearestPoint
550  (
551  pt,
552  mesh().points()
553  ).rawPoint();
554  }
555  }
556  }
557  else
558  {
559  // if sampleSource_ == cells:
560  // sampleElements_ : per surface triangle the cell
561  // samplePoints_ : n/a
562  // if sampleSource_ == insideCells:
563  // sampleElements_ : -1 or per surface triangle the cell
564  // samplePoints_ : n/a
565  // else:
566  // sampleElements_ : per surface triangle the boundary face
567  // samplePoints_ : n/a
568  sampleElements_.transfer(cellOrFaceLabels);
569  samplePoints_.clear();
570  }
571 
572 
573  if (debug)
574  {
575  this->clearOut();
576  OFstream str(mesh().time().path()/"surfaceToMesh.obj");
577  Info<< "Dumping correspondence from local surface (points or faces)"
578  << " to mesh (cells or faces) to " << str.name() << endl;
579 
580  const vectorField& centres =
581  (
582  onBoundary()
583  ? mesh().faceCentres()
584  : mesh().cellCentres()
585  );
586 
587  if (interpolate())
588  {
589  label vertI = 0;
590  forAll(samplePoints_, pointi)
591  {
592  meshTools::writeOBJ(str, points()[pointi]);
593  vertI++;
594 
595  meshTools::writeOBJ(str, samplePoints_[pointi]);
596  vertI++;
597 
598  label elemi = sampleElements_[pointi];
599  meshTools::writeOBJ(str, centres[elemi]);
600  vertI++;
601  str << "l " << vertI-2 << ' ' << vertI-1 << ' ' << vertI << nl;
602  }
603  }
604  else
605  {
606  label vertI = 0;
607  forAll(sampleElements_, triI)
608  {
609  meshTools::writeOBJ(str, faceCentres()[triI]);
610  vertI++;
611 
612  label elemi = sampleElements_[triI];
613  meshTools::writeOBJ(str, centres[elemi]);
614  vertI++;
615  str << "l " << vertI-1 << ' ' << vertI << nl;
616  }
617  }
618  }
619 
620  needsUpdate_ = false;
621  return true;
622 }
623 
624 
625 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
626 
628 (
629  const polyMesh& mesh,
630  const word& surfaceName,
631  const samplingSource sampleSource,
632  const bool allowInterpolate
633 )
634 :
635  MeshStorage(),
636  mesh_(mesh),
637  allowInterpolate_(allowInterpolate),
638  interpolate_(false),
639  surface_
640  (
641  IOobject
642  (
643  surfaceName,
644  mesh.time().constant(), // instance
645  "triSurface", // local
646  mesh.time(), // registry
649  false
650  )
651  ),
652  sampleSource_(sampleSource),
653  needsUpdate_(true),
654  keepIds_(false),
655  originalIds_(),
656  zoneIds_(),
657  sampleElements_(),
658  samplePoints_()
659 {}
660 
661 
663 (
664  const polyMesh& mesh,
665  const dictionary& dict,
666  const bool allowInterpolate
667 )
668 :
669  MeshStorage(),
670  mesh_(mesh),
671  allowInterpolate_(allowInterpolate),
672  interpolate_
673  (
674  allowInterpolate
675  && dict.lookupOrDefault("interpolate", false)
676  ),
677  surface_
678  (
679  IOobject
680  (
681  dict.get<word>("surface"),
682  mesh.time().constant(), // instance
683  "triSurface", // local
684  mesh.time(), // registry
687  false
688  )
689  ),
690  sampleSource_(samplingSourceNames_.get("source", dict)),
691  needsUpdate_(true),
692  keepIds_(dict.lookupOrDefault("keepIds", false)),
693  originalIds_(),
694  zoneIds_(),
695  sampleElements_(),
696  samplePoints_()
697 {}
698 
699 
701 (
702  const word& name,
703  const polyMesh& mesh,
704  const triSurface& surface,
705  const word& sampleSourceName,
706  const bool allowInterpolate
707 )
708 :
709  MeshStorage(),
710  mesh_(mesh),
711  allowInterpolate_(allowInterpolate),
712  interpolate_(false),
713  surface_
714  (
715  IOobject
716  (
717  name,
718  mesh.time().constant(), // instance
719  "triSurface", // local
720  mesh.time(), // registry
723  false
724  ),
725  surface
726  ),
727  sampleSource_(samplingSourceNames_[sampleSourceName]),
728  needsUpdate_(true),
729  keepIds_(false),
730  originalIds_(),
731  zoneIds_(),
732  sampleElements_(),
733  samplePoints_()
734 {}
735 
736 
737 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
738 
740 {}
741 
742 
743 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
744 
746 {
747  return interpolate_;
748 }
749 
750 
752 {
753  if (interpolate_ == b)
754  {
755  return false;
756  }
757 
758  if (b && !allowInterpolate_)
759  {
760  return false;
761  }
762 
763  // Value changed, old sampling information is invalid
764  interpolate_ = b;
765  expire();
766 
767  return true;
768 }
769 
770 
772 {
773  return needsUpdate_;
774 }
775 
776 
778 {
779  // already marked as expired
780  if (needsUpdate_)
781  {
782  return false;
783  }
784 
786  zoneIds_.clear();
787 
788  originalIds_.clear();
789  boundaryTreePtr_.clear();
790  sampleElements_.clear();
791  samplePoints_.clear();
792 
793  needsUpdate_ = true;
794  return true;
795 }
796 
797 
799 {
800  if (!needsUpdate_)
801  {
802  return false;
803  }
804 
805  // Calculate surface and mesh overlap bounding box
806  treeBoundBox bb
807  (
808  surface_.triSurface::points(),
809  surface_.triSurface::meshPoints()
810  );
811  bb.min() = max(bb.min(), mesh().bounds().min());
812  bb.max() = min(bb.max(), mesh().bounds().max());
813 
814  // Extend a bit
815  const vector span(bb.span());
816 
817  bb.min() -= 0.5*span;
818  bb.max() += 0.5*span;
819 
820  bb.inflate(1e-6);
821 
822  // Mesh search engine, no triangulation of faces.
823  meshSearch meshSearcher(mesh(), bb, polyMesh::FACE_PLANES);
824 
825  return update(meshSearcher);
826 }
827 
828 
830 {
831  if (!needsUpdate_)
832  {
833  return false;
834  }
835 
836  // Mesh search engine on subset, no triangulation of faces.
837  meshSearch meshSearcher(mesh(), bb, polyMesh::FACE_PLANES);
838 
839  return update(meshSearcher);
840 }
841 
842 
844 (
845  const objectRegistry& store,
846  const word& fieldName,
847  const word& sampleScheme
848 ) const
849 {
850  return
851  (
852  sampleType<scalar>(store, fieldName, sampleScheme)
853  || sampleType<vector>(store, fieldName, sampleScheme)
854  || sampleType<sphericalTensor>(store, fieldName, sampleScheme)
855  || sampleType<symmTensor>(store, fieldName, sampleScheme)
856  || sampleType<tensor>(store, fieldName, sampleScheme)
857  );
858 }
859 
860 
862 {
863  os << "discreteSurface:"
864  << " surface:" << surface_.objectRegistry::name()
865  << " faces:" << this->surfFaces().size()
866  << " points:" << this->points().size()
867  << " zoneids:" << this->zoneIds().size();
868 }
869 
870 
871 // ************************************************************************* //
Foam::expressions::patchExpr::debug
int debug
Static debugging option.
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::discreteSurface::interpolate
bool interpolate() const
Interpolation requested for surface.
Definition: discreteSurface.C:745
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
Foam::Map::const_iterator
typename parent_type::const_iterator const_iterator
Definition: Map.H:70
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
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()
Tuple2.H
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::boundBox::max
const point & max() const
Maximum describing the bounding box.
Definition: boundBoxI.H:97
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::discreteSurface::setZoneMap
static void setZoneMap(const surfZoneList &, labelList &zoneIds)
Set new zoneIds list based on the surfZoneList information.
Definition: discreteSurface.C:81
Foam::discreteSurface::update
virtual bool update()
Update the surface as required.
Definition: discreteSurface.C:798
Foam::Map< label >::iterator
typename parent_type::iterator iterator
Definition: Map.H:69
Foam::discreteSurface::discreteSurface
discreteSurface(const polyMesh &mesh, const word &surfaceName, const samplingSource sampleSource, const bool allowInterpolate=true)
Construct from components.
Definition: discreteSurface.C:628
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
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::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)
Foam::geometricSurfacePatchList
List< geometricSurfacePatch > geometricSurfacePatchList
Definition: geometricSurfacePatchList.H:46
treeDataFace.H
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
Foam::VectorSpace::min
static const Form min
Definition: VectorSpace.H:118
Foam::interpolate
bool interpolate(const vector &p1, const vector &p2, const vector &o, vector &n, scalar l)
Definition: curveTools.C:75
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::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
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::discreteSurface::needsUpdate
virtual bool needsUpdate() const
Does the surface need an update?
Definition: discreteSurface.C:771
Foam::discreteSurface::print
virtual void print(Ostream &os) const
Write information.
Definition: discreteSurface.C:861
Foam::PrimitivePatch< labelledTri, ::Foam::List, pointField, point >::FaceType
labelledTri FaceType
Definition: PrimitivePatch.H:100
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
forAllIters
#define forAllIters(container, iter)
Iterate across all elements in the container object.
Definition: stdFoam.H:217
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
discreteSurface.H
Foam::polyMesh::faces
virtual const faceList & faces() const
Return raw faces.
Definition: polyMesh.C:1063
Foam::discreteSurface::mesh
const polyMesh & mesh() const
Access to the underlying mesh.
Definition: discreteSurface.H:241
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:51
Foam::pointIndexHit
PointIndexHit< point > pointIndexHit
Definition: pointIndexHit.H:45
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::nearestEqOp::operator()
void operator()(nearInfo &x, const nearInfo &y) const
Definition: discreteSurface.C:67
Foam::surfZoneList
List< surfZone > surfZoneList
Definition: surfZoneList.H:47
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::discreteSurface::sampleAndStore
virtual bool sampleAndStore(const objectRegistry &store, const word &fieldName, const word &sampleScheme) const
Sample the volume field onto surface,.
Definition: discreteSurface.C:844
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::discreteSurface::~discreteSurface
virtual ~discreteSurface()
Destructor.
Definition: discreteSurface.C:739
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::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
triFace
face triFace(3)
Foam::discreteSurface::samplingSource
samplingSource
Types of communications.
Definition: discreteSurface.H:97
Foam::discreteSurface::expire
virtual bool expire()
Mark the surface as needing an update.
Definition: discreteSurface.C:777
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