49 void Foam::sampledSets::boundaryPoints::calcSamples
51 DynamicList<point>& samplingPositions,
52 DynamicList<label>& samplingSegments,
53 DynamicList<label>& samplingCells,
54 DynamicList<label>& samplingFaces
61 label nPatchFaces = 0;
65 nPatchFaces += pp.
size();
74 patchFaces[nPatchFaces++] = pp.start()+i;
83 const boundBox patchBb(pp.points(), pp.meshPoints(),
false);
84 patchBB.min() =
min(patchBB.min(), patchBb.min());
85 patchBB.max() =
max(patchBB.max(), patchBb.max());
87 patchBB = patchBB.extend(1
e-4);
90 indexedOctree<treeDataFace> patchTree
108 List<RemoteData<Tuple2<scalar, point>>> nearest(points_.size());
111 const point& sample = points_[sampleI];
115 ? patchTree.findNearest(sample,
sqr(maxDistance_))
121 nearest[sampleI].elementi = patchFaces[pih.index()];
122 nearest[sampleI].data.first() =
magSqr(pih.hitPoint() - sample);
123 nearest[sampleI].data.second() = pih.hitPoint();
131 RemoteData<Tuple2<scalar, point>>::smallestFirstEqOp()
138 OBJstream str(
mesh().time().path()/(
name() +
"_nearest.obj"));
142 if (nearest[sampleI].proci != -1)
149 nearest[sampleI].data.second()
159 if (nearest[sampleI].proci != -1)
163 const label facei = nearest[sampleI].elementi;
165 samplingPositions.append(nearest[sampleI].data.second());
166 samplingSegments.append(sampleI);
167 samplingCells.append(
mesh().faceOwner()[facei]);
168 samplingFaces.append(facei);
174 <<
"Unable to find location on patches " << patches_
175 <<
" for the point " << points_[sampleI]
176 <<
" within a distance of " << maxDistance_ <<
endl;
182 void Foam::sampledSets::boundaryPoints::genSamples()
184 DynamicList<point> samplingPositions;
185 DynamicList<label> samplingSegments;
186 DynamicList<label> samplingCells;
187 DynamicList<label> samplingFaces;
197 samplingPositions.shrink();
198 samplingSegments.shrink();
199 samplingCells.shrink();
200 samplingFaces.shrink();
223 points_(
dict.lookup(
"points")),
224 patches_(
dict.lookup(
"patches")),
225 maxDistance_(
dict.lookup<scalar>(
"maxDistance"))
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Macros for easy insertion into run-time selection tables.
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.
static bool master(const label communicator=0)
Am I the master process.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
label size() const
Return the number of elements in the UPtrList.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search.
Mesh consisting of general polyhedral cells.
const labelIOList & tetBasePtIs() const
Return the tetBasePtIs.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Holds list of sampling points which is filled at construction time. Various implementations of this b...
const word & name() const
Access the name.
const polyMesh & mesh() const
Access the mesh.
Specified point samples within patches.
boundaryPoints(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const dictionary &dict)
Construct from dictionary.
virtual ~boundaryPoints()
Destructor.
Set of sets to sample. Call sampledSets.write() to sample&write files.
A class for handling words, derived from string.
#define WarningInFunction
Report a warning using Foam::Warning.
defineTypeNameAndDebug(arcUniform, 0)
addToRunTimeSelectionTable(sampledSet, arcUniform, 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.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
PointIndexHit< point > pointIndexHit
Ostream & endl(Ostream &os)
Add newline and flush stream.
line< point, const point & > linePointRef
Line using referred points.
word name(const bool)
Return a word representation of a bool.
vector point
Point is a vector.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
dimensioned< scalar > magSqr(const dimensioned< Type > &)