SMESH_Mesh_i::SMESH_Mesh_i( PortableServer::POA_ptr thePOA,
SMESH_Gen_i* gen_i,
- CORBA::Long studyId )
+ CORBA::Long studyId )
: SALOME::GenericObj_i( thePOA )
{
MESSAGE("SMESH_Mesh_i");
try {
TopoDS_Shape S = _impl->GetMeshDS()->ShapeToMesh();
if ( !S.IsNull() )
+ {
aShapeObj = _gen_i->ShapeToGeomObject( S );
+ if ( aShapeObj->_is_nil() )
+ {
+ // S was removed from GEOM_Client by newGroupShape() called by other mesh;
+ // find GEOM_Object by entry (IPAL52735)
+ list<TGeomGroupData>::iterator data = _geomGroupData.begin();
+ for ( ; data != _geomGroupData.end(); ++data )
+ if ( data->_smeshObject->_is_equivalent( _this() ))
+ {
+ SALOMEDS::Study_var study = _gen_i->GetCurrentStudy();
+ if ( study->_is_nil() ) break;
+ SALOMEDS::SObject_wrap so = study->FindObjectID( data->_groupEntry.c_str() );
+ CORBA::Object_var obj = _gen_i->SObjectToObject( so );
+ aShapeObj = GEOM::GEOM_Object::_narrow( obj );
+ break;
+ }
+ }
+ }
}
catch(SALOME_Exception & S_ex) {
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
builder->RemoveObjectWithChildren( aGroupSO );
}
}
+ aGroup->Modified(/*removed=*/true); // notify dependent Filter with FT_BelongToMeshGroup criterion
// Remove the group from SMESH data structures
removeGroup( aGroup->GetLocalID() );
if ( _preMeshInfo )
_preMeshInfo->FullLoadFromFile();
- if ( theGroup->_is_nil() || theGroup->IsEmpty() )
+ if ( theGroup->_is_nil() )
return;
vector<int> nodeIds; // to remove nodes becoming free
- CORBA::Long elemID = theGroup->GetID( 1 );
- int nbElemNodes = GetElemNbNodes( elemID );
- if ( nbElemNodes > 0 )
- nodeIds.reserve( theGroup->Size() * nbElemNodes );
+ if ( !theGroup->IsEmpty() )
+ {
+ CORBA::Long elemID = theGroup->GetID( 1 );
+ int nbElemNodes = GetElemNbNodes( elemID );
+ if ( nbElemNodes > 0 )
+ nodeIds.reserve( theGroup->Size() * nbElemNodes );
+ }
// Remove contents
SMESH::SMESH_IDSource_var idSrc = SMESH::SMESH_IDSource::_narrow( theGroup );
bool isMajorityOfNodesCommon(int nbChecked, int nbCommon, int nbNodes, int nbCorners,
bool & toStopChecking )
{
- return nbCommon >= nbNodes / 2;
+ return nbCommon >= (nbNodes+1) / 2;
}
}
if ( study->_is_nil() ) return;
GEOM::GEOM_Object_var mainGO = _gen_i->ShapeToGeomObject( _impl->GetShapeToMesh() );
- if ( mainGO->_is_nil() ) return;
+ //if ( mainGO->_is_nil() ) return;
+
+ // Update after group modification
- if ( mainGO->GetType() == GEOM_GROUP ||
+ if ( mainGO->_is_nil() || /* shape was removed from GEOM_Client by newGroupShape()
+ called by other mesh (IPAL52735) */
+ mainGO->GetType() == GEOM_GROUP ||
mainGO->GetTick() == _mainShapeTick )
{
CheckGeomGroupModif();
return;
}
+ // Update after shape transformation like Translate
+
GEOM_Client* geomClient = _gen_i->GetShapeReader();
if ( !geomClient ) return;
GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine();
groupData.push_back
( make_pair( TIndexedShape( gog->GetID(),gog->GetShape()), gog->GetType()));
}
- // set new shape to mesh -> DS of submeshes and geom groups is deleted
+ // set new shape to mesh -> DS of sub-meshes and geom groups are deleted
+ _impl->Clear();
+ _impl->ShapeToMesh( TopoDS_Shape() ); // IPAL52730
_impl->ShapeToMesh( newShape );
-
+
// reassign hypotheses
TShapeHypList::iterator indS_hyps = assignedHyps.begin();
for ( ; indS_hyps != assignedHyps.end(); ++indS_hyps )
continue;
for ( hypIt = hyps.begin(); hypIt != hyps.end(); ++hypIt )
_impl->AddHypothesis( geom._shape, (*hypIt)->GetID());
- // care of submeshes
+ // care of sub-meshes
SMESH_subMesh* newSubmesh = _impl->GetSubMesh( geom._shape );
if ( newID != oldID ) {
_mapSubMesh [ newID ] = newSubmesh;
PrepareForWriting(file,overwrite);
+ std::string meshName("");
+ SALOMEDS::Study_var study = _gen_i->GetCurrentStudy();
+ SALOMEDS::SObject_wrap so = _gen_i->ObjectToSObject( study, meshPart );
+ if ( !so->_is_nil() )
+ {
+ CORBA::String_var name = so->GetName();
+ meshName = name.in();
+ }
SMESH_MeshPartDS partDS( meshPart );
- _impl->ExportCGNS(file, &partDS);
+ _impl->ExportCGNS(file, &partDS, meshName.c_str() );
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportCGNS( "
<< meshPart<< ", r'" << file << "', " << overwrite << ")";
return _impl->NbBiQuadQuadrangles();
}
-CORBA::Long SMESH_Mesh_i::NbPolygons()throw(SALOME::SALOME_Exception)
+CORBA::Long SMESH_Mesh_i::NbPolygons() throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
if ( _preMeshInfo )
return _impl->NbPolygons();
}
+CORBA::Long SMESH_Mesh_i::NbPolygonsOfOrder(SMESH::ElementOrder order) throw(SALOME::SALOME_Exception)
+{
+ Unexpect aCatch(SALOME_SalomeException);
+ if ( _preMeshInfo )
+ return _preMeshInfo->NbPolygons((SMDSAbs_ElementOrder) order);
+
+ return _impl->NbPolygons((SMDSAbs_ElementOrder)order);
+}
+
CORBA::Long SMESH_Mesh_i::NbFacesOfOrder(SMESH::ElementOrder order)
throw(SALOME::SALOME_Exception)
{
THROW_SALOME_CORBA_EXCEPTION( "empty group name",SALOME::BAD_PARAM );
SMESH::ListOfGroups_var groups = new SMESH::ListOfGroups;
+ ::SMESH_MeshEditor::ElemFeatures elemType;
// submesh by subshape id
if ( !_impl->HasShapeToMesh() ) theSubShapeID = 1;
if ( elem )
{
::SMESH_MeshEditor editor( _impl );
- elem = editor.AddElement( nodes, elem->GetType(), elem->IsPoly() );
+ elem = editor.AddElement( nodes, elemType.Init( elem ));
}
}
if ( elem )
if (_impl->NbVolumes()) types[nbTypes++] = SMESH::VOLUME;
if (_impl->Nb0DElements()) types[nbTypes++] = SMESH::ELEM0D;
if (_impl->NbBalls()) types[nbTypes++] = SMESH::BALL;
+ if (_impl->NbNodes() &&
+ nbTypes == 0 ) types[nbTypes++] = SMESH::NODE;
types->length( nbTypes );
return types._retn();