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