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,
170 sampleSource_(sampleSource),
198 sampleSource_(samplingSourceNames_[
dict.
lookup(
"source")]),
210 const word& sampleSourceName
228 sampleSource_(samplingSourceNames_[sampleSourceName]),
258 const pointField& fc = surface_.faceCentres();
266 (sampleSource_ ==
cells || sampleSource_ == insideCells)
273 nearest[i].
first() = great;
277 if (sampleSource_ ==
cells)
287 cellTree.findNearest(fc[triI],
sqr(great));
296 else if (sampleSource_ == insideCells)
316 nearest[triI].
first() = 0.0;
317 nearest[triI].second() = globalCells.
toGlobal(index);
338 nearest[triI].second() = globalCells.
toGlobal
362 else if (globalCells.
isLocal(nearest[triI].second()))
364 cellOrFaceLabels[triI] = globalCells.
toLocal
375 Pout<<
"Local out of faces:" << cellOrFaceLabels.
size()
376 <<
" keeping:" << nFound <<
endl;
389 labelList reversePointMap(
s.points().size(), -1);
397 if (cellOrFaceLabels[facei] != -1)
404 if (reversePointMap[
f[fp]] == -1)
424 faceList& faces = this->storedFaces();
431 reversePointMap[
f[0]],
432 reversePointMap[
f[1]],
433 reversePointMap[
f[2]]
443 this->storedPoints() =
pointField(
s.points(), pointMap);
458 samplePoints_.setSize(pointMap.
size());
459 sampleElements_.setSize(pointMap.
size(), -1);
461 if (sampleSource_ ==
cells)
470 sampleElements_[pointi] = celli;
475 samplePoints_[pointi] = pt;
482 scalar minDistSqr = vGreat;
491 samplePoints_[pointi] = info.
rawPoint();
497 else if (sampleSource_ == insideCells)
506 sampleElements_[pointi] = celli;
507 samplePoints_[pointi] = pt;
520 sampleElements_[pointi] = facei;
521 samplePoints_[pointi] =
mesh().
faces()[facei].nearestPoint
540 samplePoints_.
clear();
541 sampleElements_.transfer(cellOrFaceLabels);
551 Info<<
"Dumping correspondence from local surface (points or faces)"
552 <<
" to mesh (cells or faces) to " << str.
name() <<
endl;
556 if (sampleSource_ ==
cells || sampleSource_ == insideCells)
558 forAll(samplePoints_, pointi)
560 const label celli = sampleElements_[pointi];
567 samplePoints_[pointi],
568 mesh().cellCentres()[celli]
575 forAll(samplePoints_, pointi)
577 const label facei = sampleElements_[pointi];
584 samplePoints_[pointi],
585 mesh().faceCentres()[facei]
593 if (sampleSource_ ==
cells || sampleSource_ == insideCells)
595 forAll(sampleElements_, triI)
597 const label celli = sampleElements_[triI];
604 mesh().cellCentres()[celli]
611 forAll(sampleElements_, triI)
613 const label facei = sampleElements_[triI];
620 mesh().faceCentres()[facei]
628 needsUpdate_ =
false;
634 #define IMPLEMENT_SAMPLE(Type, nullArg) \
635 Foam::tmp<Foam::Field<Foam::Type>> \
636 Foam::sampledSurfaces::triSurface::sample \
638 const VolField<Type>& vField \
641 return sampleField(vField); \
644 #undef IMPLEMENT_SAMPLE
647 #define IMPLEMENT_INTERPOLATE(Type, nullArg) \
648 Foam::tmp<Foam::Field<Foam::Type>> \
649 Foam::sampledSurfaces::triSurface::interpolate \
651 const interpolation<Type>& interpolator \
654 return interpolateField(interpolator); \
657 #undef IMPLEMENT_INTERPOLATE
665 boundaryTreePtr_.clear();
666 sampleElements_.clear();
667 samplePoints_.clear();
693 os <<
"triSurface: " <<
name() <<
" :"
694 <<
" surface:" << surface_.objectRegistry::name()
695 <<
" faces:" << faces().size()
696 <<
" points:" <<
points().size();
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
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.
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.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Mesh consisting of general polyhedral cells.
const polyBoundaryMesh & boundary() const
Return boundary mesh.
virtual const faceList & faces() const
Return raw faces.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
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.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
virtual void movePoints()
Update for mesh point-motion.
samplingSource
Types of communications.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
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....
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)
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
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.
FOR_ALL_FIELD_TYPES(makeDimensionedPointFieldFunctions)
labelList second(const UList< labelPair > &p)
vectorField pointField
pointField is a vectorField.
tmp< DimensionedField< typename outerProduct< Type, Type >::type, GeoMesh, Field >> sqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
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)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
prefixOSstream Pout(cout, "Pout")
static const label labelMax
tmp< DimensionedField< scalar, GeoMesh, Field > > magSqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
Function for determining if a point is within a cell of a polyMesh.
#define IMPLEMENT_INTERPOLATE(Type, nullArg)
#define IMPLEMENT_SAMPLE(Type, nullArg)