Salome HOME
0021543: EDF 1978 SMESH: Viscous layer for 2D meshes
authoreap <eap@opencascade.com>
Mon, 15 Oct 2012 14:52:18 +0000 (14:52 +0000)
committereap <eap@opencascade.com>
Mon, 15 Oct 2012 14:52:18 +0000 (14:52 +0000)
   Add StdMeshers_ViscousLayers2D hypothesis

14 files changed:
src/StdMeshers/StdMeshers_MEFISTO_2D.cxx
src/StdMeshers/StdMeshers_MEFISTO_2D.hxx
src/StdMeshers/StdMeshers_Quadrangle_2D.cxx
src/StdMeshers/StdMeshers_Quadrangle_2D.hxx
src/StdMeshers/StdMeshers_ViscousLayers.cxx
src/StdMeshers/StdMeshers_ViscousLayers.hxx
src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx
src/StdMeshersGUI/StdMeshers_msg_en.ts
src/StdMeshers_I/Makefile.am
src/StdMeshers_I/StdMeshers_ViscousLayers2D_i.cxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_ViscousLayers2D_i.hxx [new file with mode: 0644]
src/StdMeshers_I/StdMeshers_ViscousLayers_i.cxx
src/StdMeshers_I/StdMeshers_ViscousLayers_i.hxx
src/StdMeshers_I/StdMeshers_i.cxx

index f7a91a6b1493044c04cfdced27d5a695522594ac..55091c7f9c598ba557cd8dcdf28890af4a7e16ba 100644 (file)
 //
 #include "StdMeshers_MEFISTO_2D.hxx"
 
+#include "SMDS_EdgePosition.hxx"
+#include "SMDS_MeshElement.hxx"
+#include "SMDS_MeshNode.hxx"
+#include "SMESH_Comment.hxx"
 #include "SMESH_Gen.hxx"
 #include "SMESH_Mesh.hxx"
-#include "SMESH_subMesh.hxx"
-#include "SMESH_Block.hxx"
 #include "SMESH_MesherHelper.hxx"
-#include "SMESH_Comment.hxx"
-
+#include "SMESH_subMesh.hxx"
 #include "StdMeshers_FaceSide.hxx"
-#include "StdMeshers_MaxElementArea.hxx"
 #include "StdMeshers_LengthFromEdges.hxx"
+#include "StdMeshers_MaxElementArea.hxx"
+#include "StdMeshers_ViscousLayers2D.hxx"
+
+#include "utilities.h"
 
 #include "Rn.h"
 #include "aptrte.h"
 
-#include "SMDS_MeshElement.hxx"
-#include "SMDS_MeshNode.hxx"
-#include "SMDS_EdgePosition.hxx"
-#include "SMDS_FacePosition.hxx"
-
-#include "utilities.h"
-
+#include <BRepGProp.hxx>
 #include <BRepTools.hxx>
 #include <BRep_Tool.hxx>
+#include <GProp_GProps.hxx>
 #include <Geom2d_Curve.hxx>
 #include <Geom_Curve.hxx>
 #include <Geom_Surface.hxx>
 #include <TopoDS_Wire.hxx>
 #include <gp_Pnt2d.hxx>
 
-#include <BRep_Tool.hxx>
-#include <GProp_GProps.hxx>
-#include <BRepGProp.hxx>
-
 using namespace std;
 
+#ifdef _DEBUG_
+//#define DUMP_POINTS // to print coordinates of MEFISTO input
+#endif
+
 //=============================================================================
 /*!
  *  
@@ -87,12 +86,13 @@ StdMeshers_MEFISTO_2D::StdMeshers_MEFISTO_2D(int hypId, int studyId, SMESH_Gen *
   _shapeType = (1 << TopAbs_FACE);
   _compatibleHypothesis.push_back("MaxElementArea");
   _compatibleHypothesis.push_back("LengthFromEdges");
+  _compatibleHypothesis.push_back("ViscousLayers2D");
 
   _edgeLength = 0;
   _maxElementArea = 0;
   _hypMaxElementArea = NULL;
   _hypLengthFromEdges = NULL;
-  myTool = 0;
+  _helper = 0;
 }
 
 //=============================================================================
@@ -191,13 +191,19 @@ bool StdMeshers_MEFISTO_2D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
 
   // helper builds quadratic mesh if necessary
   SMESH_MesherHelper helper(aMesh);
-  myTool = &helper;
-  _quadraticMesh = myTool->IsQuadraticSubMesh(aShape);
-  const bool ignoreMediumNodes = _quadraticMesh;
+  _helper = &helper;
+  _quadraticMesh = _helper->IsQuadraticSubMesh(aShape);
+  const bool skipMediumNodes = _quadraticMesh;
+
+  // build viscous layers if required
+  SMESH_ProxyMesh::Ptr proxyMesh = StdMeshers_ViscousLayers2D::Compute( aMesh, F );
+  if ( !proxyMesh )
+    return false;
 
   // get all edges of a face
   TError problem;
-  TWireVector wires = StdMeshers_FaceSide::GetFaceWires( F, aMesh, ignoreMediumNodes, problem );
+  TWireVector wires =
+    StdMeshers_FaceSide::GetFaceWires( F, aMesh, skipMediumNodes, problem, proxyMesh );
   int nbWires = wires.size();
   if ( problem && !problem->IsOK() ) return error( problem );
   if ( nbWires == 0 ) return error( "Problem in StdMeshers_FaceSide::GetFaceWires()");
@@ -575,7 +581,7 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(TWireVector &                 wires,
   TopTools_IndexedDataMapOfShapeListOfShape VWMap;
   if ( wires.size() > 1 )
   {
-    F = TopoDS::Face( myTool->GetSubShape() );
+    F = TopoDS::Face( _helper->GetSubShape() );
     TopExp::MapShapesAndAncestors( F, TopAbs_VERTEX, TopAbs_WIRE, VWMap );
     int nbVertices = 0;
     for ( int iW = 0; iW < wires.size(); ++iW )
@@ -616,10 +622,10 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(TWireVector &                 wires,
       case SMDS_TOP_EDGE:
         // In order to detect degenerated faces easily, we replace
         // nodes on a degenerated edge by node on the vertex of that edge
-        if ( myTool->IsDegenShape( uvPt->node->getshapeId() ))
+        if ( _helper->IsDegenShape( uvPt->node->getshapeId() ))
         {
           int edgeID = uvPt->node->getshapeId();
-          SMESH_subMesh* edgeSM = myTool->GetMesh()->GetSubMeshContaining( edgeID );
+          SMESH_subMesh* edgeSM = _helper->GetMesh()->GetSubMeshContaining( edgeID );
           SMESH_subMeshIteratorPtr smIt = edgeSM->getDependsOnIterator( /*includeSelf=*/0,
                                                                         /*complexShapeFirst=*/0);
           if ( smIt->more() )
