View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003939 | OpenFOAM | Patch | public | 2022-11-30 07:00 | 2022-12-05 13:52 |
Reporter | cgoessni | Assigned To | henry | ||
Priority | low | Severity | feature | Reproducibility | N/A |
Status | closed | Resolution | suspended | ||
Product Version | dev | ||||
Summary | 0003939: meshToMesh: Improved error messages due to missing patches in patchMap | ||||
Description | I saw some crashes with meshToMesh class, where patchToPatch would just segfault when I did not use -consistent flag for mapFieldsPar. After debugging the issue, it turned out that the error was on my side: I specified patches in the patchMap list which did not exist in one of the meshes (src/tgt). If you think this addition is worth it, I provided a simple patch to give a useful error message to the user. It might help users to easily identify and avoid such setup mistakes in the future. | ||||
Tags | No tags attached. | ||||
|
diff_meshToMesh_C.txt (1,365 bytes)
diff --git a/src/meshTools/meshToMesh/meshToMesh.C b/src/meshTools/meshToMesh/meshToMesh.C index dd2d6b1..cb38291 100644 --- a/src/meshTools/meshToMesh/meshToMesh.C +++ b/src/meshTools/meshToMesh/meshToMesh.C @@ -287,12 +287,32 @@ void Foam::meshToMesh::constructFromCuttingPatches const word& tgtPatchName = iter.key(); const word& srcPatchName = iter(); - srcToTgtPatchIDs_[i++] = - labelPair - ( - srcMesh_.boundaryMesh().findPatchID(srcPatchName), - tgtMesh_.boundaryMesh().findPatchID(tgtPatchName) - ); + const label tgtPatchi = + tgtMesh_.boundaryMesh().findPatchID(tgtPatchName); + const label srcPatchi = + srcMesh_.boundaryMesh().findPatchID(srcPatchName); + + if (tgtPatchi == -1) + { + FatalErrorInFunction + << "Patch " << tgtPatchName + << " not found in target mesh. " + << "Available target patches are " + << tgtMesh_.boundaryMesh().names() + << exit(FatalError); + } + + if (srcPatchi == -1) + { + FatalErrorInFunction + << "Patch " << srcPatchName + << " not found in source mesh. " + << "Available source patches are " + << srcMesh_.boundaryMesh().names() + << exit(FatalError); + } + + srcToTgtPatchIDs_[i++] = labelPair(srcPatchi, tgtPatchi); } // calculate patch addressing and weights |
|
Suspended pending contribution agreement. |
Date Modified | Username | Field | Change |
---|---|---|---|
2022-11-30 07:00 | cgoessni | New Issue | |
2022-11-30 07:00 | cgoessni | File Added: diff_meshToMesh_C.txt | |
2022-12-05 13:52 | henry | Assigned To | => henry |
2022-12-05 13:52 | henry | Status | new => closed |
2022-12-05 13:52 | henry | Resolution | open => suspended |
2022-12-05 13:52 | henry | Note Added: 0012907 |