37 namespace sampledSurfaces
70 if (
y.first() <
x.first())
95 Foam::sampledSurfaces::triSurface::nonCoupledboundaryTree()
const
100 if (!boundaryTreePtr_.valid())
114 bndFaces[bndI++] = pp.start()+i;
118 bndFaces.setSize(bndI);
122 overallBb = overallBb.extend(1
e-4);
124 boundaryTreePtr_.reset
126 new indexedOctree<treeDataFace>
142 return boundaryTreePtr_();
152 const word& surfaceName,
162 mesh.time().constant(),
170 sampleSource_(sampleSource),
189 dict.lookup(
"surface"),
190 mesh.time().constant(),
198 sampleSource_(samplingSourceNames_[
dict.lookup(
"source")]),
210 const word& sampleSourceName
219 mesh.time().constant(),
228 sampleSource_(samplingSourceNames_[sampleSourceName]),
260 boundaryTreePtr_.clear();
261 sampleElements_.clear();
262 samplePoints_.clear();
278 const pointField& fc = surface_.faceCentres();
286 (sampleSource_ ==
cells || sampleSource_ == insideCells)
293 nearest[i].
first() = great;
297 if (sampleSource_ ==
cells)
307 cellTree.findNearest(fc[triI],
sqr(great));
316 else if (sampleSource_ == insideCells)
336 nearest[triI].
first() = 0.0;
337 nearest[triI].second() = globalCells.
toGlobal(index);
358 nearest[triI].second() = globalCells.
toGlobal
382 else if (globalCells.
isLocal(nearest[triI].second()))
384 cellOrFaceLabels[triI] = globalCells.
toLocal
395 Pout<<
"Local out of faces:" << cellOrFaceLabels.
size()
396 <<
" keeping:" << nFound <<
endl;
409 labelList reversePointMap(
s.points().size(), -1);
417 if (cellOrFaceLabels[facei] != -1)
424 if (reversePointMap[
f[fp]] == -1)
444 faceList& faces = this->storedFaces();
451 reversePointMap[
f[0]],
452 reversePointMap[
f[1]],
453 reversePointMap[
f[2]]
463 this->storedPoints() =
pointField(
s.points(), pointMap);
478 samplePoints_.setSize(pointMap.
size());
479 sampleElements_.setSize(pointMap.
size(), -1);
481 if (sampleSource_ ==
cells)
490 sampleElements_[pointi] = celli;
495 samplePoints_[pointi] = pt;
502 scalar minDistSqr = vGreat;
511 samplePoints_[pointi] = info.
rawPoint();
517 else if (sampleSource_ == insideCells)
526 sampleElements_[pointi] = celli;
527 samplePoints_[pointi] = pt;
540 sampleElements_[pointi] = facei;
541 samplePoints_[pointi] =
mesh().
faces()[facei].nearestPoint
560 samplePoints_.
clear();
561 sampleElements_.transfer(cellOrFaceLabels);
571 Info<<
"Dumping correspondence from local surface (points or faces)"
572 <<
" to mesh (cells or faces) to " << str.
name() <<
endl;
576 if (sampleSource_ ==
cells || sampleSource_ == insideCells)
578 forAll(samplePoints_, pointi)
580 const label celli = sampleElements_[pointi];
587 samplePoints_[pointi],
588 mesh().cellCentres()[celli]
595 forAll(samplePoints_, pointi)
597 const label facei = sampleElements_[pointi];
604 samplePoints_[pointi],
605 mesh().faceCentres()[facei]
613 if (sampleSource_ ==
cells || sampleSource_ == insideCells)
615 forAll(sampleElements_, triI)
617 const label celli = sampleElements_[triI];
624 mesh().cellCentres()[celli]
631 forAll(sampleElements_, triI)
633 const label facei = sampleElements_[triI];
640 mesh().faceCentres()[facei]
648 needsUpdate_ =
false;
660 return sampleField(vField);
670 return sampleField(vField);
679 return sampleField(vField);
689 return sampleField(vField);
699 return sampleField(vField);
709 return interpolateField(interpolator);
719 return interpolateField(interpolator);
728 return interpolateField(interpolator);
738 return interpolateField(interpolator);
748 return interpolateField(interpolator);
754 os <<
"triSurface: " <<
name() <<
" :"
755 <<
" surface:" << surface_.objectRegistry::name()
756 <<
" faces:" << faces().size()
757 <<
" points:" <<
points().size();
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
Generic GeometricField class.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void size(const label)
Override size to be inconsistent with allocated storage.
void clear()
Clear the list, i.e. set size to zero.
void setSize(const label)
Reset size of List.
virtual void clear()
Clear all storage.
Initialise the NamedEnum HashTable from the static list of names.
OFstream which keeps track of vertices.
virtual Ostream & write(const char)
Write character.
const fileName & name() const
Return the name of the stream.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
scalar distance() const
Return distance to hit.
const Point & rawPoint() const
Return point with no checking.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
std::remove_reference< FaceList >::type::value_type FaceType
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
A 2-tuple for storing two objects of different types.
A List with indirect addressing.
T & first()
Return the first element of the list.
A cell is defined as a list of faces with extra functionality.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
A face is a list of labels corresponding to mesh vertices.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
label toGlobal(const label i) const
From local to global.
label toLocal(const label i) const
From global to local on current processor.
bool isLocal(const label i) const
Is on local processor.
const Type & shapes() const
Reference to shape.
const treeBoundBox & bb() const
Top bounding box.
label findInside(const point &, const Args &...) const
Find shape containing point. Only implemented for certain.
Abstract base class for interpolation.
static const meshSearch & New(const polyMesh &mesh, const pointInCellShapes=pointInCellShapes::tets)
Lookup or construct from mesh and cell decomposition option.
const indexedOctree< treeDataCell > & cellTree() const
Access the cell tree.
A topoSetSource to select faces based on use of points.
Mesh consisting of general polyhedral cells.
virtual const faceList & faces() const
Return raw faces.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
const cellList & cells() const
An abstract class for surfaces with sampling.
virtual void clearGeom() const
bool interpolate() const
Interpolation requested for surface.
const polyMesh & mesh() const
Access to the underlying mesh.
void operator()(nearInfo &x, const nearInfo &y) const
A sampledSurface from a triSurface. It samples on the points/triangles of the triSurface....
triSurface(const word &name, const polyMesh &mesh, const word &surfaceName, const samplingSource sampleSource)
Construct from components.
static const NamedEnum< samplingSource, 3 > samplingSourceNames_
Names of communication types.
samplingSource
Types of communications.
virtual tmp< scalarField > sample(const volScalarField &) const
Sample field on surface.
virtual bool expire()
Mark the surface as needing an update.
virtual bool needsUpdate() const
Does the surface need an update?
virtual bool update()
Update the surface as required.
virtual void print(Ostream &) const
Write.
virtual const pointField & points() const
Points of surface.
virtual ~triSurface()
Destructor.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
A class for managing temporary objects.
bool contains(const vector &dir, const point &) const
Contains point (inside or on edge) and moving in direction.
A triangular face using a FixedList of labels corresponding to mesh vertices.
face triFaceFace() const
Return triangle as a face.
Triangulated surface description with patch information.
A triangle primitive used to calculate face areas and swept volumes.
A class for handling words, derived from string.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), lagrangian::cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
const fvPatchList & patches
addBackwardCompatibleToRunTimeSelectionTable(sampledSurface, triSurface, word, triSurfaceMesh, "triSurfaceMesh")
Tuple2< scalar, label > nearInfo
Private class for finding nearest.
defineTypeNameAndDebug(cutPlane, 0)
addToRunTimeSelectionTable(sampledSurface, cutPlane, word)
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelList second(const UList< labelPair > &p)
vectorField pointField
pointField is a vectorField.
bool pointInCellFacePlanes(const point &p, const polyMesh &mesh, const label celli)
Test if a point is in a given cell. For each of the cell's faces, define a.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
void sqr(LagrangianPatchField< typename outerProduct< Type, Type >::type > &f, const LagrangianPatchField< Type > &f1)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
prefixOSstream Pout(cout, "Pout")
void magSqr(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
static const label labelMax
Function for determining if a point is within a cell of a polyMesh.