50void Foam::patchCloudSet::calcSamples
52 DynamicList<point>& samplingPts,
53 DynamicList<label>& samplingCells,
54 DynamicList<label>& samplingFaces,
55 DynamicList<label>& samplingSegments,
56 DynamicList<scalar>& samplingCurveDist
63 for (
const label patchi : patchSet_)
75 for (
const label patchi : patchSet_)
81 patchFaces[sz++] =
pp.
start()+i;
85 bb.add(
pp.points(),
pp.meshPoints());
92 bb.inflate(
rndGen, 1
e-4, ROOTVSMALL);
95 indexedOctree<treeDataFace> patchTree
97 treeDataFace(
mesh(), patchFaces),
110 List<mappedPatchBase::nearInfo> nearest(sampleCoords_.size());
112 forAll(sampleCoords_, sampleI)
114 const auto& treeData = patchTree.shapes();
115 const point& sample = sampleCoords_[sampleI];
118 auto& distSqrProc = nearest[sampleI].second();
121 if (patchFaces.size())
123 nearInfo = patchTree.findNearest(sample,
sqr(searchDist_));
140 const label objectIndex = treeData.objectIndex(nearInfo.index());
142 nearInfo.setIndex(objectIndex);
144 distSqrProc.first() = sample.distSqr(nearInfo.point());
162 Info<<
"Dumping mapping as lines from supplied points to"
163 <<
" nearest patch face to file " << str.name() <<
endl;
169 if (nearest[i].
first().hit())
175 str <<
"l " << vertI-1 <<
' ' << vertI <<
nl;
190 label facei = nearInfo.index();
192 samplingPts.append(nearInfo.point());
193 samplingCells.append(
mesh().faceOwner()[facei]);
194 samplingFaces.append(facei);
195 samplingSegments.append(0);
196 samplingCurveDist.append(1.0 * sampleI);
205 samplingPts.append(sampleCoords_[sampleI]);
206 samplingCells.append(-1);
207 samplingFaces.append(-1);
208 samplingSegments.append(0);
209 samplingCurveDist.append(1.0 * sampleI);
216void Foam::patchCloudSet::genSamples()
234 samplingPts.shrink();
235 samplingCells.shrink();
236 samplingFaces.shrink();
237 samplingSegments.shrink();
238 samplingCurveDist.shrink();
261 const polyMesh&
mesh,
262 const meshSearch& searchEngine,
264 const List<point>& sampleCoords,
266 const scalar searchDist
269 sampledSet(
name,
mesh, searchEngine, axis),
270 sampleCoords_(sampleCoords),
272 searchDist_(searchDist)
292 searchDist_(
dict.get<scalar>(
"maxDistance"))
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
static void listCombineReduce(UList< T > &values, CombineOp cop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Forwards to Pstream::listReduce with an in-place cop.
bool get(const label i) const
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
const word & axis() const
The sort axis name.
const word & name() const noexcept
The coord-set name.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search.
Like Foam::cloudSet but samples nearest patch face.
patchCloudSet(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const word &axis, const List< point > &sampleCoords, const labelHashSet &patchSet, const scalar searchDist)
Construct from components.
label start() const noexcept
The start label of boundary faces in the polyMesh face list.
Mesh consisting of general polyhedral cells.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
const labelIOList & tetBasePtIs() const
Return the tetBasePtIs.
Holds list of sampling points which is filled at construction time. Various implementations of this b...
const meshSearch & searchEngine() const noexcept
sampledSet(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const coordSet::coordFormat axisType)
Construct from components.
const polyMesh & mesh() const noexcept
A List of wordRe with additional matching capabilities.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
#define DebugInfo
Report an information message using Foam::Info.
Namespace for handling debugging switches.
List< label > labelList
A List of labels.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
vector point
Point is a vector.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
vectorField pointField
pointField is a vectorField.
PointIndexHit< point > pointIndexHit
A PointIndexHit with a 3D point.
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.