43 patchName_(patchName),
44 patchId_(mesh.boundaryMesh().findPatchID(patchName_)),
52 <<
"Requested patch " <<
patchName_ <<
" not found" <<
nl
63 patchName_(pib.patchName_),
64 patchId_(pib.patchId_),
65 sumProcArea_(pib.sumProcArea_),
66 sumFaceArea_(pib.sumFaceArea_),
67 sumFaceTriArea_(pib.sumFaceTriArea_)
87 sumFaceArea_.resize(patch.size());
89 sumFaceTriArea_.resize(patch.size());
92 sumFaceTriArea_[patchFacei].resize(patch[patchFacei].nTriangles());
93 sumFaceTriArea_[patchFacei] = 0;
100 const label facei = patchFacei + patch.
start();
103 scalar patchFaceArea = 0;
106 label patchFaceTrii = 0;
107 patchFaceTrii < patch[patchFacei].nTriangles();
111 const tetIndices tet(celli, facei, patchFaceTrii + 1);
114 sumFaceTriArea_[patchFacei][patchFaceTrii] = patchFaceArea;
117 patchArea += patchFaceArea;
118 sumFaceArea_[patchFacei] = patchArea;
127 sumProcArea_[proci] += sumProcArea_[proci - 1];
150 for (
label i = areas.
size(); i > 0; i --)
152 if (area >= areas[i - 1])
154 area -= areas[i - 1];
166 if (patch.size() > 0)
169 const label proci = findArea(sumProcArea_, area);
175 const label patchFacei = findArea(sumFaceArea_, area);
178 const label patchFaceTrii =
179 findArea(sumFaceTriArea_[patchFacei], area);
185 tetFacei = patch.
start() + patchFacei;
186 tetPti = patchFaceTrii + 1;
187 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)
scalar globalScalar01()
Advance the state and return a scalar sample from a uniform.
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.
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 setPositionAndCell(const fvMesh &mesh, Random &rnd, barycentric &coordinates, label &celli, label &tetFacei, label &tetPti, label &facei)
Set the injection position and owner cell, tetFace and tetPt.
virtual void topoChange(const polyMesh &mesh)
Update patch geometry and derived info for injection locations.
wordList names() const
Return a 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.
barycentric2D barycentric2D01(Random &rndGen)
Generate a random barycentric coordinate within the unit triangle.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.