From e651d63566897f00b049f56d461f48aedb9d129e Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 8 Feb 2024 14:58:10 +0000 Subject: [PATCH 1/5] ENH: cyclicAMI - clear finished send/recv requests --- .../cyclicACMI/cyclicACMIFvPatchField.C | 68 ++++++++++++------- .../cyclicAMI/cyclicAMIFvPatchField.C | 55 ++++++++++++++- .../cyclicACMIGAMGInterfaceField.C | 17 ++++- .../cyclicAMIGAMGInterfaceField.C | 17 ++++- 4 files changed, 129 insertions(+), 28 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.C index 3bc1a504bb..7c139b2f9f 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2017 OpenFOAM Foundation - Copyright (C) 2019-2023 OpenCFD Ltd. + Copyright (C) 2019-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -444,7 +444,14 @@ void Foam::cyclicACMIFvPatchField::initEvaluate << " starting send&receive" << endl; - if (!this->ready()) + // Bypass polyPatch to get nbrId. + // - use cyclicACMIFvPatch::neighbPatch() virtual instead + const cyclicACMIFvPatch& neighbPatch = cyclicACMIPatch_.neighbPatch(); + const labelUList& nbrFaceCells = neighbPatch.faceCells(); + const Field pnf(this->primitiveField(), nbrFaceCells); + + // Assert that all receives are known to have finished + if (!recvRequests_.empty()) { FatalErrorInFunction << "Outstanding recv request(s) on patch " @@ -453,11 +460,8 @@ void Foam::cyclicACMIFvPatchField::initEvaluate << abort(FatalError); } - // By-pass polyPatch to get nbrId. Instead use cyclicACMIFvPatch virtual - // neighbPatch() - const cyclicACMIFvPatch& neighbPatch = cyclicACMIPatch_.neighbPatch(); - const labelUList& nbrFaceCells = neighbPatch.faceCells(); - const Field pnf(this->primitiveField(), nbrFaceCells); + // Assume that sends are also OK + sendRequests_.clear(); cyclicACMIPatch_.initInterpolate ( @@ -515,6 +519,10 @@ void Foam::cyclicACMIFvPatchField::evaluate ).ptr() ); + // Receive requests all handled by last function call + recvRequests_.clear(); + + auto& patchNeighbourField = patchNeighbourFieldPtr_.ref(); if (doTransform()) @@ -559,7 +567,16 @@ void Foam::cyclicACMIFvPatchField::initInterfaceMatrixUpdate << " starting send&receive" << endl; - if (!this->ready()) + const labelUList& nbrFaceCells = + lduAddr.patchAddr(cyclicACMIPatch_.neighbPatchID()); + + solveScalarField pnf(psiInternal, nbrFaceCells); + + // Transform according to the transformation tensors + transformCoupleField(pnf, cmpt); + + // Assert that all receives are known to have finished + if (!recvRequests_.empty()) { FatalErrorInFunction << "Outstanding recv request(s) on patch " @@ -568,13 +585,8 @@ void Foam::cyclicACMIFvPatchField::initInterfaceMatrixUpdate << abort(FatalError); } - const labelUList& nbrFaceCells = - lduAddr.patchAddr(cyclicACMIPatch_.neighbPatchID()); - - solveScalarField pnf(psiInternal, nbrFaceCells); - - // Transform according to the transformation tensors - transformCoupleField(pnf, cmpt); + // Assume that sends are also OK + sendRequests_.clear(); cyclicACMIPatch_.initInterpolate ( @@ -635,6 +647,9 @@ void Foam::cyclicACMIFvPatchField::updateInterfaceMatrix recvRequests_, scalarRecvBufs_ ); + + // Receive requests all handled by last function call + recvRequests_.clear(); } else { @@ -676,7 +691,16 @@ void Foam::cyclicACMIFvPatchField::initInterfaceMatrixUpdate << exit(FatalError); } - if (!this->ready()) + const labelUList& nbrFaceCells = + lduAddr.patchAddr(cyclicACMIPatch_.neighbPatchID()); + + Field pnf(psiInternal, nbrFaceCells); + + // Transform according to the transformation tensors + transformCoupleField(pnf); + + // Assert that all receives are known to have finished + if (!recvRequests_.empty()) { FatalErrorInFunction << "Outstanding recv request(s) on patch " @@ -685,13 +709,8 @@ void Foam::cyclicACMIFvPatchField::initInterfaceMatrixUpdate << abort(FatalError); } - const labelUList& nbrFaceCells = - lduAddr.patchAddr(cyclicACMIPatch_.neighbPatchID()); - - Field pnf(psiInternal, nbrFaceCells); - - // Transform according to the transformation tensors - transformCoupleField(pnf); + // Assume that sends are also OK + sendRequests_.clear(); cyclicACMIPatch_.initInterpolate ( @@ -741,6 +760,9 @@ void Foam::cyclicACMIFvPatchField::updateInterfaceMatrix recvRequests_, recvBufs_ ); + + // Receive requests all handled by last function call + recvRequests_.clear(); } else { diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C index b732866cb0..452d119105 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019-2023 OpenCFD Ltd. + Copyright (C) 2019-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -446,14 +446,27 @@ void Foam::cyclicAMIFvPatchField::initEvaluate // Start sending - // By-pass polyPatch to get nbrId. Instead use cyclicAMIFvPatch virtual - // neighbPatch() + // Bypass polyPatch to get nbrId. + // - use cyclicACMIFvPatch::neighbPatch() virtual instead const cyclicAMIFvPatch& neighbPatch = cyclicAMIPatch_.neighbPatch(); const labelUList& nbrFaceCells = neighbPatch.faceCells(); const Field pnf(this->primitiveField(), nbrFaceCells); const cyclicAMIPolyPatch& cpp = cyclicAMIPatch_.cyclicAMIPatch(); + // Assert that all receives are known to have finished + if (!recvRequests_.empty()) + { + FatalErrorInFunction + << "Outstanding recv request(s) on patch " + << cyclicAMIPatch_.name() + << " field " << this->internalField().name() + << abort(FatalError); + } + + // Assume that sends are also OK + sendRequests_.clear(); + cpp.initInterpolate ( pnf, @@ -516,6 +529,10 @@ void Foam::cyclicAMIFvPatchField::evaluate defaultValues ).ptr() ); + + // Receive requests all handled by last function call + recvRequests_.clear(); + auto& patchNeighbourField = patchNeighbourFieldPtr_.ref(); if (doTransform()) @@ -563,6 +580,19 @@ void Foam::cyclicAMIFvPatchField::initInterfaceMatrixUpdate const cyclicAMIPolyPatch& cpp = cyclicAMIPatch_.cyclicAMIPatch(); + // Assert that all receives are known to have finished + if (!recvRequests_.empty()) + { + FatalErrorInFunction + << "Outstanding recv request(s) on patch " + << cyclicAMIPatch_.name() + << " field " << this->internalField().name() + << abort(FatalError); + } + + // Assume that sends are also OK + sendRequests_.clear(); + cpp.initInterpolate ( pnf, @@ -624,6 +654,9 @@ void Foam::cyclicAMIFvPatchField::updateInterfaceMatrix scalarRecvBufs_, defaultValues ); + + // Receive requests all handled by last function call + recvRequests_.clear(); } else { @@ -682,6 +715,19 @@ void Foam::cyclicAMIFvPatchField::initInterfaceMatrixUpdate const cyclicAMIPolyPatch& cpp = cyclicAMIPatch_.cyclicAMIPatch(); + // Assert that all receives are known to have finished + if (!recvRequests_.empty()) + { + FatalErrorInFunction + << "Outstanding recv request(s) on patch " + << cyclicAMIPatch_.name() + << " field " << this->internalField().name() + << abort(FatalError); + } + + // Assume that sends are also OK + sendRequests_.clear(); + cpp.initInterpolate ( pnf, @@ -742,6 +788,9 @@ void Foam::cyclicAMIFvPatchField::updateInterfaceMatrix recvBufs_, defaultValues ); + + // Receive requests all handled by last function call + recvRequests_.clear(); } else { diff --git a/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicACMIGAMGInterfaceField/cyclicACMIGAMGInterfaceField.C b/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicACMIGAMGInterfaceField/cyclicACMIGAMGInterfaceField.C index 5f41ba8cef..2d4491ca77 100644 --- a/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicACMIGAMGInterfaceField/cyclicACMIGAMGInterfaceField.C +++ b/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicACMIGAMGInterfaceField/cyclicACMIGAMGInterfaceField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013 OpenFOAM Foundation - Copyright (C) 2019,2023 OpenCFD Ltd. + Copyright (C) 2019-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -217,6 +217,18 @@ void Foam::cyclicACMIGAMGInterfaceField::initInterfaceMatrixUpdate : AMI.srcMap() ); + // Assert that all receives are known to have finished + if (!recvRequests_.empty()) + { + FatalErrorInFunction + << "Outstanding recv request(s) on patch " + << cyclicACMIInterface_.index() + << abort(FatalError); + } + + // Assume that sends are also OK + sendRequests_.clear(); + // Insert send/receive requests (non-blocking). See e.g. // cyclicAMIPolyPatchTemplates.C const label oldWarnComm = UPstream::commWarn(AMI.comm()); @@ -276,6 +288,9 @@ void Foam::cyclicACMIGAMGInterfaceField::updateInterfaceMatrix solveScalarField work; map.receive(recvRequests_, scalarRecvBufs_, work); + // Receive requests all handled by last function call + recvRequests_.clear(); + solveScalarField pnf(faceCells.size(), Zero); AMI.weightedSum ( diff --git a/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicAMIGAMGInterfaceField/cyclicAMIGAMGInterfaceField.C b/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicAMIGAMGInterfaceField/cyclicAMIGAMGInterfaceField.C index 793fe4bfa4..68d19e6c1d 100644 --- a/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicAMIGAMGInterfaceField/cyclicAMIGAMGInterfaceField.C +++ b/src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicAMIGAMGInterfaceField/cyclicAMIGAMGInterfaceField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2013 OpenFOAM Foundation - Copyright (C) 2019,2023 OpenCFD Ltd. + Copyright (C) 2019-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -218,6 +218,18 @@ void Foam::cyclicAMIGAMGInterfaceField::initInterfaceMatrixUpdate : AMI.srcMap() ); + // Assert that all receives are known to have finished + if (!recvRequests_.empty()) + { + FatalErrorInFunction + << "Outstanding recv request(s) on patch " + << cyclicAMIInterface_.index() + << abort(FatalError); + } + + // Assume that sends are also OK + sendRequests_.clear(); + // Insert send/receive requests (non-blocking). See e.g. // cyclicAMIPolyPatchTemplates.C const label oldWarnComm = UPstream::commWarn(AMI.comm()); @@ -290,6 +302,9 @@ void Foam::cyclicAMIGAMGInterfaceField::updateInterfaceMatrix solveScalarField work; map.receive(recvRequests_, scalarRecvBufs_, work); + // Receive requests all handled by last function call + recvRequests_.clear(); + solveScalarField pnf(faceCells.size(), Zero); AMI.weightedSum ( From 0ef758997936b28d99cfbf1e36bcc55f300194a7 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 2 May 2024 09:44:47 +0200 Subject: [PATCH 2/5] BUG: sampledMeshSurface sampling on "empty" patch fails - requires a field size check when copying into the flat boundary --- .../sampledMeshedSurfaceTemplates.C | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/sampling/sampledSurface/sampledMeshedSurface/sampledMeshedSurfaceTemplates.C b/src/sampling/sampledSurface/sampledMeshedSurface/sampledMeshedSurfaceTemplates.C index 6fa28be7ea..3e6c9b85c3 100644 --- a/src/sampling/sampledSurface/sampledMeshedSurface/sampledMeshedSurfaceTemplates.C +++ b/src/sampling/sampledSurface/sampledMeshedSurface/sampledMeshedSurfaceTemplates.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -39,7 +39,11 @@ Foam::sampledMeshedSurface::sampleOnFaces { const Type deflt ( - defaultValues_.getOrDefault(sampler.psi().name(), Zero) + defaultValues_.getOrDefault + ( + sampler.psi().name(), + Foam::zero{} + ) ); const labelList& elements = sampleElements_; @@ -71,13 +75,16 @@ Foam::sampledMeshedSurface::sampleOnFaces const polyBoundaryMesh& pbm = mesh().boundaryMesh(); - Field bVals(mesh().nBoundaryFaces(), Zero); + Field bVals(mesh().nBoundaryFaces(), deflt); const auto& bField = sampler.psi().boundaryField(); forAll(bField, patchi) { - SubList(bVals, pbm[patchi].range()) = bField[patchi]; + // Note: restrict transcribing to actual size of the patch field + // - handles "empty" patch type etc. + const auto& pfld = bField[patchi]; + SubList(bVals, pfld.size(), pbm[patchi].offset()) = pfld; } // Sample within the flat boundary field @@ -109,7 +116,11 @@ Foam::sampledMeshedSurface::sampleOnPoints { const Type deflt ( - defaultValues_.getOrDefault(interpolator.psi().name(), Zero) + defaultValues_.getOrDefault + ( + interpolator.psi().name(), + Foam::zero{} + ) ); const labelList& elements = sampleElements_; From 6581c5792a21ac0c0a09fe5c4741ca25aa013cb3 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 20 May 2024 12:17:04 +0100 Subject: [PATCH 3/5] BUG: STL: cannot handle files > 2Gb. Fixes #3171 --- src/fileFormats/stl/STLCore.C | 98 ++++++++++++++++++++++------------- 1 file changed, 62 insertions(+), 36 deletions(-) diff --git a/src/fileFormats/stl/STLCore.C b/src/fileFormats/stl/STLCore.C index 69749a70ff..b77d68a7ad 100644 --- a/src/fileFormats/stl/STLCore.C +++ b/src/fileFormats/stl/STLCore.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2023 OpenCFD Ltd. + Copyright (C) 2016-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -61,6 +61,36 @@ static bool startsWithSolid(const char header[STLHeaderSize]) } +// Check if file size appears to be reasonable for an STL binary file. +// Compare file size with that expected from number of tris +// If this is not sensible, it may be an ASCII file +// +// sizeof(STLtriangle) = 50 bytes [int16 + 4 * (3 float)] + +inline static bool checkBinaryFileSize +( + const int64_t nTris, + const Foam::fileName& file +) +{ + // When checking the content size, account for the header size (80), + // but ignore the nTris information (int32_t) to give some rounding + + const int64_t contentSize = + ( + int64_t(Foam::fileSize(file)) + - int64_t(STLHeaderSize) + ); + + return + ( + (contentSize >= 0) + && (nTris >= contentSize/50) + && (nTris <= contentSize/25) + ); +} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // bool Foam::fileFormats::STLCore::isBinaryName @@ -117,31 +147,31 @@ int Foam::fileFormats::STLCore::detectBinaryHeader // Read the number of triangles in the STL file - // (note: read as signed so we can check whether >2^31) + // (note: read as signed int so we can check whether >2^31). + // + // With nTris == 2^31, file size is 107.37 GB ! + // + // However, the limit is more likely caused by the number of points + // that can be stored (label-size=32) when flattened for merging. + // So more like 715.8M triangles (~35.8 GB) + int32_t nTris; is.read(reinterpret_cast(&nTris), sizeof(int32_t)); - // Check that stream is OK and number of triangles is positive, - // if not this may be an ASCII file + bool ok = (is && nTris >= 0); - bool bad = (!is || nTris < 0); - - if (!bad && unCompressed) + if (ok && unCompressed) { - // Compare file size with that expected from number of tris - // If this is not sensible, it may be an ASCII file - - const off_t dataFileSize = Foam::fileSize(filename); - - bad = - ( - nTris < int(dataFileSize - STLHeaderSize)/50 - || nTris > int(dataFileSize - STLHeaderSize)/25 - ); + ok = checkBinaryFileSize(nTris, filename); } + //if (ok) + //{ + // InfoErr<< "stlb : " << nTris << " triangles" << nl; + //} + // Return number of triangles if it appears to be BINARY and good. - return (bad ? 0 : nTris); + return (ok ? nTris : 0); } @@ -189,31 +219,27 @@ Foam::fileFormats::STLCore::readBinaryHeader << exit(FatalError); } - // Read the number of triangles in the STl file - // (note: read as int so we can check whether >2^31) + + // Read the number of triangles in the STL file + // (note: read as signed int so we can check whether >2^31). + // + // With nTris == 2^31, file size is 107.37 GB ! + // + // However, the limit is more likely caused by the number of points + // that can be stored (label-size=32) when flattened for merging. + // So more like 715.8M triangles (~35.8 GB) + int32_t nTris; is.read(reinterpret_cast(&nTris), sizeof(int32_t)); - // Check that stream is OK and number of triangles is positive, - // if not this maybe an ASCII file + bool ok = (is && nTris >= 0); - bool bad = (!is || nTris < 0); - - if (!bad && unCompressed) + if (ok && unCompressed) { - // Compare file size with that expected from number of tris - // If this is not sensible, it may be an ASCII file - - const off_t dataFileSize = Foam::fileSize(filename); - - bad = - ( - nTris < int(dataFileSize - STLHeaderSize)/50 - || nTris > int(dataFileSize - STLHeaderSize)/25 - ); + ok = checkBinaryFileSize(nTris, filename); } - if (bad) + if (!ok) { FatalErrorInFunction << "problem reading number of triangles, perhaps file is not binary" From 8cf757daf0dda29cbd3f5f4b9ffab7161456f37d Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 22 May 2024 10:18:53 +0100 Subject: [PATCH 4/5] BUG: GAMG: processorAgglomeration not merging proc coeffs. Fixes #3172 --- .../GAMG/GAMGSolverAgglomerateMatrix.C | 137 ++++++++---------- 1 file changed, 63 insertions(+), 74 deletions(-) diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverAgglomerateMatrix.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverAgglomerateMatrix.C index a3fe33a999..3d5378c577 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverAgglomerateMatrix.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverAgglomerateMatrix.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2023 OpenCFD Ltd. + Copyright (C) 2023-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -310,13 +310,7 @@ void Foam::GAMGSolver::gatherMatrices const auto& boundaryMap = agglomeration_.boundaryMap(destLevel); - // Use PstreamBuffers - PstreamBuffers pBufs - ( - UPstream::commsTypes::nonBlocking, - UPstream::msgType(), - comm - ); + PstreamBuffers pBufs(comm); // Send to master if (!UPstream::master(comm)) @@ -332,35 +326,49 @@ void Foam::GAMGSolver::gatherMatrices const label proci = UPstream::myProcNo(comm); - labelList validInterface(interfaces.size(), -1); + // All interfaceBouCoeffs need to be sent across + bitSet validCoeffs(interfaces.size()); + forAll(interfaceBouCoeffs, intI) + { + if (interfaceBouCoeffs.set(intI)) + { + validCoeffs.set(intI); + } + } + + // Only preserved interfaces need to be sent across + bitSet validInterface(interfaces.size()); forAll(interfaces, intI) { const label allIntI = boundaryMap[proci][intI]; if (interfaces.set(intI) && allIntI != -1) { - validInterface[intI] = intI; + validInterface.set(intI); } } UOPstream toMaster(UPstream::masterNo(), pBufs); - toMaster<< mat << token::SPACE << validInterface; + toMaster + << mat + << token::SPACE << validCoeffs + << token::SPACE << validInterface; - forAll(validInterface, intI) + for (const label intI : validCoeffs) { - if (validInterface[intI] != -1) - { - const auto& interface = refCast - ( - interfaces[intI] - ); + toMaster + << interfaceBouCoeffs[intI] + << interfaceIntCoeffs[intI]; + } + for (const label intI : validInterface) + { + const auto& interface = refCast + ( + interfaces[intI] + ); - toMaster - << interfaceBouCoeffs[intI] - << interfaceIntCoeffs[intI] - << interface.type(); - interface.write(toMaster); - } + toMaster << interface.type(); + interface.write(toMaster); } } @@ -376,10 +384,10 @@ void Foam::GAMGSolver::gatherMatrices lduInterfacePtrsList destInterfaces = destMesh.interfaces(); // Master. - otherMats.setSize(nProcs-1); - otherBouCoeffs.setSize(nProcs-1); - otherIntCoeffs.setSize(nProcs-1); - otherInterfaces.setSize(nProcs-1); + otherMats.resize(nProcs-1); + otherBouCoeffs.resize(nProcs-1); + otherIntCoeffs.resize(nProcs-1); + otherInterfaces.resize(nProcs-1); for (const int proci : UPstream::subProcs(comm)) { @@ -389,60 +397,41 @@ void Foam::GAMGSolver::gatherMatrices otherMats.set(otherI, new lduMatrix(destMesh, fromProc)); - // Receive number of/valid interfaces - // >= 0 : remote interface index - // -1 : invalid interface - const labelList validInterface(fromProc); + // Receive bit-sets of valid interfaceCoeffs/interfaces + const bitSet validCoeffs(fromProc); + const bitSet validInterface(fromProc); - otherBouCoeffs.set - ( - otherI, - new FieldField(validInterface.size()) - ); - otherIntCoeffs.set - ( - otherI, - new FieldField(validInterface.size()) - ); - otherInterfaces.set - ( - otherI, - new PtrList(validInterface.size()) - ); + otherBouCoeffs.emplace_set(otherI, validCoeffs.size()); + otherIntCoeffs.emplace_set(otherI, validCoeffs.size()); + otherInterfaces.emplace_set(otherI, validInterface.size()); - forAll(validInterface, intI) + // Receive individual interface contributions + for (const label intI : validCoeffs) { - if (validInterface[intI] != -1) - { - otherBouCoeffs[otherI].set - ( - intI, - new scalarField(fromProc) - ); - otherIntCoeffs[otherI].set - ( - intI, - new scalarField(fromProc) - ); + otherBouCoeffs[otherI].emplace_set(intI, fromProc); + otherIntCoeffs[otherI].emplace_set(intI, fromProc); + } - const word coupleType(fromProc); + // Receive individual interface contributions + for (const label intI : validInterface) + { + const word coupleType(fromProc); - const label allIntI = boundaryMap[proci][intI]; + const label allIntI = boundaryMap[proci][intI]; - otherInterfaces[otherI].set + otherInterfaces[otherI].set + ( + intI, + GAMGInterfaceField::New ( - intI, - GAMGInterfaceField::New + coupleType, + refCast ( - coupleType, - refCast - ( - destInterfaces[allIntI] - ), - fromProc - ).release() - ); - } + destInterfaces[allIntI] + ), + fromProc + ).release() + ); } } } From 4510067e63c098b260be4e7cd1dadb46dbacb93a Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 22 May 2024 14:40:51 +0200 Subject: [PATCH 5/5] CONFIG: bump patch level --- META-INFO/api-info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/META-INFO/api-info b/META-INFO/api-info index 1952c86b39..23d99db63c 100644 --- a/META-INFO/api-info +++ b/META-INFO/api-info @@ -1,2 +1,2 @@ api=2312 -patch=240220 +patch=240522