0021556: EDF 2222 SMESH: 3D mesh after projection impossible

Apply all-dimensional algos ("algos1") before applying
non-all-dimensional algos which are more local than all-dimensional
algos of upper dimension than algos1.
E.g.
 * global on a COMPOUND of SOLIDs: "Prism 3D"
 * local  on a SOLID: "Regular 1D"
 * local  on a FACE:  "Projection 1D-2D"
Fix is to apply "Projection 1D-2D" before applying "Regular 1D".
This commit is contained in:
eap 2013-04-03 12:50:17 +00:00
parent 1ade2bddc1
commit 5a2b960dfb

View File

@ -149,11 +149,12 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
else else
computeEvent = SMESH_subMesh::COMPUTE_SUBMESH; computeEvent = SMESH_subMesh::COMPUTE_SUBMESH;
if ( anUpward ) // is called from below code here if ( anUpward ) // is called from the below code in this method
{ {
// ----------------------------------------------- // ===============================================
// mesh all the sub-shapes starting from vertices // Mesh all the sub-shapes starting from vertices
// ----------------------------------------------- // ===============================================
smIt = sm->getDependsOnIterator(includeSelf, !complexShapeFirst); smIt = sm->getDependsOnIterator(includeSelf, !complexShapeFirst);
while ( smIt->more() ) while ( smIt->more() )
{ {
@ -193,19 +194,21 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
} }
else else
{ {
// ----------------------------------------------------------------- // ================================================================
// apply algos that DO NOT require Discreteized boundaries and DO NOT // Apply algos that do NOT require discreteized boundaries
// support submeshes, starting from the most complex shapes // ("all-dimensional") and do NOT support sub-meshes, starting from
// and collect submeshes with algos that DO support submeshes // the most complex shapes and collect sub-meshes with algos that
// ----------------------------------------------------------------- // DO support sub-meshes
list< SMESH_subMesh* > smWithAlgoSupportingSubmeshes; // ================================================================
list< SMESH_subMesh* > smWithAlgoSupportingSubmeshes[4]; // for each dim
// map to sort sm with same dim algos according to dim of // map to sort sm with same dim algos according to dim of
// the shape the algo assigned to (issue 0021217) // the shape the algo assigned to (issue 0021217)
multimap< int, SMESH_subMesh* > shDim2sm; multimap< int, SMESH_subMesh* > shDim2sm;
multimap< int, SMESH_subMesh* >::reverse_iterator shDim2smIt; multimap< int, SMESH_subMesh* >::reverse_iterator shDim2smIt;
TopoDS_Shape algoShape; TopoDS_Shape algoShape;
int prevShapeDim = -1; int prevShapeDim = -1, aShapeDim;
smIt = sm->getDependsOnIterator(includeSelf, complexShapeFirst); smIt = sm->getDependsOnIterator(includeSelf, complexShapeFirst);
while ( smIt->more() ) while ( smIt->more() )
@ -215,7 +218,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
continue; continue;
const TopoDS_Shape& aSubShape = smToCompute->GetSubShape(); const TopoDS_Shape& aSubShape = smToCompute->GetSubShape();
int aShapeDim = GetShapeDim( aSubShape ); aShapeDim = GetShapeDim( aSubShape );
if ( aShapeDim < 1 ) break; if ( aShapeDim < 1 ) break;
// check for preview dimension limitations // check for preview dimension limitations
@ -234,9 +237,9 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
prevShapeDim = aShapeDim; prevShapeDim = aShapeDim;
for ( shDim2smIt = shDim2sm.rbegin(); shDim2smIt != shDim2sm.rend(); ++shDim2smIt ) for ( shDim2smIt = shDim2sm.rbegin(); shDim2smIt != shDim2sm.rend(); ++shDim2smIt )
if ( shDim2smIt->first == globalAlgoDim ) if ( shDim2smIt->first == globalAlgoDim )
smWithAlgoSupportingSubmeshes.push_back( shDim2smIt->second ); smWithAlgoSupportingSubmeshes[ aShapeDim ].push_back( shDim2smIt->second );
else else
smWithAlgoSupportingSubmeshes.push_front( shDim2smIt->second ); smWithAlgoSupportingSubmeshes[ aShapeDim ].push_front( shDim2smIt->second );
shDim2sm.clear(); shDim2sm.clear();
} }
// add smToCompute to shDim2sm map // add smToCompute to shDim2sm map
@ -255,7 +258,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
} }
shDim2sm.insert( make_pair( aShapeDim, smToCompute )); shDim2sm.insert( make_pair( aShapeDim, smToCompute ));
} }
else else // Compute w/o support of sub-meshes
{ {
if (_compute_canceled) if (_compute_canceled)
return false; return false;
@ -270,82 +273,91 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
// reload sub-meshes from shDim2sm into smWithAlgoSupportingSubmeshes // reload sub-meshes from shDim2sm into smWithAlgoSupportingSubmeshes
for ( shDim2smIt = shDim2sm.rbegin(); shDim2smIt != shDim2sm.rend(); ++shDim2smIt ) for ( shDim2smIt = shDim2sm.rbegin(); shDim2smIt != shDim2sm.rend(); ++shDim2smIt )
if ( shDim2smIt->first == globalAlgoDim ) if ( shDim2smIt->first == globalAlgoDim )
smWithAlgoSupportingSubmeshes.push_back( shDim2smIt->second ); smWithAlgoSupportingSubmeshes[0].push_back( shDim2smIt->second );
else else
smWithAlgoSupportingSubmeshes.push_front( shDim2smIt->second ); smWithAlgoSupportingSubmeshes[0].push_front( shDim2smIt->second );
// ------------------------------------------------------------ // ======================================================
// sort list of submeshes according to mesh order // Apply all-dimensional algorithms supporing sub-meshes
// ------------------------------------------------------------ // ======================================================
aMesh.SortByMeshOrder( smWithAlgoSupportingSubmeshes );
// ------------------------------------------------------------ for ( aShapeDim = 0; aShapeDim < 4; ++aShapeDim )
// compute submeshes under shapes with algos that DO NOT require
// Discreteized boundaries and DO support submeshes
// ------------------------------------------------------------
list< SMESH_subMesh* >::iterator subIt, subEnd;
subIt = smWithAlgoSupportingSubmeshes.begin();
subEnd = smWithAlgoSupportingSubmeshes.end();
// start from lower shapes
for ( ; subIt != subEnd; ++subIt )
{ {
sm = *subIt; // ------------------------------------------------
// sort list of sub-meshes according to mesh order
// ------------------------------------------------
aMesh.SortByMeshOrder( smWithAlgoSupportingSubmeshes[ aShapeDim ] );
// get a shape the algo is assigned to // ------------------------------------------------------------
if ( !GetAlgo( aMesh, sm->GetSubShape(), & algoShape )) // compute sub-meshes with local uni-dimensional algos under
continue; // strange... // sub-meshes with all-dimensional algos
// ------------------------------------------------------------
// look for more local algos list< SMESH_subMesh* >::iterator subIt, subEnd;
smIt = sm->getDependsOnIterator(!includeSelf, !complexShapeFirst); subIt = smWithAlgoSupportingSubmeshes[ aShapeDim ].begin();
while ( smIt->more() ) subEnd = smWithAlgoSupportingSubmeshes[ aShapeDim ].end();
// start from lower shapes
for ( ; subIt != subEnd; ++subIt )
{ {
SMESH_subMesh* smToCompute = smIt->next(); sm = *subIt;
const TopoDS_Shape& aSubShape = smToCompute->GetSubShape(); // get a shape the algo is assigned to
const int aShapeDim = GetShapeDim( aSubShape ); if ( !GetAlgo( aMesh, sm->GetSubShape(), & algoShape ))
//if ( aSubShape.ShapeType() == TopAbs_VERTEX ) continue; continue; // strange...
if ( aShapeDim < 1 ) continue;
// check for preview dimension limitations // look for more local algos
if ( aShapesId && GetShapeDim( aSubShape.ShapeType() ) > (int)aDim ) smIt = sm->getDependsOnIterator(!includeSelf, !complexShapeFirst);
continue; while ( smIt->more() )
{
SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() ); SMESH_subMesh* smToCompute = smIt->next();
filter
.And( SMESH_HypoFilter::IsApplicableTo( aSubShape ))
.And( SMESH_HypoFilter::IsMoreLocalThan( algoShape, aMesh ));
if ( SMESH_Algo* subAlgo = (SMESH_Algo*) aMesh.GetHypothesis( aSubShape, filter, true )) { const TopoDS_Shape& aSubShape = smToCompute->GetSubShape();
if ( ! subAlgo->NeedDiscreteBoundary() ) continue; const int aShapeDim = GetShapeDim( aSubShape );
SMESH_Hypothesis::Hypothesis_Status status; //if ( aSubShape.ShapeType() == TopAbs_VERTEX ) continue;
if ( subAlgo->CheckHypothesis( aMesh, aSubShape, status )) if ( aShapeDim < 1 ) continue;
// mesh a lower smToCompute starting from vertices
Compute( aMesh, aSubShape, /*anUpward=*/true, aDim, aShapesId ); // check for preview dimension limitations
if ( aShapesId && GetShapeDim( aSubShape.ShapeType() ) > (int)aDim )
continue;
SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
filter
.And( SMESH_HypoFilter::IsApplicableTo( aSubShape ))
.And( SMESH_HypoFilter::IsMoreLocalThan( algoShape, aMesh ));
if ( SMESH_Algo* subAlgo = (SMESH_Algo*) aMesh.GetHypothesis( aSubShape, filter, true )) {
if ( ! subAlgo->NeedDiscreteBoundary() ) continue;
SMESH_Hypothesis::Hypothesis_Status status;
if ( subAlgo->CheckHypothesis( aMesh, aSubShape, status ))
// mesh a lower smToCompute starting from vertices
Compute( aMesh, aSubShape, /*anUpward=*/true, aDim, aShapesId );
}
} }
} }
} // --------------------------------
// ---------------------------------------------------------- // apply the all-dimensional algos
// apply the algos that do not require Discreteized boundaries // --------------------------------
// ---------------------------------------------------------- subIt = smWithAlgoSupportingSubmeshes[ aShapeDim ].begin();
for ( subIt = smWithAlgoSupportingSubmeshes.begin(); subIt != subEnd; ++subIt ) for ( ; subIt != subEnd; ++subIt )
{
sm = *subIt;
if ( sm->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE)
{ {
const TopAbs_ShapeEnum aShType = sm->GetSubShape().ShapeType(); sm = *subIt;
// check for preview dimension limitations if ( sm->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE)
if ( aShapesId && GetShapeDim( aShType ) > (int)aDim ) {
continue; const TopAbs_ShapeEnum aShType = sm->GetSubShape().ShapeType();
// check for preview dimension limitations
if ( aShapesId && GetShapeDim( aShType ) > (int)aDim )
continue;
if (_compute_canceled) if (_compute_canceled)
return false; return false;
_sm_current = sm; _sm_current = sm;
sm->ComputeStateEngine( computeEvent ); sm->ComputeStateEngine( computeEvent );
_sm_current = NULL; _sm_current = NULL;
if ( aShapesId ) if ( aShapesId )
aShapesId->insert( sm->GetId() ); aShapesId->insert( sm->GetId() );
}
} }
} } // loop on shape dimensions
// ----------------------------------------------- // -----------------------------------------------
// mesh the rest sub-shapes starting from vertices // mesh the rest sub-shapes starting from vertices
// ----------------------------------------------- // -----------------------------------------------
@ -451,8 +463,8 @@ bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh,
else { else {
// ----------------------------------------------------------------- // -----------------------------------------------------------------
// apply algos that DO NOT require Discreteized boundaries and DO NOT // apply algos that DO NOT require Discreteized boundaries and DO NOT
// support submeshes, starting from the most complex shapes // support sub-meshes, starting from the most complex shapes
// and collect submeshes with algos that DO support submeshes // and collect sub-meshes with algos that DO support sub-meshes
// ----------------------------------------------------------------- // -----------------------------------------------------------------
list< SMESH_subMesh* > smWithAlgoSupportingSubmeshes; list< SMESH_subMesh* > smWithAlgoSupportingSubmeshes;
smIt = sm->getDependsOnIterator(includeSelf, complexShapeFirst); smIt = sm->getDependsOnIterator(includeSelf, complexShapeFirst);
@ -481,8 +493,8 @@ bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh,
aMesh.SortByMeshOrder( smWithAlgoSupportingSubmeshes ); aMesh.SortByMeshOrder( smWithAlgoSupportingSubmeshes );
// ------------------------------------------------------------ // ------------------------------------------------------------
// compute submeshes under shapes with algos that DO NOT require // compute sub-meshes under shapes with algos that DO NOT require
// Discreteized boundaries and DO support submeshes // Discreteized boundaries and DO support sub-meshes
// ------------------------------------------------------------ // ------------------------------------------------------------
list< SMESH_subMesh* >::iterator subIt, subEnd; list< SMESH_subMesh* >::iterator subIt, subEnd;
subIt = smWithAlgoSupportingSubmeshes.begin(); subIt = smWithAlgoSupportingSubmeshes.begin();
@ -650,9 +662,9 @@ static bool checkMissing(SMESH_Gen* aGen,
{ {
case TopAbs_EDGE: case TopAbs_EDGE:
case TopAbs_FACE: case TopAbs_FACE:
case TopAbs_SOLID: break; // check this submesh, it can be meshed case TopAbs_SOLID: break; // check this sub-mesh, it can be meshed
default: default:
return true; // not meshable submesh return true; // not meshable sub-mesh
} }
if ( aCheckedMap.count( aSubMesh )) if ( aCheckedMap.count( aSubMesh ))
return true; return true;