( new _Iterator( new SMDS_mapIterator<TMap>( DependsOn() ), prepend, append ));
}
}
+
+//================================================================================
+/*!
+ * \brief Find common submeshes (based on shared subshapes with other
+ * \param theOther submesh to check
+ * \param theSetOfCommon set of common submesh
+ */
+//================================================================================
+
+bool SMESH_subMesh::FindIntersection(const SMESH_subMesh* theOther,
+ std::set<const SMESH_subMesh*>& theSetOfCommon ) const
+{
+ int oldNb = theSetOfCommon.size();
+ // check main submeshes
+ const map <int, SMESH_subMesh*>::const_iterator otherEnd = theOther->_mapDepend.end();
+ if ( theOther->_mapDepend.find(this->GetId()) != otherEnd )
+ theSetOfCommon.insert( this );
+ if ( _mapDepend.find(theOther->GetId()) != _mapDepend.end() )
+ theSetOfCommon.insert( theOther );
+ // check common submeshes
+ map <int, SMESH_subMesh*>::const_iterator mapIt = _mapDepend.begin();
+ for( ; mapIt != _mapDepend.end(); mapIt++ )
+ if ( theOther->_mapDepend.find((*mapIt).first) != otherEnd )
+ theSetOfCommon.insert( (*mapIt).second );
+ return oldNb < theSetOfCommon.size();
+}
void SetIsAlwaysComputed(bool isAlCo);
bool IsAlwaysComputed() { return _alwaysComputed; }
+
+ /*!
+ * \brief Find common submeshes (based on shared subshapes with other
+ * \param theOther submesh to check
+ * \param theCommonIds set of common submesh IDs
+ * NOTE: this method does not cleat set before collect common IDs
+ */
+ bool FindIntersection( const SMESH_subMesh * theOther,
+ std::set<const SMESH_subMesh*>& theSetOfCommon ) const;
protected:
// ==================================================================
}
}
+ // is it enought to set modifid attribute on root mesh objects only?
+ // it is seems that modifaction flag will be set on child submeshes
+ // automatically (see SMESH::ModifiedMesh for details)
+ SMESH::ModifiedMesh( aMeshSObj, false, false );
+
SMESH::submesh_array_array_var meshOrder = new SMESH::submesh_array_array();
meshOrder->length(theListListIds.count() );
ListListId::const_iterator it = theListListIds.constBegin();
meshOrder[ i++ ] = subMeshList;
}
+ // update object browser
+ SMESHGUI::GetSMESHGUI()->updateObjBrowser( true, 0 );
return myMesh->SetMeshOrder(meshOrder);
}
//if ( shapeRefFound )
//myWriter.AddAllSubMeshes();
+ // store submesh order if any
+ const TListOfListOfInt& theOrderIds = myLocMesh.GetMeshOrder();
+ if ( theOrderIds.size() ) {
+ char order_list[ 30 ];
+ strcpy( order_list, "Mesh Order" );
+ // count number of submesh ids
+ int nbIDs = 0;
+ TListOfListOfInt::const_iterator idIt = theOrderIds.begin();
+ for ( ; idIt != theOrderIds.end(); idIt++ )
+ nbIDs += (*idIt).size();
+ // number of values = number of IDs +
+ // number of lists (for separators) - 1
+ int* smIDs = new int [ nbIDs + theOrderIds.size() - 1 ];
+ idIt = theOrderIds.begin();
+ for ( int i = 0; idIt != theOrderIds.end(); idIt++ ) {
+ const TListOfInt& idList = *idIt;
+ if (idIt != theOrderIds.begin()) // not first list
+ smIDs[ i++ ] = -1/* *idList.size()*/; // separator between lists
+ // dump submesh ids from current list
+ TListOfInt::const_iterator id_smId = idList.begin();
+ for( ; id_smId != idList.end(); id_smId++ )
+ smIDs[ i++ ] = *id_smId;
+ }
+ // write HDF group
+ aSize[ 0 ] = nbIDs + theOrderIds.size() - 1;
+
+ aDataset = new HDFdataset( order_list, aTopGroup, HDF_INT32, aSize, 1 );
+ aDataset->CreateOnDisk();
+ aDataset->WriteOnDisk( smIDs );
+ aDataset->CloseOnDisk();
+ //
+ delete[] smIDs;
+ }
+
// groups root sub-branch
SALOMEDS::SObject_var myGroupsBranch;
for ( int i = GetNodeGroupsTag(); i <= GetVolumeGroupsTag(); i++ ) {
aDataset->WriteOnDisk( smIDs );
aDataset->CloseOnDisk();
//
- delete smIDs;
+ delete[] smIDs;
}
// Store node positions on sub-shapes (SMDS_Position):
}
}
}
-
}
}
}
aGroup->CloseOnDisk();
}
}
+ // read submeh order if any
+ if( aTopGroup->ExistInternalObject( "Mesh Order" ) ) {
+ aDataset = new HDFdataset( "Mesh Order", aTopGroup );
+ aDataset->OpenOnDisk();
+ size = aDataset->GetSize();
+ int* smIDs = new int[ size ];
+ aDataset->ReadFromDisk( smIDs );
+ aDataset->CloseOnDisk();
+ TListOfListOfInt anOrderIds;
+ anOrderIds.push_back( TListOfInt() );
+ for ( int i = 0; i < size; i++ )
+ if ( smIDs[ i ] < 0 ) // is separator
+ anOrderIds.push_back( TListOfInt() );
+ else
+ anOrderIds.back().push_back(smIDs[ i ]);
+
+ myNewMeshImpl->GetImpl().SetMeshOrder( anOrderIds );
+ }
}
// close mesh group
if(aTopGroup)
return aResult._retn();
}
+//=============================================================================
+/*!
+ * \brief find common submeshes with given submesh
+ * \param theSubMeshList list of already collected submesh to check
+ * \param theSubMesh given submesh to intersect with other
+ * \param theCommonSubMeshes collected common submeshes
+ */
+//=============================================================================
+
+static void findCommonSubMesh
+ (std::list<const SMESH_subMesh*>& theSubMeshList,
+ const SMESH_subMesh* theSubMesh,
+ std::set<const SMESH_subMesh*>& theCommon )
+{
+ if ( !theSubMesh )
+ return;
+ std::list<const SMESH_subMesh*>::const_iterator it = theSubMeshList.begin();
+ for ( ; it != theSubMeshList.end(); it++ )
+ theSubMesh->FindIntersection( *it, theCommon );
+ theSubMeshList.push_back( theSubMesh );
+ //theCommon.insert( theSubMesh );
+}
+
//=============================================================================
/*!
* \brief Set submesh object order
const SMESH::submesh_array& aSMArray = theSubMeshArray[i];
TListOfInt subMeshIds;
aPythonDump << "[ ";
+ // Collect subMeshes which should be clear
+ // do it list-by-list, because modification of submesh order
+ // take effect between concurrent submeshes only
+ std::set<const SMESH_subMesh*> subMeshToClear;
+ std::list<const SMESH_subMesh*> subMeshList;
for ( int j = 0, jn = aSMArray.length(); j < jn; j++ )
{
const SMESH::SMESH_subMesh_var subMesh = SMESH::SMESH_subMesh::_duplicate(aSMArray[j]);
aPythonDump << ", ";
aPythonDump << subMesh;
subMeshIds.push_back( subMesh->GetId() );
+ // detech common parts of submeshes
+ if ( _mapSubMesh.find(subMesh->GetId()) != _mapSubMesh.end() )
+ findCommonSubMesh( subMeshList, (*_mapSubMesh.find(subMesh->GetId())).second, subMeshToClear );
}
aPythonDump << " ]";
subMeshOrder.push_back( subMeshIds );
+
+ // clear collected submeshes
+ std::set<const SMESH_subMesh*>::iterator clrIt = subMeshToClear.begin();
+ for ( ; clrIt != subMeshToClear.end(); clrIt++ ) {
+ SMESH_subMesh* sm = (SMESH_subMesh*)*clrIt;
+ if ( sm )
+ sm->ComputeStateEngine( SMESH_subMesh::CLEAN );
+ // ClearSubMesh( *clrIt );
+ }
}
aPythonDump << " ])";
aResSubSet->length(aSubOrder.size());
TListOfInt::const_iterator subIt = aSubOrder.begin();
for( int j = 0; subIt != aSubOrder.end(); subIt++ ) {
+ if ( _mapSubMeshIor.find(*subIt) == _mapSubMeshIor.end() )
+ continue;
SMESH::SMESH_subMesh_var subMesh =
SMESH::SMESH_subMesh::_duplicate( (*_mapSubMeshIor.find(*subIt)).second );
if ( theIsDump ) {