44 patchName_(patchName),
45 patchId_(mesh.boundaryMesh().
findIndex(patchName_)),
53 <<
"Requested patch " <<
patchName_ <<
" not found" <<
nl
64 patchName_(pib.patchName_),
65 patchId_(pib.patchId_),
66 sumProcArea_(pib.sumProcArea_),
67 sumFaceArea_(pib.sumFaceArea_),
68 sumFaceTriArea_(pib.sumFaceTriArea_)
88 sumFaceArea_.resize(patch.
size());
90 sumFaceTriArea_.resize(patch.
size());
93 sumFaceTriArea_[patchFacei].resize(patch[patchFacei].nTriangles());
94 sumFaceTriArea_[patchFacei] = 0;
101 const label facei = patchFacei + patch.
start();
104 scalar patchFaceArea = 0;
108 patchFaceTrii < patch[patchFacei].nTriangles();
112 const tetIndices tet(celli, facei, patchFaceTrii + 1);
115 sumFaceTriArea_[patchFacei][patchFaceTrii] = patchFaceArea;
118 patchArea += patchFaceArea;
119 sumFaceArea_[patchFacei] = patchArea;
128 sumProcArea_[proci] += sumProcArea_[proci - 1];
151 for (
label i = areas.
size(); i > 0; i --)
153 if (area >= areas[i - 1])
155 area -= areas[i - 1];
167 if (patch.
size() > 0)
170 const label proci = findArea(sumProcArea_, area);
176 const label patchFacei = findArea(sumFaceArea_, area);
179 const label patchFaceTrii =
180 findArea(sumFaceTriArea_[patchFacei], area);
186 tetFacei = patch.
start() + patchFacei;
187 tetPti = patchFaceTrii + 1;
188 facei = patch.
start() + patchFacei;
#define forAll(list, i)
Loop across all elements in list.
Templated 2D Barycentric derived from VectorSpace. Has 3 components, one of which is redundant.
void size(const label)
Override size to be inconsistent with allocated storage.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
void resize(const label)
Alias for setSize(const label)
label size() const
Return the number of elements in the UList.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
static Form uniform(const Cmpt &s)
Return a VectorSpace with all elements = s.
Mesh data needed to do the Finite Volume discretisation.
static scalar globalScalar01(randomGenerator &rndGen)
Return a scalar uniformly distributed between zero and one. Samples.
Base class for patch-based injection models.
virtual ~patchInjectionBase()
Destructor.
const word patchName_
Patch name.
const label patchId_
Patch ID.
patchInjectionBase(const polyMesh &mesh, const word &patchName)
Construct from mesh and patch name.
virtual void topoChange(const polyMesh &mesh)
Update patch geometry and derived info for injection locations.
virtual void setPositionAndCell(const fvMesh &mesh, randomGenerator &rndGen, barycentric &coordinates, label &celli, label &tetFacei, label &tetPti, label &facei)
Set the injection position and owner cell, tetFace and tetPt.
wordList names() const
Return the list of patch names.
Mesh consisting of general polyhedral cells.
virtual const labelList & faceOwner() const
Return face owner.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
A patch is a list of labels that address the faces in the global face list.
label start() const
Return start label of this patch in the polyMesh face list.
const labelUList & faceCells() const
Return face-cell addressing.
Storage and named access for the indices of a tet which is part of the decomposition of a cell.
triPointRef faceTri(const polyMesh &mesh) const
Return the geometry corresponding to the tri on the face for.
scalar mag() const
Return scalar magnitude.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Barycentric< scalar > barycentric
A scalar version of the templated Barycentric.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
barycentric2D barycentric2D01(randomGenerator &rndGen)
Generate a random barycentric coordinate within the unit triangle.
randomGenerator rndGen(653213)