From 7d37e871b2dfac264cba798113457f4da29ea65c Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 19 Apr 2011 16:09:16 +0000 Subject: [PATCH] 0021217: EDF SMESH: Submesh is not taken into account whith netgen 1d-2d --- src/SMESH/SMESH_Gen.cxx | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/src/SMESH/SMESH_Gen.cxx b/src/SMESH/SMESH_Gen.cxx index 360325e81..9dd6d0d05 100644 --- a/src/SMESH/SMESH_Gen.cxx +++ b/src/SMESH/SMESH_Gen.cxx @@ -184,6 +184,14 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, // and collect submeshes with algos that DO support submeshes // ----------------------------------------------------------------- list< SMESH_subMesh* > smWithAlgoSupportingSubmeshes; + + // map to sort sm with same dim algos according to dim of + // the shape the algo assigned to (issue 0021217) + multimap< int, SMESH_subMesh* > shDim2sm; + multimap< int, SMESH_subMesh* >::reverse_iterator shDim2smIt; + TopoDS_Shape algoShape; + int prevShapeDim = -1; + smIt = sm->getDependsOnIterator(includeSelf, complexShapeFirst); while ( smIt->more() ) { @@ -192,18 +200,30 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, continue; const TopoDS_Shape& aSubShape = smToCompute->GetSubShape(); - const int aShapeDim = GetShapeDim( aSubShape ); + int aShapeDim = GetShapeDim( aSubShape ); if ( aShapeDim < 1 ) break; // check for preview dimension limitations if ( aShapesId && aShapeDim > (int)aDim ) continue; - SMESH_Algo* algo = GetAlgo( aMesh, aSubShape ); + SMESH_Algo* algo = GetAlgo( aMesh, aSubShape, &algoShape ); if ( algo && !algo->NeedDescretBoundary() ) { if ( algo->SupportSubmeshes() ) - smWithAlgoSupportingSubmeshes.push_front( smToCompute ); + { + // reload sub-meshes from shDim2sm into smWithAlgoSupportingSubmeshes + if ( prevShapeDim != aShapeDim ) + { + prevShapeDim = aShapeDim; + for ( shDim2smIt = shDim2sm.rbegin(); shDim2smIt != shDim2sm.rend(); ++shDim2smIt ) + smWithAlgoSupportingSubmeshes.push_front( shDim2smIt->second ); + shDim2sm.clear(); + } + // add smToCompute to shDim2sm map + aShapeDim = GetShapeDim( algoShape ); + shDim2sm.insert( make_pair( aShapeDim, smToCompute )); + } else { #ifdef WITH_SMESH_CANCEL_COMPUTE @@ -220,7 +240,10 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, } } } - + // reload sub-meshes from shDim2sm into smWithAlgoSupportingSubmeshes + for ( shDim2smIt = shDim2sm.rbegin(); shDim2smIt != shDim2sm.rend(); ++shDim2smIt ) + smWithAlgoSupportingSubmeshes.push_front( shDim2smIt->second ); + // ------------------------------------------------------------ // sort list of submeshes according to mesh order // ------------------------------------------------------------ @@ -239,7 +262,6 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, sm = *subIt; // get a shape the algo is assigned to - TopoDS_Shape algoShape; if ( !GetAlgo( aMesh, sm->GetSubShape(), & algoShape )) continue; // strange... -- 2.30.2