Salome HOME
Merge remote-tracking branch 'origin/V9_5_BR'
authoreap <eap@opencascade.com>
Fri, 10 Jul 2020 16:33:14 +0000 (19:33 +0300)
committereap <eap@opencascade.com>
Fri, 10 Jul 2020 16:33:14 +0000 (19:33 +0300)
Conflicts:
src/SMESH_I/SMESH_Mesh_i.cxx

1  2 
CMakeLists.txt
src/SMESHGUI/SMESHGUI_Selection.cxx
src/SMESHGUI/SMESHGUI_Selection.h
src/SMESH_I/SMESH_Mesh_i.cxx

diff --combined CMakeLists.txt
index e2434f3792c2abed0c59182f3c062e79b8296477,2dd08cb4087c6074b9f490f9a76d87e7288938af..6e6839abd3aeef2b325a8e7fba5c51fef88879ea
@@@ -27,11 -27,11 +27,11 @@@ INCLUDE(CMakeDependentOption
  STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
  
  SET(${PROJECT_NAME_UC}_MAJOR_VERSION 9)
- SET(${PROJECT_NAME_UC}_MINOR_VERSION 4)
+ SET(${PROJECT_NAME_UC}_MINOR_VERSION 5)
  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 fdf9a8d1c3c9a39e055e5dac43fa02beea59d1b0,5abe5c5be61812c0d1b17777e7a921e28c191f5a..3a32c569bf53cbceee1f916f7bba38c427dcaf06
@@@ -43,8 -43,6 +43,6 @@@
  #include <SalomeApp_Application.h>
  #include <LightApp_VTKSelector.h>
  #include <SVTK_ViewWindow.h>
- #include <LightApp_SelectionMgr.h>
- #include <LightApp_DataOwner.h>
  
  // IDL includes
  #include <SALOMEconfig.h>
@@@ -79,8 -77,6 +77,6 @@@ void SMESHGUI_Selection::init( const QS
  
    if( mgr )
    {
-     myOwners.clear();
-     mgr->selected(myOwners, client);
      for( int i=0, n=count(); i<n; i++ ) {
        myTypes.append( typeName( type( entry( i ) ) ) );
        myControls.append( controlMode( i ) );
@@@ -129,8 -125,6 +125,8 @@@ QVariant SMESHGUI_Selection::parameter
    else if ( p=="entityMode" )           val = QVariant( entityMode( ind ) );
    else if ( p=="isNumFunctor" )         val = QVariant( isNumFunctor( ind ) );
    else if ( p=="displayMode" )          val = QVariant( displayMode( ind ) );
 +  else if ( p=="hasAlgo" )              val = QVariant( hasAlgo( ind ) );
 +  else if ( p=="hasErrors" )            val = QVariant( hasErrors( ind ) );
    else if ( p=="isComputable" )         val = QVariant( isComputable( ind ) );
    else if ( p=="isPreComputable" )      val = QVariant( isPreComputable( ind ) );
    else if ( p=="hasGeomReference" )     val = QVariant( hasGeomReference( ind ) );
@@@ -550,17 -544,22 +546,17 @@@ int SMESHGUI_Selection::dim( int ind ) 
  }
  
  //=======================================================================
 -//function : isComputable
 -//purpose  : return true for a ready-to-compute mesh
 +//function : hasAlgo
 +//purpose  : return true for a ready-to-compute [sub-]mesh
  //=======================================================================
  
 -bool SMESHGUI_Selection::isComputable( int ind ) const
 +bool SMESHGUI_Selection::hasAlgo( int ind ) const
  {
    if ( ind >= 0 && ind < myTypes.count() && ( myTypes[ind] == "Mesh" ||
                                                myTypes[ind].startsWith("Mesh " )))
    {
      QMap<int,int> modeMap;
 -    _PTR(SObject) meshSO = SMESH::getStudy()->FindObjectID( entry( ind ).toUtf8().data() );
 -
 -    _PTR(SComponent) component = meshSO->GetFatherComponent();
 -    if ( meshSO->Depth() - component->Depth() > 1 ) // sub-mesh, get a mesh
 -      while ( meshSO->Depth() - component->Depth() > 1 )
 -        meshSO = meshSO->GetFather();
 +    _PTR(SObject) meshSO = SMESH::getStudy()->FindObjectID( entry( ind ).toStdString() );
  
      SMESHGUI_PrecomputeOp::getAssignedAlgos( meshSO, modeMap );
      return modeMap.size() > 0;
    return false;
  }
  
 +
 +//=======================================================================
 +//function : hasAlgo
 +//purpose  : return true if a mesh was computed with errors
 +//=======================================================================
 +
 +bool SMESHGUI_Selection::hasErrors( int ind ) const
 +{
 +  if ( ind >= 0 && ind < myTypes.count() && ( myTypes[ind] == "Mesh"))
 +  {
 +    _PTR(SObject)       meshSO = SMESH::getStudy()->FindObjectID( entry( ind ).toStdString() );
 +    CORBA::Object_var      obj = SMESH::SObjectToObject( meshSO );
 +    SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( obj );
 +    if ( !CORBA::is_nil( mesh ) )
 +    {
 +      SMESH::SMESH_Gen_var   gen = SMESHGUI::GetSMESHGUI()->GetSMESHGen();
 +      GEOM::GEOM_Object_var geom = mesh->GetShapeToMesh();
 +      SMESH::compute_error_array_var compErrors = gen->GetComputeErrors( mesh, geom );
 +      return compErrors->length();
 +    }
 +  }
 +  return false;
 +}
 +
 +//=======================================================================
 +//function : isComputable
 +//purpose  : Return true if a [sub-]mesh does not have "computed" icon
 +//=======================================================================
 +
 +bool SMESHGUI_Selection::isComputable( int ind ) const
 +{
 +  if ( ind >= 0 && ind < myTypes.count() && ( myTypes[ind] == "Mesh" ||
 +                                              myTypes[ind].startsWith("Mesh " )))
 +  {
 +    _PTR(GenericAttribute) attr;
 +    if ( _PTR(SObject) meshSO = SMESH::getStudy()->FindObjectID( entry( ind ).toStdString() ))
 +      if ( meshSO->FindAttribute( attr, "AttributePixMap" ))
 +      {
 +        _PTR(AttributePixMap) pixmap = attr;
 +        return ( pixmap->GetPixMap() != "ICON_SMESH_TREE_MESH" );
 +      }
 +  }
 +  return false;
 +}
 +
  //=======================================================================
  //function : isPreComputable
  //purpose  : returns true for a mesh with algorithms
@@@ -659,20 -613,22 +655,22 @@@ bool SMESHGUI_Selection::hasGeomReferen
  
  bool SMESHGUI_Selection::canBreakLink( int ind ) const
  {
-   if ( ind >= 0 && ind < myTypes.count()) {
-     if (isReference(ind)) {
-       SUIT_DataOwner* aOwn = myOwners.at(ind);
-       LightApp_DataOwner* sowner = dynamic_cast<LightApp_DataOwner*>(aOwn);
-       QString aEntry = sowner->entry();
-       _PTR(SObject) aSObject = SMESH::getStudy()->FindObjectID(aEntry.toStdString());
-       _PTR(SObject) aFatherObj = aSObject->GetFather();
-       _PTR(SComponent) aComponent = aFatherObj->GetFatherComponent();
-       if (aComponent->ComponentDataType() == "SMESH") {
-         QString aObjEntry = entry(ind);
-         _PTR(SObject) aGeomSObject = SMESH::getStudy()->FindObjectID(aObjEntry.toStdString());
-         GEOM::GEOM_Object_var aObject = SMESH::SObjectToInterface<GEOM::GEOM_Object>(aGeomSObject);
-         if (!aObject->_is_nil())
-           return aObject->IsParametrical();
+   if ( ind >= 0 && isReference(ind) ) {
+     QString aEntry = objectInfo(ind, OI_RefEntry).toString();
+     if (!aEntry.isEmpty()) {
+       _PTR(SObject) aSObject = SMESH::getStudy()->FindObjectID( aEntry.toStdString());
+       if (aSObject) {
+       _PTR(SObject) aFatherObj = aSObject->GetFather();
+       if (aFatherObj) {
+         _PTR(SComponent) aComponent = aFatherObj->GetFatherComponent();
+         if (aComponent && aComponent->ComponentDataType() == "SMESH") {
+           QString aObjEntry = entry(ind);
+           _PTR(SObject) aGeomSObject = SMESH::getStudy()->FindObjectID(aObjEntry.toStdString());
+           GEOM::GEOM_Object_var aObject = SMESH::SObjectToInterface<GEOM::GEOM_Object>(aGeomSObject);
+           if (!aObject->_is_nil())
+             return aObject->IsParametrical();
+           }
+         }
        }
      }
    }
index b9727108fc389223cebe4c4a62330f9f485f2965,e4b0641e0099c6a973aa34a9bf7e9487b82d647f..710cfcf83c880d2d9b85f609d5044c87225608e1
@@@ -32,7 -32,6 +32,6 @@@
  
  // SALOME GUI includes
  #include <LightApp_Selection.h>
- #include <SUIT_DataOwner.h>
  
  // SALOME KERNEL includes
  #include <SALOMEDSClient_definitions.hxx>
@@@ -58,8 -57,6 +57,8 @@@ public
    virtual int             numberOfNodes( int ) const;
    virtual int             dim( int ) const;
    virtual bool            isComputable( int ) const;
 +  virtual bool            hasAlgo( int ) const;
 +  virtual bool            hasErrors( int ) const;
    virtual bool            isPreComputable( int ) const;
    virtual bool            hasGeomReference( int ) const;
    virtual bool            isEditableHyp( int ) const;
@@@ -99,7 -96,6 +98,6 @@@ private
    QStringList             myTypes;
    QStringList             myControls;
    QList<SMESH_Actor*>     myActors;
-   SUIT_DataOwnerPtrList   myOwners;
  };
  
  #endif // SMESHGUI_SELECTION_H
index cf2a16ea647d3354553b1c95a1b5c4f3d3056bb3,470ca6587eb262b98525d7ae8979df388ae08c25..9c00cb31ee2073aa8d0f54e6090ba84c4c3d4ed8
@@@ -6425,8 -6425,8 +6425,8 @@@ class SMESH_DimHy
    //! fields
    int _dim;    //!< a dimension the algo can build (concurrent dimension)
    int _ownDim; //!< dimension of shape of _subMesh (>=_dim)
 -  TopTools_MapOfShape _shapeMap; //!< [sub-]shapes of dimension == _dim
 -  SMESH_subMesh*      _subMesh;
 +  TopTools_MapOfShape  _shapeMap; //!< [sub-]shapes of dimension == _dim
 +  const SMESH_subMesh* _subMesh;
    list<const SMESHDS_Hypothesis*> _hypotheses; //!< algo is first, then its parameters
  
    //-----------------------------------------------------------------------------
                 const int            theDim,
                 const TopoDS_Shape&  theShape)
    {
 -    _subMesh = (SMESH_subMesh*)theSubMesh;
 +    _subMesh = theSubMesh;
      SetShape( theDim, theShape );
    }
  
      if ( !isSame )
      {
        return true;
 -      // commented for IPAL54678
 +      // commented off for IPAL54678
        // if ( !a1 || !a2 )
        //   return false; // pb?
        // return a1->GetDim() == a2->GetDim(); // different algorithms of same dim -> concurrency !
@@@ -6571,8 -6571,7 +6571,8 @@@ void addDimHypInstance(const in
         theAlgo->NeedLowerHyps( theDim )) // IPAL54678
      return;
    TDimHypList& listOfdimHyp = theDimHypListArr[theDim];
 -  if ( listOfdimHyp.empty() || listOfdimHyp.back()->_subMesh != theSubMesh ) {
 +  if ( listOfdimHyp.empty() || listOfdimHyp.back()->_subMesh != theSubMesh )
 +  {
      SMESH_DimHyp* dimHyp = new SMESH_DimHyp( theSubMesh, theDim, theShape );
      dimHyp->_hypotheses.push_front(theAlgo);
      listOfdimHyp.push_back( dimHyp );
@@@ -6628,8 -6627,7 +6628,8 @@@ void unionLists(TListOfInt&       theLi
                  const int         theIndx )
  {
    TListOfListOfInt::iterator it = theListOfListOfId.begin();
 -  for ( int i = 0; it != theListOfListOfId.end(); it++, i++ ) {
 +  for ( int i = 0; it != theListOfListOfId.end(); it++, i++ )
 +  {
      if ( i < theIndx )
        continue; //skip already treated lists
      // check if other list has any same submesh object
@@@ -6752,84 -6750,82 +6752,86 @@@ TListOfListOfInt SMESH_Mesh_i::findConc
  {
    TListOfListOfInt anOrder;
    ::SMESH_Mesh& mesh = GetImpl();
 -  {
 -    // collect submeshes and detect concurrent algorithms and hypothesises
 -    TDimHypList dimHypListArr[4]; // dimHyp list for each shape dimension
 -
 -    map<int, ::SMESH_subMesh*>::iterator i_sm = _mapSubMesh.begin();
 -    for ( ; i_sm != _mapSubMesh.end(); i_sm++ ) {
 -      ::SMESH_subMesh* sm = (*i_sm).second;
 -      // shape of submesh
 -      const TopoDS_Shape& aSubMeshShape = sm->GetSubShape();
 -
 -      // list of assigned hypothesises
 -      const list <const SMESHDS_Hypothesis*>& hypList = mesh.GetHypothesisList(aSubMeshShape);
 -      // Find out dimensions where the submesh can be concurrent.
 -      // We define the dimensions by algo of each of hypotheses in hypList
 -      list <const SMESHDS_Hypothesis*>::const_iterator hypIt = hypList.begin();
 -      for( ; hypIt != hypList.end(); hypIt++ ) {
 -        SMESH_Algo* anAlgo = 0;
 -        const SMESH_Hypothesis* hyp = dynamic_cast<const SMESH_Hypothesis*>(*hypIt);
 -        if ( hyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO )
 -          // hyp it-self is algo
 -          anAlgo = (SMESH_Algo*)dynamic_cast<const SMESH_Algo*>(hyp);
 -        else {
 -          // try to find algorithm with help of sub-shapes
 -          TopExp_Explorer anExp( aSubMeshShape, shapeTypeByDim(hyp->GetDim()) );
 -          for ( ; !anAlgo && anExp.More(); anExp.Next() )
 -            anAlgo = mesh.GetGen()->GetAlgo( mesh, anExp.Current() );
 -        }
 -        if (!anAlgo)
 -          continue; // no algorithm assigned to a current submesh
  
 -        int dim = anAlgo->GetDim(); // top concurrent dimension (see comment to SMESH_DimHyp)
 -        // the submesh can concurrent at <dim> (or lower dims if !anAlgo->NeedDiscreteBoundary()
 -        // and !anAlgo->NeedLowerHyps( dim ))
 +  // collect submeshes and detect concurrent algorithms and hypothesises
 +  TDimHypList dimHypListArr[4]; // dimHyp list for each shape dimension
  
 -        // create instance of dimension-hypothesis for found concurrent dimension(s) and algorithm
 -        for ( int j = anAlgo->NeedDiscreteBoundary() ? dim : 1, jn = dim; j <= jn; j++ )
 -          addDimHypInstance( j, aSubMeshShape, anAlgo, sm, hypList, dimHypListArr );
 +  map<int, ::SMESH_subMesh*>::iterator i_sm = _mapSubMesh.begin();
-   for ( ; i_sm != _mapSubMesh.end(); i_sm++ ) {
++  for ( ; i_sm != _mapSubMesh.end(); i_sm++ )
++  {
 +    ::SMESH_subMesh* sm = (*i_sm).second;
 +    // shape of submesh
 +    const TopoDS_Shape& aSubMeshShape = sm->GetSubShape();
 +
 +    // list of assigned hypothesises
 +    const list <const SMESHDS_Hypothesis*>& hypList = mesh.GetHypothesisList(aSubMeshShape);
 +    // Find out dimensions where the submesh can be concurrent.
 +    // We define the dimensions by algo of each of hypotheses in hypList
 +    list <const SMESHDS_Hypothesis*>::const_iterator hypIt = hypList.begin();
-     for( ; hypIt != hypList.end(); hypIt++ ) {
++    for( ; hypIt != hypList.end(); hypIt++ )
++    {
 +      SMESH_Algo* anAlgo = 0;
 +      const SMESH_Hypothesis* hyp = dynamic_cast<const SMESH_Hypothesis*>(*hypIt);
 +      if ( hyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO )
 +        // hyp it-self is algo
 +        anAlgo = (SMESH_Algo*)dynamic_cast<const SMESH_Algo*>(hyp);
 +      else {
 +        // try to find algorithm with help of sub-shapes
 +        TopExp_Explorer anExp( aSubMeshShape, shapeTypeByDim(hyp->GetDim()) );
 +        for ( ; !anAlgo && anExp.More(); anExp.Next() )
 +          anAlgo = mesh.GetGen()->GetAlgo( mesh, anExp.Current() );
        }
 -    } // end iterations on submesh
 +      if (!anAlgo)
 +        continue; // no algorithm assigned to a current submesh
 +
 +      int dim = anAlgo->GetDim(); // top concurrent dimension (see comment to SMESH_DimHyp)
 +      // the submesh can concurrent at <dim> (or lower dims if !anAlgo->NeedDiscreteBoundary()
 +      // and !anAlgo->NeedLowerHyps( dim ))
 +
 +      // create instance of dimension-hypothesis for found concurrent dimension(s) and algorithm
 +      for ( int j = anAlgo->NeedDiscreteBoundary() ? dim : 1, jn = dim; j <= jn; j++ )
 +        addDimHypInstance( j, aSubMeshShape, anAlgo, sm, hypList, dimHypListArr );
 +    }
 +  } // end iterations on submesh
  
      // iterate on created dimension-hypotheses and check for concurrents
 -    for ( int i = 0; i < 4; i++ ) {
 -      const TDimHypList& listOfDimHyp = dimHypListArr[i];
 -      // check for concurrents in own and other dimensions (step-by-step)
 -      TDimHypList::const_iterator dhIt = listOfDimHyp.begin();
 -      for ( ; dhIt != listOfDimHyp.end(); dhIt++ ) {
 -        const SMESH_DimHyp* dimHyp = *dhIt;
 -        TDimHypList listOfConcurr;
 -        set<int>    setOfConcurrIds;
 -        // looking for concurrents and collect into own list
 -        for ( int j = i; j < 4; j++ )
 -          findConcurrents( dimHyp, dimHypListArr[j], listOfConcurr, setOfConcurrIds );
 -        // check if any concurrents found
 -        if ( listOfConcurr.size() > 0 ) {
 -          // add own submesh to list of concurrent
 -          addInOrderOfPriority( dimHyp, listOfConcurr );
 -          list<int> listOfConcurrIds;
 -          TDimHypList::iterator hypIt = listOfConcurr.begin();
 -          for ( ; hypIt != listOfConcurr.end(); ++hypIt )
 -            listOfConcurrIds.push_back( (*hypIt)->_subMesh->GetId() );
 -          anOrder.push_back( listOfConcurrIds );
 -        }
 +  for ( int i = 0; i < 4; i++ )
 +  {
 +    const TDimHypList& listOfDimHyp = dimHypListArr[i];
 +    // check for concurrents in own and other dimensions (step-by-step)
 +    TDimHypList::const_iterator dhIt = listOfDimHyp.begin();
 +    for ( ; dhIt != listOfDimHyp.end(); dhIt++ )
 +    {
 +      const SMESH_DimHyp* dimHyp = *dhIt;
 +      TDimHypList listOfConcurr;
 +      set<int>    setOfConcurrIds;
 +      // looking for concurrents and collect into own list
 +      for ( int j = i; j < 4; j++ )
 +        findConcurrents( dimHyp, dimHypListArr[j], listOfConcurr, setOfConcurrIds );
 +      // check if any concurrents found
 +      if ( listOfConcurr.size() > 0 )
 +      {
 +        // add own submesh to list of concurrent
 +        addInOrderOfPriority( dimHyp, listOfConcurr );
 +        list<int> listOfConcurrIds;
 +        TDimHypList::iterator hypIt = listOfConcurr.begin();
 +        for ( ; hypIt != listOfConcurr.end(); ++hypIt )
 +          listOfConcurrIds.push_back( (*hypIt)->_subMesh->GetId() );
 +        anOrder.push_back( listOfConcurrIds );
        }
      }
 +  }
  
 -    removeDimHyps(dimHypListArr);
 +  removeDimHyps(dimHypListArr);
  
 -    // now, minimize the number of concurrent groups
 -    // Here we assume that lists of submeshes can have same submesh
 -    // in case of multi-dimension algorithms, as result
 -    //  list with common submesh has to be united into one list
 -    int listIndx = 0;
 -    TListOfListOfInt::iterator listIt = anOrder.begin();
 -    for(; listIt != anOrder.end(); listIt++, listIndx++ )
 -      unionLists( *listIt,  anOrder, listIndx + 1 );
 -  }
 +  // now, minimize the number of concurrent groups
 +  // Here we assume that lists of submeshes can have same submesh
 +  // in case of multi-dimension algorithms, as result
 +  //  list with common submesh has to be united into one list
 +  int listIndx = 0;
 +  TListOfListOfInt::iterator listIt = anOrder.begin();
 +  for(; listIt != anOrder.end(); listIt++, listIndx++ )
 +    unionLists( *listIt,  anOrder, listIndx + 1 );
  
    return anOrder;
  }
@@@ -6917,8 -6913,7 +6919,8 @@@ void SMESH_Mesh_i::convertMeshOrder (co
    theResOrder.length(nbSet);
    TListOfListOfInt::const_iterator it = theIdsOrder.begin();
    int listIndx = 0;
 -  for( ; it != theIdsOrder.end(); it++ ) {
 +  for( ; it != theIdsOrder.end(); it++ )
 +  {
      // translate submesh identificators into submesh objects
      //  takeing into account real number of concurrent lists
      const TListOfInt& aSubOrder = (*it);
      aResSubSet->length(aSubOrder.size());
      TListOfInt::const_iterator subIt = aSubOrder.begin();
      int j;
 -    for( j = 0; subIt != aSubOrder.end(); subIt++ ) {
 +    for( j = 0; subIt != aSubOrder.end(); subIt++ )
 +    {
        if ( _mapSubMeshIor.find(*subIt) == _mapSubMeshIor.end() )
          continue;
        SMESH::SMESH_subMesh_var subMesh =