[GPUSPHGUI] fix errors relating to eCustomControl + offset

+ Fix SMESH_Gen_i::Concatenate()
This commit is contained in:
eap 2018-03-07 13:47:57 +03:00
parent 8b6d98aa4a
commit 09607afb27
4 changed files with 19 additions and 11 deletions

View File

@ -1700,7 +1700,9 @@ namespace
ActionControl.Bind( SMESHOp::OpOverConstrainedVolume, SMESH_Actor::eOverConstrainedVolume ); ActionControl.Bind( SMESHOp::OpOverConstrainedVolume, SMESH_Actor::eOverConstrainedVolume );
ActionControl.Bind( SMESHOp::OpEqualVolume, SMESH_Actor::eCoincidentElems3D ); ActionControl.Bind( SMESHOp::OpEqualVolume, SMESH_Actor::eCoincidentElems3D );
return theReversed ? ActionControl.Find2( theID ) : ActionControl.Find1( theID ); if ( theReversed )
return ActionControl.IsBound2( theID ) ? ActionControl.Find2( theID ) : 0;
return ActionControl.IsBound1( theID ) ? ActionControl.Find1( theID ) : 0;
} }
void Control( int theCommandID ) void Control( int theCommandID )

View File

@ -389,6 +389,7 @@ QString SMESHGUI_Selection::controlMode( int ind ) const
case SMESH_Actor::eCoincidentElems1D: mode = "eCoincidentElems1D"; break; case SMESH_Actor::eCoincidentElems1D: mode = "eCoincidentElems1D"; break;
case SMESH_Actor::eCoincidentElems2D: mode = "eCoincidentElems2D"; break; case SMESH_Actor::eCoincidentElems2D: mode = "eCoincidentElems2D"; break;
case SMESH_Actor::eCoincidentElems3D: mode = "eCoincidentElems3D"; break; case SMESH_Actor::eCoincidentElems3D: mode = "eCoincidentElems3D"; break;
case SMESH_Actor::eCustomControl: mode = "eCustomControl"; break;
default:break; default:break;
} }
} }

View File

@ -40,7 +40,7 @@
namespace namespace
{ {
const size_t theMaxNbFaces = 256; // max number of faces sharing a node const int theMaxNbFaces = 256; // max number of faces sharing a node
typedef NCollection_DataMap< Standard_Address, const SMDS_MeshNode* > TNNMap; typedef NCollection_DataMap< Standard_Address, const SMDS_MeshNode* > TNNMap;
typedef NCollection_Map< SMESH_Link, SMESH_Link > TLinkMap; typedef NCollection_Map< SMESH_Link, SMESH_Link > TLinkMap;
@ -575,7 +575,7 @@ namespace
TIDSortedElemSet elemSet, avoidSet; TIDSortedElemSet elemSet, avoidSet;
int iFace = 0; int iFace = 0;
const SMDS_MeshElement* f; const SMDS_MeshElement* f;
for ( ; faceIt->more(); faceIt->next() ) for ( ; faceIt->more() && iFace < theMaxNbFaces; faceIt->next() )
{ {
avoidSet.insert( faces[ iFace ].myFace ); avoidSet.insert( faces[ iFace ].myFace );
f = SMESH_MeshAlgos::FindFaceInSet( theNewNode, faces[ iFace ].myNode2.Node(), f = SMESH_MeshAlgos::FindFaceInSet( theNewNode, faces[ iFace ].myNode2.Node(),
@ -597,7 +597,7 @@ namespace
faces[ iFace ].SetNodes( i0, i1 ); faces[ iFace ].SetNodes( i0, i1 );
faces[ iFace ].SetNormal( theFaceNormals ); faces[ iFace ].SetNormal( theFaceNormals );
} }
int nbFaces = Min( iFace + 1, (int)theMaxNbFaces ); int nbFaces = iFace + 1;
theNewPos.SetCoord( 0, 0, 0 ); theNewPos.SetCoord( 0, 0, 0 );
gp_XYZ oldXYZ = SMESH_NodeXYZ( theNewNode ); gp_XYZ oldXYZ = SMESH_NodeXYZ( theNewNode );
@ -682,9 +682,10 @@ namespace
dot *= -1; dot *= -1;
if ( dot * theSign < 0 ) if ( dot * theSign < 0 )
{ {
gp_XYZ p1 = oldXYZ + faces[ i ].Norm() * theOffset; useOneNormal = true;
gp_XYZ p2 = oldXYZ + faces[ iPrev ].Norm() * theOffset; // gp_XYZ p1 = oldXYZ + faces[ i ].Norm() * theOffset;
useOneNormal = ( p1 - p2 ).SquareModulus() > theTol * theTol; // gp_XYZ p2 = oldXYZ + faces[ iPrev ].Norm() * theOffset;
// useOneNormal = ( p1 - p2 ).SquareModulus() > theTol * theTol;
} }
} }
if ( useOneNormal && theNewNode->isMarked() ) if ( useOneNormal && theNewNode->isMarked() )
@ -1393,7 +1394,8 @@ namespace
for ( int is2nd = 0; is2nd < 2; ++is2nd ) for ( int is2nd = 0; is2nd < 2; ++is2nd )
{ {
const SMDS_MeshElement* f = is2nd ? myFace1 : myFace2; const SMDS_MeshElement* f = is2nd ? myFace1 : myFace2;
const CutFace& cf = myCutFaces.Added( CutFace( is2nd ? myFace2 : myFace1 )); if ( !f ) continue;
const CutFace& cf = myCutFaces.Added( CutFace( is2nd ? myFace2 : myFace1 ));
for ( size_t i = 0; i < cf.myLinks.size(); ++i ) for ( size_t i = 0; i < cf.myLinks.size(); ++i )
if ( cf.myLinks[i].myFace == f && if ( cf.myLinks[i].myFace == f &&
//cf.myLinks[i].myIndex != EdgePart::_COPLANAR && //cf.myLinks[i].myIndex != EdgePart::_COPLANAR &&

View File

@ -2485,10 +2485,13 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::ListOfIDSources& theMeshesArray,
// assure that IDs increments by one during iteration // assure that IDs increments by one during iteration
::SMESH_Mesh& initLocMesh = initImpl->GetImpl(); ::SMESH_Mesh& initLocMesh = initImpl->GetImpl();
SMESHDS_Mesh* initMeshDS = initLocMesh.GetMeshDS(); SMESHDS_Mesh* initMeshDS = initLocMesh.GetMeshDS();
if ( initMeshDS->MaxNodeID() != initMeshDS->NbNodes() || if ( initMeshDS->MaxNodeID() > initMeshDS->NbNodes() ||
initMeshDS->MaxElementID() != initMeshDS->NbElements() ) initMeshDS->MaxElementID() > initMeshDS->NbElements() )
{
initMeshDS->Modified();
initMeshDS->CompactMesh(); initMeshDS->CompactMesh();
}
// remember nb of elements before filling in // remember nb of elements before filling in
SMESH::long_array_var prevState = newMesh->GetNbElementsByType(); SMESH::long_array_var prevState = newMesh->GetNbElementsByType();