]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
52863: Convert To Bi-Quadratic incorrectly locate in-face central nodes
authoreap <eap@opencascade.com>
Tue, 8 Sep 2015 14:24:05 +0000 (17:24 +0300)
committereap <eap@opencascade.com>
Tue, 8 Sep 2015 14:24:05 +0000 (17:24 +0300)
52865: Wrong order of children under a sub-mesh in the Object Browser

idl/SMESH_Mesh.idl
src/SMESH/SMESH_MesherHelper.cxx
src/SMESH_I/SMESH_Gen_i_1.cxx

index fc8a2c6a55014409537926837968aea5a37e86eb..9ede0252fd5aec967268aa8430741bc3d24c4ec7 100644 (file)
@@ -1044,7 +1044,7 @@ module SMESH
       raises (SALOME::SALOME_Exception);
     
     /*!
-     * Return type of submesh element
+     * Returns type of mesh element (same as SMESH_Mesh::GetElementType() )
      */
     ElementType GetElementType( in long id, in boolean iselem )
       raises (SALOME::SALOME_Exception);
index 6ed52110d8303f0353d0be27cc2837d2b27c6173..3ceea9fa34ca191c0b8aed017df5ff22f2b41a06 100644 (file)
@@ -1359,23 +1359,34 @@ const SMDS_MeshNode* SMESH_MesherHelper::GetCentralNode(const SMDS_MeshNode* n1,
   bool toCheck = true;
   if ( !F.IsNull() && !force3d )
   {
-    gp_XY uv[8] = {
-      GetNodeUV( F,n1,  n3, &toCheck ),
-      GetNodeUV( F,n2,  n4, &toCheck ),
-      GetNodeUV( F,n3,  n1, &toCheck ),
-      GetNodeUV( F,n4,  n2, &toCheck ),
-      GetNodeUV( F,n12, n3 ),
-      GetNodeUV( F,n23, n4 ),
-      GetNodeUV( F,n34, n2 ),
-      GetNodeUV( F,n41, n2 )
-    };
-    AdjustByPeriod( F, uv, 8 ); // put uv[] within a period (IPAL52698)
-
-    uvAvg = calcTFI (0.5, 0.5, uv[0],uv[1],uv[2],uv[3], uv[4],uv[5],uv[6],uv[7] );
+    Handle(ShapeAnalysis_Surface) surface = GetSurface( F );
+    if ( HasDegeneratedEdges() || surface->HasSingularities( 1e-7 ))
+    {
+      gp_Pnt center = calcTFI (0.5, 0.5, // IPAL0052863
+                               SMESH_TNodeXYZ(n1),  SMESH_TNodeXYZ(n2),
+                               SMESH_TNodeXYZ(n3),  SMESH_TNodeXYZ(n4),
+                               SMESH_TNodeXYZ(n12), SMESH_TNodeXYZ(n23),
+                               SMESH_TNodeXYZ(n34), SMESH_TNodeXYZ(n41));
+      gp_Pnt2d uv12 = GetNodeUV( F, n12, n3, &toCheck );
+      uvAvg = surface->NextValueOfUV( uv12, center, BRep_Tool::Tolerance( F )).XY();
+    }
+    else
+    {
+      gp_XY uv[8] = {
+        GetNodeUV( F,n1,  n3, &toCheck ),
+        GetNodeUV( F,n2,  n4, &toCheck ),
+        GetNodeUV( F,n3,  n1, &toCheck ),
+        GetNodeUV( F,n4,  n2, &toCheck ),
+        GetNodeUV( F,n12, n3 ),
+        GetNodeUV( F,n23, n4 ),
+        GetNodeUV( F,n34, n2 ),
+        GetNodeUV( F,n41, n2 )
+      };
+      AdjustByPeriod( F, uv, 8 ); // put uv[] within a period (IPAL52698)
 
-    TopLoc_Location loc;
-    Handle( Geom_Surface ) S = BRep_Tool::Surface( F, loc );
-    P = S->Value( uvAvg.X(), uvAvg.Y() ).Transformed( loc );
+      uvAvg = calcTFI (0.5, 0.5, uv[0],uv[1],uv[2],uv[3], uv[4],uv[5],uv[6],uv[7] );
+    }
+    P = surface->Value( uvAvg );
     centralNode = meshDS->AddNode( P.X(), P.Y(), P.Z() );
     // if ( mySetElemOnShape ) node is not elem!
     meshDS->SetNodeOnFace( centralNode, faceID, uvAvg.X(), uvAvg.Y() );
index 6fd7ec30d531003909204e6ad87ac2d2caf9eee9..362a61835b8e67736f0c2802afb505395461a5e2 100644 (file)
@@ -265,14 +265,17 @@ static SALOMEDS::SObject_ptr publish(SALOMEDS::Study_ptr   theStudy,
   SALOMEDS::StudyBuilder_var     aStudyBuilder = theStudy->NewBuilder();
   SALOMEDS::UseCaseBuilder_wrap useCaseBuilder = theStudy->GetUseCaseBuilder();
   SALOMEDS::SObject_wrap objAfter;
+  bool isNewSO = false;
   if ( SO->_is_nil() )
   {
     if ( theTag == 0 ) {
       SO = aStudyBuilder->NewObject( theFatherObject );
+      isNewSO = true;
     }
     else if ( !theFatherObject->FindSubObject( theTag, SO.inout() ))
     {
       SO = aStudyBuilder->NewObjectToTag( theFatherObject, theTag );
+      isNewSO = true;
 
       // define the next tag after given one in the data tree to insert SObject
       SALOMEDS::SObject_wrap curObj;
@@ -314,18 +317,19 @@ static SALOMEDS::SObject_ptr publish(SALOMEDS::Study_ptr   theStudy,
 
   // add object to the use case tree
   // (to support tree representation customization and drag-n-drop)
-  if ( !CORBA::is_nil( objAfter ) ) {
-    useCaseBuilder->InsertBefore( SO, objAfter );    // insert at given tag
-  } else if ( !useCaseBuilder->IsUseCaseNode( SO ) ) {
-    useCaseBuilder->AppendTo( theFatherObject, SO ); // append to the end of list
+  if ( isNewSO )
+  {
+    if ( !CORBA::is_nil( objAfter ) )
+      useCaseBuilder->InsertBefore( SO, objAfter );    // insert at given tag
+    else if ( !useCaseBuilder->IsUseCaseNode( SO ) )
+      useCaseBuilder->AppendTo( theFatherObject, SO ); // append to the end of list
   }
-
   return SO._retn();
 }
 
 //=======================================================================
 //function : setName
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 void SMESH_Gen_i::SetName(SALOMEDS::SObject_ptr theSObject,
@@ -421,7 +425,14 @@ static void addReference (SALOMEDS::Study_ptr   theStudy,
 
     // add reference to the use case tree
     // (to support tree representation customization and drag-n-drop)
-    SALOMEDS::UseCaseBuilder_wrap useCaseBuilder = theStudy->GetUseCaseBuilder();
+    SALOMEDS::UseCaseBuilder_wrap  useCaseBuilder = theStudy->GetUseCaseBuilder();
+    SALOMEDS::UseCaseIterator_wrap    useCaseIter = useCaseBuilder->GetUseCaseIterator(theSObject);
+    for ( ; useCaseIter->More(); useCaseIter->Next() )
+    {
+      SALOMEDS::SObject_wrap curSO = useCaseIter->Value();
+      if ( curSO->Tag() == theTag )
+        return;
+    }
     useCaseBuilder->AppendTo( theSObject, aReferenceSO );
   }
 }
@@ -940,7 +951,7 @@ bool SMESH_Gen_i::RemoveHypothesisFromShape(SALOMEDS::Study_ptr         theStudy
 
   CORBA::String_var hypEntry = aHypSO->GetID();
 
-  // Find a mesh or submesh refering to theShape
+  // Find a mesh or sub-mesh referring to theShape
   SALOMEDS::SObject_wrap aMeshOrSubMesh =
     GetMeshOrSubmeshByShape( theStudy, theMesh, theShape );
   if ( aMeshOrSubMesh->_is_nil() )