44 sampledTriSurfaceMesh,
57 sampledTriSurfaceMesh::samplingSourceNames_;
85 Foam::sampledTriSurfaceMesh::nonCoupledboundaryTree()
const 90 if (!boundaryTreePtr_.valid())
104 bndFaces[bndI++] = pp.
start()+i;
113 overallBb = overallBb.
extend(rndGen, 1
e-4);
114 overallBb.
min() -=
point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
115 overallBb.
max() +=
point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
117 boundaryTreePtr_.reset
135 return boundaryTreePtr_();
143 const pointField& fc = surface_.faceCentres();
151 (sampleSource_ ==
cells || sampleSource_ == insideCells)
158 nearest[i].first() = GREAT;
162 if (sampleSource_ ==
cells)
178 nearest[triI].second() = globalCells.toGlobal(nearInfo.
index());
182 else if (sampleSource_ == insideCells)
190 if (cellTree.
bb().contains(fc[triI]))
195 nearest[triI].first() = 0.0;
196 nearest[triI].second() = globalCells.toGlobal(index);
220 nearest[triI].second() = globalCells.toGlobal
240 if (nearest[triI].second() ==
labelMax)
244 else if (globalCells.isLocal(nearest[triI].second()))
246 cellOrFaceLabels[triI] = globalCells.toLocal
248 nearest[triI].second()
257 Pout<<
"Local out of faces:" << cellOrFaceLabels.size()
258 <<
" keeping:" << nFound <<
endl;
279 if (cellOrFaceLabels[facei] != -1)
286 if (reversePointMap[f[fp]] == -1)
289 reversePointMap[f[fp]] = newPointi++;
295 pointMap.setSize(newPointi);
306 faceList& faces = this->storedFaces();
313 reversePointMap[f[0]],
314 reversePointMap[f[1]],
315 reversePointMap[f[2]]
340 samplePoints_.setSize(pointMap.size());
341 sampleElements_.setSize(pointMap.size(), -1);
343 if (sampleSource_ ==
cells)
352 sampleElements_[pointi] = celli;
360 sampleElements_[pointi],
365 samplePoints_[pointi] = pt;
370 const cell& cFaces =
mesh().cells()[celli];
372 scalar minDistSqr = VGREAT;
376 const face&
f =
mesh().faces()[cFaces[i]];
381 samplePoints_[pointi] = info.
rawPoint();
387 else if (sampleSource_ == insideCells)
396 sampleElements_[pointi] = celli;
397 samplePoints_[pointi] = pt;
410 sampleElements_[pointi] = facei;
411 samplePoints_[pointi] =
mesh().faces()[facei].nearestPoint
430 samplePoints_.clear();
431 sampleElements_.transfer(cellOrFaceLabels);
439 Info<<
"Dumping correspondence from local surface (points or faces)" 440 <<
" to mesh (cells or faces) to " << str.
name() <<
endl;
445 if (sampleSource_ ==
cells || sampleSource_ == insideCells)
447 forAll(samplePoints_, pointi)
455 label celli = sampleElements_[pointi];
458 str <<
"l " << vertI-2 <<
' ' << vertI-1 <<
' ' << vertI
464 forAll(samplePoints_, pointi)
472 label facei = sampleElements_[pointi];
475 str <<
"l " << vertI-2 <<
' ' << vertI-1 <<
' ' << vertI
482 if (sampleSource_ ==
cells || sampleSource_ == insideCells)
484 forAll(sampleElements_, triI)
489 label celli = sampleElements_[triI];
492 str <<
"l " << vertI-1 <<
' ' << vertI <<
nl;
497 forAll(sampleElements_, triI)
502 label facei = sampleElements_[triI];
505 str <<
"l " << vertI-1 <<
' ' << vertI <<
nl;
512 needsUpdate_ =
false;
523 const word& surfaceName,
541 sampleSource_(sampleSource),
569 sampleSource_(samplingSourceNames_[dict.
lookup(
"source")]),
581 const word& sampleSourceName
599 sampleSource_(samplingSourceNames_[sampleSourceName]),
631 boundaryTreePtr_.clear();
632 sampleElements_.clear();
633 samplePoints_.clear();
650 return update(meshSearcher);
664 return update(meshSearcher);
673 return sampleField(vField);
682 return sampleField(vField);
690 return sampleField(vField);
699 return sampleField(vField);
708 return sampleField(vField);
717 return interpolateField(interpolator);
726 return interpolateField(interpolator);
734 return interpolateField(interpolator);
743 return interpolateField(interpolator);
752 return interpolateField(interpolator);
758 os <<
"sampledTriSurfaceMesh: " <<
name() <<
" :" 759 <<
" surface:" << surface_.objectRegistry::name()
760 <<
" faces:" << faces().size()
761 <<
" points:" <<
points().size();
polyMesh::cellDecomposition decompMode() const
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search...
virtual ~sampledTriSurfaceMesh()
Destructor.
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
virtual bool expire()
Mark the surface as needing an update.
const indexedOctree< treeDataCell > & cellTree() const
Get (demand driven) reference to octree holding all cells.
A face is a list of labels corresponding to mesh vertices.
const double e
Elementary charge.
A list of keyword definitions, which are a keyword followed by any number of values (e...
An abstract class for surfaces with sampling.
A 2-tuple for storing two objects of different types.
Encapsulation of data needed to search for faces.
const Type1 & first() const
Return first.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void size(const label)
Override size to be inconsistent with allocated storage.
bool interpolate() const
Interpolation requested for surface.
Ostream & endl(Ostream &os)
Add newline and flush stream.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
const fileName & name() const
Return the name of the stream.
Initialise the NamedEnum HashTable from the static list of names.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
Macros for easy insertion into run-time selection tables.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
virtual bool update()
Update the surface as required.
samplingSource
Types of communications.
virtual bool needsUpdate() const
Does the surface need an update?
const Point & hitPoint() const
Return hit point.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().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))
vectorField pointField
pointField is a vectorField.
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
virtual void clearGeom() const
A class for handling words, derived from string.
A triangular face using a FixedList of labels corresponding to mesh vertices.
const word & constant() const
Return constant name.
cachedRandom rndGen(label(0), -1)
bool hit() const
Is there a hit.
const Field< PointType > & points() const
Return reference to global points.
const Type & shapes() const
Reference to shape.
static const label labelMax
Triangle with additional region number.
const treeBoundBox & bb() const
Top bounding box.
Simple random number generator.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
const Point & rawPoint() const
Return point with no checking.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
label findInside(const point &) const
Find shape containing point. Only implemented for certain.
const Time & time() const
Return time.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
defineTypeNameAndDebug(combustionModel, 0)
void operator()(nearInfo &x, const nearInfo &y) const
treeBoundBox extend(Random &, const scalar s) const
Return slightly wider bounding box.
word name(const complex &)
Return a string representation of a complex.
void setSize(const label)
Reset size of List.
const point & max() const
Maximum describing the bounding box.
vector point
Point is a vector.
pointHit nearestPoint(const point &p, const pointField &) const
Return nearest point to face.
virtual tmp< scalarField > sample(const volScalarField &) const
Sample field on surface.
A cell is defined as a list of faces with extra functionality.
prefixOSstream Pout(cout, "Pout")
A List with indirect addressing.
label start() const
Return start label of this patch in the polyMesh face list.
Standard boundBox + extra functionality for use in octree.
Mesh consisting of general polyhedral cells.
virtual void print(Ostream &) const
Write.
scalar distance() const
Return distance to hit.
const point & min() const
Minimum describing the bounding box.
A class for managing temporary objects.
A patch is a list of labels that address the faces in the global face list.
Triangulated surface description with patch information.
A topoSetSource to select faces based on use of points.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
sampledTriSurfaceMesh(const word &name, const polyMesh &mesh, const word &surfaceName, const samplingSource sampleSource)
Construct from components.
label index() const
Return index.
Tuple2< scalar, label > nearInfo
Private class for finding nearest.
face triFaceFace() const
Return triangle as a face.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.