Salome HOME
IPAL52980: Wire Discretization with Table density fails
authoreap <eap@opencascade.com>
Fri, 10 Jun 2016 17:47:53 +0000 (20:47 +0300)
committereap <eap@opencascade.com>
Fri, 10 Jun 2016 17:47:53 +0000 (20:47 +0300)
  fix this problem for all 1D hypotheses (StdMeshers_Regular_1D.cxx)
  Bug report: http://www.salome-platform.org/forum/forum_10/636759606

Fix compilation warnings:
  - unused function
  - missing virtual destructor
  - variable set but not used

24 files changed:
doc/salome/gui/SMESH/input/additional_hypo.doc
src/DriverUNV/DriverUNV_W_SMDS_Mesh.cxx
src/OBJECT/SMESH_Object.h
src/OBJECT/SMESH_PreviewActorsCollection.h
src/SMDS/SMDS_Downward.hxx
src/SMESH/SMESH_MeshEditor.cxx
src/SMESH/SMESH_MesherHelper.cxx
src/SMESHDS/SMESH_Controls.hxx
src/SMESHGUI/SMESHGUI.cxx
src/SMESHUtils/SMESH_Comment.hxx
src/SMESHUtils/SMESH_MAT2d.cxx
src/SMESHUtils/SMESH_MeshAlgos.hxx
src/SMESH_I/SMESH_2smeshpy.cxx
src/SMESH_I/SMESH_Filter_i.cxx
src/SMESH_I/SMESH_Gen_i.cxx
src/SMESH_I/SMESH_Hypothesis_i.hxx
src/StdMeshers/StdMeshers_Cartesian_3D.cxx
src/StdMeshers/StdMeshers_Prism_3D.cxx
src/StdMeshers/StdMeshers_ProjectionUtils.cxx
src/StdMeshers/StdMeshers_Projection_2D.cxx
src/StdMeshers/StdMeshers_Propagation.cxx
src/StdMeshers/StdMeshers_Regular_1D.cxx
src/Tools/MeshCut/MeshCut_Maillage.cxx
src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.cxx

index 5904e87d49e6211649a58be1cfb1dae0b896ea64..cce2613ce686b88121f3c634c917419b157d10dd 100644 (file)
@@ -106,7 +106,8 @@ computations.
   either should be or should not be constructed, depending on the
   value of the previous parameter (<b>Specified Faces/Edges are</b>). 
   Faces (or edges) can be selected either in the Object Browser or in
-  the VTK Viewer.
+  the VTK Viewer. \b Add button becomes active as soon as a suitable
+  sub-shape is selected.
   \note A mesh shown in the 3D Viewer can prevent selection of faces
   and edges, just hide the mesh to avoid this. If a face, which should be
   selected, is hidden by other faces, consider creating a
index 59cd9adf90aeb09da0fb7f52631a2ac677d1ecf6..d94571ab649d285dc0c46c822e6819198572efbb 100644 (file)
 using namespace std;
 using namespace UNV;
 
