Salome HOME
Merge branch 'V8_2_BR'
authorrnv <rnv@opencascade.com>
Thu, 15 Dec 2016 07:49:20 +0000 (10:49 +0300)
committerrnv <rnv@opencascade.com>
Thu, 15 Dec 2016 08:05:13 +0000 (11:05 +0300)
20 files changed:
CMakeLists.txt
doc/salome/examples/filters_ex03.py
doc/salome/examples/filters_ex07.py
doc/salome/examples/filters_ex09.py
src/SMDS/SMDS_Mesh.cxx
src/SMDS/SMDS_Mesh.hxx
src/SMDS/SMDS_MeshNode.cxx
src/SMDS/SMDS_MeshNode.hxx
src/SMESH/SMESH_MesherHelper.cxx
src/SMESH/SMESH_Pattern.cxx
src/SMESHGUI/SMESHGUI_ClippingDlg.cxx
src/SMESHGUI/SMESHGUI_ReorientFacesDlg.cxx
src/SMESHUtils/SMESH_MeshAlgos.cxx
src/SMESH_SWIG/smeshBuilder.py
src/SMESH_SWIG/smesh_algorithm.py
src/StdMeshers/StdMeshers_Projection_2D.cxx
src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx
src/StdMeshersGUI/StdMeshers_images.ts
src/StdMeshers_I/StdMeshers_AutomaticLength_i.cxx
src/StdMeshers_I/StdMeshers_SegmentLengthAroundVertex_i.cxx

index 250b8deac28d00c9fdd59fdd55f6ffed18508b5f..a2d069f668e871e1e1e6c96ed20d1a258cff1e40 100755 (executable)
@@ -35,7 +35,7 @@ SET(${PROJECT_NAME_UC}_MINOR_VERSION 2)
 SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
 SET(${PROJECT_NAME_UC}_VERSION
   ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
-SET(${PROJECT_NAME_UC}_VERSION_DEV 0)
+SET(${PROJECT_NAME_UC}_VERSION_DEV 1)
 
 # Common CMake macros
 # ===================
index c9313bceb7745608afc9a8824988e10c9b4dba41..9d5467e6fe638ca80ef2ec3843048a9abea8f68d 100644 (file)
@@ -3,9 +3,6 @@
 # create mesh
 from SMESH_mechanic import *
 # get faces with warping angle = 2.0e-13 with tolerance 5.0e-14
-criterion = smesh.GetCriterion(SMESH.FACE, SMESH.FT_Warping, SMESH.FT_EqualTo, 2.0e-13)
-criterion.Tolerance = 5.0e-14
-filter = smesh.CreateFilterManager().CreateFilter()
-filter.SetCriteria([criterion])
+filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Warping, "=", 2.0e-13, Tolerance=5.0e-14)
 ids = mesh.GetIdsFromFilter(filter)
 print "Number of faces with warping angle = 2.0e-13 (tolerance 5.0e-14):", len(ids)
index 6c42d521767fa7eaf93cfeb9da5f89ced20a43d1..3afee5e1a705b941b5591b6146c5af90b5f8823b 100644 (file)
@@ -3,10 +3,8 @@
 # create mesh
 from SMESH_mechanic import *
 # get faces with area > 60 and < 90
-criterion1 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 60,\
-                                SMESH.FT_Undefined, SMESH.FT_LogicalAND)
+criterion1 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 60)
 criterion2 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 90)
-filter = smesh.CreateFilterManager().CreateFilter()
-filter.SetCriteria([criterion1,criterion2])
+filter = smesh.GetFilterFromCriteria([criterion1,criterion2], SMESH.FT_LogicalAND)
 ids = mesh.GetIdsFromFilter(filter)
 print "Number of faces with area in range (60,90):", len(ids)
index dd64159309da441e22395791a6ffe4e5da32d091..032d55ddda5f6b4f2c239f727c00908adeed016d 100644 (file)
@@ -9,8 +9,7 @@ from salome.smesh import smeshBuilder
 smesh =  smeshBuilder.New(salome.myStudy)
 
 # create mesh
-face = geompy.MakeFaceHW(100, 100, 1)
-geompy.addToStudy( face, "quadrangle" )
+face = geompy.MakeFaceHW(100, 100, 1, theName="quadrangle")
 mesh = smesh.Mesh(face)
 mesh.Segment().NumberOfSegments(10)
 mesh.Triangle().MaxElementArea(25)
