Salome HOME
0021893: EDF 2133 SMESH : Improvement of 3D extrusion algorithm
[modules/smesh.git] / src / StdMeshers / StdMeshers_RadialPrism_3D.cxx
index 96c55236a8f2381b269aea5506bfeaf40547a8b7..ec34a041c16fa3710287259ebe06a6f5d7f979e2 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 // Created   : Fri Oct 20 11:37:07 2006
 // Author    : Edward AGAPOV (eap)
 //
+
 #include "StdMeshers_RadialPrism_3D.hxx"
 
+#include <Basics_OCCTVersion.hxx>
+
 #include "StdMeshers_ProjectionUtils.hxx"
 #include "StdMeshers_NumberOfLayers.hxx"
 #include "StdMeshers_LayerDistribution.hxx"
 
 #include <BRepAdaptor_Curve.hxx>
 #include <BRepBuilderAPI_MakeEdge.hxx>
+#if OCC_VERSION_LARGE > 0x06050400
+#include <BRepClass3d.hxx>
+#else
 #include <BRepTools.hxx>
+#endif
 #include <BRep_Tool.hxx>
 #include <TopExp_Explorer.hxx>
 #include <TopoDS.hxx>
@@ -55,7 +62,6 @@
 #include <gp.hxx>
 #include <gp_Pnt.hxx>
 
-
 using namespace std;
 
 #define RETURN_BAD_RESULT(msg) { MESSAGE(")-: Error: " << msg); return false; }
@@ -162,7 +168,11 @@ bool StdMeshers_RadialPrism_3D::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& a
 
   // get 2 shells
   TopoDS_Solid solid = TopoDS::Solid( aShape );
+#if OCC_VERSION_LARGE > 0x06050400
+  TopoDS_Shell outerShell = BRepClass3d::OuterShell( solid );
+#else
   TopoDS_Shell outerShell = BRepTools::OuterShell( solid );
+#endif
   TopoDS_Shape innerShell;
   int nbShells = 0;
   for ( TopoDS_Iterator It (solid); It.More(); It.Next(), ++nbShells )
@@ -172,12 +182,12 @@ bool StdMeshers_RadialPrism_3D::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& a
     return error(COMPERR_BAD_SHAPE, SMESH_Comment("Must be 2 shells but not ")<<nbShells);
 
   // ----------------------------------
-  // Associate subshapes of the shells
+  // Associate sub-shapes of the shells
   // ----------------------------------
 
   TAssocTool::TShapeShapeMap shape2ShapeMap;
-  if ( !TAssocTool::FindSubShapeAssociation( outerShell, &aMesh,
-                                             innerShell, &aMesh,
+  if ( !TAssocTool::FindSubShapeAssociation( innerShell, &aMesh,
+                                             outerShell, &aMesh,
                                              shape2ShapeMap) )
     return error(COMPERR_BAD_SHAPE,"Topology of inner and outer shells seems different" );
 
@@ -190,14 +200,14 @@ bool StdMeshers_RadialPrism_3D::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& a
 
   for ( exp.Init( outerShell, TopAbs_FACE ); exp.More(); exp.Next() )
   {
-    // Corresponding subshapes
+    // Corresponding sub-shapes
     TopoDS_Face outFace = TopoDS::Face( exp.Current() );
     TopoDS_Face inFace;
-    if ( !shape2ShapeMap.IsBound( outFace )) {
+    if ( !shape2ShapeMap.IsBound( outFace, /*isOut=*/true )) {
       return error(SMESH_Comment("Corresponding inner face not found for face #" )
                    << meshDS->ShapeToIndex( outFace ));
     } else {
-      inFace = TopoDS::Face( shape2ShapeMap( outFace ));
+      inFace = TopoDS::Face( shape2ShapeMap( outFace, /*isOut=*/true ));
     }
 
     // Find matching nodes of in and out faces
@@ -402,7 +412,11 @@ bool StdMeshers_RadialPrism_3D::Evaluate(SMESH_Mesh& aMesh,
 {
   // get 2 shells
   TopoDS_Solid solid = TopoDS::Solid( aShape );
+#if OCC_VERSION_LARGE > 0x06050400
+  TopoDS_Shell outerShell = BRepClass3d::OuterShell( solid );
+#else
   TopoDS_Shell outerShell = BRepTools::OuterShell( solid );
+#endif
   TopoDS_Shape innerShell;
   int nbShells = 0;
   for ( TopoDS_Iterator It (solid); It.More(); It.Next(), ++nbShells )
@@ -418,7 +432,7 @@ bool StdMeshers_RadialPrism_3D::Evaluate(SMESH_Mesh& aMesh,
     return false;
   }
 
-  // Associate subshapes of the shells
+  // Associate sub-shapes of the shells
   TAssocTool::TShapeShapeMap shape2ShapeMap;
   if ( !TAssocTool::FindSubShapeAssociation( outerShell, &aMesh,
                                              innerShell, &aMesh,