-namespace{
-  typedef std::vector<size_t> TConnect;
-
-  int GetConnect(const SMDS_ElemIteratorPtr& theNodesIter, 
-                 TConnect& theConnect)
-  {
-    theConnect.clear();
-    for(; theNodesIter->more();){
-      const SMDS_MeshElement* anElem = theNodesIter->next();
-      theConnect.push_back(anElem->GetID());
-    }
-    return theConnect.size();
-  }
-  
-}
-
 Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
 {
   Kernel_Utils::Localizer loc;
@@ -93,7 +77,6 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
     {
       using namespace UNV2412;
       TDataSet aDataSet2412;
-      TConnect aConnect;
 
       // Storing SMDS Edges
       MESSAGE("Perform - myMesh->NbEdges() = "<<myMesh->NbEdges());
index 34f9e91fd37c87c7b61fbc6ac17ad74f5d1bd43c..c4a45106968b5bace94859a43e43bca5917367c3 100644 (file)
@@ -57,6 +57,7 @@ class vtkUnstructuredGrid;
 class SMESHOBJECT_EXPORT SMESH_VisualObj
 {
 public:
+  virtual ~SMESH_VisualObj() {}
   virtual bool Update( int theIsClear = true ) = 0;
   virtual bool NulData() = 0;
   virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor ) = 0;
index 3d9e1f43338f598ec027e5ad52f8b2dc1e49f26a..f5d431335aee6a781c15e190a092859e95d0d2e5 100644 (file)
@@ -41,7 +41,7 @@ class SMESHOBJECT_EXPORT SMESH_PreviewActorsCollection
 {
 public:
   SMESH_PreviewActorsCollection();
-  ~SMESH_PreviewActorsCollection();
+  virtual ~SMESH_PreviewActorsCollection();
 
   virtual void    AddToRender     (vtkRenderer* theRenderer);
   virtual void    RemoveFromRender(vtkRenderer* theRenderer);
index c85c091a93bfdf03cebef31e65783c34ed71f3f6..80206fd820e5edf3233062bca1d9ddd643667375 100644 (file)
@@ -90,7 +90,7 @@ public:
   static int getCellDimension(unsigned char cellType);
 protected:
   SMDS_Downward(SMDS_UnstructuredGrid *grid, int nbDownCells);
-  ~SMDS_Downward();
+  virtual ~SMDS_Downward();
   int addCell(int vtkId = -1);
   virtual void initCell(int cellId);
   virtual void allocate(int nbElems) = 0;
index 5969649c0fc4d14099f0a406c5f5c71c6da239f4..0366d4a079535be17bab70c0a4ec92f6dcdac268 100644 (file)
@@ -10751,8 +10751,7 @@ bool SMESH_MeshEditor::AffectedElemGroupsInRegion( const TIDSortedElemSet& theEl
     // --- iterates on elements to be replicated and get elements by back references from their nodes
 
     TIDSortedElemSet::const_iterator elemItr = theElems.begin();
-    int ielem;
-    for ( ielem=1;  elemItr != theElems.end(); ++elemItr )
+    for ( ;  elemItr != theElems.end(); ++elemItr )
     {
       SMDS_MeshElement* anElem = (SMDS_MeshElement*)*elemItr;
       if (!anElem || (anElem->GetType() != SMDSAbs_Face))
@@ -10848,8 +10847,7 @@ bool SMESH_MeshEditor::AffectedElemGroupsInRegion( const TIDSortedElemSet& theEl
 
     // iterates on indicated elements and get elements by back references from their nodes
     TIDSortedElemSet::const_iterator elemItr = theElems.begin();
-    int ielem;
-    for ( ielem = 1;  elemItr != theElems.end(); ++elemItr )
+    for ( ;  elemItr != theElems.end(); ++elemItr )
     {
       SMDS_MeshElement* anElem = (SMDS_MeshElement*)*elemItr;
       if (!anElem)
index 35973eb99f8a336ef77d6f1f1cfa402d6bd6976d..7d8ea6a84c7fe31142cc4d7b47558da1ec0b94d8 100644 (file)
@@ -4776,7 +4776,8 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
     }
     // fix nodes on geom faces
 #ifdef _DEBUG_
-    int nbfaces = faces.Extent(); /*avoid "unused varianbles": */ nbfaces++, nbfaces--; 
+    int nbfaces = nbSolids;
+    nbfaces = faces.Extent(); /*avoid "unused varianbles": */ nbfaces++, nbfaces--; 
 #endif
     for ( TopTools_MapIteratorOfMapOfShape fIt( faces ); fIt.More(); fIt.Next() ) {
       MSG("FIX FACE " << nbfaces-- << " #" << GetMeshDS()->ShapeToIndex(fIt.Key()));
@@ -5117,6 +5118,7 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
                      "uv2: "<<uv2.X()<<", "<<uv2.Y()<<" \t" <<
                      "uvOld: "<<oldUV.X()<<", "<<oldUV.Y()<<" \t" <<
                      "newUV: "<<newUV.X()<<", "<<newUV.Y()<<" \t");
+                uv0.SetX( uv2.X() ); // avoid warning: variable set but not used
               }
 #endif
               (*link1)->Move( move, /*sum=*/false, /*is2dFixed=*/true );
@@ -5135,7 +5137,6 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
   // -------------
 
   TIDSortedElemSet biQuadQuas, biQuadTris, triQuadHexa;
-  const SMDS_MeshElement *biQuadQua, *triQuadHex;
   const bool toFixCentralNodes = ( myMesh->NbBiQuadQuadrangles() +
                                    myMesh->NbBiQuadTriangles() +
                                    myMesh->NbTriQuadraticHexas() );
@@ -5166,7 +5167,6 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
       // collect bi-quadratic elements
       if ( toFixCentralNodes )
       {
-        biQuadQua = triQuadHex = 0;
         SMDS_ElemIteratorPtr eIt = pLink->_mediumNode->GetInverseElementIterator();
         while ( eIt->more() )
         {
@@ -5325,6 +5325,10 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
                              nCenterCoords.X(), nCenterCoords.Y(), nCenterCoords.Z());
     }
   }
+#ifdef _DEBUG_
+  // avoid warning: defined but not used operator<<()
+  SMESH_Comment() << *links.begin() << *faces.begin();
+#endif
 }
 
 //================================================================================
index b9ac990fa6b4da31178a289211127a538250770b..521a168ee8999e253055d5fb0e0b34fb9c88ce48 100644 (file)
@@ -53,7 +53,7 @@ namespace SMESH{
     class SMESHCONTROLS_EXPORT Functor
     {
     public:
-      ~Functor(){}
+      virtual ~Functor(){}
       virtual void SetMesh( const SMDS_Mesh* theMesh ) = 0;
       virtual SMDSAbs_ElementType GetType() const = 0;
     };
index d696c0ba2bfdc609e9e38eade8b530f1b04553bf..0e2f52983a2f7cf1405fc6bd53df8cfff3627590 100644 (file)
@@ -587,7 +587,7 @@ namespace
       };
       // is typeMsg complete? (compilation failure mains that enum SMDSAbs_EntityType changed)
       const int nbTypes = sizeof( typeMsg ) / sizeof( const char* );
-      int _assert[( nbTypes == SMESH::Entity_Last ) ? 1 : -1 ]; _assert[0]=1;
+      int _assert[( nbTypes == SMESH::Entity_Last ) ? 2 : -1 ]; _assert[0]=_assert[1];
 
       QString andStr = " " + QObject::tr("SMESH_AND") + " ", comma(", ");
       for ( size_t iType = 0; iType < presentNotSupported.size(); ++iType ) {
@@ -1721,25 +1721,25 @@ namespace
   }
 
 
-  QString CheckHomogeneousSelection()
-  {
-    LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
-    SALOME_ListIO selected;
-    if ( aSel )
-      aSel->selectedObjects( selected );
-
-    QString RefType = CheckTypeObject(selected.First());
-    SALOME_ListIteratorOfListIO It(selected);
-    for ( ; It.More(); It.Next())
-    {
-      Handle(SALOME_InteractiveObject) IObject = It.Value();
-      QString Type = CheckTypeObject(IObject);
-      if ( Type.compare(RefType) != 0 )
-        return "Heterogeneous Selection";
-    }
-
-    return RefType;
-  }
+  // QString CheckHomogeneousSelection()
+  // {
+  //   LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
+  //   SALOME_ListIO selected;
+  //   if ( aSel )
+  //     aSel->selectedObjects( selected );
+
+  //   QString RefType = CheckTypeObject(selected.First());
+  //   SALOME_ListIteratorOfListIO It(selected);
+  //   for ( ; It.More(); It.Next())
+  //   {
+  //     Handle(SALOME_InteractiveObject) IObject = It.Value();
+  //     QString Type = CheckTypeObject(IObject);
+  //     if ( Type.compare(RefType) != 0 )
+  //       return "Heterogeneous Selection";
+  //   }
+
+  //   return RefType;
+  // }
 
   uint randomize( uint size )
   {
index a8b56aef6d25a63dbcad348c95144d17e9a81165..c3bbe6fb58429fbda4d2c8e26428b83db024c803 100644 (file)
@@ -68,6 +68,8 @@ public :
   operator char*() const {
     return (char*)c_str();
   }
+
+  std::ostream& Stream() { return _s; }
 };
 
 
index 2de0cf247f4206f9b76af33ea551bfbd4c5c2880..da57a3148a0470a8507a9c7ce165a1080b728a6a 100644 (file)
@@ -220,9 +220,9 @@ namespace
     }
   }
 #else
-  void inSegmentsToFile( vector< InSegment>& inSegments) {}
-  void dumpEdge( const TVDEdge* edge ) {}
-  void dumpCell( const TVDCell* cell ) {}
+  #define inSegmentsToFile(arg) {}
+  //void dumpEdge( const TVDEdge* edge ) {}
+  //void dumpCell( const TVDCell* cell ) {}
 #endif
 }
 // -------------------------------------------------------------------------------------
index aa248187771af505f5b80c464858a9e958a48372..b6c3661b0965ddae6725e62a7d78d095e7d23b46 100644 (file)
@@ -58,6 +58,7 @@ struct SMESHUtils_EXPORT SMESH_NodeSearcher
   virtual int  FindNearPoint(const gp_Pnt&                        point,
                              const double                         tolerance,
                              std::vector< const SMDS_MeshNode* >& foundNodes) = 0;
+  virtual ~SMESH_NodeSearcher() {}
 };
 
 //=======================================================================
index e6a75758389dc35bd44de7de90fc6a5c63fa449c..416f43b6f1df5ceb9d7ca1d517b128a183ed2923 100644 (file)
@@ -903,7 +903,7 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
           Threshold = SMESH + types[ iGeom ];
 #ifdef _DEBUG_
         // is types complete? (compilation failure mains that enum GeometryType changed)
-        int _assert[( sizeof(types) / sizeof(const char*) == nbTypes ) ? 1 : -1 ]; _assert[0]=1;
+        int _asrt[( sizeof(types) / sizeof(const char*) == nbTypes ) ? 2 : -1 ]; _asrt[0]=_asrt[1];
 #endif
       }
       if (Type == "SMESH.FT_EntityType")
@@ -922,8 +922,8 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
         if ( -1 < iGeom && iGeom < nbTypes )
           Threshold = SMESH + types[ iGeom ];
 #ifdef _DEBUG_
