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");
}
// --------------------------
// Simple cases of projection
// --------------------------
// ===========
// Projection
// ===========
// find out if EDGEs are meshed or not
bool is1DComputed = false;
@ -822,13 +822,21 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
is1DComputed = sm->IsMeshComputed();
}
// try to project from same face with different location
if ( projectPartner( tgtFace, srcFace, tgtMesh, srcMesh, shape2ShapeMap ))
return true;
bool done = false;
if ( projectBy2DSimilarity( tgtFace, srcFace, tgtMesh, srcMesh, shape2ShapeMap, is1DComputed ))
return true;
if ( !done )
{
// 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
// --------------------
@ -918,8 +926,6 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
// in failure case
MeshCleaner cleaner( tgtSubMesh );
SMESH_MeshEditor editor( tgtMesh );
// -------------------------------------------------------------------------
// mapper doesn't take care of nodes already existing on edges and vertices,
// 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
SMESH_MeshEditor editor( tgtMesh );
int nbFaceBeforeMerge = tgtSubMesh->GetSubMeshDS()->NbElements();
editor.MergeNodes( groupsOfNodes );
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);
}
cleaner.Release(); // not to remove mesh
} // end of projection using Pattern mapping
// ---------------------------
// Check elements orientation
// ---------------------------
@ -1084,6 +1096,7 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
// Fix orientation
if ( SMESH_Algo::IsReversedSubMesh( face, meshDS ))
{
SMESH_MeshEditor editor( tgtMesh );
SMDS_ElemIteratorPtr eIt = meshDS->MeshElements( face )->GetElements();
while ( eIt->more() ) {
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;
}