#include "OpUtil.hxx"
#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
+#include CORBA_CLIENT_HEADER(SALOME_Session)
#include "GEOM_Client.hxx"
#include "Utils_ExceptHandlers.hxx"
+#include "Basics_Utils.hxx"
#include <map>
// set it in standalone mode only
//OSD::SetSignal( true );
+
+ // 0020605: EDF 1190 SMESH: Display performance. 80 seconds for 52000 cells.
+ // find out mode (embedded or standalone) here else
+ // meshes created before calling SMESH_Client::GetSMESHGen(), which calls
+ // SMESH_Gen_i::SetEmbeddedMode(), have wrong IsEmbeddedMode flag
+ if ( SALOME_NamingService* ns = GetNS() )
+ {
+ CORBA::Object_var obj = ns->Resolve( "/Kernel/Session" );
+ SALOME::Session_var session = SALOME::Session::_narrow( obj ) ;
+ if ( !session->_is_nil() )
+ {
+ CORBA::String_var s_host = session->getHostname();
+ CORBA::Long s_pid = session->getPID();
+ string my_host = Kernel_Utils::GetHostname();
+#ifdef WNT
+ long my_pid = (long)_getpid();
+#else
+ long my_pid = (long) getpid();
+#endif
+ SetEmbeddedMode( s_pid == my_pid && my_host == s_host.in() );
+ }
+ }
}
//=============================================================================
void SMESH_Gen_i::SetDefaultNbSegments(CORBA::Long theNbSegments)
throw ( SALOME::SALOME_Exception )
{
- if ( theNbSegments )
+ if ( theNbSegments > 0 )
myGen.SetDefaultNbSegments( int(theNbSegments) );
else
THROW_SALOME_CORBA_EXCEPTION( "non-positive number of segments", SALOME::BAD_PARAM );
nbels[i] += aVec[i];
}
}
-#ifdef _DEBUG_
- cout<<endl;
-#endif
return nbels._retn();
}
}
return aNewMesh._retn();
}
+//================================================================================
+/*!
+ * SMESH_Gen_i::GetMEDVersion
+ *
+ * Get MED version of the file by its name
+ */
+//================================================================================
+CORBA::Boolean SMESH_Gen_i::GetMEDVersion(const char* theFileName,
+ SMESH::MED_VERSION& theVersion)
+{
+ theVersion = SMESH::MED_V2_1;
+ MED::EVersion aVersion = MED::GetVersionId( theFileName );
+ switch( aVersion ) {
+ case MED::eV2_1 : theVersion = SMESH::MED_V2_1; return true;
+ case MED::eV2_2 : theVersion = SMESH::MED_V2_2; return true;
+ case MED::eVUnknown : return false;
+ }
+ return false;
+}
+
+//================================================================================
+/*!
+ * SMESH_Gen_i::GetMeshNames
+ *
+ * Get names of meshes defined in file with the specified name
+ */
+//================================================================================
+SMESH::string_array* SMESH_Gen_i::GetMeshNames(const char* theFileName)
+{
+ SMESH::string_array_var aResult = new SMESH::string_array();
+ MED::PWrapper aMed = MED::CrWrapper( theFileName );
+ MED::TErr anErr;
+ MED::TInt aNbMeshes = aMed->GetNbMeshes( &anErr );
+ if( anErr >= 0 ) {
+ aResult->length( aNbMeshes );
+ for( MED::TInt i = 0; i < aNbMeshes; i++ ) {
+ MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo( i+1 );
+ aResult[i] = CORBA::string_dup( aMeshInfo->GetName().c_str() );
+ }
+ }
+ return aResult._retn();
+}
+
//=============================================================================
/*!
* SMESH_Gen_i::Save