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
62 label nPatchFaces = 0;
65 const polyPatch& pp =
mesh().boundaryMesh()[iter.key()];
66 nPatchFaces += pp.size();
72 const polyPatch& pp =
mesh().boundaryMesh()[iter.key()];
75 patchFaces[nPatchFaces++] = pp.start()+i;
83 const polyPatch& pp =
mesh().boundaryMesh()[iter.key()];
84 const boundBox patchBb(pp.points(), pp.meshPoints(),
false);
85 patchBB.min() =
min(patchBB.min(), patchBb.min());
86 patchBB.max() =
max(patchBB.max(), patchBb.max());
88 patchBB = patchBB.extend(1
e-4);
91 indexedOctree<treeDataFace> patchTree
106 (void)
mesh().tetBasePtIs();
109 List<mappedPatchBase::nearInfo> nearest(points_.size());
112 const point& sample = points_[sampleI];
115 scalar& nearDist = nearest[sampleI].second().first();
116 label& nearProc = nearest[sampleI].second().second();
119 if (patchFaces.size())
121 nearHit = patchTree.findNearest(sample,
sqr(maxDistance_));
131 nearHit.setIndex(patchFaces[nearHit.index()]);
132 nearDist =
magSqr(nearHit.hitPoint() - sample);
137 nearHit.setIndex(-1);
150 OFstream str(
mesh().time().
path() /
name() +
"_nearest.obj");
156 if (nearest[i].
first().hit())
162 str <<
"l " << verti - 1 <<
' ' << verti <<
nl;
171 const label& nearProc = nearest[sampleI].second().second();
177 label facei = nearHit.index();
179 samplingPts.append(nearHit.hitPoint());
180 samplingCells.append(
mesh().faceOwner()[facei]);
181 samplingFaces.append(facei);
182 samplingSegments.append(0);
183 samplingCurveDist.append(sampleI);
189 <<
"Unable to find location on patches " << patches_
190 <<
" for the point " << points_[sampleI]
191 <<
" within a distance of " << maxDistance_ <<
endl;
197 void Foam::sampledSets::boundaryPoints::genSamples()
199 DynamicList<point> samplingPts;
200 DynamicList<label> samplingCells;
201 DynamicList<label> samplingFaces;
202 DynamicList<label> samplingSegments;
203 DynamicList<scalar> samplingCurveDist;
214 samplingPts.shrink();
215 samplingCells.shrink();
216 samplingFaces.shrink();
217 samplingSegments.shrink();
218 samplingCurveDist.shrink();
242 points_(dict.
lookup(
"points")),
243 patches_(dict.
lookup(
"patches")),
244 maxDistance_(dict.
lookup<scalar>(
"maxDistance"))
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
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.
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.
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.