53 void Foam::sampledSets::boundaryRandom::calcSamples
55 DynamicList<point>& samplingPositions,
56 DynamicList<label>& samplingSegments,
57 DynamicList<label>& samplingCells,
58 DynamicList<label>& samplingFaces
62 const labelList patchIDs(
mesh().boundaryMesh().patchSet(patches_).toc());
65 DynamicList<label> triFaces, triTetPts;
68 const polyPatch& patch =
mesh().boundaryMesh()[patchIDs[
patchi]];
72 const face& f = patch[patchFacei];
73 const label facei = patchFacei + patch.start();
75 for (
label tetPti = 1; tetPti < f.size() - 1; ++ tetPti)
77 triFaces.append(facei);
78 triTetPts.append(tetPti);
87 const tetIndices tetIs
89 mesh().faceOwner()[triFaces[trii]],
94 trisFraction[trii + 1] =
95 trisFraction[trii] + tetIs.faceTri(
mesh()).mag();
106 procsFraction[proci + 1] = procsFraction[proci] + procsArea[proci];
112 trisFraction /= trisFraction.last();
115 if (procsFraction.last() != 0)
117 procsFraction /= procsFraction.last();
123 for (
label i = 0; i < nPoints_; ++ i)
128 const scalar rProc =
rndGen.scalar01();
129 const scalar rTri =
rndGen.scalar01();
132 if (procsFraction[proci] < rProc && rProc <= procsFraction[proci + 1])
135 while (rTri > trisFraction[trii + 1])
140 const tetIndices tetIs
142 mesh().faceOwner()[triFaces[trii]],
150 (1 - rootSmall)*r2D.a(),
151 (1 - rootSmall)*r2D.b(),
152 (1 - rootSmall)*r2D.c()
155 samplingPositions.append(tetIs.tet(mesh()).barycentricToPoint(r3D));
156 samplingSegments.append(i);
157 samplingCells.append(tetIs.cell());
158 samplingFaces.append(tetIs.face());
164 void Foam::sampledSets::boundaryRandom::genSamples()
166 DynamicList<point> samplingPositions;
167 DynamicList<label> samplingSegments;
168 DynamicList<label> samplingCells;
169 DynamicList<label> samplingFaces;
179 samplingPositions.shrink();
180 samplingSegments.shrink();
181 samplingCells.shrink();
182 samplingFaces.shrink();
205 patches_(dict.
lookup(
"patches")),
barycentric2D barycentric2D01(Random &rndGen)
Generate a random barycentric coordinate within the unit triangle.
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.
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Barycentric2D< scalar > barycentric2D
A scalar version of the templated Barycentric2D.
A list of keyword definitions, which are a keyword followed by any number of values (e...
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Barycentric< scalar > barycentric
A scalar version of the templated Barycentric.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
virtual ~boundaryRandom()
Destructor.
Macros for easy insertion into run-time selection tables.
Holds list of sampling points which is filled at construction time. Various implementations of this b...
A class for handling words, derived from string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
List< label > labelList
A List of labels.
addToRunTimeSelectionTable(sampledSet, arcUniform, word)
static label nProcs(const label communicator=0)
Number of processes in parallel run.
boundaryRandom(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const dictionary &dict)
Construct from dictionary.
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.