Foam::autoPtr<Foam::indirectPrimitivePatch> Foam::streamLine::wallPatch() const { const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_); const polyBoundaryMesh& patches = mesh.boundaryMesh(); label nFaces = 0; forAll(patches, patchI) { //if (!polyPatch::constraintType(patches[patchI].type())) if (isA<wallPolyPatch>(patches[patchI])) { nFaces += patches[patchI].size(); } } labelList addressing(nFaces); nFaces = 0; forAll(patches, patchI) { //if (!polyPatch::constraintType(patches[patchI].type())) if (isA<wallPolyPatch>(patches[patchI])) { const polyPatch& pp = patches[patchI]; forAll(pp, i) { addressing[nFaces++] = pp.start()+i; } } }
/*Network Constructor*/ Network::Network() { init(); addressing(); createSocket(); }
//- Calculate inverse-distance weights for interpolative mapping void topoCellMapper::calcInverseDistanceWeights() const { if (weightsPtr_) { FatalErrorIn ( "void topoCellMapper::calcInverseDistanceWeights() const" ) << "Weights already calculated." << abort(FatalError); } // Fetch interpolative addressing const labelListList& addr = addressing(); // Allocate memory weightsPtr_ = new scalarListList(size()); scalarListList& w = *weightsPtr_; // Obtain cell-centre information from old/new meshes const vectorField& oldCentres = tMapper_.internalCentres(); const vectorField& newCentres = mesh_.cellCentres(); forAll(addr, cellI) { const labelList& mo = addr[cellI]; // Do mapped cells if (mo.size() == 1) { w[cellI] = scalarList(1, 1.0); } else { // Map from masters, inverse-distance weights scalar totalWeight = 0.0; w[cellI] = scalarList(mo.size(), 0.0); forAll (mo, oldCellI) { w[cellI][oldCellI] = ( 1.0/stabilise ( magSqr ( newCentres[cellI] - oldCentres[mo[oldCellI]] ), VSMALL ) ); totalWeight += w[cellI][oldCellI]; } // Normalize weights scalar normFactor = (1.0/totalWeight); forAll (mo, oldCellI) { w[cellI][oldCellI] *= normFactor; } } }
void topoCellMapper::mapInternalField ( const word& fieldName, const Field<gradType>& gF, Field<Type>& iF ) const { if (iF.size() != sizeBeforeMapping() || gF.size() != sizeBeforeMapping()) { FatalErrorIn ( "\n\n" "void topoCellMapper::mapInternalField<Type>\n" "(\n" " const word& fieldName,\n" " const Field<gradType>& gF,\n" " Field<Type>& iF\n" ") const\n" ) << "Incompatible size before mapping." << nl << " Field: " << fieldName << nl << " Field size: " << iF.size() << nl << " Gradient Field size: " << gF.size() << nl << " map size: " << sizeBeforeMapping() << nl << abort(FatalError); } // If we have direct addressing, map and bail out if (direct()) { iF.autoMap(*this); return; } // Fetch addressing const labelListList& cAddressing = addressing(); const List<scalarField>& wC = intersectionWeights(); const List<vectorField>& xC = intersectionCentres(); // Fetch geometry const vectorField& centres = tMapper_.internalCentres(); // Copy the original field Field<Type> fieldCpy(iF); // Resize to current dimensions iF.setSize(size()); // Map the internal field forAll(iF, cellI) { const labelList& addr = cAddressing[cellI]; iF[cellI] = pTraits<Type>::zero; forAll(addr, cellJ) { // Accumulate volume-weighted Taylor-series interpolate iF[cellI] += ( wC[cellI][cellJ] * ( fieldCpy[addr[cellJ]] + ( gF[addr[cellJ]] & ( xC[cellI][cellJ] - centres[addr[cellJ]] ) ) ) ); } } }