searchableSurfaceCollection.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) 2016-2020 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 
31 #include "SortableList.H"
32 #include "Time.H"
33 #include "ListOps.H"
34 
35 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
36 
37 namespace Foam
38 {
39  defineTypeNameAndDebug(searchableSurfaceCollection, 0);
41  (
42  searchableSurface,
43  searchableSurfaceCollection,
44  dict
45  );
47  (
48  searchableSurface,
49  searchableSurfaceCollection,
50  dict,
51  collection
52  );
53 }
54 
55 
56 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
57 
58 void Foam::searchableSurfaceCollection::findNearest
59 (
60  const pointField& samples,
61  scalarField& minDistSqr,
62  List<pointIndexHit>& nearestInfo,
63  labelList& nearestSurf
64 ) const
65 {
66  // Initialise
67  nearestInfo.setSize(samples.size());
68  nearestInfo = pointIndexHit();
69  nearestSurf.setSize(samples.size());
70  nearestSurf = -1;
71 
72  List<pointIndexHit> hitInfo(samples.size());
73 
74  const scalarField localMinDistSqr(samples.size(), GREAT);
75 
76  forAll(subGeom_, surfI)
77  {
78  subGeom_[surfI].findNearest
79  (
80  cmptDivide // Transform then divide
81  (
82  transform_[surfI].localPosition(samples),
83  scale_[surfI]
84  ),
85  localMinDistSqr,
86  hitInfo
87  );
88 
89  forAll(hitInfo, pointi)
90  {
91  if (hitInfo[pointi].hit())
92  {
93  // Rework back into global coordinate sys. Multiply then
94  // transform
95  point globalPt = transform_[surfI].globalPosition
96  (
98  (
99  hitInfo[pointi].rawPoint(),
100  scale_[surfI]
101  )
102  );
103 
104  scalar distSqr = magSqr(globalPt - samples[pointi]);
105 
106  if (distSqr < minDistSqr[pointi])
107  {
108  minDistSqr[pointi] = distSqr;
109  nearestInfo[pointi].setPoint(globalPt);
110  nearestInfo[pointi].setHit();
111  nearestInfo[pointi].setIndex
112  (
113  hitInfo[pointi].index()
114  + indexOffset_[surfI]
115  );
116  nearestSurf[pointi] = surfI;
117  }
118  }
119  }
120  }
121 }
122 
123 
124 // Sort hits into per-surface bins. Misses are rejected. Maintains map back
125 // to position
126 void Foam::searchableSurfaceCollection::sortHits
127 (
128  const List<pointIndexHit>& info,
129  List<List<pointIndexHit>>& surfInfo,
130  labelListList& infoMap
131 ) const
132 {
133  // Count hits per surface.
134  labelList nHits(subGeom_.size(), Zero);
135 
136  forAll(info, pointi)
137  {
138  if (info[pointi].hit())
139  {
140  label index = info[pointi].index();
141  label surfI = findLower(indexOffset_, index+1);
142  nHits[surfI]++;
143  }
144  }
145 
146  // Per surface the hit
147  surfInfo.setSize(subGeom_.size());
148  // Per surface the original position
149  infoMap.setSize(subGeom_.size());
150 
151  forAll(surfInfo, surfI)
152  {
153  surfInfo[surfI].setSize(nHits[surfI]);
154  infoMap[surfI].setSize(nHits[surfI]);
155  }
156  nHits = 0;
157 
158  forAll(info, pointi)
159  {
160  if (info[pointi].hit())
161  {
162  label index = info[pointi].index();
163  label surfI = findLower(indexOffset_, index+1);
164 
165  // Store for correct surface and adapt indices back to local
166  // ones
167  label localI = nHits[surfI]++;
168  surfInfo[surfI][localI] = pointIndexHit
169  (
170  info[pointi].hit(),
171  info[pointi].rawPoint(),
172  index-indexOffset_[surfI]
173  );
174  infoMap[surfI][localI] = pointi;
175  }
176  }
177 }
178 
179 
180 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
181 
182 Foam::searchableSurfaceCollection::searchableSurfaceCollection
183 (
184  const IOobject& io,
185  const dictionary& dict
186 )
187 :
188  searchableSurface(io),
189  instance_(dict.size()),
190  scale_(dict.size()),
191  transform_(dict.size()),
192  subGeom_(dict.size()),
193  mergeSubRegions_(dict.get<bool>("mergeSubRegions")),
194  indexOffset_(dict.size()+1)
195 {
196  Info<< "SearchableCollection : " << name() << endl;
197 
198  label surfI = 0;
199  label startIndex = 0;
200  for (const entry& dEntry : dict)
201  {
202  if (dEntry.isDict())
203  {
204  instance_[surfI] = dEntry.keyword();
205 
206  const dictionary& sDict = dEntry.dict();
207 
208  sDict.readEntry("scale", scale_[surfI]);
209 
210  const dictionary& coordDict = sDict.subDict("transform");
211  if (coordDict.found("coordinateSystem"))
212  {
213  // Backwards compatibility: use coordinateSystem subdictionary
214  transform_.set
215  (
216  surfI,
217  new coordSystem::cartesian(coordDict, "coordinateSystem")
218  );
219  }
220  else
221  {
222  // New form: directly set from dictionary
223  transform_.set
224  (
225  surfI,
226  new coordSystem::cartesian(sDict, "transform")
227  );
228  }
229 
230  const word subGeomName(sDict.get<word>("surface"));
231  //Pout<< "Trying to find " << subGeomName << endl;
232 
234  io.db().lookupObjectRef<searchableSurface>(subGeomName);
235 
236  // I don't know yet how to handle the globalSize combined with
237  // regionOffset. Would cause non-consecutive indices locally
238  // if all indices offset by globalSize() of the local region...
239  if (s.size() != s.globalSize())
240  {
242  << "Cannot use a distributed surface in a collection."
243  << exit(FatalError);
244  }
245 
246  subGeom_.set(surfI, &s);
247 
248  indexOffset_[surfI] = startIndex;
249  startIndex += subGeom_[surfI].size();
250 
251  Info<< " instance : " << instance_[surfI] << endl;
252  Info<< " surface : " << s.name() << endl;
253  Info<< " scale : " << scale_[surfI] << endl;
254  Info<< " transform: " << transform_[surfI] << endl;
255 
256  surfI++;
257  }
258  }
259  indexOffset_[surfI] = startIndex;
260 
261  instance_.setSize(surfI);
262  scale_.setSize(surfI);
263  transform_.setSize(surfI);
264  subGeom_.setSize(surfI);
265  indexOffset_.setSize(surfI+1);
266 
267  // Bounds is the overall bounds - prepare for min/max ops
268  bounds() = boundBox::invertedBox;
269 
270  forAll(subGeom_, surfI)
271  {
272  const boundBox& surfBb = subGeom_[surfI].bounds();
273 
274  // Transform back to global coordinate sys.
275  const point surfBbMin = transform_[surfI].globalPosition
276  (
278  (
279  surfBb.min(),
280  scale_[surfI]
281  )
282  );
283  const point surfBbMax = transform_[surfI].globalPosition
284  (
286  (
287  surfBb.max(),
288  scale_[surfI]
289  )
290  );
291 
292  bounds().min() = min(bounds().min(), surfBbMin);
293  bounds().max() = max(bounds().max(), surfBbMax);
294  }
295 }
296 
297 
298 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
299 
301 {}
302 
303 
304 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
305 
307 {
308  if (regions_.empty())
309  {
310  regionOffset_.setSize(subGeom_.size());
311 
312  DynamicList<word> allRegions;
313  forAll(subGeom_, surfI)
314  {
315  regionOffset_[surfI] = allRegions.size();
316 
317  if (mergeSubRegions_)
318  {
319  // Single name regardless how many regions subsurface has
320  allRegions.append(instance_[surfI] + "_" + Foam::name(surfI));
321  }
322  else
323  {
324  const wordList& subRegions = subGeom_[surfI].regions();
325 
326  for (const word& regionName : subRegions)
327  {
328  allRegions.append(instance_[surfI] + "_" + regionName);
329  }
330  }
331  }
332  regions_.transfer(allRegions);
333  }
334  return regions_;
335 }
336 
337 
339 {
340  return indexOffset_.last();
341 }
342 
343 
346 {
347  auto tctrs = tmp<pointField>::New(size());
348  auto& ctrs = tctrs.ref();
349 
350  // Append individual coordinates
351  label coordI = 0;
352 
353  forAll(subGeom_, surfI)
354  {
355  const pointField subCoords(subGeom_[surfI].coordinates());
356 
357  forAll(subCoords, i)
358  {
359  ctrs[coordI++] = transform_[surfI].globalPosition
360  (
362  (
363  subCoords[i],
364  scale_[surfI]
365  )
366  );
367  }
368  }
369 
370  return tctrs;
371 }
372 
373 
375 (
376  pointField& centres,
377  scalarField& radiusSqr
378 ) const
379 {
380  centres.setSize(size());
381  radiusSqr.setSize(centres.size());
382 
383  // Append individual coordinates
384  label coordI = 0;
385 
386  forAll(subGeom_, surfI)
387  {
388  scalar maxScale = cmptMax(scale_[surfI]);
389 
390  pointField subCentres;
391  scalarField subRadiusSqr;
392  subGeom_[surfI].boundingSpheres(subCentres, subRadiusSqr);
393 
394  forAll(subCentres, i)
395  {
396  centres[coordI] = transform_[surfI].globalPosition
397  (
399  (
400  subCentres[i],
401  scale_[surfI]
402  )
403  );
404  radiusSqr[coordI] = maxScale*subRadiusSqr[i];
405  coordI++;
406  }
407  }
408 }
409 
410 
413 {
414  // Get overall size
415  label nPoints = 0;
416 
417  forAll(subGeom_, surfI)
418  {
419  nPoints += subGeom_[surfI].points()().size();
420  }
421 
422  auto tpts = tmp<pointField>::New(nPoints);
423  auto& pts = tpts.ref();
424 
425  // Append individual coordinates
426  nPoints = 0;
427 
428  forAll(subGeom_, surfI)
429  {
430  const pointField subCoords(subGeom_[surfI].points());
431 
432  forAll(subCoords, i)
433  {
434  pts[nPoints++] = transform_[surfI].globalPosition
435  (
437  (
438  subCoords[i],
439  scale_[surfI]
440  )
441  );
442  }
443  }
444 
445  return tpts;
446 }
447 
448 
449 void Foam::searchableSurfaceCollection::findNearest
450 (
451  const pointField& samples,
452  const scalarField& nearestDistSqr,
453  List<pointIndexHit>& nearestInfo
454 ) const
455 {
456  // How to scale distance?
457  scalarField minDistSqr(nearestDistSqr);
458 
459  labelList nearestSurf;
460  findNearest
461  (
462  samples,
463  minDistSqr,
464  nearestInfo,
465  nearestSurf
466  );
467 }
468 
469 
471 (
472  const pointField& start,
473  const pointField& end,
474  List<pointIndexHit>& info
475 ) const
476 {
477  info.setSize(start.size());
478  info = pointIndexHit();
479 
480  // Current nearest (to start) intersection
481  pointField nearest(end);
482 
483  List<pointIndexHit> hitInfo(start.size());
484 
485  forAll(subGeom_, surfI)
486  {
487  // Starting point
489  (
490  transform_[surfI].localPosition
491  (
492  start
493  ),
494  scale_[surfI]
495  );
496 
497  // Current best end point
499  (
500  transform_[surfI].localPosition
501  (
502  nearest
503  ),
504  scale_[surfI]
505  );
506 
507  subGeom_[surfI].findLine(e0, e1, hitInfo);
508 
509  forAll(hitInfo, pointi)
510  {
511  if (hitInfo[pointi].hit())
512  {
513  // Transform back to global coordinate sys.
514  nearest[pointi] = transform_[surfI].globalPosition
515  (
517  (
518  hitInfo[pointi].rawPoint(),
519  scale_[surfI]
520  )
521  );
522  info[pointi] = hitInfo[pointi];
523  info[pointi].rawPoint() = nearest[pointi];
524  info[pointi].setIndex
525  (
526  hitInfo[pointi].index()
527  + indexOffset_[surfI]
528  );
529  }
530  }
531  }
532 
533 
534  // Debug check
535  if (false)
536  {
537  forAll(info, pointi)
538  {
539  if (info[pointi].hit())
540  {
541  vector n(end[pointi] - start[pointi]);
542  scalar magN = mag(n);
543 
544  if (magN > SMALL)
545  {
546  n /= mag(n);
547 
548  scalar s = ((info[pointi].rawPoint()-start[pointi])&n);
549 
550  if (s < 0 || s > 1)
551  {
553  << "point:" << info[pointi]
554  << " s:" << s
555  << " outside vector "
556  << " start:" << start[pointi]
557  << " end:" << end[pointi]
558  << abort(FatalError);
559  }
560  }
561  }
562  }
563  }
564 }
565 
566 
568 (
569  const pointField& start,
570  const pointField& end,
571  List<pointIndexHit>& info
572 ) const
573 {
574  // To be done ...
575  findLine(start, end, info);
576 }
577 
578 
580 (
581  const pointField& start,
582  const pointField& end,
584 ) const
585 {
586  // To be done. Assume for now only one intersection.
587  List<pointIndexHit> nearestInfo;
588  findLine(start, end, nearestInfo);
589 
590  info.setSize(start.size());
591  forAll(info, pointi)
592  {
593  if (nearestInfo[pointi].hit())
594  {
595  info[pointi].setSize(1);
596  info[pointi][0] = nearestInfo[pointi];
597  }
598  else
599  {
600  info[pointi].clear();
601  }
602  }
603 }
604 
605 
607 (
608  const List<pointIndexHit>& info,
609  labelList& region
610 ) const
611 {
612  if (subGeom_.size() == 0)
613  {}
614  else if (subGeom_.size() == 1)
615  {
616  if (mergeSubRegions_)
617  {
618  region.setSize(info.size());
619  region = regionOffset_[0];
620  }
621  else
622  {
623  subGeom_[0].getRegion(info, region);
624  }
625  }
626  else
627  {
628  // Multiple surfaces. Sort by surface.
629 
630  // Per surface the hit
631  List<List<pointIndexHit>> surfInfo;
632  // Per surface the original position
633  List<List<label>> infoMap;
634  sortHits(info, surfInfo, infoMap);
635 
636  region.setSize(info.size());
637  region = -1;
638 
639  // Do region tests
640 
641  if (mergeSubRegions_)
642  {
643  // Actually no need for surfInfo. Just take region for surface.
644  forAll(infoMap, surfI)
645  {
646  const labelList& map = infoMap[surfI];
647  forAll(map, i)
648  {
649  region[map[i]] = regionOffset_[surfI];
650  }
651  }
652  }
653  else
654  {
655  forAll(infoMap, surfI)
656  {
657  labelList surfRegion;
658  subGeom_[surfI].getRegion(surfInfo[surfI], surfRegion);
659 
660  const labelList& map = infoMap[surfI];
661  forAll(map, i)
662  {
663  region[map[i]] = regionOffset_[surfI] + surfRegion[i];
664  }
665  }
666  }
667  }
668 }
669 
670 
672 (
673  const List<pointIndexHit>& info,
674  vectorField& normal
675 ) const
676 {
677  if (subGeom_.size() == 0)
678  {}
679  else if (subGeom_.size() == 1)
680  {
681  subGeom_[0].getNormal(info, normal);
682  }
683  else
684  {
685  // Multiple surfaces. Sort by surface.
686 
687  // Per surface the hit
688  List<List<pointIndexHit>> surfInfo;
689  // Per surface the original position
690  List<List<label>> infoMap;
691  sortHits(info, surfInfo, infoMap);
692 
693  normal.setSize(info.size());
694 
695  // Do region tests
696  forAll(surfInfo, surfI)
697  {
698  vectorField surfNormal;
699  subGeom_[surfI].getNormal(surfInfo[surfI], surfNormal);
700 
701  // Transform back to global coordinate sys.
702  surfNormal = transform_[surfI].globalVector(surfNormal);
703 
704  const labelList& map = infoMap[surfI];
705  forAll(map, i)
706  {
707  normal[map[i]] = surfNormal[i];
708  }
709  }
710  }
711 }
712 
713 
715 (
716  const pointField& points,
717  List<volumeType>& volType
718 ) const
719 {
721  << "Volume type not supported for collection."
722  << exit(FatalError);
723 }
724 
725 
727 (
728  const List<treeBoundBox>& bbs,
729  const bool keepNonLocal,
731  autoPtr<mapDistribute>& pointMap
732 )
733 {
734  forAll(subGeom_, surfI)
735  {
736  // Note:Transform the bounding boxes? Something like
737  // pointField bbPoints =
738  // cmptDivide
739  // (
740  // transform_[surfI].localPosition(bbs[i].points()),
741  // scale_[surfI]
742  // );
743  // treeBoundBox newBb(bbPoints);
744 
745  // Note: what to do with faceMap, pointMap from multiple surfaces?
746  subGeom_[surfI].distribute
747  (
748  bbs,
749  keepNonLocal,
750  faceMap,
751  pointMap
752  );
753  }
754 }
755 
756 
758 {
759  forAll(subGeom_, surfI)
760  {
761  subGeom_[surfI].setField
762  (
763  static_cast<const labelList&>
764  (
766  (
767  values,
768  subGeom_[surfI].size(),
769  indexOffset_[surfI]
770  )
771  )
772  );
773  }
774 }
775 
776 
778 (
779  const List<pointIndexHit>& info,
781 ) const
782 {
783  if (subGeom_.size() == 0)
784  {}
785  else if (subGeom_.size() == 1)
786  {
787  subGeom_[0].getField(info, values);
788  }
789  else
790  {
791  // Multiple surfaces. Sort by surface.
792 
793  // Per surface the hit
794  List<List<pointIndexHit>> surfInfo;
795  // Per surface the original position
796  List<List<label>> infoMap;
797  sortHits(info, surfInfo, infoMap);
798 
799  // Do surface tests
800  forAll(surfInfo, surfI)
801  {
802  labelList surfValues;
803  subGeom_[surfI].getField(surfInfo[surfI], surfValues);
804 
805  if (surfValues.size())
806  {
807  // Size values only when we have a surface that supports it.
808  values.setSize(info.size());
809 
810  const labelList& map = infoMap[surfI];
811  forAll(map, i)
812  {
813  values[map[i]] = surfValues[i];
814  }
815  }
816  }
817  }
818 }
819 
820 
821 // ************************************************************************* //
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Foam::entry
A keyword and a list of tokens is an 'entry'.
Definition: entry.H:67
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:71
Foam::pointField
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
Foam::searchableSurfaceCollection::getRegion
virtual void getRegion(const List< pointIndexHit > &, labelList &region) const
From a set of points and indices get the region.
Definition: searchableSurfaceCollection.C:607
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
Foam::faceMap
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Definition: blockMeshMergeTopological.C:94
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
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::cmptMultiply
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::searchableSurfaceCollection::getVolumeType
virtual void getVolumeType(const pointField &points, List< volumeType > &volType) const
Determine type (inside/outside/mixed) for point.
Definition: searchableSurfaceCollection.C:715
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::DynamicList< word >
Foam::dictionary::found
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
Definition: dictionary.C:364
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::searchableSurfaceCollection::findLine
virtual void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Find first intersection on segment from start to end.
Definition: searchableSurfaceCollection.C:471
Foam::SubList
A List obtained as a section of another List.
Definition: SubList.H:53
Foam::boundBox::invertedBox
static const boundBox invertedBox
A large inverted boundBox: min/max == +/- ROOTVGREAT.
Definition: boundBox.H:86
Foam::searchableSurfaceCollection::~searchableSurfaceCollection
virtual ~searchableSurfaceCollection()
Destructor.
Definition: searchableSurfaceCollection.C:300
Foam::searchableSurfaceCollection::points
virtual tmp< pointField > points() const
Get the points that define the surface.
Definition: searchableSurfaceCollection.C:412
Foam::searchableSurfaceCollection::distribute
virtual void distribute(const List< treeBoundBox > &, const bool keepNonLocal, autoPtr< mapDistribute > &faceMap, autoPtr< mapDistribute > &pointMap)
Set bounds of surface. Bounds currently set as list of.
Definition: searchableSurfaceCollection.C:727
Foam::searchableSurfaceCollection::regions
virtual const wordList & regions() const
Names of regions.
Definition: searchableSurfaceCollection.C:306
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
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::set
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
Definition: dictionary.C:847
Foam::searchableSurfaceCollection::getNormal
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
Definition: searchableSurfaceCollection.C:672
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::searchableSurfaceCollection::boundingSpheres
virtual void boundingSpheres(pointField &centres, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
Definition: searchableSurfaceCollection.C:375
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:296
Foam::magSqr
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
Foam::IOobject::db
const objectRegistry & db() const
Return the local objectRegistry.
Definition: IOobject.C:457
nPoints
label nPoints
Definition: gmvOutputHeader.H:2
Foam::searchableSurfaceCollection::findLineAll
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit >> &) const
Get all intersections in order from start to end.
Definition: searchableSurfaceCollection.C:580
Foam::searchableSurfaceCollection::size
virtual label size() const
Range of local indices that can be returned.
Definition: searchableSurfaceCollection.C:338
Foam::cmptMax
void cmptMax(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:253
n
label n
Definition: TABSMDCalcMethod2.H:31
SortableList.H
regionName
Foam::word regionName
Definition: createNamedDynamicFvMesh.H:1
Foam::VectorSpace::min
static const Form min
Definition: VectorSpace.H:118
Foam::Field< vector >
Foam::findLower
label findLower(const ListType &input, const T &val, const label start, const ComparePredicate &comp)
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::DynamicList::append
DynamicList< T, SizeMin > & append(const T &val)
Append an element to the end of this list.
Definition: DynamicListI.H:474
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::dictionary::subDict
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
Definition: dictionary.C:528
Foam::addNamedToRunTimeSelectionTable
addNamedToRunTimeSelectionTable(topoSetCellSource, badQualityToCell, word, badQuality)
Foam::searchableSurfaceCollection::coordinates
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
Definition: searchableSurfaceCollection.C:345
Foam::searchableSurfaceCollection::getField
virtual void getField(const List< pointIndexHit > &, labelList &) const
WIP. From a set of hits (points and.
Definition: searchableSurfaceCollection.C:778
Foam::dictionary::readEntry
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
Definition: dictionaryTemplates.C:314
Foam::searchableSurfaceCollection::findLineAny
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
Definition: searchableSurfaceCollection.C:568
samples
scalarField samples(nIntervals, Zero)
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
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
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:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::objectRegistry::lookupObjectRef
Type & lookupObjectRef(const word &name, const bool recursive=false) const
Definition: objectRegistryTemplates.C:478
Foam::cmptDivide
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
Time.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::labelListList
List< labelList > labelListList
A List of labelList.
Definition: labelList.H:56
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:381
Foam::pointIndexHit
PointIndexHit< point > pointIndexHit
A PointIndexHit for 3D points.
Definition: pointIndexHit.H:46
Foam::coordSystem::cartesian
A Cartesian coordinate system.
Definition: cartesianCS.H:69
Foam::Vector< scalar >
Foam::List< word >
searchableSurfaceCollection.H
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
points
const pointField & points
Definition: gmvOutputHeader.H:1
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.
Foam::boundBox
A bounding box defined in terms of min/max extrema points.
Definition: boundBox.H:63
ListOps.H
Various functions to operate on Lists.
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::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::searchableSurfaceCollection::setField
virtual void setField(const labelList &values)
WIP. Store element-wise field.
Definition: searchableSurfaceCollection.C:757