33 template<
class TransferType,
class TrackingData>
40 template<
class TransferType,
class TrackingData>
45 List<TransferType>& faceDist
50 label nChangedFaces = 0;
56 const polyPatch&
patch =
mesh.boundaryMesh()[patchi];
58 const Field<Type>& patchField = initialPatchValuePtrs_[patchi];
62 label meshFacei =
patch.start() + patchFacei;
64 changedFaces[nChangedFaces] = meshFacei;
66 faceDist[nChangedFaces] =
69 patch.faceCentres()[patchFacei],
70 patchField[patchFacei],
82 template<
class TransferType,
class TrackingData>
85 const MeshWave<TransferType, TrackingData>& waveInfo
90 const List<TransferType>& cellInfo = waveInfo.allCellInfo();
91 const List<TransferType>& faceInfo = waveInfo.allFaceInfo();
96 distance_.setSize(cellInfo.size());
100 const TransferType & wpn = cellInfo[celli];
102 scalar dist = wpn.distSqr();
104 if (cellInfo[celli].valid(waveInfo.data()))
108 cellData_[celli] = cellInfo[celli].data();
115 distance_[celli] =
mag(dist);
118 cellData_[celli] = cellInfo[celli].data();
125 forAll(patchDistance_, patchi)
127 const polyPatch&
patch =
mesh.boundaryMesh()[patchi];
132 patchDistance_.
set(patchi, patchFieldPtr);
137 Field<Type>* patchDataFieldPtr =
new Field<Type>(
patch.size());
139 patchData_.
set(patchi, patchDataFieldPtr);
141 Field<Type>& patchDataField = *patchDataFieldPtr;
144 forAll(patchField, patchFacei)
146 label meshFacei =
patch.start() + patchFacei;
148 scalar dist = faceInfo[meshFacei].distSqr();
150 if (faceInfo[meshFacei].valid(waveInfo.data()))
154 patchField[patchFacei] =
Foam::sqrt(dist) + SMALL;
156 patchDataField[patchFacei] = faceInfo[meshFacei].data();
162 patchField[patchFacei] =
mag(dist);
165 patchDataField[patchFacei] = faceInfo[meshFacei].data();
179 template<
class TransferType,
class TrackingData>
185 const bool correctWalls,
191 initialPatchValuePtrs_(initialPatchValuePtrs),
192 correctWalls_(correctWalls),
195 distance_(
mesh.nCells()),
197 cellData_(
mesh.nCells()),
206 template<
class TransferType,
class TrackingData>
214 template<
class TransferType,
class TrackingData>
223 label nWalls = sumPatchSize(patchIDs_);
228 setChangedFaces(patchIDs_, changedFaces, faceDist);
239 mesh().globalData().nTotalCells()+1,
248 nUnset_ = getValues(waveInfo);
259 correctBoundaryFaceCells
266 correctBoundaryPointCells
276 const labelList wallCells(nearestFace.toc());
278 forAll(wallCells, wallCelli)
280 label celli = wallCells[wallCelli];
282 label facei = nearestFace[celli];
284 cellData_[celli] = faceInfo[facei].
data();
const labelList patchIDs(pbm.indices(polyPatchNames, true))
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
T * data() noexcept
Return pointer to the underlying array serving as data storage.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface...
dimensionedScalar sqrt(const dimensionedScalar &ds)
Takes a set of patches to start MeshWave from.
#define forAll(list, i)
Loop across all elements in list.
Collection of functions used in wall distance calculation.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
virtual void correct()
Correct for mesh geom/topo changes.
Generic templated field type.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
const std::string patch
OpenFOAM patch number as a std::string.
Mesh consisting of general polyhedral cells.
List< label > labelList
A List of labels.
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.
virtual ~patchDataWave()
Destructor.