import HOMARD
homard = salome.lcc.FindOrLoadComponent('FactoryServer','HOMARD')
- homard.SetStudy(salome.myStudy)
To use the module HOMARD within a distributed scheme YACS, the loading is made as follows:
import HOMARD
my_container.load_component_Library('HOMARD')
homard = my_container.create_component_instance('HOMARD',0)
- homard.SetStudy(salome.myStudy)
Uniform refinement
******************
# ==================================
#
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(True)
+ salome.sg.updateObjBrowser()
# ==================================
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(True)
+ salome.sg.updateObjBrowser()
# ==================================
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(True)
+ salome.sg.updateObjBrowser()
# ==================================
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(True)
+ salome.sg.updateObjBrowser()
# ==================================
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(True)
+ salome.sg.updateObjBrowser()
<component-author>EDF</component-author>
<component-version>1.6</component-version>
<component-comment>unknown</component-comment>
- <component-multistudy>1</component-multistudy>
<component-impltype>1</component-impltype>
<component-icone>HOMARD_2.png</component-icone>
<constraint></constraint>
<component-author>HOMARD team - EDF RD</component-author>
<component-version>1.4</component-version>
<component-comment>unknown</component-comment>
- <component-multistudy>1</component-multistudy>
<component-impltype>1</component-impltype>
<component-icone>HOMARD_2.png</component-icone>
<constraint></constraint>
</outParameter-list>
<DataStream-list></DataStream-list>
</component-service>
- <component-service>
- <service-name>SetCurrentStudy</service-name>
- <service-author>HOMARD team - EDF RD</service-author>
- <service-version>1.1</service-version>
- <service-comment>unknown</service-comment>
- <service-by-default>0</service-by-default>
- <inParameter-list>
- <inParameter>
- <inParameter-name>theStudy</inParameter-name>
- <inParameter-type>Study</inParameter-type>
- <inParameter-comment>unknown</inParameter-comment>
- </inParameter>
- </inParameter-list>
- <outParameter-list></outParameter-list>
- <DataStream-list></DataStream-list>
- </component-service>
<component-service>
<service-name>PublishBoundaryUnderCase</service-name>
<service-author>HOMARD team - EDF RD</service-author>
virtual void createPreferences();
HOMARD::HOMARD_Gen_var myComponentHomard;
- SALOMEDS::Study_var myStudy;
int anId;
QString _ObjectName;
SALOME_ListIO HOMARD_UTILS::mySelected;
-//================================================================
-// Function : GetCStudy
-// Returne un pointeur sur l'etude courante
-//================================================================
- _PTR(Study) HOMARD_UTILS::GetCStudy(const SalomeApp_Study* theStudy)
-{
- return theStudy->studyDS();
-}
-
//================================================================
// Function : GetActiveStudy
// Returne un pointeur sur l'etude active
}
//================================================================
-// Function : GetActiveStudyDocument
+// Function : getStudy
// Returne un pointeur sur l'etude active
//================================================================
-_PTR(Study) HOMARD_UTILS::GetActiveStudyDocument()
+_PTR(Study) HOMARD_UTILS::getStudy()
{
- SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(GetActiveStudy());
- if (aStudy){
- return aStudy->studyDS();
- }
- else
- return _PTR(Study)();
+ static _PTR(Study) _study;
+ if(!_study)
+ _study = SalomeApp_Application::getStudy();
+ return _study;
}
//================================================================
namespace HOMARD_UTILS {
- HOMARD_EXPORT
- _PTR(Study)
- GetCStudy(const SalomeApp_Study* theStudy);
-
HOMARD_EXPORT SUIT_Study* GetActiveStudy();
- HOMARD_EXPORT _PTR(Study) GetActiveStudyDocument();
+ HOMARD_EXPORT _PTR(Study) getStudy();
HOMARD_EXPORT void updateObjBrowser();
if ( aIO->hasEntry() )
{
// MESSAGE("aIO->getEntry() = " << aIO->getEntry());
- _PTR(Study) aStudy = HOMARD_UTILS::GetActiveStudyDocument();
+ _PTR(Study) aStudy = HOMARD_UTILS::getStudy();
_PTR(SObject) aSO ( aStudy->FindObjectID( aIO->getEntry() ) );
_PTR(GenericAttribute) anAttr;
if (aSO->FindAttribute(anAttr, "AttributeComment") )
Handle(SALOME_InteractiveObject) aIO = HOMARD_UTILS::firstIObject();
if ( aIO->hasEntry() )
{
- _PTR(Study) aStudy = HOMARD_UTILS::GetActiveStudyDocument();
+ _PTR(Study) aStudy = HOMARD_UTILS::getStudy();
_PTR(SObject) aSO ( aStudy->FindObjectID( aIO->getEntry() ) );
_PTR(SObject) aSObjCas = aSO->GetFather();
_PTR(GenericAttribute) anAttr;
Handle(SALOME_InteractiveObject) aIO = HOMARD_UTILS::firstIObject();
if ( aIO->hasEntry() )
{
- _PTR(Study) aStudy = HOMARD_UTILS::GetActiveStudyDocument();
+ _PTR(Study) aStudy = HOMARD_UTILS::getStudy();
_PTR(SObject) aSO ( aStudy->FindObjectID( aIO->getEntry() ) );
_PTR(GenericAttribute) anAttr;
_PTR(AttributeFileType) aFileType;
#include "SALOMEDS_Tool.hxx"
#include "SALOME_LifeCycleCORBA.hxx"
#include "SALOMEconfig.h"
+#include <SMESH_Gen_i.hxx>
#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
#include CORBA_CLIENT_HEADER(SMESH_Gen)
ASSERT(SINGLETON_<SALOME_NamingService>::IsAlreadyExisting());
_NS->init_orb(_orb);
- CORBA::Object_var aStudyObject = _NS->Resolve( "/Study" );
- myStudy = SALOMEDS::Study::_narrow( aStudyObject );
+ myStudy = SALOMEDS::Study::_duplicate( SMESH_Gen_i::getStudyServant() );
_tag_gene = 0 ;
_tag_boun = 0 ;
// get temporary directory name
std::string tmpDir = isMultiFile ? std::string(theURL) : SALOMEDS_Tool::GetTmpDir();
- SALOMEDS::Study_var aStudy = theComponent->GetStudy();
StudyContext& context = myStudyContext;
// HOMARD data file name
std::string aFileName = "";
if (isMultiFile)
- aFileName = SALOMEDS_Tool::GetNameFromPath(aStudy->URL());
+ aFileName = SALOMEDS_Tool::GetNameFromPath(SMESH_Gen_i::getStudyServant()->URL());
aFileName += "_HOMARD.dat";
// initialize sequence of file names
CORBA::Boolean isMultiFile)
{
MESSAGE ("Load pour theURL = "<< theURL);
- SALOMEDS::Study_var aStudy = theComponent->GetStudy();
// set current study
if (myStudy->_is_nil())
// HOMARD data file name
std::string aFileName = "";
if (isMultiFile)
- aFileName = SALOMEDS_Tool::GetNameFromPath(aStudy->URL());
+ aFileName = SALOMEDS_Tool::GetNameFromPath(SMESH_Gen_i::getStudyServant()->URL());
aFileName = tmpDir + aFileName + "_HOMARD.dat";
StudyContext& context = myStudyContext;
//===========================================================================
void HOMARD_Gen_i::Close(SALOMEDS::SComponent_ptr theComponent)
{
- if (theComponent->GetStudy())
- // - nullify myStudy
- myStudy = SALOMEDS::Study::_nil();
};
//===========================================================================
}
//==========================================================================
-Engines::TMPFile* HOMARD_Gen_i::DumpPython(CORBA::Object_ptr theStudy,
- CORBA::Boolean isPublished,
- CORBA::Boolean isMultiFile,
- CORBA::Boolean& isValidScript)
+Engines::TMPFile* HOMARD_Gen_i::DumpPython(CORBA::Boolean isPublished,
+ CORBA::Boolean isMultiFile,
+ CORBA::Boolean& isValidScript)
{
MESSAGE ("Entree dans DumpPython");
isValidScript=1;
- SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(theStudy);
- if(CORBA::is_nil(aStudy))
- return new Engines::TMPFile(0);
- SALOMEDS::SObject_var aSO = aStudy->FindComponent("HOMARD");
+ SALOMEDS::SObject_var aSO = SMESH_Gen_i::getStudyServant()->FindComponent("HOMARD");
if(CORBA::is_nil(aSO))
return new Engines::TMPFile(0);
void HOMARD_Gen_i::IsValidStudy( )
{
// MESSAGE( "IsValidStudy" );
- if (CORBA::is_nil(myStudy))
+ if (CORBA::is_nil(SMESH_Gen_i::getStudyServant()))
{
SALOME::ExceptionStruct es;
es.type = SALOME::BAD_PARAM;
HOMARD::HOMARD_Zone_ptr newZone();
- virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
- CORBA::Boolean isPublished,
- CORBA::Boolean isMultiFile,
- CORBA::Boolean& isValidScript);
+ virtual Engines::TMPFile* DumpPython(CORBA::Boolean isPublished,
+ CORBA::Boolean isMultiFile,
+ CORBA::Boolean& isValidScript);
virtual char* getVersion();
std::string GetStringInTexte( const std::string Texte, const std::string String, int option ) ;
#
#========================================================================
#========================================================================
-def homard_exec(theStudy):
+def homard_exec():
"""
Python script for HOMARD
"""
# Exec of HOMARD-SALOME
#
try :
- ERROR = homard_exec(salome.myStudy)
+ ERROR = homard_exec()
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
except Exception, eee:
test_results(REP_DATA, TEST_NAME, DIRCASE, N_ITER_TEST_FILE, N_REP_TEST_FILE, DESTROY_DIR)
#
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(True)
+ salome.sg.updateObjBrowser()
iparameters.getSession().restoreVisualState(1)
#
#========================================================================
#========================================================================
-def homard_exec(theStudy):
+def homard_exec():
"""
Python script for HOMARD
"""
# Exec of HOMARD-SALOME
#
try :
- ERROR = homard_exec(salome.myStudy)
+ ERROR = homard_exec()
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
except Exception, eee:
test_results(REP_DATA, TEST_NAME, DIRCASE, N_ITER_TEST_FILE, N_REP_TEST_FILE, DESTROY_DIR)
#
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(True)
+ salome.sg.updateObjBrowser()
iparameters.getSession().restoreVisualState(1)
#
#========================================================================
#========================================================================
-def homard_exec(theStudy):
+def homard_exec():
"""
Python script for HOMARD
"""
# Exec of HOMARD-SALOME
#
try :
- ERROR = homard_exec(salome.myStudy)
+ ERROR = homard_exec()
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
except Exception, eee:
test_results(REP_DATA, TEST_NAME, DIRCASE, N_ITER_TEST_FILE, N_REP_TEST_FILE, DESTROY_DIR)
#
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(True)
+ salome.sg.updateObjBrowser()
iparameters.getSession().restoreVisualState(1)
#
#========================================================================
#========================================================================
-def geom_smesh_exec(theStudy):
+def geom_smesh_exec():
"""
Python script for GEOM and SMESH
"""
#
while not error :
#
- geompy = geomBuilder.New(theStudy)
+ geompy = geomBuilder.New()
#
# Creation of the box
# ===================
# Creation of the mesh
# ====================
- smesh = smeshBuilder.New(theStudy)
+ smesh = smeshBuilder.New()
box_m = smesh.Mesh(box_g)
smesh.SetName(box_m.GetMesh(), 'MESH')
#
#========================================================================
#
#========================================================================
-def field_exec(theStudy, niter):
+def field_exec(niter):
"""
Python script for MEDCoupling
"""
#========================================================================
#========================================================================
-def homard_exec(theStudy):
+def homard_exec():
"""
Python script for HOMARD
"""
# Creation of the iteration 3
#
- error = field_exec(theStudy, 2)
+ error = field_exec(2)
if error :
error = 30
break
# Geometry and Mesh
#
try :
- ERROR = geom_smesh_exec(salome.myStudy)
+ ERROR = geom_smesh_exec()
if ERROR :
raise Exception('Pb in geom_smesh_exec')
except Exception, eee:
# Exec of HOMARD-SALOME
#
try :
- ERROR = homard_exec(salome.myStudy)
+ ERROR = homard_exec()
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
except Exception, eee:
test_results(REP_DATA, TEST_NAME, DIRCASE, N_ITER_TEST_FILE, N_REP_TEST_FILE, DESTROY_DIR)
#
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(True)
+ salome.sg.updateObjBrowser()
iparameters.getSession().restoreVisualState(1)
#
#========================================================================
#========================================================================
-def mesh_exec(theStudy):
+def mesh_exec():
"""
Python script for MED
"""
#========================================================================
#
#========================================================================
-def field_exec(theStudy, niter):
+def field_exec(niter):
"""
Python script for MEDCoupling
"""
#========================================================================
#========================================================================
-def homard_exec(theStudy):
+def homard_exec():
"""
Python script for HOMARD
"""
#
# Creation of the indicator
#
- error, ficmed_indic = field_exec(theStudy, niter)
+ error, ficmed_indic = field_exec(niter)
if error :
error = 10
break
# Geometry and Mesh
#
try :
- ERROR = mesh_exec(salome.myStudy)
+ ERROR = mesh_exec()
if ERROR :
raise Exception('Pb in mesh_exec')
except Exception, eee:
# Exec of HOMARD-SALOME
#
try :
- ERROR = homard_exec(salome.myStudy)
+ ERROR = homard_exec()
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
except Exception, eee:
test_results(REP_DATA, TEST_NAME, DIRCASE, N_ITER_TEST_FILE, N_REP_TEST_FILE, DESTROY_DIR)
#
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(True)
+ salome.sg.updateObjBrowser()
iparameters.getSession().restoreVisualState(1)
#
#========================================================================
#========================================================================
-def homard_exec(theStudy):
+def homard_exec():
"""
Python script for HOMARD
"""
# Exec of HOMARD-SALOME
#
try :
- ERROR = homard_exec(salome.myStudy)
+ ERROR = homard_exec()
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
except Exception, eee:
# ==================================
#
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(True)
+ salome.sg.updateObjBrowser()
iparameters.getSession().restoreVisualState(1)
#
#========================================================================
#========================================================================
-def homard_exec(theStudy):
+def homard_exec():
"""
Python script for HOMARD
"""
# Exec of HOMARD-SALOME
#
try :
- ERROR = homard_exec(salome.myStudy)
+ ERROR = homard_exec()
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
except Exception, eee:
# ==================================
#
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(True)
+ salome.sg.updateObjBrowser()
iparameters.getSession().restoreVisualState(1)
#
#========================================================================
#========================================================================
-def homard_exec(theStudy):
+def homard_exec():
"""
Python script for HOMARD
"""
# Exec of HOMARD-SALOME
#
try :
- ERROR = homard_exec(salome.myStudy)
+ ERROR = homard_exec()
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
except Exception, eee:
# ==================================
#
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(True)
+ salome.sg.updateObjBrowser()
iparameters.getSession().restoreVisualState(1)
#
#========================================================================
#========================================================================
-def homard_exec(theStudy):
+def homard_exec():
"""
Python script for HOMARD
"""
# Exec of HOMARD-SALOME
#
try :
- ERROR = homard_exec(salome.myStudy)
+ ERROR = homard_exec()
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
except Exception, eee:
# ==================================
#
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(True)
+ salome.sg.updateObjBrowser()
iparameters.getSession().restoreVisualState(1)
#
#========================================================================
#========================================================================
-def homard_exec(theStudy):
+def homard_exec():
"""
Python script for HOMARD
"""
# Exec of HOMARD-SALOME
#
try :
- ERROR = homard_exec(salome.myStudy)
+ ERROR = homard_exec()
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
except Exception, eee:
# ==================================
#
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(True)
+ salome.sg.updateObjBrowser()
iparameters.getSession().restoreVisualState(1)