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