33template<
class TransferType,
class TrackingData>
34int Foam::patchDataWave<TransferType, TrackingData>::dummyTrackData_ = 12345;
40template<
class TransferType,
class TrackingData>
41void Foam::patchDataWave<TransferType, TrackingData>::setChangedFaces
44 DynamicList<label>& changedFaces,
45 DynamicList<TransferType>& faceDist
48 const polyMesh&
mesh = cellDistFuncs::mesh();
54 const polyPatch&
patch =
mesh.boundaryMesh()[patchi];
56 const auto areaFraction(
patch.areaFraction());
58 const auto faceCentres(
patch.faceCentres());
60 const Field<Type>& patchField = initialPatchValuePtrs_[patchi];
62 forAll(faceCentres, patchFacei)
67 || (areaFraction()[patchFacei] > 0.5)
70 label meshFacei =
patch.start() + patchFacei;
71 changedFaces.append(meshFacei);
77 faceCentres[patchFacei],
78 patchField[patchFacei],
90template<
class TransferType,
class TrackingData>
91Foam::label Foam::patchDataWave<TransferType, TrackingData>::getValues
93 const MeshWave<TransferType, TrackingData>& waveInfo
96 const polyMesh&
mesh = cellDistFuncs::mesh();
98 const List<TransferType>& cellInfo = waveInfo.allCellInfo();
99 const List<TransferType>& faceInfo = waveInfo.allFaceInfo();
104 distance_.setSize(cellInfo.size());
108 const TransferType & wpn = cellInfo[celli];
110 scalar dist = wpn.distSqr();
112 if (cellInfo[celli].valid(waveInfo.data()))
116 cellData_[celli] = cellInfo[celli].data();
123 distance_[celli] =
mag(dist);
126 cellData_[celli] = cellInfo[celli].data();
133 forAll(patchDistance_, patchi)
135 const polyPatch&
patch =
mesh.boundaryMesh()[patchi];
140 patchDistance_.set(patchi, patchFieldPtr);
145 Field<Type>* patchDataFieldPtr =
new Field<Type>(
patch.size());
147 patchData_.set(patchi, patchDataFieldPtr);
149 Field<Type>& patchDataField = *patchDataFieldPtr;
152 forAll(patchField, patchFacei)
154 label meshFacei =
patch.start() + patchFacei;
156 scalar dist = faceInfo[meshFacei].distSqr();
158 if (faceInfo[meshFacei].valid(waveInfo.data()))
162 patchField[patchFacei] =
Foam::sqrt(dist) + SMALL;
164 patchDataField[patchFacei] = faceInfo[meshFacei].data();
170 patchField[patchFacei] =
mag(dist);
173 patchDataField[patchFacei] = faceInfo[meshFacei].data();
187template<
class TransferType,
class TrackingData>
193 const bool correctWalls,
199 initialPatchValuePtrs_(initialPatchValuePtrs),
200 correctWalls_(correctWalls),
203 distance_(
mesh.nCells()),
205 cellData_(
mesh.nCells()),
214template<
class TransferType,
class TrackingData>
222template<
class TransferType,
class TrackingData>
231 label nWalls = sumPatchSize(patchIDs_);
236 setChangedFaces(patchIDs_, changedFaces, faceDist);
247 mesh().globalData().nTotalCells()+1,
256 nUnset_ = getValues(waveInfo);
271 patchIDs_.sortedToc(),
280 correctBoundaryFaceCells
287 correctBoundaryPointCells
299 const labelList wallCells(nearestFace.toc());
301 forAll(wallCells, wallCelli)
303 label celli = wallCells[wallCelli];
305 label facei = nearestFace[celli];
307 cellData_[celli] = faceInfo[facei].data();
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
List< Key > toc() const
The table of contents (the keys) in unsorted order.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A HashTable to objects of type <T> with a label key.
const List< Type > & allFaceInfo() const noexcept
Get allFaceInfo.
T * data() noexcept
Return pointer to the underlying array serving as data storage.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
Collection of functions used in wall distance calculation.
label sumPatchSize(const labelHashSet &patchIDs) const
Sum of patch sizes (out of supplied subset of patches).
const polyMesh & mesh() const
Access mesh.
void correctBoundaryFaceCells(const labelHashSet &patchIDs, scalarField &wallDistCorrected, Map< label > &nearestFace) const
Correct all cells connected to boundary (via face). Sets values in.
void correctBoundaryCells(const labelList &patchIDs, const bool doPointCells, scalarField &wallDistCorrected, Map< label > &nearestFace) const
Correct all cells connected to any of the patches in patchIDs. Sets.
void correctBoundaryPointCells(const labelHashSet &patchIDs, scalarField &wallDistCorrected, Map< label > &nearestFace) const
Correct all cells connected to wall (via point). Sets values in.
static bool useCombinedWallPatch
Use combined-wall-patches wall distance v.s. v2406 per-patch distance. Default is true.
virtual ~patchDataWave()
Destructor.
virtual void correct()
Correct for mesh geom/topo changes.
patchDataWave(const polyMesh &mesh, const labelHashSet &patchIDs, const UPtrList< Field< Type > > &initialPatchValuePtrs, const bool correctWalls=true, TrackingData &td=dummyTrackData_)
Construct from mesh, information on patches to initialize and flag.
Mesh consisting of general polyhedral cells.
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
const std::string patch
OpenFOAM patch number as a std::string.
List< label > labelList
A List of labels.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
#define forAll(list, i)
Loop across all elements in list.