Go to the documentation of this file.
40 patchName_(patchName),
41 patchId_(
mesh.boundaryMesh().findPatchID(patchName_)),
47 triCumulativeMagSf_(),
48 sumTriMagSf_(Pstream::nProcs() + 1, 0.0)
53 <<
"Requested patch " << patchName_ <<
" not found" <<
nl
54 <<
"Available patches are: " <<
mesh.boundaryMesh().names() <<
nl
64 patchName_(pib.patchName_),
65 patchId_(pib.patchId_),
66 patchArea_(pib.patchArea_),
67 patchNormal_(pib.patchNormal_),
68 cellOwners_(pib.cellOwners_),
69 triFace_(pib.triFace_),
70 triToFace_(pib.triToFace_),
71 triCumulativeMagSf_(pib.triCumulativeMagSf_),
72 sumTriMagSf_(pib.sumTriMagSf_)
103 const face&
f = patch[faceI];
118 sumTriMagSf_[i] = 0.0;
126 for (
label i = 1; i < triMagSf.size(); i++)
128 triMagSf[i] += triMagSf[i-1];
133 triToFace_.transfer(triToFace);
134 triCumulativeMagSf_.transfer(triMagSf);
137 for (
label i = 1; i < sumTriMagSf_.size(); i++)
139 sumTriMagSf_[i] += sumTriMagSf_[i-1];
143 patchArea_ =
sum(magSf);
159 scalar areaFraction = 0;
163 areaFraction = rnd.
position<scalar>(0, patchArea_);
168 if (cellOwners_.size() > 0)
174 if (areaFraction >= sumTriMagSf_[i])
185 scalar offset = sumTriMagSf_[procI];
188 if (areaFraction > triCumulativeMagSf_[i] + offset)
196 label faceI = triToFace_[triI];
197 cellOwner = cellOwners_[faceI];
202 const face&
tf = triFace_[triI];
207 const scalar a = rnd.
position(scalar(0.1), scalar(0.5));
209 const vector d =
mag(pf - pc)*patchNormal_[faceI];
const Field< PointType > & points() const
Return reference to global points.
A class for handling words, derived from string.
Point randomPoint(Random &rndGen) const
Return a random point on the triangle from a uniform.
#define forAll(list, i)
Loop across all elements in list.
virtual ~patchInjectionBase()
Destructor.
static void scatter(const List< commsStruct > &comms, T &Value, const int tag, const label comm)
Scatter data. Distribute without modification. Reverse of gather.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
dimensioned< scalar > mag(const dimensioned< Type > &)
Mesh consisting of general polyhedral cells.
A triangle primitive used to calculate face normals and swept volumes.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
patchInjectionBase(const polyMesh &mesh, const word &patchName)
Construct from mesh and patch name.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
Type position(const Type &start, const Type &end)
Return a sample between start and end.
A patch is a list of labels that address the faces in the global face list.
void clear()
Clear the addressed list, i.e. set the size to zero.
virtual void updateMesh(const polyMesh &mesh)
Update patch geometry and derived info for injection locations.
void findCellFacePt(const point &p, label &celli, label &tetFacei, label &tetPti) const
Find the cell, tetFacei and tetPti for point p.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
const labelUList & faceCells() const
Return face-cell addressing.
virtual void setPositionAndCell(const polyMesh &mesh, cachedRandom &rnd, vector &position, label &cellOwner, label &tetFaceI, label &tetPtI)
Set the injection position and owner cell, tetFace and tetPt.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
static bool master(const label communicator=0)
Am I the master process.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
const vectorField & cellCentres() const
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A triangular face using a FixedList of labels corresponding to mesh vertices.
Traits class for primitives.
const vectorField::subField faceAreas() const
Return face normals.
void transfer(List< T > &)
Transfer contents of the argument List into this.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
A face is a list of labels corresponding to mesh vertices.
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.