index d70ff4bcdf59aebdf0e0fbcaf26a83f0033fae89..13a2aa40f9a442a527f073149985a844d248ea3d 100644 (file)
@@ -2570,6 +2570,13 @@ int SMDS_Mesh::NbNodes() const
   return myInfo.NbNodes();
 }
 
+///////////////////////////////////////////////////////////////////////////////
+/// Return the number of elements
+///////////////////////////////////////////////////////////////////////////////
+int SMDS_Mesh::NbElements() const
+{
+  return myInfo.NbElements();
+}
 ///////////////////////////////////////////////////////////////////////////////
 /// Return the number of 0D elements
 ///////////////////////////////////////////////////////////////////////////////
@@ -3322,14 +3329,14 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement *        elem,
 void SMDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elem)
 {
   int elemId = elem->GetID();
-  int vtkId = elem->getVtkId();
+  int  vtkId = elem->getVtkId();
   SMDSAbs_ElementType aType = elem->GetType();
-  SMDS_MeshElement* todest = (SMDS_MeshElement*)(elem);
-  if (aType == SMDSAbs_Node) {
+  SMDS_MeshElement*  todest = (SMDS_MeshElement*)(elem);
+  if ( aType == SMDSAbs_Node )
+  {
     // only free node can be removed by this method
     const SMDS_MeshNode* n = static_cast<SMDS_MeshNode*>(todest);
-    SMDS_ElemIteratorPtr itFe = n->GetInverseElementIterator();
-    if (!itFe->more()) { // free node
+    if ( n->NbInverseElements() == 0 ) { // free node
       myNodes[elemId] = 0;
       myInfo.myNbNodes--;
       ((SMDS_MeshNode*) n)->SetPosition(SMDS_SpacePosition::originSpacePosition());
@@ -3337,7 +3344,9 @@ void SMDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elem)
       myNodePool->destroy(static_cast<SMDS_MeshNode*>(todest));
       myNodeIDFactory->ReleaseID(elemId, vtkId);
     }
-  } else {
+  }
+  else
+  {
     if (hasConstructionEdges() || hasConstructionFaces())
       // this methods is only for meshes without descendants
       return;
index 459befaa9d8eaf087bb99552db9e3a603f031d6e..814fe9bac7c1aadfb6165f3af97045210ed91a72 100644 (file)
@@ -705,6 +705,7 @@ public:
   const SMDS_MeshInfo& GetMeshInfo() const { return myInfo; }
 
   virtual int NbNodes() const;
+  virtual int NbElements() const;
   virtual int Nb0DElements() const;
   virtual int NbBalls() const;
   virtual int NbEdges() const;
index 1f49f82dc6f45a18c0c3434f43b3b81286e1cc15..553d568f056dbda22c9cd08d5ed4248f754632af 100644 (file)
@@ -143,22 +143,29 @@ public:
   SMDS_MeshNode_MyInvIterator(SMDS_Mesh *mesh, vtkIdType* cells, int ncells, SMDSAbs_ElementType type) :
     myMesh(mesh), myCells(cells), myNcells(ncells), myType(type), iter(0)
   {
-    cellList.reserve( ncells );
-    if (type == SMDSAbs_All)
-      cellList.assign( cells, cells + ncells );
-    else
-      for (int i = 0; i < ncells; i++)
+    if ( ncells )
+    {
+      cellList.reserve( ncells );
+      if (type == SMDSAbs_All)
+      {
+        cellList.assign( cells, cells + ncells );
+      }
+      else
       {
-        int vtkId = cells[i];
-        int smdsId = myMesh->fromVtkToSmds(vtkId);
-        const SMDS_MeshElement* elem = myMesh->FindElement(smdsId);
-        if (elem->GetType() == type)
+        for (int i = 0; i < ncells; i++)
         {
-          cellList.push_back(vtkId);
+          int vtkId = cells[i];
+          int smdsId = myMesh->fromVtkToSmds(vtkId);
+          const SMDS_MeshElement* elem = myMesh->FindElement(smdsId);
+          if (elem->GetType() == type)
+          {
+            cellList.push_back(vtkId);
+          }
         }
+        myCells = cellList.empty() ? 0 : &cellList[0];
+        myNcells = cellList.size();
       }
-    myCells = cellList.empty() ? 0 : &cellList[0];
-    myNcells = cellList.size();
+    }
   }
 
   bool more()
@@ -183,64 +190,23 @@ public:
 
 SMDS_ElemIteratorPtr SMDS_MeshNode::GetInverseElementIterator(SMDSAbs_ElementType type) const
 {
-  vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetLinks()->GetLink(myVtkID);
-  return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyInvIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type));
-}
-
-// Same as GetInverseElementIterator but the created iterator only returns
-// wanted type elements.
-class SMDS_MeshNode_MyIterator:public SMDS_ElemIterator
-{
-private:
-  SMDS_Mesh*                myMesh;
-  vtkIdType*                myCells;
-  int                       myNcells;
-  SMDSAbs_ElementType       myType;
-  int                       iter;
-  vector<SMDS_MeshElement*> myFiltCells;
-
-public:
-  SMDS_MeshNode_MyIterator(SMDS_Mesh *mesh,
-                           vtkIdType* cells,
-                           int ncells,
-                           SMDSAbs_ElementType type):
-    myMesh(mesh), myCells(cells), myNcells(ncells), myType(type), iter(0)
+  if ( SMDS_Mesh::_meshList[myMeshId]->NbElements() > 0 ) // avoid building links
   {
-    for (; iter<ncells; iter++)
-    {
-      int vtkId = myCells[iter];
-      int smdsId = myMesh->fromVtkToSmds(vtkId);
-      const SMDS_MeshElement* elem = myMesh->FindElement(smdsId);
-      if (elem->GetType() == type)
-        myFiltCells.push_back((SMDS_MeshElement*)elem);
-    }
-    myNcells = myFiltCells.size();
-    iter = 0;
-  }
-
-  bool more()
-  {
-    return (iter< myNcells);
+    vtkCellLinks::Link& l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetLinks()->GetLink(myVtkID);
+    return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyInvIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type));
   }