-        // is types complete? (compilation failure mains that enum EntityType changed)
-        int _assert[( sizeof(types) / sizeof(const char*) == nbTypes ) ? 1 : -1 ]; _assert[0]=1;
+        // is 'types' complete? (compilation failure mains that enum EntityType changed)
+        int _asrt[( sizeof(types) / sizeof(const char*) == nbTypes ) ? 2 : -1 ]; _asrt[0]=_asrt[1];
 #endif
       }
     }
index d26f37dd7de962d44fe298b6af5b64b25f3c8ac8..ec604d7590e1e68044a82d55befaaa6449075f7b 100644 (file)
@@ -4082,7 +4082,7 @@ static const char** getFunctNames()
 #ifdef _DEBUG_
   // check if functName is complete, compilation failure means that enum FunctorType changed
   const int nbFunctors = sizeof(functName) / sizeof(const char*);
-  int _assert[( nbFunctors == SMESH::FT_Undefined + 1 ) ? 1 : -1 ]; _assert[0]=1;
+  int _assert[( nbFunctors == SMESH::FT_Undefined + 1 ) ? 2 : -1 ]; _assert[0]=_assert[1];
 #endif
 
   return functName;
index a279a4ada6df344848925daad936a7045094e4e8..5e2316415e5ba5a74669116499403f0df5190ee6 100644 (file)
@@ -2543,9 +2543,9 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::ListOfIDSources& theMeshesArray,
 
         // make a group name
         const char* typeNames[] = { "All","Nodes","Edges","Faces","Volumes","0DElems","Balls" };
-        { // check of typeNames, compilation failure mains that NB_ELEMENT_TYPES changed:
+        { // check of typeNames: compilation failure mains that NB_ELEMENT_TYPES changed:
           const int nbNames = sizeof(typeNames) / sizeof(const char*);
-          int _assert[( nbNames == SMESH::NB_ELEMENT_TYPES ) ? 1 : -1 ]; _assert[0]=0;
+          int _assert[( nbNames == SMESH::NB_ELEMENT_TYPES ) ? 2 : -1 ]; _assert[0]=_assert[1];
         }
         string groupName = "Gr";
         SALOMEDS::SObject_wrap aMeshSObj = ObjectToSObject( myCurrentStudy, theMeshesArray[i] );
index 08e64aa5cb55a80cfe497ee8c01473e378312d29..85f1d01964e6fe6d89d8ed771132247748d4f6a4 100644 (file)
@@ -135,6 +135,8 @@ public:
   virtual SMESH_Hypothesis_i* Create(PortableServer::POA_ptr thePOA,
                                      int                     theStudyId,
                                      ::SMESH_Gen*            theGenImpl) = 0;
+  virtual ~GenericHypothesisCreator_i() {}
+
   // return the name of IDL module
   virtual std::string GetModuleName() = 0;
   virtual bool IsApplicable( const TopoDS_Shape &S, bool toCheckAll ) {return true;}
index 0c386f09ae343a52be31b1ac275cfbcc033b0d65..fb5dc152d8281389f83966bf3d761506fb90bf89 100644 (file)
@@ -3056,7 +3056,7 @@ namespace
 
     // sort nodes accoring to the order of edges
     _Node*  orderNodes   [20];
-    TGeomID orderShapeIDs[20];
+    //TGeomID orderShapeIDs[20];
     size_t nbN = 0;
     TGeomID id, *pID = 0;
     for ( e = edges.begin(); e != edges.end(); ++e )
@@ -3064,14 +3064,14 @@ namespace
       if (( id = _grid->_shapes.FindIndex( SMESH_MesherHelper::IthVertex( 0, *e ))) &&
           (( pID = std::find( &nShapeIds[0], nShapeIdsEnd, id )) != nShapeIdsEnd ))
       {
-        orderShapeIDs[ nbN ] = id;
+        //orderShapeIDs[ nbN ] = id;
         orderNodes   [ nbN++ ] = nodes[ pID - &nShapeIds[0] ];
         *pID = -1;
       }
       if (( id = _grid->_shapes.FindIndex( *e )) &&
           (( pID = std::find( &nShapeIds[0], nShapeIdsEnd, id )) != nShapeIdsEnd ))
       {
-        orderShapeIDs[ nbN ] = id;
+        //orderShapeIDs[ nbN ] = id;
         orderNodes   [ nbN++ ] = nodes[ pID - &nShapeIds[0] ];
         *pID = -1;
       }
index d0c4410e76ab8f081d72cf25f81872b8d6aadaa7..fe5276b3993ba46566cef617e7bc725a195ff9c1 100644 (file)
@@ -561,7 +561,9 @@ StdMeshers_Prism_3D::StdMeshers_Prism_3D(int hypId, int studyId, SMESH_Gen* gen)
 //================================================================================
 
 StdMeshers_Prism_3D::~StdMeshers_Prism_3D()
-{}
+{
+  pointsToPython( std::vector<gp_XYZ>() ); // avoid warning: pointsToPython defined but not used
+}
 
 //=======================================================================
 //function : CheckHypothesis
@@ -2639,19 +2641,19 @@ namespace // utils used by StdMeshers_Prism_3D::IsApplicable()
   /*!
    * \brief Return number of faces sharing given edges
    */
-  int nbAdjacentFaces( const std::vector< EdgeWithNeighbors >&          edges,
-                       const TopTools_IndexedDataMapOfShapeListOfShape& facesOfEdge )
-  {
-    TopTools_MapOfShape adjFaces;
-
-    for ( size_t i = 0; i < edges.size(); ++i )
-    {
-      TopTools_ListIteratorOfListOfShape faceIt( facesOfEdge.FindFromKey( edges[i]._edge ));
-      for ( ; faceIt.More(); faceIt.Next() )
-        adjFaces.Add( faceIt.Value() );
-    }
-    return adjFaces.Extent();
-  }
+  // int nbAdjacentFaces( const std::vector< EdgeWithNeighbors >&          edges,
+  //                      const TopTools_IndexedDataMapOfShapeListOfShape& facesOfEdge )
+  // {
+  //   TopTools_MapOfShape adjFaces;
+
+  //   for ( size_t i = 0; i < edges.size(); ++i )
+  //   {
+  //     TopTools_ListIteratorOfListOfShape faceIt( facesOfEdge.FindFromKey( edges[i]._edge ));
+  //     for ( ; faceIt.More(); faceIt.Next() )
+  //       adjFaces.Add( faceIt.Value() );
+  //   }
+  //   return adjFaces.Extent();
+  // }
 }
 
 //================================================================================
