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;
64 const polyPatch& pp =
mesh().boundaryMesh()[iter.key()];
65 nPatchFaces += pp.size();
71 const polyPatch& pp =
mesh().boundaryMesh()[iter.key()];
74 patchFaces[nPatchFaces++] = pp.start()+i;
82 const polyPatch& pp =
mesh().boundaryMesh()[iter.key()];
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
105 (void)
mesh().tetBasePtIs();
108 List<mappedPatchBase::nearInfo> nearest(points_.size());
111 const point& sample = points_[sampleI];
114 scalar& nearDist = nearest[sampleI].second().first();
115 label& nearProc = nearest[sampleI].second().second();
118 if (patchFaces.size())
120 nearHit = patchTree.findNearest(sample,
sqr(maxDistance_));
130 nearHit.setIndex(patchFaces[nearHit.index()]);
131 nearDist =
magSqr(nearHit.hitPoint() - sample);
136 nearHit.setIndex(-1);
149 OFstream str(
mesh().time().path() /
name() +
"_nearest.obj");
155 if (nearest[i].
first().hit())
161 str <<
"l " << verti - 1 <<
' ' << verti <<
nl;
170 const label& nearProc = nearest[sampleI].second().second();
176 label facei = nearHit.index();
178 samplingPositions.append(nearHit.hitPoint());
179 samplingSegments.append(sampleI);
180 samplingCells.append(
mesh().faceOwner()[facei]);
181 samplingFaces.append(facei);
187 <<
"Unable to find location on patches " << patches_
188 <<
" for the point " << points_[sampleI]
189 <<
" within a distance of " << maxDistance_ <<
endl;
195 void Foam::sampledSets::boundaryPoints::genSamples()
197 DynamicList<point> samplingPositions;
198 DynamicList<label> samplingSegments;
199 DynamicList<label> samplingCells;
200 DynamicList<label> samplingFaces;
210 samplingPositions.shrink();
211 samplingSegments.shrink();
212 samplingCells.shrink();
213 samplingFaces.shrink();
236 points_(dict.
lookup(
"points")),
237 patches_(dict.
lookup(
"patches")),
238 maxDistance_(dict.
lookup<scalar>(
"maxDistance"))
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search...
labelList first(const UList< labelPair > &p)
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.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
boundaryPoints(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const dictionary &dict)
Construct from dictionary.
static const Vector< scalar > max
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool master(const label communicator=0)
Am I the master process.
PointIndexHit< point > pointIndexHit
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.
static const layerAndWeight max
static const Vector< scalar > min
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
Holds list of sampling points which is filled at construction time. Various implementations of this b...
A class for handling words, derived from string.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
List< label > labelList
A List of labels.
addToRunTimeSelectionTable(sampledSet, arcUniform, word)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
virtual ~boundaryPoints()
Destructor.
word name(const complex &)
Return a string representation of a complex.
vector point
Point is a vector.
#define WarningInFunction
Report a warning using Foam::Warning.
const doubleScalar e
Elementary charge.
Mesh consisting of general polyhedral cells.
defineTypeNameAndDebug(arcUniform, 0)
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.