-
-  const SMDS_MeshElement* next()
+  else
   {
-    const SMDS_MeshElement* elem = myFiltCells[iter];
-    iter++;
-    return elem;
+    return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyInvIterator(SMDS_Mesh::_meshList[myMeshId], 0, 0, type));
   }
-};
+}
 
-SMDS_ElemIteratorPtr SMDS_MeshNode::
-elementsIterator(SMDSAbs_ElementType type) const
+SMDS_ElemIteratorPtr SMDS_MeshNode::elementsIterator(SMDSAbs_ElementType type) const
 {
-  if(type==SMDSAbs_Node)
-    return SMDS_MeshElement::elementsIterator(SMDSAbs_Node);
+  if ( type == SMDSAbs_Node )
+    return SMDS_MeshElement::elementsIterator( SMDSAbs_Node );
   else
-  {
-    vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetLinks()->GetLink(myVtkID);
-    return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type));
-  }
+    return GetInverseElementIterator( type );
 }
 
 int SMDS_MeshNode::NbNodes() const
@@ -275,12 +241,14 @@ double SMDS_MeshNode::Z() const
 /*!
  * \brief thread safe getting coords
  */
+//================================================================================
+
 void SMDS_MeshNode::GetXYZ(double xyz[3]) const
 {
   return SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetPoint(myVtkID,xyz);
 }
 
-//* resize the vtkPoints structure every SMDS_Mesh::chunkSize points
+//================================================================================
 void SMDS_MeshNode::setXYZ(double x, double y, double z)
 {
   SMDS_Mesh *mesh = SMDS_Mesh::_meshList[myMeshId];
@@ -321,12 +289,6 @@ void SMDS_MeshNode::ClearInverseElements()
   SMDS_Mesh::_meshList[myMeshId]->getGrid()->ResizeCellList(myVtkID, 0);
 }
 