@@ -3016,7 +3018,6 @@ bool StdMeshers_Prism_3D::initPrism(Prism_3D::TPrismTopo& thePrism,
   list< SMESH_subMesh* > meshedSubMesh;
   int nbFaces = 0;
   //
-  SMESH_subMesh* anyFaceSM = 0;
   SMESH_subMeshIteratorPtr smIt = mainSubMesh->getDependsOnIterator(false,true);
   while ( smIt->more() )
   {
@@ -3025,7 +3026,6 @@ bool StdMeshers_Prism_3D::initPrism(Prism_3D::TPrismTopo& thePrism,
     if      ( face.ShapeType() > TopAbs_FACE ) break;
     else if ( face.ShapeType() < TopAbs_FACE ) continue;
     nbFaces++;
-    anyFaceSM = sm;
 
     // is quadrangle FACE?
     list< TopoDS_Edge > orderedEdges;
index 814c38dfdd9e50345fc94c0619851df5f42de9bf..794aa889d33a97496c77ab635834dd7b68a5a74d 100644 (file)
@@ -124,6 +124,10 @@ namespace {
     const char* type[] ={"COMPOUND","COMPSOLID","SOLID","SHELL","FACE","WIRE","EDGE","VERTEX"};
     BRepTools::Write( shape, SMESH_Comment("/tmp/") << type[shape.ShapeType()] << "_"
                       << shape.TShape().operator->() << ".brep");
+    if ( !theMeshDS[0] ) {
+      show_shape( TopoDS_Shape(), "avoid warning: show_shape() defined but not used");
+      show_list( "avoid warning: show_list() defined but not used", list< TopoDS_Edge >() );
+    }
 #endif
     return false;
   }
index 7f476aa82e29238859adf14700e6b013f5658909..0e7d3ff2065732b48bbf6f251986c91d3d0c87cd 100644 (file)
@@ -949,144 +949,144 @@ namespace {
                     TAssocTool::TNodeNodeMap&          src2tgtNodes,
                     const bool                         is1DComputed)
   {
-    SMESH_Mesh * tgtMesh = tgtWires[0]->GetMesh();
-    SMESH_Mesh * srcMesh = srcWires[0]->GetMesh();
-    //SMESHDS_Mesh * tgtMeshDS = tgtMesh->GetMeshDS();
-    SMESHDS_Mesh * srcMeshDS = srcMesh->GetMeshDS();
-
-    if ( srcWires[0]->NbEdges() != 4 )
-      return false;
-    if ( !is1DComputed )
-      return false;
-    for ( int iE = 0; iE < 4; ++iE )
-    {
-      SMESHDS_SubMesh* sm = srcMeshDS->MeshElements( srcWires[0]->Edge( iE ));
-      if ( !sm ) return false;
-      if ( sm->NbNodes() + sm->NbElements() == 0 ) return false;
-    }
-    if ( BRepAdaptor_Surface( tgtFace ).GetType() != GeomAbs_Plane )
-      return false;
-    // if ( BRepAdaptor_Surface( tgtFace ).GetType() == GeomAbs_Plane &&
-    //      BRepAdaptor_Surface( srcFace ).GetType() == GeomAbs_Plane )
-    //   return false; // too easy
-
-    // load EDGEs to SMESH_Block
-
-    SMESH_Block block;
-    TopTools_IndexedMapOfOrientedShape blockSubShapes;
-    {
-      const TopoDS_Solid& box = srcMesh->PseudoShape();
-      TopoDS_Shell shell = TopoDS::Shell( TopExp_Explorer( box, TopAbs_SHELL ).Current() );
-      TopoDS_Vertex v;
-      block.LoadBlockShapes( shell, v, v, blockSubShapes ); // fill all since operator[] is missing
-    }
-    const SMESH_Block::TShapeID srcFaceBID = SMESH_Block::ID_Fxy0;
-    const SMESH_Block::TShapeID tgtFaceBID = SMESH_Block::ID_Fxy1;
-    vector< int > edgeBID;
-    block.GetFaceEdgesIDs( srcFaceBID, edgeBID ); // u0, u1, 0v, 1v
-    blockSubShapes.Substitute( edgeBID[0], srcWires[0]->Edge(0) );
-    blockSubShapes.Substitute( edgeBID[1], srcWires[0]->Edge(2) );
-    blockSubShapes.Substitute( edgeBID[2], srcWires[0]->Edge(3) );
-    blockSubShapes.Substitute( edgeBID[3], srcWires[0]->Edge(1) );
-    block.GetFaceEdgesIDs( tgtFaceBID, edgeBID ); // u0, u1, 0v, 1v
-    blockSubShapes.Substitute( edgeBID[0], tgtWires[0]->Edge(0) );
-    blockSubShapes.Substitute( edgeBID[1], tgtWires[0]->Edge(2) );
-    blockSubShapes.Substitute( edgeBID[2], tgtWires[0]->Edge(3) );
-    blockSubShapes.Substitute( edgeBID[3], tgtWires[0]->Edge(1) );
-    block.LoadFace( srcFace, srcFaceBID, blockSubShapes );
-    block.LoadFace( tgtFace, tgtFaceBID, blockSubShapes );
-
-    // remember connectivity of new faces in terms of ( node-or-XY )
-
-    typedef std::pair< const SMDS_MeshNode*, gp_XYZ > TNodeOrXY; // node-or-XY
-    typedef std::vector< TNodeOrXY* >                 TFaceConn; // face connectivity
-    std::vector< TFaceConn >                    newFacesVec;     // connectivity of all faces
-    std::map< const SMDS_MeshNode*, TNodeOrXY > srcNode2tgtNXY;  // src node -> node-or-XY
-
-    TAssocTool::TNodeNodeMap::iterator                                       srcN_tgtN;
-    std::map< const SMDS_MeshNode*, TNodeOrXY >::iterator                    srcN_tgtNXY;
-    std::pair< std::map< const SMDS_MeshNode*, TNodeOrXY >::iterator, bool > n2n_isNew;
-    TNodeOrXY nullNXY( (SMDS_MeshNode*)NULL, gp_XYZ(0,0,0) );
+    // SMESH_Mesh * tgtMesh = tgtWires[0]->GetMesh();
+    // SMESH_Mesh * srcMesh = srcWires[0]->GetMesh();
+    // //SMESHDS_Mesh * tgtMeshDS = tgtMesh->GetMeshDS();
+    // SMESHDS_Mesh * srcMeshDS = srcMesh->GetMeshDS();
+
+    // if ( srcWires[0]->NbEdges() != 4 )
+    //   return false;
+    // if ( !is1DComputed )
+    //   return false;
+    // for ( int iE = 0; iE < 4; ++iE )
+    // {
+    //   SMESHDS_SubMesh* sm = srcMeshDS->MeshElements( srcWires[0]->Edge( iE ));
+    //   if ( !sm ) return false;
+    //   if ( sm->NbNodes() + sm->NbElements() == 0 ) return false;
+    // }
+    // if ( BRepAdaptor_Surface( tgtFace ).GetType() != GeomAbs_Plane )
+    //   return false;
+    // // if ( BRepAdaptor_Surface( tgtFace ).GetType() == GeomAbs_Plane &&
+    // //      BRepAdaptor_Surface( srcFace ).GetType() == GeomAbs_Plane )
+    // //   return false; // too easy
 
-    SMESHDS_SubMesh* srcSubDS = srcMeshDS->MeshElements( srcFace );
-    newFacesVec.resize( srcSubDS->NbElements() );
-    int iFaceSrc = 0;
+    // // load EDGEs to SMESH_Block
 
-    SMDS_ElemIteratorPtr elemIt = srcSubDS->GetElements();
-    while ( elemIt->more() ) // loop on all mesh faces on srcFace
-    {
-      const SMDS_MeshElement* elem = elemIt->next();
-      TFaceConn& tgtNodes = newFacesVec[ iFaceSrc++ ];
-
-      const int nbN = elem->NbCornerNodes(); 
-      tgtNodes.resize( nbN );
-      for ( int i = 0; i < nbN; ++i ) // loop on nodes of the source element
-      {
-        const SMDS_MeshNode* srcNode = elem->GetNode(i);
-        n2n_isNew = srcNode2tgtNXY.insert( make_pair( srcNode, nullNXY ));
-        TNodeOrXY & tgtNodeOrXY = n2n_isNew.first->second;
-        if ( n2n_isNew.second ) // new src node encounters
-        {
-          srcN_tgtN = src2tgtNodes.find( srcNode );
-          if ( srcN_tgtN != src2tgtNodes.end() )
-          {
-            tgtNodeOrXY.first = srcN_tgtN->second; // tgt node exists
-          }
-          else 
-          {
-            // find XY of src node withing the quadrilateral srcFace
-            if ( !block.ComputeParameters( SMESH_TNodeXYZ( srcNode ),
-                                           tgtNodeOrXY.second, srcFaceBID ))
-              return false;
-          }
-        }
-        tgtNodes[ i ] = & tgtNodeOrXY;
-      }
-    }
+    // SMESH_Block block;
+    // TopTools_IndexedMapOfOrientedShape blockSubShapes;
+    // {
+    //   const TopoDS_Solid& box = srcMesh->PseudoShape();
+    //   TopoDS_Shell shell = TopoDS::Shell( TopExp_Explorer( box, TopAbs_SHELL ).Current() );
+    //   TopoDS_Vertex v;
+    //   block.LoadBlockShapes( shell, v, v, blockSubShapes ); // fill all since operator[] is missing
+    // }
+    // const SMESH_Block::TShapeID srcFaceBID = SMESH_Block::ID_Fxy0;
+    // const SMESH_Block::TShapeID tgtFaceBID = SMESH_Block::ID_Fxy1;
+    // vector< int > edgeBID;
+    // block.GetFaceEdgesIDs( srcFaceBID, edgeBID ); // u0, u1, 0v, 1v
+    // blockSubShapes.Substitute( edgeBID[0], srcWires[0]->Edge(0) );
+    // blockSubShapes.Substitute( edgeBID[1], srcWires[0]->Edge(2) );
+    // blockSubShapes.Substitute( edgeBID[2], srcWires[0]->Edge(3) );
+    // blockSubShapes.Substitute( edgeBID[3], srcWires[0]->Edge(1) );
+    // block.GetFaceEdgesIDs( tgtFaceBID, edgeBID ); // u0, u1, 0v, 1v
+    // blockSubShapes.Substitute( edgeBID[0], tgtWires[0]->Edge(0) );
+    // blockSubShapes.Substitute( edgeBID[1], tgtWires[0]->Edge(2) );
+    // blockSubShapes.Substitute( edgeBID[2], tgtWires[0]->Edge(3) );
+    // blockSubShapes.Substitute( edgeBID[3], tgtWires[0]->Edge(1) );
+    // block.LoadFace( srcFace, srcFaceBID, blockSubShapes );
+    // block.LoadFace( tgtFace, tgtFaceBID, blockSubShapes );
+
+    // // remember connectivity of new faces in terms of ( node-or-XY )
+
+    // typedef std::pair< const SMDS_MeshNode*, gp_XYZ > TNodeOrXY; // node-or-XY
+    // typedef std::vector< TNodeOrXY* >                 TFaceConn; // face connectivity
+    // std::vector< TFaceConn >                    newFacesVec;     // connectivity of all faces
+    // std::map< const SMDS_MeshNode*, TNodeOrXY > srcNode2tgtNXY;  // src node -> node-or-XY
+
+    // TAssocTool::TNodeNodeMap::iterator                                       srcN_tgtN;
+    // std::map< const SMDS_MeshNode*, TNodeOrXY >::iterator                    srcN_tgtNXY;
+    // std::pair< std::map< const SMDS_MeshNode*, TNodeOrXY >::iterator, bool > n2n_isNew;
+    // TNodeOrXY nullNXY( (SMDS_MeshNode*)NULL, gp_XYZ(0,0,0) );
+
+    // SMESHDS_SubMesh* srcSubDS = srcMeshDS->MeshElements( srcFace );
+    // newFacesVec.resize( srcSubDS->NbElements() );
+    // int iFaceSrc = 0;
+
+    // SMDS_ElemIteratorPtr elemIt = srcSubDS->GetElements();
+    // while ( elemIt->more() ) // loop on all mesh faces on srcFace
+    // {
+    //   const SMDS_MeshElement* elem = elemIt->next();
+    //   TFaceConn& tgtNodes = newFacesVec[ iFaceSrc++ ];
+
+    //   const int nbN = elem->NbCornerNodes(); 
+    //   tgtNodes.resize( nbN );
+    //   for ( int i = 0; i < nbN; ++i ) // loop on nodes of the source element
+    //   {
+    //     const SMDS_MeshNode* srcNode = elem->GetNode(i);
+    //     n2n_isNew = srcNode2tgtNXY.insert( make_pair( srcNode, nullNXY ));
+    //     TNodeOrXY & tgtNodeOrXY = n2n_isNew.first->second;
+    //     if ( n2n_isNew.second ) // new src node encounters
+    //     {
+    //       srcN_tgtN = src2tgtNodes.find( srcNode );
+    //       if ( srcN_tgtN != src2tgtNodes.end() )
+    //       {
+    //         tgtNodeOrXY.first = srcN_tgtN->second; // tgt node exists
+    //       }
+    //       else 
+    //       {
+    //         // find XY of src node withing the quadrilateral srcFace
+    //         if ( !block.ComputeParameters( SMESH_TNodeXYZ( srcNode ),
+    //                                        tgtNodeOrXY.second, srcFaceBID ))
+    //           return false;
+    //       }
+    //     }
+    //     tgtNodes[ i ] = & tgtNodeOrXY;
+    //   }
+    // }
 
-    // as all XY are computed, create tgt nodes and faces
+    // // as all XY are computed, create tgt nodes and faces
 
-    SMESH_MesherHelper helper( *tgtMesh );
-    helper.SetSubShape( tgtFace );
-    if ( is1DComputed )
-      helper.IsQuadraticSubMesh( tgtFace );
-    else
-      helper.SetIsQuadratic( srcSubDS->GetElements()->next()->IsQuadratic() );
-    helper.SetElementsOnShape( true );
-    Handle(Geom_Surface) tgtSurface = BRep_Tool::Surface( tgtFace );
+    // SMESH_MesherHelper helper( *tgtMesh );
+    // helper.SetSubShape( tgtFace );
+    // if ( is1DComputed )
+    //   helper.IsQuadraticSubMesh( tgtFace );
+    // else
+    //   helper.SetIsQuadratic( srcSubDS->GetElements()->next()->IsQuadratic() );
+    // helper.SetElementsOnShape( true );
+    // Handle(Geom_Surface) tgtSurface = BRep_Tool::Surface( tgtFace );
 
-    SMESH_MesherHelper srcHelper( *srcMesh );
-    srcHelper.SetSubShape( srcFace );
+    // SMESH_MesherHelper srcHelper( *srcMesh );
+    // srcHelper.SetSubShape( srcFace );
 
-    vector< const SMDS_MeshNode* > tgtNodes;
-    gp_XY uv;
+    // vector< const SMDS_MeshNode* > tgtNodes;
+    // gp_XY uv;
 
-    for ( size_t iFaceTgt = 0; iFaceTgt < newFacesVec.size(); ++iFaceTgt )
-    {
-      TFaceConn& tgtConn = newFacesVec[ iFaceTgt ];
-      tgtNodes.resize( tgtConn.size() );
-      for ( size_t iN = 0; iN < tgtConn.size(); ++iN )
-      {
-        const SMDS_MeshNode* & tgtN = tgtConn[ iN ]->first;
-        if ( !tgtN ) // create a node
-        {
-          if ( !block.FaceUV( tgtFaceBID, tgtConn[iN]->second, uv ))
-            return false;
-          gp_Pnt p = tgtSurface->Value( uv.X(), uv.Y() );
-          tgtN = helper.AddNode( p.X(), p.Y(), p.Z(), uv.X(), uv.Y() );
-        }
-        tgtNodes[ tgtNodes.size() - iN - 1] = tgtN; // reversed orientation
-      }
-      switch ( tgtNodes.size() )
-      {
-      case 3: helper.AddFace(tgtNodes[0], tgtNodes[1], tgtNodes[2]); break;
-      case 4: helper.AddFace(tgtNodes[0], tgtNodes[1], tgtNodes[2], tgtNodes[3]); break;
-      default:
-        if ( tgtNodes.size() > 4 )
-          helper.AddPolygonalFace( tgtNodes );
-      }
-    }
-    return true;
+    // for ( size_t iFaceTgt = 0; iFaceTgt < newFacesVec.size(); ++iFaceTgt )
+    // {
+    //   TFaceConn& tgtConn = newFacesVec[ iFaceTgt ];
+    //   tgtNodes.resize( tgtConn.size() );
+    //   for ( size_t iN = 0; iN < tgtConn.size(); ++iN )
+    //   {
+    //     const SMDS_MeshNode* & tgtN = tgtConn[ iN ]->first;
+    //     if ( !tgtN ) // create a node
+    //     {
+    //       if ( !block.FaceUV( tgtFaceBID, tgtConn[iN]->second, uv ))
+    //         return false;
+    //       gp_Pnt p = tgtSurface->Value( uv.X(), uv.Y() );
+    //       tgtN = helper.AddNode( p.X(), p.Y(), p.Z(), uv.X(), uv.Y() );
+    //     }
+    //     tgtNodes[ tgtNodes.size() - iN - 1] = tgtN; // reversed orientation
+    //   }
+    //   switch ( tgtNodes.size() )
+    //   {
+    //   case 3: helper.AddFace(tgtNodes[0], tgtNodes[1], tgtNodes[2]); break;
+    //   case 4: helper.AddFace(tgtNodes[0], tgtNodes[1], tgtNodes[2], tgtNodes[3]); break;
+    //   default:
+    //     if ( tgtNodes.size() > 4 )
+    //       helper.AddPolygonalFace( tgtNodes );
+    //   }
+    // }
+    return false; //true;
 
   } // bool projectQuads(...)
 
@@ -1310,8 +1310,9 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
   if ( !projDone )
   {
     // projection in case of quadrilateral faces
-    // projDone = projectQuads( tgtFace, srcFace, tgtWires, srcWires,
-    //                          shape2ShapeMap, _src2tgtNodes, is1DComputed);
+    // NOT IMPLEMENTED, returns false
+    projDone = projectQuads( tgtFace, srcFace, tgtWires, srcWires,
+                             shape2ShapeMap, _src2tgtNodes, is1DComputed);
   }
 
   // it will remove mesh built on edges and vertices in failure case
index e72e3fc3465cff65d33078f4caf9dfe2c19445bf..56a5887bc3c7bac0b225fde756a7e77b0e12bdc1 100644 (file)
@@ -184,7 +184,7 @@ namespace {
   }
   //=============================================================================
   /*!
-   * \brief return PropagationMgrData found on a submesh
+   * \brief return PropagationMgrData found on a sub-mesh
    */
   PropagationMgrData* findData(SMESH_subMesh* sm)
   {
@@ -194,14 +194,14 @@ namespace {
   }
   //=============================================================================
   /*!
-   * \brief return PropagationMgrData found on theEdge submesh
+   * \brief return PropagationMgrData found on theEdge sub-mesh
    */
-  PropagationMgrData* findData(SMESH_Mesh& theMesh, const TopoDS_Shape& theEdge)
-  {
-    if ( theEdge.ShapeType() == TopAbs_EDGE )
-      return findData( theMesh.GetSubMeshContaining( theEdge ) );
-    return 0;
-  }
+  // PropagationMgrData* findData(SMESH_Mesh& theMesh, const TopoDS_Shape& theEdge)
+  // {
+  //   if ( theEdge.ShapeType() == TopAbs_EDGE )
+  //     return findData( theMesh.GetSubMeshContaining( theEdge ) );
+  //   return 0;
+  // }
   //=============================================================================
   /*!
    * \brief return existing or a new PropagationMgrData
index 7025642b3b9bbdc5c5c53b93e171fd6a00a24de8..973f113847f2f54edcf302fb3152cecf435ede20 100644 (file)
@@ -415,16 +415,17 @@ static void compensateError(double a1, double an,
   if ( a1 + an <= length && nPar > 1 )
   {
     bool reverse = ( U1 > Un );
-    GCPnts_AbscissaPoint Discret(C3d, reverse ? an : -an, Un);
+    double tol   = Min( Precision::Confusion(), 0.01 * an );
+    GCPnts_AbscissaPoint Discret( tol, C3d, reverse ? an : -an, Un );
     if ( !Discret.IsDone() )
       return;
     double Utgt = Discret.Parameter(); // target value of the last parameter
     list<double>::reverse_iterator itU = theParams.rbegin();
     double Ul = *itU++; // real value of the last parameter
     double dUn = Utgt - Ul; // parametric error of <an>
-    if ( Abs(dUn) <= Precision::Confusion() )
-      return;
     double dU = Abs( Ul - *itU ); // parametric length of the last but one segment
+    if ( Abs(dUn) <= 1e-3 * dU )
+      return;
     if ( adjustNeighbors2an || Abs(dUn) < 0.5 * dU ) { // last segment is a bit shorter than it should
       // move the last parameter to the edge beginning
     }
@@ -595,7 +596,8 @@ void StdMeshers_Regular_1D::redistributeNearVertices (SMESH_Mesh &          theM
       {
         if ( !isEnd1 )
           vertexLength = -vertexLength;
-        GCPnts_AbscissaPoint Discret(theC3d, vertexLength, l);
+        double tol = Min( Precision::Confusion(), 0.01 * vertexLength );
+        GCPnts_AbscissaPoint Discret( tol, theC3d, vertexLength, l );
         if ( Discret.IsDone() ) {
           if ( nPar == 0 )
             theParameters.push_back( Discret.Parameter());
@@ -705,7 +707,8 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh &     theMesh,
     size_t nbParams = 0;
     for ( int i = 0, nb = segLen.size()-1; i < nb; ++i, iSeg += dSeg )
     {
-      GCPnts_AbscissaPoint Discret( theC3d, segLen[ iSeg ], param );
+      double tol = Min( Precision::Confusion(), 0.01 * segLen[ iSeg ]);
+      GCPnts_AbscissaPoint Discret( tol, theC3d, segLen[ iSeg ], param );
       if ( !Discret.IsDone() ) break;
       param = Discret.Parameter();
       theParams.push_back( param );
@@ -733,8 +736,8 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh &     theMesh,
     {
       double nbseg = ceil(theLength / _value[ BEG_LENGTH_IND ]); // integer sup
       if (nbseg <= 0)
-        nbseg = 1;                        // degenerated edge
-      eltSize = theLength / nbseg;
+        nbseg = 1; // degenerated edge
+      eltSize = theLength / nbseg * ( 1. - 1e-9 );
       nbSegments = (int) nbseg;
     }
     else if ( _hypType == LOCAL_LENGTH )
@@ -802,7 +805,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh &     theMesh,
             if ( theReverse )
               scale = 1.0 / scale;
 
-            double alpha = pow(scale, 1.0 / (nbSegments - 1));
+            double  alpha = pow(scale, 1.0 / (nbSegments - 1));
             double factor = (l - f) / (1.0 - pow(alpha, nbSegments));
 
             for (int i = 1; i < nbSegments; i++) {
@@ -811,10 +814,12 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh &     theMesh,
             }
           }
           const double lenFactor = theLength/(l-f);
+          const double minSegLen = Min( theParams.front() - f, l - theParams.back() );
+          const double       tol = Min( Precision::Confusion(), 0.01 * minSegLen );
           list<double>::iterator u = theParams.begin(), uEnd = theParams.end();
           for ( ; u != uEnd; ++u )
           {
-            GCPnts_AbscissaPoint Discret( theC3d, ((*u)-f) * lenFactor, f );
+            GCPnts_AbscissaPoint Discret( tol, theC3d, ((*u)-f) * lenFactor, f );
             if ( Discret.IsDone() )
               *u = Discret.Parameter();
           }
@@ -844,9 +849,13 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh &     theMesh,
         return false;
       }
     }
-    GCPnts_UniformAbscissa Discret(theC3d, eltSize, f, l);
+
+    double tol = Min( Precision::Confusion(), 0.01 * eltSize );
+    GCPnts_UniformAbscissa Discret(theC3d, nbSegments + 1, f, l, tol );
     if ( !Discret.IsDone() )
       return error( "GCPnts_UniformAbscissa failed");
+    if ( Discret.NbPoints() < nbSegments + 1 )
+      Discret.Initialize(theC3d, nbSegments + 2, f, l, tol );
 
     int NbPoints = Min( Discret.NbPoints(), nbSegments + 1 );
     for ( int i = 2; i < NbPoints; i++ ) // skip 1st and last points
@@ -858,6 +867,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh &     theMesh,
     return true;
   }
 
+
   case BEG_END_LENGTH: {
 
     // geometric progression: SUM(n) = ( a1 - an * q ) / ( 1 - q ) = theLength
@@ -869,14 +879,15 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh &     theMesh,
       return error ( SMESH_Comment("Invalid segment lengths (")<<a1<<" and "<<an<<") "<<
                      "for an edge of length "<<theLength);
 
-    double U1 = theReverse ? l : f;
-    double Un = theReverse ? f : l;
-    double param = U1;
+    double      U1 = theReverse ? l : f;
+    double      Un = theReverse ? f : l;
+    double   param = U1;
     double eltSize = theReverse ? -a1 : a1;
+    double     tol = Min( Precision::Confusion(), 0.01 * Min( a1, an ));
     while ( 1 ) {
       // computes a point on a curve <theC3d> at the distance <eltSize>
       // from the point of parameter <param>.
-      GCPnts_AbscissaPoint Discret( theC3d, eltSize, param );
+      GCPnts_AbscissaPoint Discret( tol, theC3d, eltSize, param );
       if ( !Discret.IsDone() ) break;
       param = Discret.Parameter();
       if ( f < param && param < l )
@@ -903,10 +914,11 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh &     theMesh,
     double q = ( an - a1 ) / ( 2 *theLength/( a1 + an ) - 1 );
     int    n = int(fabs(q) > numeric_limits<double>::min() ? ( 1+( an-a1 )/q ) : ( 1+theLength/a1 ));
 
-    double U1 = theReverse ? l : f;
-    double Un = theReverse ? f : l;
-    double param = U1;
+    double      U1 = theReverse ? l : f;
+    double      Un = theReverse ? f : l;
+    double   param = U1;
     double eltSize = a1;
+    double     tol = Min( Precision::Confusion(), 0.01 * Min( a1, an ));
     if ( theReverse ) {
       eltSize = -eltSize;
       q = -q;
@@ -914,7 +926,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh &     theMesh,
     while ( n-- > 0 && eltSize * ( Un - U1 ) > 0 ) {
       // computes a point on a curve <theC3d> at the distance <eltSize>
       // from the point of parameter <param>.
-      GCPnts_AbscissaPoint Discret( theC3d, eltSize, param );
+      GCPnts_AbscissaPoint Discret( tol, theC3d, eltSize, param );
       if ( !Discret.IsDone() ) break;
       param = Discret.Parameter();
       if ( param > f && param < l )
@@ -945,7 +957,8 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh &     theMesh,
     while ( true ) {
       // computes a point on a curve <theC3d> at the distance <eltSize>
       // from the point of parameter <param>.
-      GCPnts_AbscissaPoint Discret( theC3d, eltSize, param );
+      double tol = Min( Precision::Confusion(), 0.01 * eltSize );
+      GCPnts_AbscissaPoint Discret( tol, theC3d, eltSize, param );
       if ( !Discret.IsDone() ) break;
       param = Discret.Parameter();
       if ( f < param && param < l )
@@ -978,95 +991,75 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh &     theMesh,
   {
     const std::vector<double>& aPnts = _fpHyp->GetPoints();
     const std::vector<int>&   nbsegs = _fpHyp->GetNbSegments();
+
+    // sort normalized params, taking into account theReverse
     TColStd_SequenceOfReal Params;
+    double tol = 1e-7 / theLength; // GCPnts_UniformAbscissa allows u2-u1 > 1e-7
     for ( size_t i = 0; i < aPnts.size(); i++ )
     {
-      if( aPnts[i]<0.0001 || aPnts[i]>0.9999 ) continue;
-      int j=1;
+      if( aPnts[i] < tol || aPnts[i] > 1 - tol )
+        continue;
+      double u = theReverse ? ( 1 - aPnts[i] ) : aPnts[i];
+      int    j = 1;
       bool IsExist = false;
       for ( ; j <= Params.Length(); j++ ) {
-        if ( Abs( aPnts[i] - Params.Value(j) ) < 1e-4 ) {
+        if ( Abs( u - Params.Value(j) ) < tol ) {
           IsExist = true;
           break;
         }
-        if ( aPnts[i]<Params.Value(j) ) break;
+        if ( u < Params.Value(j) ) break;
       }
-      if ( !IsExist ) Params.InsertBefore( j, aPnts[i] );
-    }
-    double par2, par1, lp;
-    par1 = f;
-    lp   = l;
-    double sign = 1.0;
-    if ( theReverse ) {
-      par1 = l;
-      lp   = f;
-      sign = -1.0;
+      if ( !IsExist ) Params.InsertBefore( j, u );
     }
-    double eltSize, segmentSize = 0.;
-    double currAbscissa = 0;
-    for ( int i = 0; i < Params.Length(); i++ )
+
+    // transform normalized Params into real ones
+    std::vector< double > uVec( Params.Length() + 2 );
+    uVec[ 0 ] = theFirstU;
+    double abscissa;
+    for ( int i = 1; i <= Params.Length(); i++ )
     {
-      int nbseg = ( i > (int)nbsegs.size()-1 ) ? nbsegs[0] : nbsegs[i];
-      segmentSize = Params.Value( i+1 ) * theLength - currAbscissa;
-      currAbscissa += segmentSize;
-      GCPnts_AbscissaPoint APnt( theC3d, sign*segmentSize, par1 );
+      abscissa = Params( i ) * theLength;
+      tol      = Min( Precision::Confusion(), 0.01 * abscissa );
+      GCPnts_AbscissaPoint APnt( tol, theC3d, abscissa, theFirstU );
       if ( !APnt.IsDone() )
         return error( "GCPnts_AbscissaPoint failed");
-      par2    = APnt.Parameter();
-      eltSize = segmentSize/nbseg;
-      GCPnts_UniformAbscissa Discret( theC3d, eltSize, par1, par2 );
-      if ( theReverse )
-        Discret.Initialize( theC3d, eltSize, par2, par1 );
-      else
-        Discret.Initialize( theC3d, eltSize, par1, par2 );
-      if ( !Discret.IsDone() )
-        return error( "GCPnts_UniformAbscissa failed");
-      int NbPoints = Discret.NbPoints();
-      list<double> tmpParams;
-      for ( int i = 2; i < NbPoints; i++ ) {
-        double param = Discret.Parameter(i);
-        tmpParams.push_back( param );
-      }
-      if ( theReverse ) {
-        compensateError( eltSize, eltSize, par2, par1, segmentSize, theC3d, tmpParams );
-        tmpParams.reverse();
+      uVec[ i ] = APnt.Parameter();
+    }
+    uVec.back() = theLastU;
+
+    // divide segments
+    Params.InsertBefore( 1, 0.0 );
+    Params.Append( 1.0 );
+    double eltSize, segmentSize, par1, par2;
+    for ( size_t i = 0; i < uVec.size()-1; i++ )
+    {
+      par1 = uVec[ i   ];
+      par2 = uVec[ i+1 ];
+      int nbseg = ( i < nbsegs.size() ) ? nbsegs[i] : nbsegs[0];
+      if ( nbseg == 1 )
+      {
+        theParams.push_back( par2 );
       }
-      else {
-        compensateError( eltSize, eltSize, par1, par2, segmentSize, theC3d, tmpParams );
+      else
+      {
+        segmentSize = ( Params( i+2 ) - Params( i+1 )) * theLength;
+        eltSize     = segmentSize / nbseg;
+        tol         = Min( Precision::Confusion(), 0.01 * eltSize );
+        GCPnts_UniformAbscissa Discret( theC3d, eltSize, par1, par2, tol );
+        if ( !Discret.IsDone() )
+          return error( "GCPnts_UniformAbscissa failed");
+        if ( Discret.NbPoints() < nbseg + 1 ) {
+          eltSize = segmentSize / ( nbseg + 0.5 );
+          Discret.Initialize( theC3d, eltSize, par1, par2, tol );
+        }
+        int NbPoints = Discret.NbPoints();
+        for ( int i = 2; i <= NbPoints; i++ ) {
+          double param = Discret.Parameter(i);
+          theParams.push_back( param );
+        }
       }
-      theParams.splice( theParams.end(), tmpParams );
-      theParams.push_back( par2 );
-
-      par1 = par2;
     }
-    // add for last
-    int nbseg = ( (int)nbsegs.size() > Params.Length() ) ? nbsegs[Params.Length()] : nbsegs[0];
-    segmentSize = theLength - currAbscissa;
-    eltSize = segmentSize/nbseg;
-    GCPnts_UniformAbscissa Discret;
-    if ( theReverse )
-      Discret.Initialize( theC3d, eltSize, par1, lp );
-    else
-      Discret.Initialize( theC3d, eltSize, lp, par1 );
-    if ( !Discret.IsDone() )
-      return error( "GCPnts_UniformAbscissa failed");
-    int NbPoints = Discret.NbPoints();
-    list<double> tmpParams;
-    for ( int i = 2; i < NbPoints; i++ ) {
-      double param = Discret.Parameter(i);
-      tmpParams.push_back( param );
-    }
-    if ( theReverse ) {
-      compensateError( eltSize, eltSize, lp, par1, segmentSize, theC3d, tmpParams );
-      tmpParams.reverse();
-    }
-    else {
-      compensateError( eltSize, eltSize, par1, lp, segmentSize, theC3d, tmpParams );
-    }
-    theParams.splice( theParams.end(), tmpParams );
-
-    if ( theReverse )
-      theParams.reverse(); // NPAL18025
+    theParams.pop_back();
 
     return true;
   }
index 1c7726730694d5cd8eb1c9c360ebcd713ca85ef2..de5a5b03644cd3821582a2229b54d219953be172 100644 (file)
@@ -934,7 +934,7 @@ void Maillage::acquisitionTYPE_inputMED(TYPE_MAILLE TYPE, int nTYPE, med_idt fid
 void Maillage::outputMED(std::string fichierMED)
 {
   // int i, j, k;
-  int nTYPE, tTYPE;
+  int nTYPE;//, tTYPE;
   string line, s, stype, nomnoeud;
   //  med_err ret = 0; // Code retour
   //  int ig, jg;
@@ -1457,7 +1457,7 @@ void Maillage::outputMED(std::string fichierMED)
       if (EFFECTIFS_TYPES[tm])
         {
           nTYPE = EFFECTIFS_TYPES[tm];
-          tTYPE = Nnoeuds(tm);
+          //tTYPE = Nnoeuds(tm);
           MGE = InstanceMGE(tm);
           stype = TM2string(tm);
 
index ef7e266d85fe4521c81de2f1ca1b6b323aa0c6ee..e1cd4e7d25836c6e36aa76d0341f691b625c0830 100644 (file)
@@ -100,7 +100,7 @@ bool SPADDERPluginTester_i::testkernel()
   beginService("SPADDERPluginTester_i::testplugin");
 
   Engines::SalomeLauncher_ptr salomeLauncher = KERNEL::getSalomeLauncher();
-  salomeLauncher = NULL;
+  if ( salomeLauncher ) salomeLauncher = NULL;
 
   endService("SPADDERPluginTester_i::testplugin");
   return true;