0021484: EDF 2087 SMESH: Problem projection

Check orientation of faces after simple cases of projection as well
This commit is contained in:
eap 2012-01-25 07:37:32 +00:00
parent 8ed51b18ba
commit 40a14effec

View File

@ -807,9 +807,9 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
return error(COMPERR_BAD_INPUT_MESH,"Source mesh not computed"); return error(COMPERR_BAD_INPUT_MESH,"Source mesh not computed");
} }
// -------------------------- // ===========
// Simple cases of projection // Projection
// -------------------------- // ===========
// find out if EDGEs are meshed or not // find out if EDGEs are meshed or not
bool is1DComputed = false; bool is1DComputed = false;
@ -822,13 +822,21 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
is1DComputed = sm->IsMeshComputed(); is1DComputed = sm->IsMeshComputed();
} }
// try to project from same face with different location bool done = false;
if ( projectPartner( tgtFace, srcFace, tgtMesh, srcMesh, shape2ShapeMap ))
return true;
if ( projectBy2DSimilarity( tgtFace, srcFace, tgtMesh, srcMesh, shape2ShapeMap, is1DComputed )) if ( !done )
return true; {
// try to project from the same face with different location
done = projectPartner( tgtFace, srcFace, tgtMesh, srcMesh, shape2ShapeMap );
}
if ( !done )
{
// projection in case if the faces are similar in 2D space
done = projectBy2DSimilarity( tgtFace, srcFace, tgtMesh, srcMesh, shape2ShapeMap, is1DComputed);
}
if ( !done )
{
// -------------------- // --------------------
// Prepare to mapping // Prepare to mapping
// -------------------- // --------------------
@ -918,8 +926,6 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
// in failure case // in failure case
MeshCleaner cleaner( tgtSubMesh ); MeshCleaner cleaner( tgtSubMesh );
SMESH_MeshEditor editor( tgtMesh );
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// mapper doesn't take care of nodes already existing on edges and vertices, // mapper doesn't take care of nodes already existing on edges and vertices,
// so we must merge nodes created by it with existing ones // so we must merge nodes created by it with existing ones
@ -1024,6 +1030,7 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
// Merge // Merge
SMESH_MeshEditor editor( tgtMesh );
int nbFaceBeforeMerge = tgtSubMesh->GetSubMeshDS()->NbElements(); int nbFaceBeforeMerge = tgtSubMesh->GetSubMeshDS()->NbElements();
editor.MergeNodes( groupsOfNodes ); editor.MergeNodes( groupsOfNodes );
int nbFaceAtferMerge = tgtSubMesh->GetSubMeshDS()->NbElements(); int nbFaceAtferMerge = tgtSubMesh->GetSubMeshDS()->NbElements();
@ -1048,6 +1055,11 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
editor.ConvertToQuadratic(/*theForce3d=*/false, tgtFaces); editor.ConvertToQuadratic(/*theForce3d=*/false, tgtFaces);
} }
cleaner.Release(); // not to remove mesh
} // end of projection using Pattern mapping
// --------------------------- // ---------------------------
// Check elements orientation // Check elements orientation
// --------------------------- // ---------------------------
@ -1084,6 +1096,7 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
// Fix orientation // Fix orientation
if ( SMESH_Algo::IsReversedSubMesh( face, meshDS )) if ( SMESH_Algo::IsReversedSubMesh( face, meshDS ))
{ {
SMESH_MeshEditor editor( tgtMesh );
SMDS_ElemIteratorPtr eIt = meshDS->MeshElements( face )->GetElements(); SMDS_ElemIteratorPtr eIt = meshDS->MeshElements( face )->GetElements();
while ( eIt->more() ) { while ( eIt->more() ) {
const SMDS_MeshElement* e = eIt->next(); const SMDS_MeshElement* e = eIt->next();
@ -1092,8 +1105,6 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
} }
} }
cleaner.Release(); // do not remove mesh
return true; return true;
} }