-bool SMDS_MeshNode::emptyInverseElements()
-{
-  vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetLinks()->GetLink(myVtkID);
-  return (l.ncells == 0);
-}
-
 //================================================================================
 /*!
  * \brief Count inverse elements of given type
@@ -335,35 +297,20 @@ bool SMDS_MeshNode::emptyInverseElements()
 
 int SMDS_MeshNode::NbInverseElements(SMDSAbs_ElementType type) const
 {
-  vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetLinks()->GetLink(myVtkID);
-
-  if ( type == SMDSAbs_All )
-    return l.ncells;
-
   int nb = 0;
-  SMDS_Mesh *mesh = SMDS_Mesh::_meshList[myMeshId];
-  for (int i=0; i<l.ncells; i++)
+  if ( SMDS_Mesh::_meshList[myMeshId]->NbElements() > 0 ) // avoid building links
   {
-    const SMDS_MeshElement* elem = mesh->FindElement(mesh->fromVtkToSmds(l.cells[i]));
-    if (elem->GetType() == type)
-      nb++;
-  }
-  return nb;
-}
+    vtkCellLinks::Link& l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetLinks()->GetLink(myVtkID);
 
-///////////////////////////////////////////////////////////////////////////////
-/// To be used with STL set
-///////////////////////////////////////////////////////////////////////////////
-bool operator<(const SMDS_MeshNode& e1, const SMDS_MeshNode& e2)
-{
-  return e1.getVtkId()<e2.getVtkId();
-  /*if(e1.myX<e2.myX) return true;
-    else if(e1.myX==e2.myX)
+    if ( type == SMDSAbs_All )
+      return l.ncells;
+
+    SMDS_Mesh *mesh = SMDS_Mesh::_meshList[myMeshId];
+    for ( int i = 0; i < l.ncells; i++ )
     {
-    if(e1.myY<e2.myY) return true;
-    else if(e1.myY==e2.myY) return (e1.myZ<e2.myZ);
-    else return false;
+      const SMDS_MeshElement* elem = mesh->FindElement( mesh->fromVtkToSmds( l.cells[i] ));
+      nb += ( elem->GetType() == type );
     }
-    else return false;*/
+  }
+  return nb;
 }
-
index a61e673f302700627a0219f328e5027085bb5c09..43dc9c7f2ffa7d861dbc2b8132ca1ce809e268c3 100644 (file)
@@ -69,7 +69,6 @@ protected:
   void AddInverseElement(const SMDS_MeshElement * ME);
   void RemoveInverseElement(const SMDS_MeshElement * parent);
   void ClearInverseElements();
-  bool emptyInverseElements();
 
   SMDS_ElemIteratorPtr
   elementsIterator(SMDSAbs_ElementType type) const;
index 67df8daebb388f8127ad0e94026a6bcb89fea7ec..c6c34ed47fda1f8f105c340b2135671ff3f2432c 100644 (file)
@@ -4635,7 +4635,7 @@ namespace { // Structures used by FixQuadraticElements()
       SMDS_ElemIteratorPtr faceIter( new TIterOnIter( faceIterVec ));
 
       // a seacher to check if a volume is close to a concave face
-      std::auto_ptr< SMESH_ElementSearcher > faceSearcher
+      SMESHUtils::Deleter< SMESH_ElementSearcher > faceSearcher
         ( SMESH_MeshAlgos::GetElementSearcher( *theHelper.GetMeshDS(), faceIter ));
 
       // classifier
@@ -4737,7 +4737,7 @@ namespace { // Structures used by FixQuadraticElements()
                     gp_Pnt pMedium = SMESH_TNodeXYZ( linkIt->second );
                     double hMedium = faceNorm * gp_Vec( pOnFace0, pMedium ).XYZ();
                     double hVol    = faceNorm * gp_Vec( pOnFace0, pInSolid ).XYZ();
-                    isDistorted = ( Abs( hMedium ) > Abs( hVol * 0.5 ));
+                    isDistorted = ( Abs( hMedium ) > Abs( hVol * 0.75 ));
                   }
                 }
               }
index bfcaeab50f6305d16ee8d23a13024ef1ffd07269..6f3c1b076931849b022eae8659e1d50de145c3a4 100644 (file)
@@ -794,7 +794,7 @@ bool SMESH_Pattern::Load (SMESH_Mesh*        theMesh,
           double u = epos->GetUParameter();
           paramNodeMap.insert( make_pair( u, node ));
         }
