Salome HOME
PAL16229 (Issue in order to mesh with Hexahedron algorithms)
[modules/smesh.git] / src / StdMeshers / StdMeshers_Projection_3D.cxx
index f634ecf2b5331c71872a433ccda0133863360866..4a3d9a63070b61c2662bd4aacfcfce09efa7a199 100644 (file)
@@ -92,6 +92,7 @@ bool StdMeshers_Projection_3D::CheckHypothesis(SMESH_Mesh&
                                                SMESH_Hypothesis::Hypothesis_Status& aStatus)
 {
   // check aShape that must be a 6 faces block
+/*  PAL16229
   if ( TAssocTool::Count( aShape, TopAbs_SHELL, 1 ) != 1 ||
        TAssocTool::Count( aShape, TopAbs_FACE , 1 ) != 6 ||
        TAssocTool::Count( aShape, TopAbs_EDGE , 1 ) != 12 ||
@@ -100,7 +101,7 @@ bool StdMeshers_Projection_3D::CheckHypothesis(SMESH_Mesh&
     aStatus = HYP_BAD_GEOMETRY;
     return false;
   }
-
+*/
   list <const SMESHDS_Hypothesis * >::const_iterator itl;
 
   const list <const SMESHDS_Hypothesis * >&hyps = GetUsedHypothesis(aMesh, aShape);
@@ -206,14 +207,24 @@ bool StdMeshers_Projection_3D::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aS
     srcShell = TopoDS::Shell( exp.Current() );
   if ( nbShell != 1 )
     return error(COMPERR_BAD_SHAPE,
-                 SMESH_Comment("Shape must have 1 shell but not") << nbShell);
+                 SMESH_Comment("Source shape must have 1 shell but not ") << nbShell);
 
   exp.Init( aShape, TopAbs_SHELL );
   for ( nbShell = 0; exp.More(); exp.Next(), ++nbShell )
     tgtShell = TopoDS::Shell( exp.Current() );
   if ( nbShell != 1 )
     return error(COMPERR_BAD_SHAPE,
-                 SMESH_Comment("Shape must have 1 shell but not") << nbShell);
+                 SMESH_Comment("Target shape must have 1 shell but not ") << nbShell);
+
+  // Check that shapes are blocks
+  if ( TAssocTool::Count( tgtShell, TopAbs_FACE , 1 ) != 6 ||
+       TAssocTool::Count( tgtShell, TopAbs_EDGE , 1 ) != 12 ||
+       TAssocTool::Count( tgtShell, TopAbs_WIRE , 1 ) != 6 )
+    return error(COMPERR_BAD_SHAPE, "Target shape is not a block");
+  if ( TAssocTool::Count( srcShell, TopAbs_FACE , 1 ) != 6 ||
+       TAssocTool::Count( srcShell, TopAbs_EDGE , 1 ) != 12 ||
+       TAssocTool::Count( srcShell, TopAbs_WIRE , 1 ) != 6 )
+    return error(COMPERR_BAD_SHAPE, "Source shape is not a block");
 
   // Assure that mesh on a source shape is computed