mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-15 18:18:34 +05:00
0021208: Performance issue when loading SMESH with an hdf file containing a big mesh
+ virtual bool IsMeshInfoCorrect(); + SMESH_PreMeshInfo* _preMeshInfo; // mesh info before full loading from study file
This commit is contained in:
parent
c978123512
commit
53b7f3b9bb
@ -37,6 +37,7 @@
|
|||||||
#include "SMESH_Group.hxx"
|
#include "SMESH_Group.hxx"
|
||||||
#include "SMESH_Mesh_i.hxx"
|
#include "SMESH_Mesh_i.hxx"
|
||||||
#include "SMESH_PythonDump.hxx"
|
#include "SMESH_PythonDump.hxx"
|
||||||
|
#include "SMESH_PreMeshInfo.hxx"
|
||||||
|
|
||||||
#include CORBA_SERVER_HEADER(SMESH_Filter)
|
#include CORBA_SERVER_HEADER(SMESH_Filter)
|
||||||
|
|
||||||
@ -57,7 +58,8 @@ SMESH_GroupBase_i::SMESH_GroupBase_i( PortableServer::POA_ptr thePOA,
|
|||||||
myMeshServant( theMeshServant ),
|
myMeshServant( theMeshServant ),
|
||||||
myLocalID( theLocalID ),
|
myLocalID( theLocalID ),
|
||||||
myNbNodes(-1),
|
myNbNodes(-1),
|
||||||
myGroupDSTic(0)
|
myGroupDSTic(0),
|
||||||
|
myPreMeshInfo(NULL)
|
||||||
{
|
{
|
||||||
// PAL7962: san -- To ensure correct mapping of servant and correct reference counting in GenericObj_i,
|
// PAL7962: san -- To ensure correct mapping of servant and correct reference counting in GenericObj_i,
|
||||||
// servant activation is performed by SMESH_Mesh_i::createGroup()
|
// servant activation is performed by SMESH_Mesh_i::createGroup()
|
||||||
@ -102,6 +104,8 @@ SMESH_GroupBase_i::~SMESH_GroupBase_i()
|
|||||||
MESSAGE("~SMESH_GroupBase_i; this = "<<this );
|
MESSAGE("~SMESH_GroupBase_i; this = "<<this );
|
||||||
if ( myMeshServant )
|
if ( myMeshServant )
|
||||||
myMeshServant->removeGroup(myLocalID);
|
myMeshServant->removeGroup(myLocalID);
|
||||||
|
|
||||||
|
if ( myPreMeshInfo ) delete myPreMeshInfo; myPreMeshInfo = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -209,6 +213,9 @@ SMESH::ElementType SMESH_GroupBase_i::GetType()
|
|||||||
|
|
||||||
CORBA::Long SMESH_GroupBase_i::Size()
|
CORBA::Long SMESH_GroupBase_i::Size()
|
||||||
{
|
{
|
||||||
|
if ( myPreMeshInfo )
|
||||||
|
return GetType() == SMESH::NODE ? myPreMeshInfo->NbNodes() : myPreMeshInfo->NbElements();
|
||||||
|
|
||||||
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
|
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
|
||||||
if (aGroupDS)
|
if (aGroupDS)
|
||||||
return aGroupDS->Extent();
|
return aGroupDS->Extent();
|
||||||
@ -224,6 +231,9 @@ CORBA::Long SMESH_GroupBase_i::Size()
|
|||||||
|
|
||||||
CORBA::Boolean SMESH_GroupBase_i::IsEmpty()
|
CORBA::Boolean SMESH_GroupBase_i::IsEmpty()
|
||||||
{
|
{
|
||||||
|
if ( myPreMeshInfo )
|
||||||
|
return Size() == 0;
|
||||||
|
|
||||||
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
|
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
|
||||||
if (aGroupDS)
|
if (aGroupDS)
|
||||||
return aGroupDS->IsEmpty();
|
return aGroupDS->IsEmpty();
|
||||||
@ -239,6 +249,9 @@ CORBA::Boolean SMESH_GroupBase_i::IsEmpty()
|
|||||||
|
|
||||||
void SMESH_Group_i::Clear()
|
void SMESH_Group_i::Clear()
|
||||||
{
|
{
|
||||||
|
if ( myPreMeshInfo )
|
||||||
|
myPreMeshInfo->FullLoadFromFile();
|
||||||
|
|
||||||
// Update Python script
|
// Update Python script
|
||||||
TPythonDump() << _this() << ".Clear()";
|
TPythonDump() << _this() << ".Clear()";
|
||||||
|
|
||||||
@ -259,6 +272,9 @@ void SMESH_Group_i::Clear()
|
|||||||
|
|
||||||
CORBA::Boolean SMESH_GroupBase_i::Contains( CORBA::Long theID )
|
CORBA::Boolean SMESH_GroupBase_i::Contains( CORBA::Long theID )
|
||||||
{
|
{
|
||||||
|
if ( myPreMeshInfo )
|
||||||
|
myPreMeshInfo->FullLoadFromFile();
|
||||||
|
|
||||||
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
|
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
|
||||||
if (aGroupDS)
|
if (aGroupDS)
|
||||||
return aGroupDS->Contains(theID);
|
return aGroupDS->Contains(theID);
|
||||||
@ -274,6 +290,9 @@ CORBA::Boolean SMESH_GroupBase_i::Contains( CORBA::Long theID )
|
|||||||
|
|
||||||
CORBA::Long SMESH_Group_i::Add( const SMESH::long_array& theIDs )
|
CORBA::Long SMESH_Group_i::Add( const SMESH::long_array& theIDs )
|
||||||
{
|
{
|
||||||
|
if ( myPreMeshInfo )
|
||||||
|
myPreMeshInfo->FullLoadFromFile();
|
||||||
|
|
||||||
// Update Python script
|
// Update Python script
|
||||||
TPythonDump() << "nbAdd = " << _this() << ".Add( " << theIDs << " )";
|
TPythonDump() << "nbAdd = " << _this() << ".Add( " << theIDs << " )";
|
||||||
|
|
||||||
@ -300,6 +319,9 @@ CORBA::Long SMESH_Group_i::Add( const SMESH::long_array& theIDs )
|
|||||||
|
|
||||||
CORBA::Long SMESH_Group_i::Remove( const SMESH::long_array& theIDs )
|
CORBA::Long SMESH_Group_i::Remove( const SMESH::long_array& theIDs )
|
||||||
{
|
{
|
||||||
|
if ( myPreMeshInfo )
|
||||||
|
myPreMeshInfo->FullLoadFromFile();
|
||||||
|
|
||||||
// Update Python script
|
// Update Python script
|
||||||
TPythonDump() << "nbDel = " << _this() << ".Remove( " << theIDs << " )";
|
TPythonDump() << "nbDel = " << _this() << ".Remove( " << theIDs << " )";
|
||||||
|
|
||||||
@ -350,6 +372,9 @@ CORBA::Long
|
|||||||
SMESH_Group_i::
|
SMESH_Group_i::
|
||||||
AddByPredicate( SMESH::Predicate_ptr thePredicate )
|
AddByPredicate( SMESH::Predicate_ptr thePredicate )
|
||||||
{
|
{
|
||||||
|
if ( myPreMeshInfo )
|
||||||
|
myPreMeshInfo->FullLoadFromFile();
|
||||||
|
|
||||||
if(SMESH::Predicate_i* aPredicate = SMESH::GetPredicate(thePredicate)){
|
if(SMESH::Predicate_i* aPredicate = SMESH::GetPredicate(thePredicate)){
|
||||||
TPythonDump()<<_this()<<".AddByPredicate("<<aPredicate<<")";
|
TPythonDump()<<_this()<<".AddByPredicate("<<aPredicate<<")";
|
||||||
return ChangeByPredicate(aPredicate,GetGroupDS(),&SMESHDS_Group::Add);
|
return ChangeByPredicate(aPredicate,GetGroupDS(),&SMESHDS_Group::Add);
|
||||||
@ -361,6 +386,9 @@ CORBA::Long
|
|||||||
SMESH_Group_i::
|
SMESH_Group_i::
|
||||||
RemoveByPredicate( SMESH::Predicate_ptr thePredicate )
|
RemoveByPredicate( SMESH::Predicate_ptr thePredicate )
|
||||||
{
|
{
|
||||||
|
if ( myPreMeshInfo )
|
||||||
|
myPreMeshInfo->FullLoadFromFile();
|
||||||
|
|
||||||
if(SMESH::Predicate_i* aPredicate = SMESH::GetPredicate(thePredicate)){
|
if(SMESH::Predicate_i* aPredicate = SMESH::GetPredicate(thePredicate)){
|
||||||
TPythonDump()<<_this()<<".RemoveByPredicate("<<aPredicate<<")";
|
TPythonDump()<<_this()<<".RemoveByPredicate("<<aPredicate<<")";
|
||||||
return ChangeByPredicate(aPredicate,GetGroupDS(),&SMESHDS_Group::Remove);
|
return ChangeByPredicate(aPredicate,GetGroupDS(),&SMESHDS_Group::Remove);
|
||||||
@ -370,6 +398,9 @@ RemoveByPredicate( SMESH::Predicate_ptr thePredicate )
|
|||||||
|
|
||||||
CORBA::Long SMESH_Group_i::AddFrom( SMESH::SMESH_IDSource_ptr theSource )
|
CORBA::Long SMESH_Group_i::AddFrom( SMESH::SMESH_IDSource_ptr theSource )
|
||||||
{
|
{
|
||||||
|
if ( myPreMeshInfo )
|
||||||
|
myPreMeshInfo->FullLoadFromFile();
|
||||||
|
|
||||||
TPythonDump pd;
|
TPythonDump pd;
|
||||||
long nbAdd = 0;
|
long nbAdd = 0;
|
||||||
SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( GetGroupDS() );
|
SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( GetGroupDS() );
|
||||||
@ -410,6 +441,9 @@ CORBA::Long SMESH_Group_i::AddFrom( SMESH::SMESH_IDSource_ptr theSource )
|
|||||||
|
|
||||||
CORBA::Long SMESH_GroupBase_i::GetID( CORBA::Long theIndex )
|
CORBA::Long SMESH_GroupBase_i::GetID( CORBA::Long theIndex )
|
||||||
{
|
{
|
||||||
|
if ( myPreMeshInfo )
|
||||||
|
myPreMeshInfo->FullLoadFromFile();
|
||||||
|
|
||||||
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
|
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
|
||||||
if (aGroupDS)
|
if (aGroupDS)
|
||||||
return aGroupDS->GetID(theIndex);
|
return aGroupDS->GetID(theIndex);
|
||||||
@ -425,6 +459,9 @@ CORBA::Long SMESH_GroupBase_i::GetID( CORBA::Long theIndex )
|
|||||||
|
|
||||||
SMESH::long_array* SMESH_GroupBase_i::GetListOfID()
|
SMESH::long_array* SMESH_GroupBase_i::GetListOfID()
|
||||||
{
|
{
|
||||||
|
if ( myPreMeshInfo )
|
||||||
|
myPreMeshInfo->FullLoadFromFile();
|
||||||
|
|
||||||
SMESH::long_array_var aRes = new SMESH::long_array();
|
SMESH::long_array_var aRes = new SMESH::long_array();
|
||||||
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
|
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
|
||||||
if (aGroupDS) {
|
if (aGroupDS) {
|
||||||
@ -468,6 +505,9 @@ CORBA::Long SMESH_GroupBase_i::GetNumberOfNodes()
|
|||||||
if ( GetType() == SMESH::NODE )
|
if ( GetType() == SMESH::NODE )
|
||||||
return Size();
|
return Size();
|
||||||
|
|
||||||
|
if ( myPreMeshInfo )
|
||||||
|
myPreMeshInfo->FullLoadFromFile();
|
||||||
|
|
||||||
if ( SMESHDS_GroupBase* g = GetGroupDS())
|
if ( SMESHDS_GroupBase* g = GetGroupDS())
|
||||||
{
|
{
|
||||||
if ( myNbNodes < 0 || g->GetTic() != myGroupDSTic )
|
if ( myNbNodes < 0 || g->GetTic() != myGroupDSTic )
|
||||||
@ -491,6 +531,8 @@ CORBA::Boolean SMESH_GroupBase_i::IsNodeInfoAvailable()
|
|||||||
{
|
{
|
||||||
if ( GetType() == SMESH::NODE/* || Size() < 100000 */)
|
if ( GetType() == SMESH::NODE/* || Size() < 100000 */)
|
||||||
return true;
|
return true;
|
||||||
|
if ( myPreMeshInfo )
|
||||||
|
return false;
|
||||||
if ( SMESHDS_GroupBase* g = GetGroupDS())
|
if ( SMESHDS_GroupBase* g = GetGroupDS())
|
||||||
return ( myNbNodes > -1 && g->GetTic() == myGroupDSTic);
|
return ( myNbNodes > -1 && g->GetTic() == myGroupDSTic);
|
||||||
return false;
|
return false;
|
||||||
@ -507,6 +549,9 @@ SMESH::long_array* SMESH_GroupBase_i::GetNodeIDs()
|
|||||||
if ( GetType() == SMESH::NODE )
|
if ( GetType() == SMESH::NODE )
|
||||||
return GetListOfID();
|
return GetListOfID();
|
||||||
|
|
||||||
|
if ( myPreMeshInfo )
|
||||||
|
myPreMeshInfo->FullLoadFromFile();
|
||||||
|
|
||||||
SMESH::long_array_var aRes = new SMESH::long_array();
|
SMESH::long_array_var aRes = new SMESH::long_array();
|
||||||
if ( SMESHDS_GroupBase* g = GetGroupDS())
|
if ( SMESHDS_GroupBase* g = GetGroupDS())
|
||||||
{
|
{
|
||||||
@ -631,32 +676,22 @@ void SMESH_GroupBase_i::SetColorNumber(CORBA::Long color)
|
|||||||
//=============================================================================
|
//=============================================================================
|
||||||
SMESH::long_array* SMESH_GroupBase_i::GetMeshInfo()
|
SMESH::long_array* SMESH_GroupBase_i::GetMeshInfo()
|
||||||
{
|
{
|
||||||
|
if ( myPreMeshInfo )
|
||||||
|
return myPreMeshInfo->GetMeshInfo();
|
||||||
|
|
||||||
SMESH::long_array_var aRes = new SMESH::long_array();
|
SMESH::long_array_var aRes = new SMESH::long_array();
|
||||||
aRes->length(SMESH::Entity_Last);
|
aRes->length(SMESH::Entity_Last);
|
||||||
for (int i = SMESH::Entity_Node; i < SMESH::Entity_Last; i++)
|
for (int i = SMESH::Entity_Node; i < SMESH::Entity_Last; i++)
|
||||||
aRes[i] = 0;
|
aRes[i] = 0;
|
||||||
|
|
||||||
SMESHDS_GroupBase* aGrpDS = GetGroupDS();
|
if ( SMESHDS_GroupBase* g = GetGroupDS())
|
||||||
if ( !aGrpDS )
|
{
|
||||||
return aRes._retn();
|
if ( g->GetType() == SMDSAbs_Node || ( myNbNodes > -1 && g->GetTic() == myGroupDSTic))
|
||||||
if ( GetType() == NODE )
|
aRes[ SMDSEntity_Node ] = GetNumberOfNodes();
|
||||||
aRes[ SMESH::Entity_Node ] = aGrpDS->Extent();
|
|
||||||
else
|
|
||||||
SMESH_Mesh_i::CollectMeshInfo( aGrpDS->GetElements(), aRes);
|
|
||||||
|
|
||||||
// SMDS_ElemIteratorPtr it = aGrpDS->GetElements();
|
if ( g->GetType() != SMDSAbs_Node )
|
||||||
// if ( it->more() )
|
SMESH_Mesh_i::CollectMeshInfo( g->GetElements(), aRes);
|
||||||
// {
|
}
|
||||||
// cout << "START" << endl;
|
|
||||||
// set< const SMDS_MeshElement* > nodes;
|
|
||||||
// const SMDS_MeshElement* e = it->next();
|
|
||||||
// for ( int i = 0; i < 1000000; ++i)
|
|
||||||
// {
|
|
||||||
// SMDS_ElemIteratorPtr it = e->nodesIterator();
|
|
||||||
// nodes.insert( e + i );
|
|
||||||
// }
|
|
||||||
// cout << "END "<< nodes.size() << endl;
|
|
||||||
// }
|
|
||||||
|
|
||||||
return aRes._retn();
|
return aRes._retn();
|
||||||
}
|
}
|
||||||
@ -668,8 +703,7 @@ SMESH::long_array* SMESH_GroupBase_i::GetMeshInfo()
|
|||||||
|
|
||||||
SMESH::long_array* SMESH_GroupBase_i::GetIDs()
|
SMESH::long_array* SMESH_GroupBase_i::GetIDs()
|
||||||
{
|
{
|
||||||
SMESH::long_array_var aResult = GetListOfID();
|
return GetListOfID();
|
||||||
return aResult._retn();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -680,8 +714,7 @@ SMESH::long_array* SMESH_GroupBase_i::GetIDs()
|
|||||||
SMESH::array_of_ElementType* SMESH_GroupBase_i::GetTypes()
|
SMESH::array_of_ElementType* SMESH_GroupBase_i::GetTypes()
|
||||||
{
|
{
|
||||||
SMESH::array_of_ElementType_var types = new SMESH::array_of_ElementType;
|
SMESH::array_of_ElementType_var types = new SMESH::array_of_ElementType;
|
||||||
if ( SMESHDS_GroupBase* ds = GetGroupDS() )
|
if ( !IsEmpty() )
|
||||||
if ( !ds->IsEmpty() )
|
|
||||||
{
|
{
|
||||||
types->length( 1 );
|
types->length( 1 );
|
||||||
types[0] = GetType();
|
types[0] = GetType();
|
||||||
@ -689,6 +722,17 @@ SMESH::array_of_ElementType* SMESH_GroupBase_i::GetTypes()
|
|||||||
return types._retn();
|
return types._retn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : IsMeshInfoCorrect
|
||||||
|
//purpose : * Returns false if GetMeshInfo() returns incorrect information that may
|
||||||
|
// * happen if mesh data is not yet fully loaded from the file of study.
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
bool SMESH_GroupBase_i::IsMeshInfoCorrect()
|
||||||
|
{
|
||||||
|
return myPreMeshInfo ? myPreMeshInfo->IsMeshInfoCorrect() : true;
|
||||||
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Retrieves the predicate from the filter
|
* \brief Retrieves the predicate from the filter
|
||||||
@ -714,6 +758,9 @@ SMESH_PredicatePtr SMESH_GroupOnFilter_i::GetPredicate( SMESH::Filter_ptr filter
|
|||||||
|
|
||||||
void SMESH_GroupOnFilter_i::SetFilter(SMESH::Filter_ptr theFilter)
|
void SMESH_GroupOnFilter_i::SetFilter(SMESH::Filter_ptr theFilter)
|
||||||
{
|
{
|
||||||
|
if ( myPreMeshInfo )
|
||||||
|
myPreMeshInfo->FullLoadFromFile();
|
||||||
|
|
||||||
if ( ! myFilter->_is_nil() )
|
if ( ! myFilter->_is_nil() )
|
||||||
myFilter->UnRegister();
|
myFilter->UnRegister();
|
||||||
|
|
||||||
@ -838,6 +885,12 @@ SMESH::Filter_ptr SMESH_GroupOnFilter_i::StringToFilter(const std::string& thePe
|
|||||||
return filter._retn();
|
return filter._retn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Destructor of SMESH_GroupOnFilter_i
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
SMESH_GroupOnFilter_i::~SMESH_GroupOnFilter_i()
|
SMESH_GroupOnFilter_i::~SMESH_GroupOnFilter_i()
|
||||||
{
|
{
|
||||||
if ( ! myFilter->_is_nil() )
|
if ( ! myFilter->_is_nil() )
|
||||||
@ -847,8 +900,17 @@ SMESH_GroupOnFilter_i::~SMESH_GroupOnFilter_i()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Method calleds when a predicate of myFilter changes
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
void SMESH_GroupOnFilter_i::PredicateChanged()
|
void SMESH_GroupOnFilter_i::PredicateChanged()
|
||||||
{
|
{
|
||||||
|
if ( myPreMeshInfo )
|
||||||
|
myPreMeshInfo->FullLoadFromFile();
|
||||||
|
|
||||||
if ( SMESHDS_GroupOnFilter* grDS = dynamic_cast< SMESHDS_GroupOnFilter*>( GetGroupDS() ))
|
if ( SMESHDS_GroupOnFilter* grDS = dynamic_cast< SMESHDS_GroupOnFilter*>( GetGroupDS() ))
|
||||||
grDS->SetPredicate( GetPredicate( myFilter ));
|
grDS->SetPredicate( GetPredicate( myFilter ));
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
class SMESH_Group;
|
class SMESH_Group;
|
||||||
class SMESHDS_GroupBase;
|
class SMESHDS_GroupBase;
|
||||||
|
class SMESH_PreMeshInfo;
|
||||||
|
|
||||||
// ===========
|
// ===========
|
||||||
// Group Base
|
// Group Base
|
||||||
@ -67,7 +68,8 @@ class SMESH_I_EXPORT SMESH_GroupBase_i:
|
|||||||
SMESH::long_array* GetNodeIDs();
|
SMESH::long_array* GetNodeIDs();
|
||||||
CORBA::Long GetNumberOfNodes();
|
CORBA::Long GetNumberOfNodes();
|
||||||
CORBA::Boolean IsNodeInfoAvailable(); // for gui
|
CORBA::Boolean IsNodeInfoAvailable(); // for gui
|
||||||
SMESH::SMESH_Mesh_ptr GetMesh();
|
|
||||||
|
virtual SMESH::SMESH_Mesh_ptr GetMesh();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Returns statistic of mesh elements
|
* Returns statistic of mesh elements
|
||||||
@ -84,6 +86,11 @@ class SMESH_I_EXPORT SMESH_GroupBase_i:
|
|||||||
* Inherited from SMESH_IDSource interface
|
* Inherited from SMESH_IDSource interface
|
||||||
*/
|
*/
|
||||||
virtual SMESH::array_of_ElementType* GetTypes();
|
virtual SMESH::array_of_ElementType* GetTypes();
|
||||||
|
/*!
|
||||||
|
* Returns false if GetMeshInfo() returns incorrect information that may
|
||||||
|
* happen if mesh data is not yet fully loaded from the file of study.
|
||||||
|
*/
|
||||||
|
virtual bool IsMeshInfoCorrect();
|
||||||
|
|
||||||
// Internal C++ interface
|
// Internal C++ interface
|
||||||
int GetLocalID() const { return myLocalID; }
|
int GetLocalID() const { return myLocalID; }
|
||||||
@ -97,6 +104,12 @@ class SMESH_I_EXPORT SMESH_GroupBase_i:
|
|||||||
void SetColorNumber(CORBA::Long color);
|
void SetColorNumber(CORBA::Long color);
|
||||||
CORBA::Long GetColorNumber();
|
CORBA::Long GetColorNumber();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
SMESH_PreMeshInfo* & changePreMeshInfo() { return myPreMeshInfo; }
|
||||||
|
SMESH_PreMeshInfo* myPreMeshInfo; // mesh info before full loading from study file
|
||||||
|
friend class SMESH_PreMeshInfo;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SMESH_Mesh_i* myMeshServant;
|
SMESH_Mesh_i* myMeshServant;
|
||||||
int myLocalID;
|
int myLocalID;
|
||||||
|
@ -24,11 +24,11 @@
|
|||||||
// File : SMESH_subMesh_i.cxx
|
// File : SMESH_subMesh_i.cxx
|
||||||
// Author : Paul RASCLE, EDF
|
// Author : Paul RASCLE, EDF
|
||||||
// Module : SMESH
|
// Module : SMESH
|
||||||
// $Header$
|
|
||||||
//
|
//
|
||||||
#include "SMESH_subMesh_i.hxx"
|
#include "SMESH_subMesh_i.hxx"
|
||||||
#include "SMESH_Gen_i.hxx"
|
#include "SMESH_Gen_i.hxx"
|
||||||
#include "SMESH_Mesh_i.hxx"
|
#include "SMESH_Mesh_i.hxx"
|
||||||
|
#include "SMESH_PreMeshInfo.hxx"
|
||||||
|
|
||||||
#include "Utils_CorbaException.hxx"
|
#include "Utils_CorbaException.hxx"
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
@ -65,11 +65,10 @@ SMESH_subMesh_i::SMESH_subMesh_i( PortableServer::POA_ptr thePOA,
|
|||||||
int localId )
|
int localId )
|
||||||
: SALOME::GenericObj_i( thePOA )
|
: SALOME::GenericObj_i( thePOA )
|
||||||
{
|
{
|
||||||
MESSAGE("SMESH_subMesh_i::SMESH_subMesh_i");
|
|
||||||
_gen_i = gen_i;
|
_gen_i = gen_i;
|
||||||
_mesh_i = mesh_i;
|
_mesh_i = mesh_i;
|
||||||
_localId = localId;
|
_localId = localId;
|
||||||
// ****
|
_preMeshInfo = NULL;
|
||||||
}
|
}
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
@ -80,7 +79,8 @@ SMESH_subMesh_i::SMESH_subMesh_i( PortableServer::POA_ptr thePOA,
|
|||||||
SMESH_subMesh_i::~SMESH_subMesh_i()
|
SMESH_subMesh_i::~SMESH_subMesh_i()
|
||||||
{
|
{
|
||||||
MESSAGE("SMESH_subMesh_i::~SMESH_subMesh_i");
|
MESSAGE("SMESH_subMesh_i::~SMESH_subMesh_i");
|
||||||
// ****
|
if ( _preMeshInfo ) delete _preMeshInfo;
|
||||||
|
_preMeshInfo = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -162,7 +162,10 @@ CORBA::Long SMESH_subMesh_i::GetNumberOfElements()
|
|||||||
throw (SALOME::SALOME_Exception)
|
throw (SALOME::SALOME_Exception)
|
||||||
{
|
{
|
||||||
Unexpect aCatch(SALOME_SalomeException);
|
Unexpect aCatch(SALOME_SalomeException);
|
||||||
MESSAGE("SMESH_subMesh_i::GetNumberOfElements");
|
|
||||||
|
if ( _preMeshInfo )
|
||||||
|
return _preMeshInfo->NbElements();
|
||||||
|
|
||||||
if ( _mesh_i->_mapSubMesh.find( _localId ) == _mesh_i->_mapSubMesh.end() )
|
if ( _mesh_i->_mapSubMesh.find( _localId ) == _mesh_i->_mapSubMesh.end() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -192,10 +195,15 @@ CORBA::Long SMESH_subMesh_i::GetNumberOfNodes(CORBA::Boolean all)
|
|||||||
throw (SALOME::SALOME_Exception)
|
throw (SALOME::SALOME_Exception)
|
||||||
{
|
{
|
||||||
Unexpect aCatch(SALOME_SalomeException);
|
Unexpect aCatch(SALOME_SalomeException);
|
||||||
MESSAGE("SMESH_subMesh_i::GetNumberOfNodes");
|
|
||||||
if ( _mesh_i->_mapSubMesh.find( _localId ) == _mesh_i->_mapSubMesh.end() )
|
if ( _mesh_i->_mapSubMesh.find( _localId ) == _mesh_i->_mapSubMesh.end() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if ( _preMeshInfo )
|
||||||
|
{
|
||||||
|
if ( all ) return _preMeshInfo->NbNodes();
|
||||||
|
else _preMeshInfo->FullLoadFromFile();
|
||||||
|
}
|
||||||
::SMESH_subMesh* aSubMesh = _mesh_i->_mapSubMesh[_localId];
|
::SMESH_subMesh* aSubMesh = _mesh_i->_mapSubMesh[_localId];
|
||||||
SMESHDS_SubMesh* aSubMeshDS = aSubMesh->GetSubMeshDS();
|
SMESHDS_SubMesh* aSubMeshDS = aSubMesh->GetSubMeshDS();
|
||||||
|
|
||||||
@ -258,12 +266,15 @@ SMESH::long_array* SMESH_subMesh_i::GetElementsId()
|
|||||||
throw (SALOME::SALOME_Exception)
|
throw (SALOME::SALOME_Exception)
|
||||||
{
|
{
|
||||||
Unexpect aCatch(SALOME_SalomeException);
|
Unexpect aCatch(SALOME_SalomeException);
|
||||||
MESSAGE("SMESH_subMesh_i::GetElementsId");
|
|
||||||
SMESH::long_array_var aResult = new SMESH::long_array();
|
SMESH::long_array_var aResult = new SMESH::long_array();
|
||||||
|
|
||||||
if ( _mesh_i->_mapSubMesh.find( _localId ) == _mesh_i->_mapSubMesh.end() )
|
if ( _mesh_i->_mapSubMesh.find( _localId ) == _mesh_i->_mapSubMesh.end() )
|
||||||
return aResult._retn();
|
return aResult._retn();
|
||||||
|
|
||||||
|
if ( _preMeshInfo )
|
||||||
|
_preMeshInfo->FullLoadFromFile();
|
||||||
|
|
||||||
::SMESH_subMesh* aSubMesh = _mesh_i->_mapSubMesh[_localId];
|
::SMESH_subMesh* aSubMesh = _mesh_i->_mapSubMesh[_localId];
|
||||||
SMESHDS_SubMesh* aSubMeshDS = aSubMesh->GetSubMeshDS();
|
SMESHDS_SubMesh* aSubMeshDS = aSubMesh->GetSubMeshDS();
|
||||||
|
|
||||||
@ -305,12 +316,15 @@ SMESH::long_array* SMESH_subMesh_i::GetElementsByType( SMESH::ElementType theEle
|
|||||||
throw (SALOME::SALOME_Exception)
|
throw (SALOME::SALOME_Exception)
|
||||||
{
|
{
|
||||||
Unexpect aCatch(SALOME_SalomeException);
|
Unexpect aCatch(SALOME_SalomeException);
|
||||||
MESSAGE("SMESH_subMesh_i::GetElementsByType");
|
|
||||||
SMESH::long_array_var aResult = new SMESH::long_array();
|
SMESH::long_array_var aResult = new SMESH::long_array();
|
||||||
|
|
||||||
if ( _mesh_i->_mapSubMesh.find( _localId ) == _mesh_i->_mapSubMesh.end() )
|
if ( _mesh_i->_mapSubMesh.find( _localId ) == _mesh_i->_mapSubMesh.end() )
|
||||||
return aResult._retn();
|
return aResult._retn();
|
||||||
|
|
||||||
|
if ( _preMeshInfo )
|
||||||
|
_preMeshInfo->FullLoadFromFile();
|
||||||
|
|
||||||
::SMESH_subMesh* aSubMesh = _mesh_i->_mapSubMesh[_localId];
|
::SMESH_subMesh* aSubMesh = _mesh_i->_mapSubMesh[_localId];
|
||||||
SMESHDS_SubMesh* aSubMeshDS = aSubMesh->GetSubMeshDS();
|
SMESHDS_SubMesh* aSubMeshDS = aSubMesh->GetSubMeshDS();
|
||||||
|
|
||||||
@ -413,7 +427,7 @@ SMESH::long_array* SMESH_subMesh_i::GetNodesId()
|
|||||||
throw (SALOME::SALOME_Exception)
|
throw (SALOME::SALOME_Exception)
|
||||||
{
|
{
|
||||||
Unexpect aCatch(SALOME_SalomeException);
|
Unexpect aCatch(SALOME_SalomeException);
|
||||||
MESSAGE("SMESH_subMesh_i::GetNodesId");
|
|
||||||
SMESH::long_array_var aResult = GetElementsByType( SMESH::NODE );
|
SMESH::long_array_var aResult = GetElementsByType( SMESH::NODE );
|
||||||
return aResult._retn();
|
return aResult._retn();
|
||||||
}
|
}
|
||||||
@ -428,7 +442,6 @@ SMESH::SMESH_Mesh_ptr SMESH_subMesh_i::GetFather()
|
|||||||
throw (SALOME::SALOME_Exception)
|
throw (SALOME::SALOME_Exception)
|
||||||
{
|
{
|
||||||
Unexpect aCatch(SALOME_SalomeException);
|
Unexpect aCatch(SALOME_SalomeException);
|
||||||
MESSAGE("SMESH_subMesh_i::GetFather");
|
|
||||||
return _mesh_i->_this();
|
return _mesh_i->_this();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,7 +453,6 @@ SMESH::SMESH_Mesh_ptr SMESH_subMesh_i::GetFather()
|
|||||||
|
|
||||||
CORBA::Long SMESH_subMesh_i::GetId()
|
CORBA::Long SMESH_subMesh_i::GetId()
|
||||||
{
|
{
|
||||||
MESSAGE("SMESH_subMesh_i::GetId");
|
|
||||||
return _localId;
|
return _localId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,6 +494,8 @@ SALOME_MED::FAMILY_ptr SMESH_subMesh_i::GetFamily()
|
|||||||
throw (SALOME::SALOME_Exception)
|
throw (SALOME::SALOME_Exception)
|
||||||
{
|
{
|
||||||
Unexpect aCatch(SALOME_SalomeException);
|
Unexpect aCatch(SALOME_SalomeException);
|
||||||
|
if ( _preMeshInfo )
|
||||||
|
_preMeshInfo->FullLoadFromFile();
|
||||||
SALOME_MED::MESH_var MEDMesh = GetFather()->GetMEDMesh();
|
SALOME_MED::MESH_var MEDMesh = GetFather()->GetMEDMesh();
|
||||||
|
|
||||||
SALOME_MED::Family_array_var families =
|
SALOME_MED::Family_array_var families =
|
||||||
@ -502,8 +516,7 @@ SALOME_MED::FAMILY_ptr SMESH_subMesh_i::GetFamily()
|
|||||||
//=============================================================================
|
//=============================================================================
|
||||||
SMESH::long_array* SMESH_subMesh_i::GetIDs()
|
SMESH::long_array* SMESH_subMesh_i::GetIDs()
|
||||||
{
|
{
|
||||||
SMESH::long_array_var aResult = GetElementsId();
|
return GetElementsId();
|
||||||
return aResult._retn();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -514,6 +527,8 @@ SMESH::long_array* SMESH_subMesh_i::GetIDs()
|
|||||||
SMESH::ElementType SMESH_subMesh_i::GetElementType( const CORBA::Long id, const bool iselem )
|
SMESH::ElementType SMESH_subMesh_i::GetElementType( const CORBA::Long id, const bool iselem )
|
||||||
throw (SALOME::SALOME_Exception)
|
throw (SALOME::SALOME_Exception)
|
||||||
{
|
{
|
||||||
|
if ( _preMeshInfo )
|
||||||
|
_preMeshInfo->FullLoadFromFile();
|
||||||
return GetFather()->GetElementType( id, iselem );
|
return GetFather()->GetElementType( id, iselem );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -527,6 +542,9 @@ SMESH::ElementType SMESH_subMesh_i::GetElementType( const CORBA::Long id, const
|
|||||||
//=============================================================================
|
//=============================================================================
|
||||||
SMESH::long_array* SMESH_subMesh_i::GetMeshInfo()
|
SMESH::long_array* SMESH_subMesh_i::GetMeshInfo()
|
||||||
{
|
{
|
||||||
|
if ( _preMeshInfo )
|
||||||
|
return _preMeshInfo->GetMeshInfo();
|
||||||
|
|
||||||
SMESH::long_array_var aRes = new SMESH::long_array();
|
SMESH::long_array_var aRes = new SMESH::long_array();
|
||||||
aRes->length(SMESH::Entity_Last);
|
aRes->length(SMESH::Entity_Last);
|
||||||
for (int i = SMESH::Entity_Node; i < SMESH::Entity_Last; i++)
|
for (int i = SMESH::Entity_Node; i < SMESH::Entity_Last; i++)
|
||||||
@ -554,6 +572,9 @@ SMESH::long_array* SMESH_subMesh_i::GetMeshInfo()
|
|||||||
|
|
||||||
SMESH::array_of_ElementType* SMESH_subMesh_i::GetTypes()
|
SMESH::array_of_ElementType* SMESH_subMesh_i::GetTypes()
|
||||||
{
|
{
|
||||||
|
if ( _preMeshInfo )
|
||||||
|
return _preMeshInfo->GetTypes();
|
||||||
|
|
||||||
SMESH::array_of_ElementType_var types = new SMESH::array_of_ElementType;
|
SMESH::array_of_ElementType_var types = new SMESH::array_of_ElementType;
|
||||||
|
|
||||||
::SMESH_subMesh* aSubMesh = _mesh_i->_mapSubMesh[_localId];
|
::SMESH_subMesh* aSubMesh = _mesh_i->_mapSubMesh[_localId];
|
||||||
@ -592,3 +613,14 @@ SMESH::SMESH_Mesh_ptr SMESH_subMesh_i::GetMesh()
|
|||||||
{
|
{
|
||||||
return GetFather();
|
return GetFather();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : IsMeshInfoCorrect
|
||||||
|
//purpose : * Returns false if GetMeshInfo() returns incorrect information that may
|
||||||
|
// * happen if mesh data is not yet fully loaded from the file of study.
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
bool SMESH_subMesh_i::IsMeshInfoCorrect()
|
||||||
|
{
|
||||||
|
return _preMeshInfo ? _preMeshInfo->IsMeshInfoCorrect() : true;
|
||||||
|
}
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include "SMESH_Mesh_i.hxx"
|
#include "SMESH_Mesh_i.hxx"
|
||||||
|
|
||||||
class SMESH_Gen_i;
|
class SMESH_Gen_i;
|
||||||
|
class SMESH_PreMeshInfo;
|
||||||
|
|
||||||
class SMESH_I_EXPORT SMESH_subMesh_i:
|
class SMESH_I_EXPORT SMESH_subMesh_i:
|
||||||
public virtual POA_SMESH::SMESH_subMesh,
|
public virtual POA_SMESH::SMESH_subMesh,
|
||||||
@ -65,9 +66,6 @@ public:
|
|||||||
SMESH::long_array* GetElementsByType( SMESH::ElementType theElemType )
|
SMESH::long_array* GetElementsByType( SMESH::ElementType theElemType )
|
||||||
throw (SALOME::SALOME_Exception);
|
throw (SALOME::SALOME_Exception);
|
||||||
|
|
||||||
//for omniORB conflict compilation
|
|
||||||
/*SMESH::ElementType GetElementType( const CORBA::Long id, const bool iselem )
|
|
||||||
throw (SALOME::SALOME_Exception);*/
|
|
||||||
SMESH::ElementType GetElementType( CORBA::Long id, bool iselem )
|
SMESH::ElementType GetElementType( CORBA::Long id, bool iselem )
|
||||||
throw (SALOME::SALOME_Exception);
|
throw (SALOME::SALOME_Exception);
|
||||||
|
|
||||||
@ -106,17 +104,27 @@ public:
|
|||||||
/*!
|
/*!
|
||||||
* Returns the mesh
|
* Returns the mesh
|
||||||
*/
|
*/
|
||||||
SMESH::SMESH_Mesh_ptr GetMesh();
|
virtual SMESH::SMESH_Mesh_ptr GetMesh();
|
||||||
|
/*!
|
||||||
|
* Returns false if GetMeshInfo() returns incorrect information that may
|
||||||
|
* happen if mesh data is not yet fully loaded from the file of study.
|
||||||
|
*/
|
||||||
|
virtual bool IsMeshInfoCorrect();
|
||||||
|
|
||||||
|
|
||||||
SMESH_Mesh_i* _mesh_i; //NRI
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void changeLocalId(int localId) { _localId = localId; }
|
|
||||||
SMESH_Gen_i* _gen_i;
|
SMESH_Gen_i* _gen_i;
|
||||||
int _localId;
|
int _localId;
|
||||||
|
SMESH_Mesh_i* _mesh_i; //NRI
|
||||||
|
|
||||||
|
void changeLocalId(int localId) { _localId = localId; }
|
||||||
friend void SMESH_Mesh_i::CheckGeomGroupModif();
|
friend void SMESH_Mesh_i::CheckGeomGroupModif();
|
||||||
|
|
||||||
|
SMESH_PreMeshInfo* _preMeshInfo; // mesh info before full loading from study file
|
||||||
|
|
||||||
|
SMESH_PreMeshInfo* & changePreMeshInfo() { return _preMeshInfo; }
|
||||||
|
friend class SMESH_PreMeshInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user