diff --git a/src/sampling/meshToMesh/meshToMesh.C b/src/sampling/meshToMesh/meshToMesh.C index 957b910f7b..d10a652fea 100644 --- a/src/sampling/meshToMesh/meshToMesh.C +++ b/src/sampling/meshToMesh/meshToMesh.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -758,6 +758,28 @@ void Foam::meshToMesh::constructFromCuttingPatches const wordList& cuttingPatches ) { + const polyBoundaryMesh& srcBm = srcRegion_.boundaryMesh(); + const polyBoundaryMesh& tgtBm = tgtRegion_.boundaryMesh(); + + // set IDs of cutting patches + cuttingPatches_.setSize(cuttingPatches.size()); + forAll(cuttingPatches_, i) + { + const word& patchName = cuttingPatches[i]; + label cuttingPatchi = srcBm.findPatchID(patchName); + + if (cuttingPatchi == -1) + { + FatalErrorInFunction + << "Unable to find patch '" << patchName + << "' in mesh '" << srcRegion_.name() << "'. " + << " Available patches include:" << srcBm.names() + << exit(FatalError); + } + + cuttingPatches_[i] = cuttingPatchi; + } + DynamicList