Foam::sampledPatchInternalField::sampledPatchInternalField ( const word& name, const polyMesh& mesh, const dictionary& dict ) : sampledPatch(name, mesh, dict), mappers_(patchIDs().size()) { const scalar distance = readScalar(dict.lookup("distance")); forAll(patchIDs(), i) { label patchI = patchIDs()[i]; mappers_.set ( i, new directMappedPatchBase ( mesh.boundaryMesh()[patchI], mesh.name(), // sampleRegion directMappedPatchBase::NEARESTCELL, // sampleMode word::null, // samplePatch -distance // sample inside my domain ) ); }
bool Foam::sampledPatch::update() { if (!needsUpdate_) { return false; } label sz = 0; forAll(patchIDs(), i) { label patchI = patchIDs()[i]; const polyPatch& pp = mesh().boundaryMesh()[patchI]; if (isA<emptyPolyPatch>(pp)) { FatalErrorIn("sampledPatch::update()") << "Cannot sample an empty patch. Patch " << pp.name() << exit(FatalError); } sz += pp.size(); }
forAll(patchIDs(), i) { label patchI = patchIDs()[i]; patchStart_[i] = sz; const polyPatch& pp = mesh().boundaryMesh()[patchI]; forAll(pp, j) { patchIndex_[sz] = i; patchFaceLabels_[sz] = j; meshFaceLabels[sz] = pp.start()+j; sz++; }
Foam::labelHashSet Foam::cellDistFuncs::getPatchIDs() const { const polyBoundaryMesh& bMesh = mesh().boundaryMesh(); labelHashSet patchIDs(bMesh.size()); forAll(bMesh, patchI) { if (isA<Type>(bMesh[patchI])) { patchIDs.insert(patchI); } } return patchIDs; }
Foam::labelHashSet Foam::polyBoundaryMesh::findPatchIDs() const { const polyBoundaryMesh& bm = *this; labelHashSet patchIDs(bm.size()); forAll(bm, patchi) { if (isA<Type>(bm[patchi])) { patchIDs.insert(patchi); } } return patchIDs; }
Foam::labelList Foam::structuredDecomp::decompose ( const polyMesh& mesh, const pointField& cc, const scalarField& cWeights ) { labelList patchIDs(patches_.size()); const polyBoundaryMesh& pbm = mesh.boundaryMesh(); label nFaces = 0; forAll(patches_, i) { patchIDs[i] = pbm.findPatchID(patches_[i]); if (patchIDs[i] == -1) { FatalErrorIn("structuredDecomp::decompose(..)") << "Cannot find patch " << patches_[i] << endl << "Valid patches are " << pbm.names() << exit(FatalError); } nFaces += pbm[patchIDs[i]].size(); }
if (isA<emptyPolyPatch>(pp)) { FatalErrorIn("sampledPatch::update()") << "Cannot sample an empty patch. Patch " << pp.name() << exit(FatalError); } sz += pp.size(); } // For every face (or triangle) the originating patch and local face in the // patch. patchIndex_.setSize(sz); patchFaceLabels_.setSize(sz); patchStart_.setSize(patchIDs().size()); labelList meshFaceLabels(sz); sz = 0; forAll(patchIDs(), i) { label patchI = patchIDs()[i]; patchStart_[i] = sz; const polyPatch& pp = mesh().boundaryMesh()[patchI]; forAll(pp, j) { patchIndex_[sz] = i;