diff --git a/meshLibrary/utilities/surfaceTools/meshSurfaceEngine/meshSurfaceEngineCalculateBoundaryNodesAndFaces.C b/meshLibrary/utilities/surfaceTools/meshSurfaceEngine/meshSurfaceEngineCalculateBoundaryNodesAndFaces.C index 5c6dc4e56b5a93190066b80e8ff45fb3aac73361..e6e3f5ae6b9ba6c1cfb0843e751fe01422483594 100644 --- a/meshLibrary/utilities/surfaceTools/meshSurfaceEngine/meshSurfaceEngineCalculateBoundaryNodesAndFaces.C +++ b/meshLibrary/utilities/surfaceTools/meshSurfaceEngine/meshSurfaceEngineCalculateBoundaryNodesAndFaces.C @@ -1220,6 +1220,7 @@ void meshSurfaceEngine::calculateEdgeFacesAddressing() const const edge& ee = edges[edgeI]; const label bpI = bp[ee.start()]; + //- find boundary faces attached to this edge DynList<label> eFaces; forAllRow(pointFaces, bpI, pfI) { @@ -1237,6 +1238,23 @@ void meshSurfaceEngine::calculateEdgeFacesAddressing() const } } + //- the face that owns the edge shall be the first one in the list + // TODO: find out whether this will be necessary + if( eFaces.size() == 2 ) + { + const face& bf = bFaces[eFaces[1]]; + + const label pos = bf.which(ee.start()); + + if( bf.nextLabel(pos) == ee.end() ) + { + //- this face shall be the first one in the list + const label helper = eFaces[0]; + eFaces[0] = eFaces[1]; + eFaces[1] = helper; + } + } + edgeFaces.setRow(edgeI, eFaces); } }