-        if ((int) paramNodeMap.size() != eSubMesh->NbNodes() ) {
+        if ((int) paramNodeMap.size() != eSubMesh->NbNodes() - nbMeduimNodes ) {
           // wrong U on edge, project
           Extrema_ExtPC proj;
           BRepAdaptor_Curve aCurve( edge );
index 09c3a39420f869d27685f798771776cca1b77fbf..d7d455b6d79cf5dd58d9cb0247e70e8f802e4cb9 100644 (file)
@@ -1086,6 +1086,8 @@ void SMESHGUI_ClippingDlg::updateActorList()
   std::for_each( myPlanes.begin(),myPlanes.end(), TSetVisibility( PreviewCheckBox->isChecked() ) );
   aPlaneData.Plane.GetPointer()->myActor->SetVisibility( false );
 
+  std::map< std::string, QListWidgetItem* > itemMap; // used to sort items by entry
+
   VTK::ActorCollectionCopy aCopy( myViewWindow->getRenderer()->GetActors() );
   vtkActorCollection* anAllActors = aCopy.GetActors();
   anAllActors->InitTraversal();
@@ -1111,13 +1113,20 @@ void SMESHGUI_ClippingDlg::updateActorList()
           if ( !aFatherName.isEmpty() )
             aName = aFatherName + " / " + aName;
           aName += QString(" (%1)").arg( aSObj->GetID().c_str() );
-          QListWidgetItem* anItem = new ActorItem( anActor, aName, ActorList );
+          QListWidgetItem* anItem = new ActorItem( anActor, aName, 0 );
           anItem->setCheckState( anIsChecked ? Qt::Checked : Qt::Unchecked );
-          updateActorItem( anItem, true, false );
+          itemMap.insert( std::make_pair( aSObj->GetID(), anItem ));
         }
       }
     }
   }
