49 void Foam::sampledSets::boundaryPoints::calcSamples
51 DynamicList<point>& samplingPts,
52 DynamicList<label>& samplingCells,
53 DynamicList<label>& samplingFaces,
54 DynamicList<label>& samplingSegments,
55 DynamicList<scalar>& samplingCurveDist
59 label nPatchFaces = 0;
62 const polyPatch& pp =
mesh().boundaryMesh()[iter.key()];
63 nPatchFaces += pp.size();
69 const polyPatch& pp =
mesh().boundaryMesh()[iter.key()];
72 patchFaces[nPatchFaces++] = pp.start()+i;
80 const polyPatch& pp =
mesh().boundaryMesh()[iter.key()];
81 const boundBox patchBb(pp.points(), pp.meshPoints(),
false);
82 patchBB.min() =
min(patchBB.min(), patchBb.min());
83 patchBB.max() =
max(patchBB.max(), patchBb.max());
85 patchBB = patchBB.extend(1
e-4);
88 indexedOctree<treeDataFace> patchTree
103 (void)
mesh().tetBasePtIs();
106 List<mappedPatchBase::nearInfo> nearest(points_.size());
109 const point& sample = points_[sampleI];
112 scalar& nearDist = nearest[sampleI].second().first();
113 label& nearProc = nearest[sampleI].second().second();
116 if (patchFaces.size())
118 nearHit = patchTree.findNearest(sample,
sqr(maxDistance_));
128 nearHit.setIndex(patchFaces[nearHit.index()]);
129 nearDist =
magSqr(nearHit.hitPoint() - sample);
134 nearHit.setIndex(-1);
147 OFstream str(
mesh().time().
path() /
name() +
"_nearest.obj");
153 if (nearest[i].
first().hit())
159 str <<
"l " << verti - 1 <<
' ' << verti <<
nl;
168 const label& nearProc = nearest[sampleI].second().second();
174 label facei = nearHit.index();
176 samplingPts.append(nearHit.hitPoint());
177 samplingCells.append(
mesh().faceOwner()[facei]);
178 samplingFaces.append(facei);
179 samplingSegments.append(0);
180 samplingCurveDist.append(sampleI);
186 <<
"Unable to find location on patches " << patches_
187 <<
" for the point " << points_[sampleI]
188 <<
" within a distance of " << maxDistance_ <<
endl;
194 void Foam::sampledSets::boundaryPoints::genSamples()
196 DynamicList<point> samplingPts;
197 DynamicList<label> samplingCells;
198 DynamicList<label> samplingFaces;
199 DynamicList<label> samplingSegments;
200 DynamicList<scalar> samplingCurveDist;
211 samplingPts.shrink();
212 samplingCells.shrink();
213 samplingFaces.shrink();
214 samplingSegments.shrink();
215 samplingCurveDist.shrink();
239 points_(dict.
lookup(
"points")),
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search...
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.
intWM_LABEL_SIZE_t 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
const word & name() const
Return the name of this functionObject.
A list of keyword definitions, which are a keyword followed by any number of values (e...
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< 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
labelHashSet patchSet(const UList< wordRe > &patchNames, const bool warnNotFound=true, const bool usePatchGroups=true) const
Return the set of patch IDs corresponding to the given names.
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 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.
List< label > labelList
A List of labels.
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if successful.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
addToRunTimeSelectionTable(sampledSet, arcUniform, word)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
virtual ~boundaryPoints()
Destructor.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
vector point
Point is a vector.
#define WarningInFunction
Report a warning using Foam::Warning.
virtual bool write()
Sample and write.
const doubleScalar e
Elementary charge.
Mesh consisting of general polyhedral cells.
List< wordRe > wordReList
A List of wordRe (word or regular expression)
defineTypeNameAndDebug(arcUniform, 0)
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
fileName path(UMean.rootPath()/UMean.caseName()/functionObjects::writeFile::outputPrefix/"graphs"/UMean.instance())
T & first()
Return reference to the first element of the list.