@@ -644,8 +650,8 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(TWireVector &                 wires,
       if ( iW && !VWMap.IsEmpty()) { // except outer wire
         // avoid passing same uv point for a vertex common to 2 wires
         int vID = mefistoToDS[m]->getshapeId();
-        TopoDS_Vertex V = TopoDS::Vertex( myTool->GetMeshDS()->IndexToShape( vID ));
-        if ( fixCommonVertexUV( uvslf[m], V, F, VWMap, *myTool->GetMesh(),
+        TopoDS_Vertex V = TopoDS::Vertex( _helper->GetMeshDS()->IndexToShape( vID ));
+        if ( fixCommonVertexUV( uvslf[m], V, F, VWMap, *_helper->GetMesh(),
                                 scalex, scaley, _quadraticMesh )) {
           myNodesOnCommonV.push_back( mefistoToDS[m] );
           continue;
@@ -659,9 +665,13 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(TWireVector &                 wires,
       fixOverlappedLinkUV (uvslf[ mB ], uvslf[ m ], uvslf[ mA ]);
     }
   }
-//   cout << "MEFISTO INPUT************" << endl;
-//   for ( int i =0; i < m; ++i )
-//     cout << i << ": \t" << uvslf[i].x << ", " << uvslf[i].y << " Node " << mefistoToDS[i]->GetID()<< endl;
+
+#ifdef DUMP_POINTS
+  cout << "MEFISTO INPUT************" << endl;
+  for ( int i =0; i < m; ++i )
+    cout << i << ": \t" << uvslf[i].x << ", " << uvslf[i].y
+         << " Node " << mefistoToDS[i]->GetID()<< endl;
+#endif
 
   return true;
 }
@@ -770,10 +780,10 @@ void StdMeshers_MEFISTO_2D::StoreResult(Z nbst, R2 * uvst, Z nbt, Z * nust,
                                         vector< const SMDS_MeshNode*>&mefistoToDS,
                                         double scalex, double scaley)
 {
-  SMESHDS_Mesh * meshDS = myTool->GetMeshDS();
-  int faceID = myTool->GetSubShapeID();
+  SMESHDS_Mesh * meshDS = _helper->GetMeshDS();
+  int faceID = _helper->GetSubShapeID();
 
-  TopoDS_Face F = TopoDS::Face( myTool->GetSubShape() );
+  TopoDS_Face F = TopoDS::Face( _helper->GetSubShape() );
   Handle(Geom_Surface) S = BRep_Tool::Surface( F );
 
   Z n = mefistoToDS.size(); // nb input points
@@ -809,14 +819,14 @@ void StdMeshers_MEFISTO_2D::StoreResult(Z nbst, R2 * uvst, Z nbt, Z * nust,
     const SMDS_MeshNode * n3 = mefistoToDS[ nust[m++] - 1 ];
 
     // avoid creating degenetrated faces
-    bool isDegen = ( myTool->HasDegeneratedEdges() && ( n1 == n2 || n1 == n3 || n2 == n3 ));
+    bool isDegen = ( _helper->HasDegeneratedEdges() && ( n1 == n2 || n1 == n3 || n2 == n3 ));
     if ( !isDegen )
     {
       SMDS_MeshElement * elt;
       if (triangleIsWellOriented)
-        elt = myTool->AddFace(n1, n2, n3);
+        elt = _helper->AddFace(n1, n2, n3);
       else
-        elt = myTool->AddFace(n1, n3, n2);
+        elt = _helper->AddFace(n1, n3, n2);
       meshDS->SetMeshElementOnShape(elt, faceID);
     }
     m++;
index 219df40890088fc1f82f799f186a1e0b3f0e6f06..28f2da8a2de9a5008f7729cbf2eb218d8b92ea7e 100644 (file)
@@ -85,7 +85,7 @@ protected:
 
   std::list<const SMDS_MeshNode*> myNodesOnCommonV;
 
-  SMESH_MesherHelper* myTool; // tool for working with quadratic elements
+  SMESH_MesherHelper* _helper; // tool for working with quadratic elements
 };
 
 #endif
index 3842b4733f56d8d937d25444bfb7de67257cb272..d5c4c9ad788c34b02eabf65666a4f478f16e3493 100644 (file)
 
 #include "StdMeshers_Quadrangle_2D.hxx"
 
-#include "StdMeshers_FaceSide.hxx"
-
-#include "StdMeshers_QuadrangleParams.hxx"
-
+#include "SMDS_EdgePosition.hxx"
+#include "SMDS_FacePosition.hxx"
+#include "SMDS_MeshElement.hxx"
+#include "SMDS_MeshNode.hxx"
+#include "SMESH_Block.hxx"
+#include "SMESH_Comment.hxx"
 #include "SMESH_Gen.hxx"
 #include "SMESH_Mesh.hxx"
-#include "SMESH_subMesh.hxx"
 #include "SMESH_MesherHelper.hxx"
-#include "SMESH_Block.hxx"
-#include "SMESH_Comment.hxx"
-
-#include "SMDS_MeshElement.hxx"
-#include "SMDS_MeshNode.hxx"
-#include "SMDS_EdgePosition.hxx"
-#include "SMDS_FacePosition.hxx"
+#include "SMESH_subMesh.hxx"
+#include "StdMeshers_FaceSide.hxx"
+#include "StdMeshers_QuadrangleParams.hxx"
+#include "StdMeshers_ViscousLayers2D.hxx"
 
 #include <BRep_Tool.hxx>
 #include <Geom_Surface.hxx>
@@ -79,7 +77,8 @@ typedef SMESH_Comment TComm;
 
 StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D (int hypId, int studyId,
                                                     SMESH_Gen* gen)
-     : SMESH_2D_Algo(hypId, studyId, gen)
+  : SMESH_2D_Algo(hypId, studyId, gen),
+    myHelper( 0 )
 {
   MESSAGE("StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D");
   _name = "Quadrangle_2D";
@@ -87,7 +86,7 @@ StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D (int hypId, int studyId,
   _compatibleHypothesis.push_back("QuadrangleParams");
   _compatibleHypothesis.push_back("QuadranglePreference");
   _compatibleHypothesis.push_back("TrianglePreference");
-  myHelper = 0;
+  _compatibleHypothesis.push_back("ViscousLayers2D");
 }
 
 //=============================================================================
@@ -193,11 +192,11 @@ bool StdMeshers_Quadrangle_2D::CheckHypothesis
  */
 //=============================================================================
 
-bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
-                                        const TopoDS_Shape& aShape)// throw (SALOME_Exception)
+bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh&         aMesh,
+                                        const TopoDS_Shape& aShape)
 {
-  // PAL14921. Enable catching std::bad_alloc and Standard_OutOfMemory outside
-  //Unexpect aCatchSalomeException);
+  const TopoDS_Face& F = TopoDS::Face(aShape);
+  Handle(Geom_Surface) S = BRep_Tool::Surface(F);
 
   SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
   aMesh.GetSubMesh(aShape);
@@ -205,6 +204,10 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
   SMESH_MesherHelper helper (aMesh);
   myHelper = &helper;
 
+  myProxyMesh = StdMeshers_ViscousLayers2D::Compute( aMesh, F );
+  if ( !myProxyMesh )
+    return false;
+
   _quadraticMesh = myHelper->IsQuadraticSubMesh(aShape);
   myNeedSmooth = false;
 
@@ -263,9 +266,6 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
   int nbhoriz  = Min(nbdown, nbup);
   int nbvertic = Min(nbright, nbleft);
 
-  const TopoDS_Face& F = TopoDS::Face(aShape);
-  Handle(Geom_Surface) S = BRep_Tool::Surface(F);
-
   // internal mesh nodes
   int i, j, geomFaceID = meshDS->ShapeToIndex(F);
   for (i = 1; i < nbhoriz - 1; i++) {
@@ -307,10 +307,10 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
   for (i = ilow; i < iup; i++) {
     for (j = jlow; j < jup; j++) {
       const SMDS_MeshNode *a, *b, *c, *d;
-      a = quad->uv_grid[j * nbhoriz + i].node;
-      b = quad->uv_grid[j * nbhoriz + i + 1].node;
+      a = quad->uv_grid[j       * nbhoriz + i    ].node;
+      b = quad->uv_grid[j       * nbhoriz + i + 1].node;
       c = quad->uv_grid[(j + 1) * nbhoriz + i + 1].node;
-      d = quad->uv_grid[(j + 1) * nbhoriz + i].node;
+      d = quad->uv_grid[(j + 1) * nbhoriz + i    ].node;
       SMDS_MeshFace* face = myHelper->AddFace(a, b, c, d);
       if (face) {
         meshDS->SetMeshElementOnShape(face, geomFaceID);
@@ -831,9 +831,16 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh &         aMes
         }
         if (!E1.IsNull() && !E2.IsNull() && !E3.IsNull())
         {
-          quad->side.push_back(new StdMeshers_FaceSide(F, E1, &aMesh, true, ignoreMediumNodes));
-          quad->side.push_back(new StdMeshers_FaceSide(F, E2, &aMesh, true, ignoreMediumNodes));
-          quad->side.push_back(new StdMeshers_FaceSide(F, E3, &aMesh, false,ignoreMediumNodes));
+          if ( myProxyMesh->GetProxySubMesh( E1 ) ||
+               myProxyMesh->GetProxySubMesh( E2 ) ||
+               myProxyMesh->GetProxySubMesh( E3 ) )
+            
+          quad->side.push_back(new StdMeshers_FaceSide(F, E1, &aMesh, true,
+                                                       ignoreMediumNodes, myProxyMesh));
+          quad->side.push_back(new StdMeshers_FaceSide(F, E2, &aMesh, true,
+                                                       ignoreMediumNodes, myProxyMesh));
+          quad->side.push_back(new StdMeshers_FaceSide(F, E3, &aMesh, false,
+                                                       ignoreMediumNodes, myProxyMesh));
           const vector<UVPtStruct>& UVPSleft  = quad->side[0]->GetUVPtStruct(true,0);
           /*  vector<UVPtStruct>& UVPStop   = */quad->side[1]->GetUVPtStruct(false,1);
           /*  vector<UVPtStruct>& UVPSright = */quad->side[2]->GetUVPtStruct(true,1);
@@ -856,8 +863,8 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh &         aMes
   else if (nbEdgesInWire.front() == 4) // exactly 4 edges
   {
     for (; edgeIt != edges.end(); ++edgeIt, nbSides++)
-      quad->side.push_back(new StdMeshers_FaceSide(F, *edgeIt, &aMesh,
-                                                    nbSides<TOP_SIDE, ignoreMediumNodes));
+      quad->side.push_back(new StdMeshers_FaceSide(F, *edgeIt, &aMesh, nbSides < TOP_SIDE,
+                                                   ignoreMediumNodes, myProxyMesh));
   }
   else if (nbEdgesInWire.front() > 4) // more than 4 edges - try to unite some
   {
@@ -883,8 +890,8 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh &         aMes
       if ( sideEdges.size() == 1 && BRep_Tool::Degenerated( sideEdges.front() ))
         degenSides.push_back( nbSides );
 
-      quad->side.push_back(new StdMeshers_FaceSide(F, sideEdges, &aMesh,
-                                                    nbSides<TOP_SIDE, ignoreMediumNodes));
+      quad->side.push_back(new StdMeshers_FaceSide(F, sideEdges, &aMesh, nbSides < TOP_SIDE,
+                                                   ignoreMediumNodes, myProxyMesh));
       ++nbSides;
     }
     if ( !degenSides.empty() && nbSides - degenSides.size() == 4 )
@@ -935,7 +942,8 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh &         aMes
           }
         }
         quad->side.push_back(new StdMeshers_FaceSide(F, sideEdges, &aMesh,
-                                                      nbSides<TOP_SIDE, ignoreMediumNodes));
+                                                     nbSides < TOP_SIDE,
+                                                     ignoreMediumNodes, myProxyMesh));
         ++nbSides;
       }
     }
@@ -1265,37 +1273,29 @@ bool StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
   if ( myNeedSmooth )
     UpdateDegenUV( quad );
 
-  // nodes Id on "in" edges
-  if (! quad->isEdgeOut[0]) {
-    int j = 0;
-    for (int i = 0; i < nbhoriz; i++) { // down
-      int ij = j * nbhoriz + i;
-      uv_grid[ij].node = uv_e0[i].node;
-    }
+  // copy data of face boundary
+  /*if (! quad->isEdgeOut[0])*/ {
+    const int j = 0;
+    for (int i = 0; i < nbhoriz; i++)       // down
+      uv_grid[ j * nbhoriz + i ] = uv_e0[i];
   }
-  if (! quad->isEdgeOut[1]) {
-    int i = nbhoriz - 1;
-    for (int j = 0; j < nbvertic; j++) { // right
-      int ij = j * nbhoriz + i;
-      uv_grid[ij].node = uv_e1[j].node;
-    }
+  /*if (! quad->isEdgeOut[1])*/ {
+    const int i = nbhoriz - 1;
+    for (int j = 0; j < nbvertic; j++)      // right
+      uv_grid[ j * nbhoriz + i ] = uv_e1[j];
   }
-  if (! quad->isEdgeOut[2]) {
-    int j = nbvertic - 1;
-    for (int i = 0; i < nbhoriz; i++) { // up
-      int ij = j * nbhoriz + i;
-      uv_grid[ij].node = uv_e2[i].node;
-    }
+  /*if (! quad->isEdgeOut[2])*/ {
+    const int j = nbvertic - 1;
+    for (int i = 0; i < nbhoriz; i++)       // up
+      uv_grid[ j * nbhoriz + i ] = uv_e2[i];
   }
-  if (! quad->isEdgeOut[3]) {
+  /*if (! quad->isEdgeOut[3])*/ {
     int i = 0;
-    for (int j = 0; j < nbvertic; j++) { // left
-      int ij = j * nbhoriz + i;
-      uv_grid[ij].node = uv_e3[j].node;
-    }
+    for (int j = 0; j < nbvertic; j++)      // left
+      uv_grid[ j * nbhoriz + i ] = uv_e3[j];
   }
 
-  // normalized 2d values on grid
+  // normalized 2d parameters on grid
   for (int i = 0; i < nbhoriz; i++) {
     for (int j = 0; j < nbvertic; j++) {
       int ij = j * nbhoriz + i;
@@ -1316,26 +1316,23 @@ bool StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
   }
 
   // 4 --- projection on 2d domain (u,v)
-  gp_UV a0(uv_e0.front().u, uv_e0.front().v);
-  gp_UV a1(uv_e0.back().u,  uv_e0.back().v);
-  gp_UV a2(uv_e2.back().u,  uv_e2.back().v);
-  gp_UV a3(uv_e2.front().u, uv_e2.front().v);
+  gp_UV a0 (uv_e0.front().u, uv_e0.front().v);
+  gp_UV a1 (uv_e0.back().u,  uv_e0.back().v );
+  gp_UV a2 (uv_e2.back().u,  uv_e2.back().v );
+  gp_UV a3 (uv_e2.front().u, uv_e2.front().v);
+
+  for (int i = 0; i < nbhoriz; i++)
+  {
+    gp_UV p0( uv_e0[i].u, uv_e0[i].v );
+    gp_UV p2( uv_e2[i].u, uv_e2[i].v );
+    for (int j = 0; j < nbvertic; j++)
+    {
+      gp_UV p1( uv_e1[j].u, uv_e1[j].v );
+      gp_UV p3( uv_e3[j].u, uv_e3[j].v );
 
-  for (int i = 0; i < nbhoriz; i++) {
-    for (int j = 0; j < nbvertic; j++) {
       int ij = j * nbhoriz + i;
       double x = uv_grid[ij].x;
       double y = uv_grid[ij].y;
-      double param_0 = uv_e0[0].normParam + x * (uv_e0.back().normParam - uv_e0[0].normParam); // sud
-      double param_2 = uv_e2[0].normParam + x * (uv_e2.back().normParam - uv_e2[0].normParam); // nord
-      double param_1 = uv_e1[0].normParam + y * (uv_e1.back().normParam - uv_e1[0].normParam); // est
-      double param_3 = uv_e3[0].normParam + y * (uv_e3.back().normParam - uv_e3[0].normParam); // ouest
-
-      //MESSAGE("params "<<param_0<<" "<<param_1<<" "<<param_2<<" "<<param_3);
-      gp_UV p0 = quad->side[0]->Value2d(param_0).XY();
-      gp_UV p1 = quad->side[1]->Value2d(param_1).XY();
-      gp_UV p2 = quad->side[2]->Value2d(param_2).XY();
-      gp_UV p3 = quad->side[3]->Value2d(param_3).XY();
 
       gp_UV uv = CalcUV(x,y, a0,a1,a2,a3, p0,p1,p2,p3);
 
@@ -1353,7 +1350,8 @@ bool StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
 
 static void ShiftQuad(FaceQuadStruct* quad, const int num, bool)
 {
-  StdMeshers_FaceSide* side[4] = { quad->side[0], quad->side[1], quad->side[2], quad->side[3] };
+  StdMeshers_FaceSide* side[4] = { quad->side[0], quad->side[1],
+                                   quad->side[2], quad->side[3] };
   for (int i = BOTTOM_SIDE; i < NB_SIDES; ++i) {
     int id = (i + num) % NB_SIDES;
     bool wasForward = (i < TOP_SIDE);
@@ -1374,23 +1372,18 @@ static gp_UV CalcUV(double x0, double x1, double y0, double y1,
                     const gp_UV& a0, const gp_UV& a1,
                     const gp_UV& a2, const gp_UV& a3)
 {
-  const vector<UVPtStruct>& uv_eb = quad->side[0]->GetUVPtStruct(true,0);
-  const vector<UVPtStruct>& uv_er = quad->side[1]->GetUVPtStruct(false,1);
-  const vector<UVPtStruct>& uv_et = quad->side[2]->GetUVPtStruct(true,1);
-  const vector<UVPtStruct>& uv_el = quad->side[3]->GetUVPtStruct(false,0);
+  // const vector<UVPtStruct>& uv_eb = quad->side[0]->GetUVPtStruct(true,0);
+  // const vector<UVPtStruct>& uv_er = quad->side[1]->GetUVPtStruct(false,1);
+  // const vector<UVPtStruct>& uv_et = quad->side[2]->GetUVPtStruct(true,1);
+  // const vector<UVPtStruct>& uv_el = quad->side[3]->GetUVPtStruct(false,0);
 
   double x = (x0 + y0 * (x1 - x0)) / (1 - (y1 - y0) * (x1 - x0));
   double y = y0 + x * (y1 - y0);
 
-  double param_b = uv_eb[0].normParam + x * (uv_eb.back().normParam - uv_eb[0].normParam);
-  double param_t = uv_et[0].normParam + x * (uv_et.back().normParam - uv_et[0].normParam);
-  double param_r = uv_er[0].normParam + y * (uv_er.back().normParam - uv_er[0].normParam);
-  double param_l = uv_el[0].normParam + y * (uv_el.back().normParam - uv_el[0].normParam);
-
-  gp_UV p0 = quad->side[BOTTOM_SIDE]->Value2d(param_b).XY();
-  gp_UV p1 = quad->side[RIGHT_SIDE ]->Value2d(param_r).XY();
-  gp_UV p2 = quad->side[TOP_SIDE   ]->Value2d(param_t).XY();
-  gp_UV p3 = quad->side[LEFT_SIDE  ]->Value2d(param_l).XY();
+  gp_UV p0 = quad->side[BOTTOM_SIDE]->Value2d(x).XY();
+  gp_UV p1 = quad->side[RIGHT_SIDE ]->Value2d(y).XY();
+  gp_UV p2 = quad->side[TOP_SIDE   ]->Value2d(x).XY();
+  gp_UV p3 = quad->side[LEFT_SIDE  ]->Value2d(y).XY();
 
   gp_UV uv = CalcUV(x,y, a0,a1,a2,a3, p0,p1,p2,p3);
 
index e200bc5af1b26554b27cb421fef6bfa220731499..000c01f66103b74908cec7eacb1abe52e68ac604 100644 (file)
 #ifndef _SMESH_QUADRANGLE_2D_HXX_
 #define _SMESH_QUADRANGLE_2D_HXX_
 
+#include "SMESH_Algo.hxx"
+#include "SMESH_ProxyMesh.hxx"
 #include "SMESH_StdMeshers.hxx"
-
 #include "StdMeshers_QuadrangleParams.hxx"
 
-#include "SMESH_Algo.hxx"
-#include "Utils_SALOME_Exception.hxx"
-
 #include <TopoDS_Face.hxx>
 
+class SMDS_MeshNode;
 class SMESH_Mesh;
 class SMESH_MesherHelper;
+class SMESH_ProxyMesh;
 class StdMeshers_FaceSide;
-class SMDS_MeshNode;
 struct uvPtStruct;
 
 
@@ -124,13 +123,15 @@ protected:
 
   bool myTrianglePreference;
 
-  int myTriaVertexID;
+  int  myTriaVertexID;
+
+  bool myNeedSmooth;
 
-  StdMeshers_QuadType myQuadType;
+  StdMeshers_QuadType  myQuadType;
 
-  SMESH_MesherHelper* myHelper; // tool for working with quadratic elements
+  SMESH_MesherHelper*  myHelper; // tool for working with quadratic elements
 
-  bool myNeedSmooth;
+  SMESH_ProxyMesh::Ptr myProxyMesh;
 };
 
 #endif
index c875ca104a4f622be907664d77f9c5f2329f6597..f5bc7afbe576143e6adf350b3c181987a23d2b9e 100644 (file)
@@ -82,7 +82,7 @@
 using namespace std;
 
 //================================================================================
-namespace VISCOUS
+namespace VISCOUS_3D
 {
   typedef int TGeomID;
 
@@ -121,13 +121,13 @@ namespace VISCOUS
    * \brief Listener of events of 3D sub-meshes computed with viscous layers.
    * It is used to clear an inferior dim sub-meshes modified by viscous layers
    */
-  class _SrinkShapeListener : SMESH_subMeshEventListener
+  class _ShrinkShapeListener : SMESH_subMeshEventListener
   {
-    _SrinkShapeListener()
+    _ShrinkShapeListener()
       : SMESH_subMeshEventListener(/*isDeletable=*/false,
-                                   "StdMeshers_ViscousLayers::_SrinkShapeListener") {}
-    static SMESH_subMeshEventListener* Get() { static _SrinkShapeListener l; return &l; }
+                                   "StdMeshers_ViscousLayers::_ShrinkShapeListener") {}
   public:
+    static SMESH_subMeshEventListener* Get() { static _ShrinkShapeListener l; return &l; }
     virtual void ProcessEvent(const int                       event,
                               const int                       eventType,
                               SMESH_subMesh*                  solidSM,
@@ -139,23 +139,6 @@ namespace VISCOUS
         SMESH_subMeshEventListener::ProcessEvent(event,eventType,solidSM,data,hyp);
       }
     }
-    static void ToClearSubMeshWithSolid( SMESH_subMesh*      sm,
-                                         const TopoDS_Shape& solid)
-    {
-      SMESH_subMesh* solidSM = sm->GetFather()->GetSubMesh( solid );
-      SMESH_subMeshEventListenerData* data = solidSM->GetEventListenerData( Get());
-      if ( data )
-      {
-        if ( find( data->mySubMeshes.begin(), data->mySubMeshes.end(), sm ) ==
-             data->mySubMeshes.end())
-          data->mySubMeshes.push_back( sm );
-      }
-      else
-      {
-        data = SMESH_subMeshEventListenerData::MakeData( /*dependent=*/sm );
-        sm->SetEventListener( Get(), data, /*whereToListenTo=*/solidSM );
-      }
-    }
   };
   //--------------------------------------------------------------------------------
   /*!
@@ -205,6 +188,32 @@ namespace VISCOUS
     }
   };
   
+  //================================================================================
+  /*!
+   * \brief sets a sub-mesh event listener to clear sub-meshes of sub-shapes of
+   * the main shape when sub-mesh of the main shape is cleared,
+   * for example to clear sub-meshes of FACEs when sub-mesh of a SOLID
+   * is cleared
+   */
+  //================================================================================
+
+  void ToClearSubWithMain( SMESH_subMesh* sub, const TopoDS_Shape& main)
+  {
+    SMESH_subMesh* mainSM = sub->GetFather()->GetSubMesh( main );
+    SMESH_subMeshEventListenerData* data =
+      mainSM->GetEventListenerData( _ShrinkShapeListener::Get());
+    if ( data )
+    {
+      if ( find( data->mySubMeshes.begin(), data->mySubMeshes.end(), sub ) ==
+           data->mySubMeshes.end())
+        data->mySubMeshes.push_back( sub );
+    }
+    else
+    {
+      data = SMESH_subMeshEventListenerData::MakeData( /*dependent=*/sub );
+      sub->SetEventListener( _ShrinkShapeListener::Get(), data, /*whereToListenTo=*/mainSM );
+    }
+  }
   //--------------------------------------------------------------------------------
   /*!
    * \brief Simplex (triangle or tetrahedron) based on 1 (tria) or 2 (tet) nodes of
@@ -547,7 +556,7 @@ virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const
       _nn[3]=_le2->_nodes[0];
     }
   };
-} // namespace VISCOUS
+} // namespace VISCOUS_3D
 
 //================================================================================
 // StdMeshers_ViscousLayers hypothesis
@@ -559,10 +568,15 @@ StdMeshers_ViscousLayers::StdMeshers_ViscousLayers(int hypId, int studyId, SMESH
   _name = StdMeshers_ViscousLayers::GetHypType();
   _param_algo_dim = -3; // auxiliary hyp used by 3D algos
 } // --------------------------------------------------------------------------------
-void StdMeshers_ViscousLayers::SetIgnoreFaces(const std::vector<int>& faceIds)
+void StdMeshers_ViscousLayers::SetBndShapesToIgnore(const std::vector<int>& faceIds)
+{
+  if ( faceIds != _ignoreBndShapeIds )
+    _ignoreBndShapeIds = faceIds, NotifySubMeshesHypothesisModification();
+} // --------------------------------------------------------------------------------
+bool StdMeshers_ViscousLayers::IsIgnoredShape(const int shapeID) const
 {
-  if ( faceIds != _ignoreFaceIds )
-    _ignoreFaceIds = faceIds, NotifySubMeshesHypothesisModification();
+  return ( find( _ignoreBndShapeIds.begin(), _ignoreBndShapeIds.end(), shapeID )
+           != _ignoreBndShapeIds.end() );
 } // --------------------------------------------------------------------------------
 void StdMeshers_ViscousLayers::SetTotalThickness(double thickness)
 {
@@ -584,7 +598,7 @@ StdMeshers_ViscousLayers::Compute(SMESH_Mesh&         theMesh,
                                   const TopoDS_Shape& theShape,
                                   const bool          toMakeN2NMap) const
 {
-  using namespace VISCOUS;
+  using namespace VISCOUS_3D;
   _ViscousBuilder bulder;
   SMESH_ComputeErrorPtr err = bulder.Compute( theMesh, theShape );
   if ( err && !err->IsOK() )
@@ -620,17 +634,17 @@ std::ostream & StdMeshers_ViscousLayers::SaveTo(std::ostream & save)
   save << " " << _nbLayers
        << " " << _thickness
        << " " << _stretchFactor
-       << " " << _ignoreFaceIds.size();
-  for ( unsigned i = 0; i < _ignoreFaceIds.size(); ++i )
-    save << " " << _ignoreFaceIds[i];
+       << " " << _ignoreBndShapeIds.size();
+  for ( unsigned i = 0; i < _ignoreBndShapeIds.size(); ++i )
+    save << " " << _ignoreBndShapeIds[i];
   return save;
 } // --------------------------------------------------------------------------------
 std::istream & StdMeshers_ViscousLayers::LoadFrom(std::istream & load)
 {
   int nbFaces, faceID;
   load >> _nbLayers >> _thickness >> _stretchFactor >> nbFaces;
-  while ( _ignoreFaceIds.size() < nbFaces && load >> faceID )
-    _ignoreFaceIds.push_back( faceID );
+  while ( _ignoreBndShapeIds.size() < nbFaces && load >> faceID )
+    _ignoreBndShapeIds.push_back( faceID );
   return load;
 } // --------------------------------------------------------------------------------
 bool StdMeshers_ViscousLayers::SetParametersByMesh(const SMESH_Mesh*   theMesh,
@@ -849,7 +863,7 @@ namespace
 #endif
 }
 
-using namespace VISCOUS;
+using namespace VISCOUS_3D;
 
 //================================================================================
 /*!
@@ -1051,7 +1065,7 @@ bool _ViscousBuilder::findFacesWithLayers()
   vector<TopoDS_Shape> ignoreFaces;
   for ( unsigned i = 0; i < _sdVec.size(); ++i )
   {
-    vector<TGeomID> ids = _sdVec[i]._hyp->GetIgnoreFaces();
+    vector<TGeomID> ids = _sdVec[i]._hyp->GetBndShapesToIgnore();
     for ( unsigned i = 0; i < ids.size(); ++i )
     {
       const TopoDS_Shape& s = getMeshDS()->IndexToShape( ids[i] );
@@ -3599,6 +3613,7 @@ bool _ViscousBuilder::shrink()
           _Shrinker1D& srinker = e2shrMap[ edgeIndex ];
           eShri1D.insert( & srinker );
           srinker.AddEdge( edge, helper );
+          VISCOUS_3D::ToClearSubWithMain( _mesh->GetSubMesh( edge->_sWOL ), data._solid );
           // restore params of nodes on EGDE if the EDGE has been already
           // srinked while srinking another FACE
           srinker.RestoreParams();
@@ -3684,7 +3699,7 @@ bool _ViscousBuilder::shrink()
       dumpFunctionEnd();
     }
     // Set an event listener to clear FACE sub-mesh together with SOLID sub-mesh
-    _SrinkShapeListener::ToClearSubMeshWithSolid( sm, data._solid );
+    VISCOUS_3D::ToClearSubWithMain( sm, data._solid );
 
     if ( !getMeshDS()->IsEmbeddedMode() )
       // Log node movement
index 42c1871304effa3104e648a6f2da9af835bf86f3..4fa07a9efe0f8a8a572717b5c739efa2d1fcffca 100644 (file)
@@ -39,9 +39,10 @@ class STDMESHERS_EXPORT StdMeshers_ViscousLayers : public SMESH_Hypothesis
 public:
   StdMeshers_ViscousLayers(int hypId, int studyId, SMESH_Gen* gen);
 
-  // Set faces to exclude from treatment
-  void SetIgnoreFaces(const std::vector<int>& faceIds);
-  std::vector<int> GetIgnoreFaces() const { return _ignoreFaceIds; }
+  // Set boundary shapes to exclude from treatment, faces in 3D, edges in 2D
+  void SetBndShapesToIgnore(const std::vector<int>& shapeIds);
+  std::vector<int> GetBndShapesToIgnore() const { return _ignoreBndShapeIds; }
+  bool IsIgnoredShape(const int shapeID) const;
 
   // Set total thickness of layers of prisms
   void SetTotalThickness(double thickness);
@@ -85,10 +86,20 @@ public:
 
  private:
 
-  std::vector<int> _ignoreFaceIds;
+  std::vector<int> _ignoreBndShapeIds;
   int              _nbLayers;
   double           _thickness;
   double           _stretchFactor;
 };
 
+class SMESH_subMesh;
+namespace VISCOUS_3D
+{
+  // sets a sub-mesh event listener to clear sub-meshes of sub-shapes of
+  // the main shape when sub-mesh of the main shape is cleared,
+  // for example to clear sub-meshes of FACEs when sub-mesh of a SOLID
+  // is cleared
+  void ToClearSubWithMain( SMESH_subMesh* sub, const TopoDS_Shape& main);
+}
+
 #endif
index 127be9f4e53ce440c19d085a0fd3aa788a6b844f..0a033c0335ffa6b3b4715be869982c90ecf62419 100644 (file)
@@ -694,6 +694,24 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
         h->SetIgnoreFaces( idsWg->GetListOfIDs() );
       }
     }
+    else if( hypType()=="ViscousLayers2D" )
+    {
+      StdMeshers::StdMeshers_ViscousLayers2D_var h =
+        StdMeshers::StdMeshers_ViscousLayers2D::_narrow( hypothesis() );
+
+      h->SetVarParameter( params[0].text(), "SetTotalThickness" );
+      h->SetTotalThickness( params[0].myValue.toDouble() );
+      h->SetVarParameter( params[1].text(), "SetNumberLayers" );
+      h->SetNumberLayers  ( params[1].myValue.toInt() );
+      h->SetVarParameter( params[2].text(), "SetStretchFactor" );
+      h->SetStretchFactor ( params[2].myValue.toDouble() );
+
+      if ( StdMeshersGUI_SubShapeSelectorWdg* idsWg = 
+           widget< StdMeshersGUI_SubShapeSelectorWdg >( 3 ))
+      {
+        h->SetIgnoreEdges( idsWg->GetListOfIDs() );
+      }
+    }
     else if( hypType()=="QuadrangleParams" )
     {
       StdMeshers::StdMeshers_QuadrangleParams_var h =
@@ -1152,6 +1170,45 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
       customWidgets()->append ( idsWg );
     }
   }
+  else if( hypType()=="ViscousLayers2D" )
+  {
+    StdMeshers::StdMeshers_ViscousLayers2D_var h =
+      StdMeshers::StdMeshers_ViscousLayers2D::_narrow( hyp );
+
+    item.myName = tr( "SMESH_TOTAL_THICKNESS" );
+    if(!initVariableName( hyp, item, "SetTotalThickness" ))
+      item.myValue = h->GetTotalThickness();
+    p.append( item );
+    customWidgets()->append (0);
+
+    item.myName = tr( "SMESH_NUMBER_OF_LAYERS" );
+    if(!initVariableName( hyp, item, "SetNumberLayers" ))
+      item.myValue = h->GetNumberLayers();
+    p.append( item );
+    customWidgets()->append (0);
+
+    item.myName = tr( "SMESH_STRETCH_FACTOR" );
+    if(!initVariableName( hyp, item, "SetStretchFactor" ))
+      item.myValue = h->GetStretchFactor();
+    p.append( item );
+    customWidgets()->append (0);
+
+    QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
+    if ( !aMainEntry.isEmpty() )
+    {
+      item.myName = tr( "SMESH_EDGES_WO_LAYERS" );
+      p.append( item );
+
+      StdMeshersGUI_SubShapeSelectorWdg* idsWg =
+        new StdMeshersGUI_SubShapeSelectorWdg(0,TopAbs_EDGE);
+
+      idsWg->SetGeomShapeEntry( aMainEntry );
+      idsWg->SetMainShapeEntry( aMainEntry );
+      idsWg->SetListOfIDs( h->GetIgnoreEdges() );
+      idsWg->showPreview( true );
+      customWidgets()->append ( idsWg );
+    }
+  }
   else if (hypType() == "QuadrangleParams")
   {
     StdMeshers::StdMeshers_QuadrangleParams_var h =
@@ -1242,7 +1299,7 @@ void StdMeshersGUI_StdHypothesisCreator::attuneStdWidget (QWidget* w, const int)
     {
       sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "parametric_precision" );
     }
-    else if( hypType()=="ViscousLayers" )
+    else if( hypType().startsWith( "ViscousLayers" ))
     {
       if (sb->objectName() == tr("SMESH_STRETCH_FACTOR"))
         sb->RangeStepAndValidator( 1.0, VALUE_MAX, 0.1, "parametric_precision" );
@@ -1254,12 +1311,6 @@ void StdMeshersGUI_StdHypothesisCreator::attuneStdWidget (QWidget* w, const int)
       sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
     }
   }
-//   else if ( QtxIntSpinBox* ib = w->inherits( "QtxIntSpinBox" ) ? ( QtxIntSpinBox* )w : 0)
-//   {
-//     if( hypType()=="ViscousLayers" )
-//     {
-//     }
-//   }
 }
 
 //================================================================================
@@ -1334,6 +1385,7 @@ QString StdMeshersGUI_StdHypothesisCreator::hypTypeName( const QString& t ) cons
     types.insert( "SegmentLengthAroundVertex", "SEGMENT_LENGTH_AROUND_VERTEX" );
     types.insert( "MaxLength", "MAX_LENGTH" );
     types.insert( "ViscousLayers", "VISCOUS_LAYERS" );
+    types.insert( "ViscousLayers2D", "VISCOUS_LAYERS" );
     types.insert( "QuadrangleParams", "QUADRANGLE_PARAMS" );
     types.insert( "CartesianParameters3D", "CARTESIAN_PARAMS" );
   }
index df97c12a15c0becd9c74fb20818deaeec6d66a18..2b506311f87a1e9a160b9038afa5c797e1de7892 100644 (file)
     <message>
         <source>SMESH_FACES_WO_LAYERS</source>
         <translation>Faces without layers
+(inlets and oulets)</translation>
+    </message>
+    <message>
+        <source>SMESH_EDGES_WO_LAYERS</source>
+        <translation>Edges without layers
 (inlets and oulets)</translation>
     </message>
     <message>
index 4bc901d2dfa6750e7358f1c3c6a5d9e8f6ab0f44..c9f50b4d085dbfb25e90c085d2ee9fb945833dde 100644 (file)
@@ -68,6 +68,7 @@ salomeinclude_HEADERS = \
        StdMeshers_Import_1D_i.hxx \
        StdMeshers_Import_1D2D_i.hxx \
        StdMeshers_ViscousLayers_i.hxx \
+       StdMeshers_ViscousLayers2D_i.hxx \
        StdMeshers_CartesianParameters3D_i.hxx \
        StdMeshers_Cartesian_3D_i.hxx
 
@@ -116,6 +117,7 @@ dist_libStdMeshersEngine_la_SOURCES = \
        StdMeshers_Import_1D_i.cxx \
        StdMeshers_Import_1D2D_i.cxx \
        StdMeshers_ViscousLayers_i.cxx \
+       StdMeshers_ViscousLayers2D_i.cxx \
        StdMeshers_CartesianParameters3D_i.cxx \
        StdMeshers_Cartesian_3D_i.cxx
 
diff --git a/src/StdMeshers_I/StdMeshers_ViscousLayers2D_i.cxx b/src/StdMeshers_I/StdMeshers_ViscousLayers2D_i.cxx
new file mode 100644 (file)
index 0000000..b60672a
--- /dev/null
@@ -0,0 +1,225 @@
+// 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
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//  File   : StdMeshers_ViscousLayers2D_i.cxx
+//  Module : SMESH
+//
+#include "StdMeshers_ViscousLayers2D_i.hxx"
+
+#include "SMESH_Gen.hxx"
+#include "SMESH_Gen_i.hxx"
+#include "SMESH_PythonDump.hxx"
+
+#include "Utils_CorbaException.hxx"
+#include "utilities.h"
+
+#include <TCollection_AsciiString.hxx>
+
+#include CORBA_SERVER_HEADER(SMESH_Group)
+
+using namespace std;
+
+//=============================================================================
+/*!
+ *  StdMeshers_ViscousLayers2D_i::StdMeshers_ViscousLayers2D_i
+ *
+ *  Constructor
+ */
+//=============================================================================
+
+StdMeshers_ViscousLayers2D_i::StdMeshers_ViscousLayers2D_i( PortableServer::POA_ptr thePOA,
+                                                            int                     theStudyId,
+                                                            ::SMESH_Gen*            theGenImpl )
+  : SALOME::GenericObj_i( thePOA ),
+    SMESH_Hypothesis_i( thePOA )
+{
+  MESSAGE( "StdMeshers_ViscousLayers2D_i::StdMeshers_ViscousLayers2D_i" );
+  myBaseImpl = new ::StdMeshers_ViscousLayers2D( theGenImpl->GetANewId(),
+                                                 theStudyId,
+                                                 theGenImpl );
+}
+
+//=============================================================================
+/*!
+ *  StdMeshers_ViscousLayers2D_i::~StdMeshers_ViscousLayers2D_i
+ *
+ *  Destructor
+ */
+//=============================================================================
+
+StdMeshers_ViscousLayers2D_i::~StdMeshers_ViscousLayers2D_i()
+{
+  MESSAGE( "StdMeshers_ViscousLayers2D_i::~StdMeshers_ViscousLayers2D_i" );
+}
+
+//================================================================================
+/*!
+ * \brief 
+ */
+//================================================================================
+
+void StdMeshers_ViscousLayers2D_i::SetIgnoreEdges(const ::SMESH::long_array& edgeIDs)
+throw ( SALOME::SALOME_Exception )
+{
+  vector<int> ids( edgeIDs.length() );
+  for ( unsigned i = 0; i < ids.size(); ++i )
+    if (( ids[i] = edgeIDs[i] ) < 1 )
+      THROW_SALOME_CORBA_EXCEPTION( "Invalid edge id", SALOME::BAD_PARAM );
+  GetImpl()->SetBndShapesToIgnore( ids );
+  SMESH::TPythonDump() << _this() << ".SetIgnoreEdges( " << edgeIDs << " )";
+}
+
+//================================================================================
+/*!
+ * \brief 
+ */
+//================================================================================
+
+SMESH::long_array* StdMeshers_ViscousLayers2D_i::GetIgnoreEdges()
+{
+  vector<int> idsVec = GetImpl()->GetBndShapesToIgnore();
+  SMESH::long_array_var ids = new SMESH::long_array;
+  ids->length( idsVec.size() );
+  for ( unsigned i = 0; i < idsVec.size(); ++i )
+    ids[i] = idsVec[i];
+  return ids._retn();
+}
+
+//================================================================================
+/*!
+ * \brief 
+ */
+//================================================================================
+
+void StdMeshers_ViscousLayers2D_i::SetTotalThickness(::CORBA::Double thickness)
+throw ( SALOME::SALOME_Exception )
+{
+  if ( thickness < 1e-100 )
+    THROW_SALOME_CORBA_EXCEPTION( "Invalid thickness", SALOME::BAD_PARAM );
+  GetImpl()->SetTotalThickness(thickness);
+  SMESH::TPythonDump() << _this() << ".SetTotalThickness( " << SMESH::TVar(thickness) << " )";
+}
+
+//================================================================================
+/*!
+ * \brief 
+ */
+//================================================================================
+
+::CORBA::Double StdMeshers_ViscousLayers2D_i::GetTotalThickness()
+{
+  return GetImpl()->GetTotalThickness();
+}
+
+//================================================================================
+/*!
+ * \brief 
+ *  \param nb - 
+ */
+//================================================================================
+
+void StdMeshers_ViscousLayers2D_i::SetNumberLayers(::CORBA::Short nb)
+throw ( SALOME::SALOME_Exception )
+{
+  if ( nb < 1 )
+    THROW_SALOME_CORBA_EXCEPTION( "Invalid number of layers", SALOME::BAD_PARAM );
+  GetImpl()->SetNumberLayers( nb );
+  SMESH::TPythonDump() << _this() << ".SetNumberLayers( " << SMESH::TVar(nb) << " )";
+}
+
+//================================================================================
+/*!
+ * \brief 
+ */
+//================================================================================
+
+::CORBA::Short StdMeshers_ViscousLayers2D_i::GetNumberLayers()
+{
+  return CORBA::Short( GetImpl()->GetNumberLayers() );
+}
+
+//================================================================================
+/*!
+ * \brief 
+ *  \param factor - 
+ */
+//================================================================================
+
+void StdMeshers_ViscousLayers2D_i::SetStretchFactor(::CORBA::Double factor)
+throw ( SALOME::SALOME_Exception )
+{
+  if ( factor < 1 )
+    THROW_SALOME_CORBA_EXCEPTION( "Invalid stretch factor, it must be >= 1.0", SALOME::BAD_PARAM );
+  GetImpl()->SetStretchFactor(factor);
+  SMESH::TPythonDump() << _this() << ".SetStretchFactor( " << SMESH::TVar(factor) << " )";
+}
+
+//================================================================================
+/*!
+ * \brief 
+ * 
+ */
+//================================================================================
+
+::CORBA::Double StdMeshers_ViscousLayers2D_i::GetStretchFactor()
+{
+  return GetImpl()->GetStretchFactor();
+}
+
+//=============================================================================
+/*!
+ *  Get implementation
+ */
+//=============================================================================
+
+::StdMeshers_ViscousLayers2D* StdMeshers_ViscousLayers2D_i::GetImpl()
+{
+  MESSAGE( "StdMeshers_ViscousLayers2D_i::GetImpl" );
+  return ( ::StdMeshers_ViscousLayers2D* )myBaseImpl;
+}
+
+//================================================================================
+/*!
+ * \brief Verify whether hypothesis supports given entity type 
+  * \param type - dimension (see SMESH::Dimension enumeration)
+  * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
+ * 
+ * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
+ */
+//================================================================================  
+
+CORBA::Boolean StdMeshers_ViscousLayers2D_i::IsDimSupported( SMESH::Dimension type )
+{
+  return type == SMESH::DIM_2D;
+}
+
+//================================================================================
+/*!
+ * \brief Sets sub-mesh event listeners to clear sub-meshes of edges
+ * shrinked by viscous layers
+ */
+//================================================================================
+
+void StdMeshers_ViscousLayers2D_i::UpdateAsMeshesRestored()
+{
+  GetImpl()->RestoreListeners();
+}
diff --git a/src/StdMeshers_I/StdMeshers_ViscousLayers2D_i.hxx b/src/StdMeshers_I/StdMeshers_ViscousLayers2D_i.hxx
new file mode 100644 (file)
index 0000000..8a6eacf
--- /dev/null
@@ -0,0 +1,74 @@
+// 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
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//  File   : StdMeshers_ViscousLayers2D_i.hxx
+//  Module : SMESH
+//
+#ifndef _SMESH_ViscousLayers2D_I_HXX_
+#define _SMESH_ViscousLayers2D_I_HXX_
+
+#include "SMESH_StdMeshers_I.hxx"
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "StdMeshers_ViscousLayers_i.hxx"
+#include "StdMeshers_ViscousLayers2D.hxx"
+
+class SMESH_Gen;
+
+class STDMESHERS_I_EXPORT StdMeshers_ViscousLayers2D_i:
+  public virtual POA_StdMeshers::StdMeshers_ViscousLayers2D,
+  public virtual SMESH_Hypothesis_i
+{
+ public:
+  // Constructor
+  StdMeshers_ViscousLayers2D_i( PortableServer::POA_ptr thePOA,
+                              int                     theStudyId,
+                              ::SMESH_Gen*            theGenImpl );
+  // Destructor
+  virtual ~StdMeshers_ViscousLayers2D_i();
+
+  void SetIgnoreEdges(const ::SMESH::long_array& edgeIDs) throw ( SALOME::SALOME_Exception );
+  SMESH::long_array* GetIgnoreEdges();
+
+  void SetTotalThickness(::CORBA::Double thickness) throw ( SALOME::SALOME_Exception );
+  ::CORBA::Double GetTotalThickness();
+
+  void SetNumberLayers(::CORBA::Short nb) throw ( SALOME::SALOME_Exception );
+  ::CORBA::Short GetNumberLayers();
+
+  void SetStretchFactor(::CORBA::Double factor) throw ( SALOME::SALOME_Exception );
+  ::CORBA::Double GetStretchFactor();
+
+  // Get implementation
+  ::StdMeshers_ViscousLayers2D* GetImpl();
+
+  // Verify whether hypothesis supports given entity type 
+  CORBA::Boolean IsDimSupported( SMESH::Dimension type );
+
+  // Sets sub-mesh event listeners to clear sub-meshes of edges
+  // shrinked by viscous layers
+  virtual void  UpdateAsMeshesRestored();
+};
+
+#endif
index 55ca30d75905209e02866600dfcba7d4f4dfe012..e6e7897f0bf4e0cadf71816733d4986caa090331 100644 (file)
@@ -85,7 +85,7 @@ throw ( SALOME::SALOME_Exception )
   for ( unsigned i = 0; i < ids.size(); ++i )
     if (( ids[i] = faceIDs[i] ) < 1 )
       THROW_SALOME_CORBA_EXCEPTION( "Invalid face id", SALOME::BAD_PARAM );
-  GetImpl()->SetIgnoreFaces( ids );
+  GetImpl()->SetBndShapesToIgnore( ids );
   SMESH::TPythonDump() << _this() << ".SetIgnoreFaces( " << faceIDs << " )";
 }
 
@@ -97,7 +97,7 @@ throw ( SALOME::SALOME_Exception )
 
 SMESH::long_array* StdMeshers_ViscousLayers_i::GetIgnoreFaces()
 {
-  vector<int> idsVec = GetImpl()->GetIgnoreFaces();
+  vector<int> idsVec = GetImpl()->GetBndShapesToIgnore();
   SMESH::long_array_var ids = new SMESH::long_array;
   ids->length( idsVec.size() );
   for ( unsigned i = 0; i < idsVec.size(); ++i )
index e4d5d6e2e98a84e4c60b0d885e014b2929f32497..b17f9f242de91b0e9c890384c158bfb08e66298b 100644 (file)
@@ -20,7 +20,6 @@
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
 //  File   : StdMeshers_ViscousLayers_i.hxx
 //  Module : SMESH
 //
index 20104d9c8755a58f82e984fff2825fbaef6731c5..9920827583f01efc69f8b6656c13ae7e749548f7 100644 (file)
@@ -73,6 +73,7 @@
 #include "StdMeshers_Import_1D_i.hxx"
 #include "StdMeshers_Import_1D2D_i.hxx"
 #include "StdMeshers_ViscousLayers_i.hxx"
+#include "StdMeshers_ViscousLayers2D_i.hxx"
 #include "StdMeshers_CartesianParameters3D_i.hxx"
 
 template <class T> class StdHypothesisCreator_i:public HypothesisCreator_i<T>
@@ -179,6 +180,8 @@ STDMESHERS_I_EXPORT
       aCreator = new StdHypothesisCreator_i<StdMeshers_ImportSource2D_i>;
     else if (strcmp(aHypName, "ViscousLayers") == 0)
       aCreator = new StdHypothesisCreator_i<StdMeshers_ViscousLayers_i>;
+    else if (strcmp(aHypName, "ViscousLayers2D") == 0)
+      aCreator = new StdHypothesisCreator_i<StdMeshers_ViscousLayers2D_i>;
     else if (strcmp(aHypName, "CartesianParameters3D") == 0)
       aCreator = new StdHypothesisCreator_i<StdMeshers_CartesianParameters3D_i>;