+  std::map< std::string, QListWidgetItem* >::iterator s2i = itemMap.begin();
+  for ( ; s2i != itemMap.end(); ++s2i )
+  {
+    QListWidgetItem* anItem = s2i->second;
+    ActorList->addItem( anItem );
+  }
+  updateActorItem( 0, true, false );
 }
 
 /*!
@@ -1258,16 +1267,19 @@ void SMESHGUI_ClippingDlg::ClickOnNew()
     SMESH::OrientedPlane* aPlane = SMESH::OrientedPlane::New(myViewWindow);
     SMESH::TPlane aTPlane(aPlane);
     aPlane->PlaneMode = CurrentMode;
-    SMESH::TActorList anActorList;
+    SMESH::TActorList anActorList, aVisibleActorList;
     VTK::ActorCollectionCopy aCopy( myViewWindow->getRenderer()->GetActors() );
     vtkActorCollection* anAllActors = aCopy.GetActors();
     anAllActors->InitTraversal();
     while( vtkActor* aVTKActor = anAllActors->GetNextActor() )
       if( SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( aVTKActor ) )
+      {
         anActorList.push_back( anActor );
-
-    SMESH::TPlaneData aPlaneData(aTPlane, anActorList);
-
+        if ( anActor->GetVisibility() )
+          aVisibleActorList.push_back( anActor );
+      }
+    SMESH::TPlaneData aPlaneData(aTPlane,
+                                 aVisibleActorList.empty() ? anActorList : aVisibleActorList);
     myPlanes.push_back(aPlaneData);
 
 
index 9d4495083b5e00ed1e316db6e50036aa80dc6f28..cb3828246dbc0af8776cf4467737349e085ee480 100644 (file)
@@ -203,9 +203,9 @@ QWidget* SMESHGUI_ReorientFacesDlg::createMainFrame (QWidget* theParent)
   myDY->SetValue(0);
   myDZ->SetValue(0);
 
-  myDX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
-  myDY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
-  myDZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
+  myDX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 1.0, "length_precision");
+  myDY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 1.0, "length_precision");
+  myDZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 1.0, "length_precision");
 
   width = Max( aFaceBut->fontMetrics().width( tr("SMESH_X")),
                aFaceBut->fontMetrics().width( tr("SMESH_DX")));
index 6670e509e9d00a8d06677dd91ee726145a6a8902..a26695858025dd9644b6ab75b0fcb1ff47e2ff0f 100644 (file)
@@ -1163,8 +1163,8 @@ bool SMESH_MeshAlgos::IsOut( const SMDS_MeshElement* element, const gp_Pnt& poin
       gp_Vec edge2( xyz[i+1], xyz[(i+2)%nbNodes] );
       faceNorm += edge1 ^ edge2;
     }
-    double normSize = faceNorm.Magnitude();
-    if ( normSize <= tol )
+    double fNormSize = faceNorm.Magnitude();
+    if ( fNormSize <= tol )
     {
       // degenerated face: point is out if it is out of all face edges
       for ( i = 0; i < nbNodes; ++i )
@@ -1175,7 +1175,7 @@ bool SMESH_MeshAlgos::IsOut( const SMDS_MeshElement* element, const gp_Pnt& poin
       }
       return true;
     }
-    faceNorm /= normSize;
+    faceNorm /= fNormSize;
 
     // check if the point lays on face plane
     gp_Vec n2p( xyz[0], point );
@@ -1204,9 +1204,10 @@ bool SMESH_MeshAlgos::IsOut( const SMDS_MeshElement* element, const gp_Pnt& poin
     // to find intersections of the ray with the boundary.
     gp_Vec ray = n2p;
     gp_Vec plnNorm = ray ^ faceNorm;
-    normSize = plnNorm.Magnitude();
-    if ( normSize <= tol ) return false; // point coincides with the first node
-    plnNorm /= normSize;
+    double n2pSize = plnNorm.Magnitude();
+    if ( n2pSize <= tol ) return false; // point coincides with the first node
+    if ( n2pSize * n2pSize > fNormSize * 100 ) return true; // point is very far
+    plnNorm /= n2pSize;
     // for each node of the face, compute its signed distance to the cutting plane
     vector<double> dist( nbNodes + 1);
     for ( i = 0; i < nbNodes; ++i )
@@ -1252,7 +1253,7 @@ bool SMESH_MeshAlgos::IsOut( const SMDS_MeshElement* element, const gp_Pnt& poin
     if ( rClosest > 0. && rClosest < 1. ) // not node intersection
       return out;
 
-    // ray pass through a face node; analyze transition through an adjacent edge
+    // the ray passes through a face node; analyze transition through an adjacent edge
     gp_Pnt p1 = xyz[ (rClosest == 0.) ? ((iClosest+nbNodes-1) % nbNodes) : (iClosest+1) ];
     gp_Pnt p2 = xyz[ (rClosest == 0.) ? iClosest : ((iClosest+2) % nbNodes) ];
     gp_Vec edgeAdjacent( p1, p2 );
index e779c7a7ab8d220c2e8f2afaa8d66ae18f7f6fc9..9a7b7611bfe17201619e1c9793822d2acfabc382 100644 (file)
@@ -3606,6 +3606,7 @@ class Mesh:
     #         1 - the medium node lies at the middle of the line segments connecting two nodes of a mesh element
     #  @param theSubMesh a group or a sub-mesh to convert; WARNING: in this case the mesh can become not conformal
     #  @param theToBiQuad If True, converts the mesh to bi-quadratic
+    #  @return SMESH.ComputeError which can hold a warning
     #  @ingroup l2_modif_tofromqu
     def ConvertToQuadratic(self, theForce3d=False, theSubMesh=None, theToBiQuad=False):
         if isinstance( theSubMesh, Mesh ):
@@ -3620,6 +3621,7 @@ class Mesh:
         error = self.editor.GetLastError()
         if error and error.comment:
             print error.comment
+        return error
             
     ## Converts the mesh from quadratic to ordinary,
     #  deletes old quadratic elements, \n replacing
index 3a2939151d54fc2daf86d51e91e910ed07a75568..c686068866683f35e374b5b6ad4f59c50fe53dbd 100644 (file)
@@ -183,7 +183,7 @@ class Mesh_Algorithm:
     ## Private method.
     def Create(self, mesh, geom, hypo, so="libStdMeshersEngine.so"):
         if geom is None and mesh.mesh.HasShapeToMesh():
-            raise RuntimeError, "Attemp to create " + hypo + " algoritm on None shape"
+            raise RuntimeError, "Attemp to create " + hypo + " algorithm on None shape"
         algo = self.FindAlgorithm(hypo, mesh.smeshpyD)
         if algo is None:
             algo = mesh.smeshpyD.CreateHypothesis(hypo, so)
@@ -195,7 +195,7 @@ class Mesh_Algorithm:
     def Assign(self, algo, mesh, geom):
         from salome.smesh.smeshBuilder import AssureGeomPublished, TreatHypoStatus, GetName
         if geom is None and mesh.mesh.HasShapeToMesh():
-            raise RuntimeError, "Attemp to create " + algo + " algoritm on None shape"
+            raise RuntimeError, "Attemp to create " + algo + " algorithm on None shape"
         self.mesh = mesh
         if not geom or geom.IsSame( mesh.geom ):
             self.geom = mesh.geom
index 2888a362cf23aeda129c0e8ea361791f16d9bb58..10f86269668b36670de022da3e301bdd75017567 100644 (file)
 using namespace std;
 
 #define RETURN_BAD_RESULT(msg) { MESSAGE(")-: Error: " << msg); return false; }
+#ifdef _DEBUG_
+// enable printing algo + projection shapes while meshing
+//#define PRINT_WHO_COMPUTE_WHAT
+#endif
 
 namespace TAssocTool = StdMeshers_ProjectionUtils;
 //typedef StdMeshers_ProjectionUtils TAssocTool;
@@ -436,7 +440,11 @@ namespace {
     if (( err && !err->IsOK() ) ||
         ( srcWires.empty() ))
       return err;
-
+#ifdef PRINT_WHO_COMPUTE_WHAT
+    cout << "Projection_2D" <<  " F "
+         << tgtMesh->GetMeshDS()->ShapeToIndex( tgtFace ) << " <- "
+         << srcMesh->GetMeshDS()->ShapeToIndex( srcFace ) << endl;
+#endif
     SMESH_MesherHelper srcHelper( *srcMesh );
     srcHelper.SetSubShape( srcFace );
 
@@ -492,6 +500,11 @@ namespace {
 
       for ( int iE = 0; iE < srcWire->NbEdges(); ++iE )
       {
+#ifdef PRINT_WHO_COMPUTE_WHAT
+        if ( tgtMesh->GetSubMesh( tgtWire->Edge(iE) )->IsEmpty() )
+          cout << "Projection_2D" <<  " E "
+               << tgtWire->EdgeID(iE) << " <- " << srcWire->EdgeID(iE) << endl;
+#endif
         if ( srcMesh->GetSubMesh( srcWire->Edge(iE) )->IsEmpty() ||
              tgtMesh->GetSubMesh( tgtWire->Edge(iE) )->IsEmpty() )
         {
index 9259d2e1da78a081c93fa908e9e84da2e1154cd5..2e4ea50b8fb3effa05cc7ff8904de0bbbf3d0df4 100644 (file)
@@ -485,9 +485,6 @@ static bool HasIntersection3(const gp_Pnt& P, const gp_Pnt& PC, gp_Pnt& Pint,
   gp_XYZ vert1 = P2.XYZ();
   gp_XYZ vert2 = P3.XYZ();
 
-  /* calculate distance from vert0 to ray origin */
-  gp_XYZ  tvec = orig - vert0;
-
   gp_XYZ edge1 = vert1 - vert0;
   gp_XYZ edge2 = vert2 - vert0;
 
