X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_MeshEditor_i.cxx;h=448eef042c0a014d8b3d98be969ac156dad118a7;hb=1ef48564e516df97f5ac600fe8b6ba1e8c6318a4;hp=9eb4ebdfd017e9e46b338055a4c87cf287a73d5c;hpb=7d0549090a7d5d931b6551fc7dccefbd6cf83b9f;p=modules%2Fsmesh.git diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx index 9eb4ebdfd..448eef042 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.cxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -94,7 +94,7 @@ namespace { myPreviewType = previewElements; } //!< Destructor - virtual ~TPreviewMesh() { delete _myMeshDS; } + virtual ~TPreviewMesh() { delete _myMeshDS; _myMeshDS = 0; } //!< Copy a set of elements void Copy(const TIDSortedElemSet & theElements, TIDSortedElemSet& theCopyElements, @@ -169,7 +169,8 @@ namespace { SMESH_Mesh* myMesh; string myMeshPartIOR; //!< Constructor - TSearchersDeleter(): SMESH_subMeshEventListener( false ), // won't be deleted by submesh + TSearchersDeleter(): SMESH_subMeshEventListener( false, // won't be deleted by submesh + "SMESH_MeshEditor_i::TSearchersDeleter"), myMesh(0) {} //!< Delete theNodeSearcher static void Delete() @@ -432,8 +433,10 @@ struct _IDSource : public POA_SMESH::SMESH_IDSource SMESH::array_of_ElementType* GetTypes() { SMESH::array_of_ElementType_var types = new SMESH::array_of_ElementType; - types->length( 1 ); - types[0] = _type; + if ( _ids.length() > 0 ) { + types->length( 1 ); + types[0] = _type; + } return types._retn(); } }; @@ -658,6 +661,10 @@ CORBA::Long SMESH_MeshEditor_i::AddFace(const SMESH::long_array & IDsOfNodes) elem = GetMeshDS()->AddFace(nodes[0], nodes[1], nodes[2], nodes[3], nodes[4], nodes[5], nodes[6], nodes[7]); } + else if (NbNodes == 9) { + elem = GetMeshDS()->AddFace(nodes[0], nodes[1], nodes[2], nodes[3], + nodes[4], nodes[5], nodes[6], nodes[7], nodes[8] ); + } else if (NbNodes > 2) { elem = GetMeshDS()->AddPolygonalFace(nodes); } @@ -720,6 +727,9 @@ CORBA::Long SMESH_MeshEditor_i::AddVolume(const SMESH::long_array & IDsOfNodes) case 10:elem = GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5], n[6],n[7],n[8],n[9]); break; + case 12:elem = GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5], + n[6],n[7],n[8],n[9],n[10],n[11]); + break; case 13:elem = GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5],n[6], n[7],n[8],n[9],n[10],n[11],n[12]); break; @@ -730,6 +740,11 @@ CORBA::Long SMESH_MeshEditor_i::AddVolume(const SMESH::long_array & IDsOfNodes) n[8],n[9],n[10],n[11],n[12],n[13],n[14], n[15],n[16],n[17],n[18],n[19]); break; + case 27:elem = GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7], + n[8],n[9],n[10],n[11],n[12],n[13],n[14], + n[15],n[16],n[17],n[18],n[19], + n[20],n[21],n[22],n[23],n[24],n[25],n[26]); + break; } // Update Python script @@ -5671,6 +5686,7 @@ CORBA::Boolean SMESH_MeshEditor_i::Make2DMeshFrom3D() CORBA::Boolean SMESH_MeshEditor_i::DoubleNodesOnGroupBoundaries( const SMESH::ListOfGroups& theDomains, CORBA::Boolean createJointElems ) + throw (SALOME::SALOME_Exception) { initData(); @@ -5684,8 +5700,10 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodesOnGroupBoundaries( const SMESH::Li for ( int i = 0, n = theDomains.length(); i < n; i++ ) { SMESH::SMESH_GroupBase_var aGrp = theDomains[ i ]; - if ( !CORBA::is_nil( aGrp ) && ( aGrp->GetType() != SMESH::NODE ) ) + if ( !CORBA::is_nil( aGrp ) /*&& ( aGrp->GetType() != SMESH::NODE )*/ ) { + if ( aGrp->GetType() != SMESH::VOLUME ) + THROW_SALOME_CORBA_EXCEPTION("Not a volume group", SALOME::BAD_PARAM); TIDSortedElemSet domain; domain.clear(); domains.push_back(domain); @@ -5881,20 +5899,37 @@ CORBA::Long SMESH_MeshEditor_i::MakeBoundaryElements(SMESH::Bnd_Dimension dim, if ( dim > SMESH::BND_1DFROM2D ) THROW_SALOME_CORBA_EXCEPTION("Invalid boundary dimension", SALOME::BAD_PARAM); - // check that groups belongs to to this mesh and is not this mesh - const int nbGroups = groups.length(); - for ( int i = 0; i < nbGroups; ++i ) + // separate groups belonging to this and other mesh + SMESH::ListOfIDSources_var groupsOfThisMesh = new SMESH::ListOfIDSources; + SMESH::ListOfIDSources_var groupsOfOtherMesh = new SMESH::ListOfIDSources; + groupsOfThisMesh->length( groups.length() ); + groupsOfOtherMesh->length( groups.length() ); + int nbGroups = 0, nbGroupsOfOtherMesh = 0; + for ( int i = 0; i < groups.length(); ++i ) { SMESH::SMESH_Mesh_var m = groups[i]->GetMesh(); if ( myMesh_i != SMESH::DownCast( m )) - THROW_SALOME_CORBA_EXCEPTION("group does not belong to this mesh", SALOME::BAD_PARAM); + groupsOfOtherMesh[ nbGroupsOfOtherMesh++ ] = groups[i]; + else + groupsOfThisMesh[ nbGroups++ ] = groups[i]; if ( SMESH::DownCast( groups[i] )) THROW_SALOME_CORBA_EXCEPTION("expect a group but recieve a mesh", SALOME::BAD_PARAM); } + groupsOfThisMesh->length( nbGroups ); + groupsOfOtherMesh->length( nbGroupsOfOtherMesh ); + int nbAdded = 0; TPythonDump pyDump; - int nbAdded = 0; + if ( nbGroupsOfOtherMesh > 0 ) + { + // process groups belonging to another mesh + SMESH::SMESH_Mesh_var otherMesh = groupsOfOtherMesh[0]->GetMesh(); + SMESH::SMESH_MeshEditor_var editor = otherMesh->GetMeshEditor(); + nbAdded += editor->MakeBoundaryElements( dim, groupName, meshName, toCopyAll, + groupsOfOtherMesh, mesh, group ); + } + SMESH::SMESH_Mesh_var mesh_var; SMESH::SMESH_Group_var group_var; @@ -5931,12 +5966,12 @@ CORBA::Long SMESH_MeshEditor_i::MakeBoundaryElements(SMESH::Bnd_Dimension dim, TIDSortedElemSet elements; - if ( nbGroups > 0 ) + if ( groups.length() > 0 ) { for ( int i = 0; i < nbGroups; ++i ) { elements.clear(); - if ( idSourceToSet( groups[i], srcMeshDS, elements, elemType,/*emptyIfIsMesh=*/false )) + if ( idSourceToSet( groupsOfThisMesh[i], srcMeshDS, elements, elemType,/*emptyIfIsMesh=*/0 )) { SMESH::Bnd_Dimension bdim = ( elemType == SMDSAbs_Volume ) ? SMESH::BND_2DFROM3D : SMESH::BND_1DFROM2D;