mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-02-13 16:03:07 +05:00
add to GenericHypothesisCreator_i a method returning it's IDL module name to be used for importing it in the script by PythonDump
This commit is contained in:
parent
69a203b6d4
commit
6b5e44e4d8
@ -489,6 +489,16 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
|
||||
else
|
||||
aScript += aSMESHGen + ".SetCurrentStudy(None)";
|
||||
|
||||
// import python files corresponding to plugins
|
||||
set<string> moduleNameSet;
|
||||
map<string, GenericHypothesisCreator_i*>::iterator hyp_creator = myHypCreatorMap.begin();
|
||||
for ( ; hyp_creator != myHypCreatorMap.end(); ++hyp_creator ) {
|
||||
string moduleName = hyp_creator->second->GetModuleName();
|
||||
bool newModule = moduleNameSet.insert( moduleName ).second;
|
||||
if ( newModule )
|
||||
aScript += helper + "\n\t" + "import " + (char*) moduleName.c_str();
|
||||
}
|
||||
|
||||
// Dump trace of restored study
|
||||
if (theSavedTrace.Length() > 0) {
|
||||
// For the convertion of IDL API calls -> smesh.py API, "smesh" standing for SMESH_Gen
|
||||
|
@ -92,6 +92,8 @@ public:
|
||||
virtual SMESH_Hypothesis_i* Create(PortableServer::POA_ptr thePOA,
|
||||
int theStudyId,
|
||||
::SMESH_Gen* theGenImpl) = 0;
|
||||
// return the name of IDL module
|
||||
virtual std::string GetModuleName() = 0;
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
@ -106,7 +108,7 @@ template <class T> class HypothesisCreator_i: public GenericHypothesisCreator_i
|
||||
public:
|
||||
virtual SMESH_Hypothesis_i* Create (PortableServer::POA_ptr thePOA,
|
||||
int theStudyId,
|
||||
::SMESH_Gen* theGenImpl)
|
||||
::SMESH_Gen* theGenImpl)
|
||||
{
|
||||
return new T (thePOA, theStudyId, theGenImpl);
|
||||
};
|
||||
|
@ -49,6 +49,12 @@ using namespace std;
|
||||
#include "StdMeshers_Quadrangle_2D_i.hxx"
|
||||
#include "StdMeshers_Hexa_3D_i.hxx"
|
||||
|
||||
template <class T> class StdHypothesisCreator_i:public HypothesisCreator_i<T>
|
||||
{
|
||||
// as we have 'module StdMeshers' in SMESH_BasicHypothesis.idl
|
||||
virtual std::string GetModuleName() { return "StdMeshers"; }
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
@ -65,41 +71,41 @@ extern "C"
|
||||
|
||||
// Hypotheses
|
||||
if (strcmp(aHypName, "LocalLength") == 0)
|
||||
aCreator = new HypothesisCreator_i<StdMeshers_LocalLength_i>;
|
||||
aCreator = new StdHypothesisCreator_i<StdMeshers_LocalLength_i>;
|
||||
else if (strcmp(aHypName, "NumberOfSegments") == 0)
|
||||
aCreator = new HypothesisCreator_i<StdMeshers_NumberOfSegments_i>;
|
||||
aCreator = new StdHypothesisCreator_i<StdMeshers_NumberOfSegments_i>;
|
||||
else if (strcmp(aHypName, "LengthFromEdges") == 0)
|
||||
aCreator = new HypothesisCreator_i<StdMeshers_LengthFromEdges_i>;
|
||||
aCreator = new StdHypothesisCreator_i<StdMeshers_LengthFromEdges_i>;
|
||||
else if (strcmp(aHypName, "NotConformAllowed") == 0)
|
||||
aCreator = new HypothesisCreator_i<StdMeshers_NotConformAllowed_i>;
|
||||
aCreator = new StdHypothesisCreator_i<StdMeshers_NotConformAllowed_i>;
|
||||
else if (strcmp(aHypName, "Propagation") == 0)
|
||||
aCreator = new HypothesisCreator_i<StdMeshers_Propagation_i>;
|
||||
aCreator = new StdHypothesisCreator_i<StdMeshers_Propagation_i>;
|
||||
else if (strcmp(aHypName, "MaxElementArea") == 0)
|
||||
aCreator = new HypothesisCreator_i<StdMeshers_MaxElementArea_i>;
|
||||
aCreator = new StdHypothesisCreator_i<StdMeshers_MaxElementArea_i>;
|
||||
else if (strcmp(aHypName, "MaxElementVolume") == 0)
|
||||
aCreator = new HypothesisCreator_i<StdMeshers_MaxElementVolume_i>;
|
||||
aCreator = new StdHypothesisCreator_i<StdMeshers_MaxElementVolume_i>;
|
||||
else if (strcmp(aHypName, "StartEndLength") == 0)
|
||||
aCreator = new HypothesisCreator_i<StdMeshers_StartEndLength_i>;
|
||||
aCreator = new StdHypothesisCreator_i<StdMeshers_StartEndLength_i>;
|
||||
else if (strcmp(aHypName, "Deflection1D") == 0)
|
||||
aCreator = new HypothesisCreator_i<StdMeshers_Deflection1D_i>;
|
||||
aCreator = new StdHypothesisCreator_i<StdMeshers_Deflection1D_i>;
|
||||
else if (strcmp(aHypName, "Arithmetic1D") == 0)
|
||||
aCreator = new HypothesisCreator_i<StdMeshers_Arithmetic1D_i>;
|
||||
aCreator = new StdHypothesisCreator_i<StdMeshers_Arithmetic1D_i>;
|
||||
else if (strcmp(aHypName, "AutomaticLength") == 0)
|
||||
aCreator = new HypothesisCreator_i<StdMeshers_AutomaticLength_i>;
|
||||
aCreator = new StdHypothesisCreator_i<StdMeshers_AutomaticLength_i>;
|
||||
else if (strcmp(aHypName, "QuadranglePreference") == 0)
|
||||
aCreator = new HypothesisCreator_i<StdMeshers_QuadranglePreference_i>;
|
||||
aCreator = new StdHypothesisCreator_i<StdMeshers_QuadranglePreference_i>;
|
||||
else if (strcmp(aHypName, "QuadraticMesh") == 0)
|
||||
aCreator = new HypothesisCreator_i<StdMeshers_QuadraticMesh_i>;
|
||||
aCreator = new StdHypothesisCreator_i<StdMeshers_QuadraticMesh_i>;
|
||||
|
||||
// Algorithms
|
||||
else if (strcmp(aHypName, "Regular_1D") == 0)
|
||||
aCreator = new HypothesisCreator_i<StdMeshers_Regular_1D_i>;
|
||||
aCreator = new StdHypothesisCreator_i<StdMeshers_Regular_1D_i>;
|
||||
else if (strcmp(aHypName, "MEFISTO_2D") == 0)
|
||||
aCreator = new HypothesisCreator_i<StdMeshers_MEFISTO_2D_i>;
|
||||
aCreator = new StdHypothesisCreator_i<StdMeshers_MEFISTO_2D_i>;
|
||||
else if (strcmp(aHypName, "Quadrangle_2D") == 0)
|
||||
aCreator = new HypothesisCreator_i<StdMeshers_Quadrangle_2D_i>;
|
||||
aCreator = new StdHypothesisCreator_i<StdMeshers_Quadrangle_2D_i>;
|
||||
else if (strcmp(aHypName, "Hexa_3D") == 0)
|
||||
aCreator = new HypothesisCreator_i<StdMeshers_Hexa_3D_i>;
|
||||
aCreator = new StdHypothesisCreator_i<StdMeshers_Hexa_3D_i>;
|
||||
else ;
|
||||
|
||||
return aCreator;
|
||||
|
Loading…
Reference in New Issue
Block a user