@@ -497,9 +494,13 @@ static bool HasIntersection3(const gp_Pnt& P, const gp_Pnt& PC, gp_Pnt& Pint,
   /* if determinant is near zero, ray lies in plane of triangle */
   double det = edge1 * pvec;
 
-  if (det > -EPSILON && det < EPSILON)
+  const double ANGL_EPSILON = 1e-12;
+  if ( det > -ANGL_EPSILON && det < ANGL_EPSILON )
     return false;
 
+  /* calculate distance from vert0 to ray origin */
+  gp_XYZ  tvec = orig - vert0;
+
   /* calculate U parameter and test bounds */
   double u = ( tvec * pvec ) / det;
   //if (u < 0.0 || u > 1.0)
index 0f56903ef2b147f423333fdf675f5f97c8c54168..4bfcece28269070bc44ecaa39e878a468f79fe52 100644 (file)
             <source>ICON_SMESH_TREE_ALGO_Projection_2D</source>
             <translation>mesh_tree_algo_projection_2d.png</translation>
         </message>
+        <message>
+            <source>ICON_SMESH_TREE_ALGO_Projection_1D2D</source>
+            <translation>mesh_tree_algo_projection_2d.png</translation>
+        </message>
         <message>
             <source>ICON_SMESH_TREE_ALGO_Projection_3D</source>
             <translation>mesh_tree_hypo_projection_3d.png</translation>
             <source>ICON_SMESH_TREE_HYPO_QuadranglePreference</source>
             <translation>mesh_tree_algo_quad.png</translation>
         </message>
+        <message>
+            <source>ICON_SMESH_TREE_HYPO_QuadrangleParams</source>
+            <translation>mesh_tree_algo_quad.png</translation>
+        </message>
         <message>
             <source>ICON_SMESH_TREE_HYPO_TrianglePreference</source>
             <translation>mesh_tree_algo_mefisto.png</translation>
index 580ccb6533bfdbebc8679ed208037719edf9b563..d532e39351b70d0d476c027e3facebdcc83c221d 100644 (file)
@@ -52,7 +52,6 @@ StdMeshers_AutomaticLength_i::StdMeshers_AutomaticLength_i( PortableServer::POA_
      : SALOME::GenericObj_i( thePOA ), 
        SMESH_Hypothesis_i( thePOA )
 {
-  MESSAGE( "StdMeshers_AutomaticLength_i::StdMeshers_AutomaticLength_i" );
   myBaseImpl = new ::StdMeshers_AutomaticLength( theGenImpl->GetANewId(),
                                                  theStudyId,
                                                  theGenImpl );
@@ -68,7 +67,6 @@ StdMeshers_AutomaticLength_i::StdMeshers_AutomaticLength_i( PortableServer::POA_
 
 StdMeshers_AutomaticLength_i::~StdMeshers_AutomaticLength_i()
 {
-  MESSAGE( "StdMeshers_AutomaticLength_i::~StdMeshers_AutomaticLength_i" );
 }
 
 //=============================================================================
index 605395f2b7352e01ac8c81bf1039113a0f415cf1..5801115bb8c81ddf1e3853d80b2ebce576255658 100644 (file)
@@ -50,7 +50,6 @@ StdMeshers_SegmentLengthAroundVertex_i::StdMeshers_SegmentLengthAroundVertex_i
   : SALOME::GenericObj_i( thePOA ), 
     SMESH_Hypothesis_i( thePOA )
 {
-  MESSAGE( "StdMeshers_SegmentLengthAroundVertex_i::StdMeshers_SegmentLengthAroundVertex_i" );
   myBaseImpl = new ::StdMeshers_SegmentLengthAroundVertex( theGenImpl->GetANewId(),
                                                            theStudyId,
                                                            theGenImpl );
@@ -66,7 +65,6 @@ StdMeshers_SegmentLengthAroundVertex_i::StdMeshers_SegmentLengthAroundVertex_i
 
 StdMeshers_SegmentLengthAroundVertex_i::~StdMeshers_SegmentLengthAroundVertex_i()
 {
-  MESSAGE( "StdMeshers_SegmentLengthAroundVertex_i::~StdMeshers_SegmentLengthAroundVertex_i" );
 }
 
 //=============================================================================
@@ -80,7 +78,6 @@ StdMeshers_SegmentLengthAroundVertex_i::~StdMeshers_SegmentLengthAroundVertex_i(
 void StdMeshers_SegmentLengthAroundVertex_i::SetLength( CORBA::Double theLength )
      throw ( SALOME::SALOME_Exception )
 {
-  MESSAGE( "StdMeshers_SegmentLengthAroundVertex_i::SetLength" );
   ASSERT( myBaseImpl );
   try {
     this->GetImpl()->SetLength( theLength );
@@ -103,7 +100,6 @@ void StdMeshers_SegmentLengthAroundVertex_i::SetLength( CORBA::Double theLength
 
 CORBA::Double StdMeshers_SegmentLengthAroundVertex_i::GetLength()
 {
-  MESSAGE( "StdMeshers_SegmentLengthAroundVertex_i::GetLength" );
   ASSERT( myBaseImpl );
   return this->GetImpl()->GetLength();
 }
@@ -118,7 +114,6 @@ CORBA::Double StdMeshers_SegmentLengthAroundVertex_i::GetLength()
 
 ::StdMeshers_SegmentLengthAroundVertex* StdMeshers_SegmentLengthAroundVertex_i::GetImpl()
 {
-  MESSAGE( "StdMeshers_SegmentLengthAroundVertex_i::GetImpl" );
   return ( ::StdMeshers_SegmentLengthAroundVertex* )myBaseImpl;
 }