Simplify interface

This commit is contained in:
jfa 2021-12-27 14:21:01 +03:00
parent b2bc1bc120
commit 1c08dab8eb
7 changed files with 43 additions and 145 deletions

View File

@ -39,8 +39,6 @@ module SMESHHOMARD
void SetName(in string Name) raises (SALOME::SALOME_Exception);
string GetName() raises (SALOME::SALOME_Exception);
string GetDumpPython() raises (SALOME::SALOME_Exception);
// Caracteristiques
void SetType (in long Type) raises (SALOME::SALOME_Exception);
long GetType() raises (SALOME::SALOME_Exception);
@ -82,17 +80,11 @@ module SMESHHOMARD
void SetGroups(in ListGroupType ListGroup) raises (SALOME::SALOME_Exception);
ListGroupType GetGroups() raises (SALOME::SALOME_Exception);
// Liens avec les autres iterations
void SetCaseCreation(in string NomCas) raises (SALOME::SALOME_Exception);
string GetCaseCreation() raises (SALOME::SALOME_Exception);
string GetDumpPython() raises (SALOME::SALOME_Exception);
};
interface HOMARD_Cas : SALOME::GenericObj
{
string GetName() raises (SALOME::SALOME_Exception);
string GetDumpPython() raises (SALOME::SALOME_Exception);
// Caracteristiques
void SetDirName(in string NomDir) raises (SALOME::SALOME_Exception);
string GetDirName() raises (SALOME::SALOME_Exception);
@ -108,10 +100,13 @@ module SMESHHOMARD
in string Group) raises (SALOME::SALOME_Exception);
ListBoundaryGroupType GetBoundaryGroup() raises (SALOME::SALOME_Exception);
void SupprBoundaryGroup() raises (SALOME::SALOME_Exception);
string GetDumpPython() raises (SALOME::SALOME_Exception);
};
interface HOMARD_Gen : SALOME::GenericObj
{
// Create boundaries
HOMARD_Boundary CreateBoundaryCAO (in string BoundaryName, in string FileName)
raises(SALOME::SALOME_Exception);
HOMARD_Boundary CreateBoundaryDi (in string BoundaryName, in string MeshName,
@ -143,7 +138,7 @@ module SMESHHOMARD
in double RadiusRev, in double RadiusPri)
raises (SALOME::SALOME_Exception);
// CreateCase
// Set mesh (SMESH_Mesh object or MED file) and working directory
HOMARD_Cas CreateCaseOnMesh(in string MeshName,
in SMESH::SMESH_Mesh smeshMesh,
in string theWorkingDir) raises(SALOME::SALOME_Exception);
@ -151,27 +146,14 @@ module SMESHHOMARD
in string FileName,
in string theWorkingDir) raises(SALOME::SALOME_Exception);
// A.2. Information
HOMARD_Boundary GetBoundary(in string BoundaryName) raises (SALOME::SALOME_Exception);
HOMARD_Cas GetCase() raises (SALOME::SALOME_Exception);
listeBoundarys GetAllBoundarysName() raises (SALOME::SALOME_Exception);
void InvalideBoundary (in string BoundaryName) raises (SALOME::SALOME_Exception);
long DeleteBoundary (in string BoundaryName) raises (SALOME::SALOME_Exception);
long DeleteCase() raises (SALOME::SALOME_Exception);
void CleanCase() raises (SALOME::SALOME_Exception);
// Associate boundaries to groups
void AddBoundaryGroup(in string BoundaryName,
in string Group) raises (SALOME::SALOME_Exception);
long Compute() raises (SALOME::SALOME_Exception);
string CreateDirNameIter (in string NomDir, in long num)
raises (SALOME::SALOME_Exception);
void PublishResultInSmesh (in string FileName, in long Option)
raises (SALOME::SALOME_Exception);
// Information
HOMARD_Boundary GetBoundary(in string BoundaryName) raises (SALOME::SALOME_Exception);
HOMARD_Cas GetCase() raises (SALOME::SALOME_Exception);
listeBoundarys GetAllBoundarysName() raises (SALOME::SALOME_Exception);
// Preferences
void SetConfType(in long ConfType) raises (SALOME::SALOME_Exception);
@ -185,6 +167,14 @@ module SMESHHOMARD
void SetLogInFile (in boolean theLogInFile);
void SetLogFile (in string theFileName) raises (SALOME::SALOME_Exception);
void SetRemoveLogOnSuccess (in boolean theRemoveLogOnSuccess);
// Computation
long Compute() raises (SALOME::SALOME_Exception);
// Clean data
void InvalideBoundary (in string BoundaryName) raises (SALOME::SALOME_Exception);
long DeleteBoundary (in string BoundaryName) raises (SALOME::SALOME_Exception);
void DeleteCase() raises (SALOME::SALOME_Exception);
};
}; // module SMESHHOMARD

View File

@ -310,20 +310,6 @@ const std::list<std::string>& HOMARD_Boundary::GetGroups() const
return _ListGroupSelected;
}
//=============================================================================
//=============================================================================
// Liens avec les autres structures
//=============================================================================
//=============================================================================
void HOMARD_Boundary::SetCaseCreation( const char* NomCasCreation )
{
_NomCasCreation = std::string( NomCasCreation );
}
//=============================================================================
std::string HOMARD_Boundary::GetCaseCreation() const
{
return _NomCasCreation;
}
//=============================================================================
//=============================================================================
/*!
@ -332,7 +318,7 @@ std::string HOMARD_Boundary::GetCaseCreation() const
*/
//=============================================================================
HOMARD_Cas::HOMARD_Cas():
_Name(""), _NomDir("/tmp")
_NomDir("/tmp")
{
MESSAGE("HOMARD_Cas");
}
@ -347,16 +333,6 @@ HOMARD_Cas::~HOMARD_Cas()
// Generalites
//=============================================================================
//=============================================================================
void HOMARD_Cas::SetName( const char* Name )
{
_Name = std::string( Name );
}
//=============================================================================
std::string HOMARD_Cas::GetName() const
{
return _Name;
}
//=============================================================================
std::string HOMARD_Cas::GetDumpPython() const
{
std::ostringstream aScript;

View File

@ -82,13 +82,8 @@ public:
void SetGroups(const std::list<std::string>& ListGroup );
const std::list<std::string>& GetGroups() const;
// Liens avec les autres structures
std::string GetCaseCreation() const;
void SetCaseCreation( const char* NomCasCreation );
private:
std::string _Name;
std::string _NomCasCreation;
std::string _DataFile;
std::string _MeshName;
int _Type;
@ -110,9 +105,6 @@ public:
~HOMARD_Cas();
// Generalites
void SetName( const char* Name );
std::string GetName() const;
std::string GetDumpPython() const;
// Caracteristiques
@ -135,7 +127,6 @@ public:
void AddIteration( const char* NomIteration );
private:
std::string _Name;
std::string _NomDir;
int _Etat;

View File

@ -182,7 +182,7 @@ SMESHGUI_HomardAdaptDlg::SMESHGUI_HomardAdaptDlg(SMESHHOMARD::HOMARD_Gen_ptr myH
SMESHGUI_HomardAdaptDlg::~SMESHGUI_HomardAdaptDlg()
{
// no need to delete child widgets, Qt does it all for us
myHomardGen->CleanCase();
myHomardGen->DeleteCase();
}
//=================================================================================

View File

@ -872,7 +872,6 @@ bool SMESH_CreateBoundaryCAO::PushOnApply()
_aName=aName;
aBoundary=myHomardGen->CreateBoundaryCAO(CORBA::string_dup(_aName.toStdString().c_str()), aCAOFile.toStdString().c_str());
_parent->AddBoundaryCAO(_aName);
aBoundary->SetCaseCreation("Case_1");
}
catch( SALOME::SALOME_Exception& S_ex )
{
@ -1044,7 +1043,6 @@ bool SMESH_CreateBoundaryDi::PushOnApply()
_aName=aName;
aBoundary=myHomardGen->CreateBoundaryDi(CORBA::string_dup(_aName.toStdString().c_str()), aMeshName.toStdString().c_str(), aMeshFile.toStdString().c_str());
_parent->AddBoundaryDi(_aName);
aBoundary->SetCaseCreation("Case_1");
}
catch( SALOME::SALOME_Exception& S_ex )
{

View File

@ -285,22 +285,6 @@ SMESHHOMARD::ListGroupType* HOMARD_Boundary_i::GetGroups()
}
return aResult._retn();
}
//=============================================================================
//=============================================================================
// Liens avec les autres structures
//=============================================================================
//=============================================================================
void HOMARD_Boundary_i::SetCaseCreation(const char* NomCaseCreation)
{
ASSERT(myHomardBoundary);
myHomardBoundary->SetCaseCreation(NomCaseCreation);
}
//=============================================================================
char* HOMARD_Boundary_i::GetCaseCreation()
{
ASSERT(myHomardBoundary);
return CORBA::string_dup(myHomardBoundary->GetCaseCreation().c_str());
}
//=============================================================================
/*!
@ -326,7 +310,6 @@ HOMARD_Cas_i::HOMARD_Cas_i(SMESHHOMARD::HOMARD_Gen_var engine)
_gen_i = engine;
myHomardCas = new SMESHHOMARDImpl::HOMARD_Cas();
ASSERT(myHomardCas);
myHomardCas->SetName("Case_1");
}
//=============================================================================
@ -338,16 +321,6 @@ HOMARD_Cas_i::~HOMARD_Cas_i()
{
}
//=============================================================================
//=============================================================================
// Generalites
//=============================================================================
//=============================================================================
char* HOMARD_Cas_i::GetName()
{
ASSERT(myHomardCas);
return CORBA::string_dup(myHomardCas->GetName().c_str());
}
//=============================================================================
char* HOMARD_Cas_i::GetDumpPython()
{
ASSERT(myHomardCas);
@ -379,6 +352,7 @@ void HOMARD_Cas_i::SetDirName(const char* NomDir)
es.text = CORBA::string_dup(text.c_str());
throw SALOME::SALOME_Exception(es);
}
// D. En cas de reprise, deplacement du point de depart
HOMARD_Gen_i* aGenImpl = SMESH::DownCast<HOMARD_Gen_i*>(_gen_i);
HOMARD_Iteration_i* Iter0 = aGenImpl->GetIteration(0);
@ -389,7 +363,7 @@ void HOMARD_Cas_i::SetDirName(const char* NomDir)
char* DirNameIter = Iter0->GetDirNameLoc();
MESSAGE ("SetDirName : nom actuel pour le repertoire de l iteration, DirNameIter = "<< DirNameIter);
// D.2. Recherche d'un nom local pour l'iteration de depart dans le futur repertoire du cas
char* nomDirIter = _gen_i->CreateDirNameIter(NomDir, 0);
char* nomDirIter = aGenImpl->CreateDirNameIter(NomDir, 0);
MESSAGE ("SetDirName : nom futur pour le repertoire de l iteration, nomDirIter = "<< nomDirIter);
// D.3. Creation du futur repertoire local pour l'iteration de depart
std::string nomDirIterTotal;
@ -837,9 +811,6 @@ HOMARD_Gen_i::HOMARD_Gen_i() : SALOME::GenericObj_i(SMESH_Gen_i::GetPOA()),
HOMARD_Gen_i::~HOMARD_Gen_i()
{
MESSAGE ("HOMARD_Gen_i::~HOMARD_Gen_i()");
//if (!myCase->_is_nil()) {
// CleanCase();
//}
}
//=============================================================================
@ -866,19 +837,6 @@ CORBA::Long HOMARD_Gen_i::DeleteBoundary(const char* BoundaryName)
return 0;
}
//=============================================================================
CORBA::Long HOMARD_Gen_i::DeleteCase()
{
MESSAGE ("DeleteCase");
if (!CORBA::is_nil(myCase)) {
// Delete Iteration0
if (DeleteIteration(0) != 0) return 2;
myCase = SMESHHOMARD::HOMARD_Cas::_nil();
}
return 0;
}
//=============================================================================
CORBA::Long HOMARD_Gen_i::DeleteIteration(int numIter)
{
@ -1063,12 +1021,6 @@ SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::newBoundary()
return aBoundary._retn();
}
//=============================================================================
//=============================================================================
// Creation des structures identifiees par leurs noms
//=============================================================================
//=============================================================================
//=============================================================================
// Creation of a case
// MeshName : name of the mesh
@ -1084,7 +1036,7 @@ SMESHHOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseOnMesh (const char* MeshName
// A. Controles
// A.1. Controle du nom :
if (!myCase->_is_nil()) {
CleanCase();
DeleteCase();
}
// A.2. Controle du objet maillage
@ -1196,7 +1148,7 @@ SMESHHOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCase(const char* MeshName,
// A. Controles
// A.1. Controle du nom :
if (!myCase->_is_nil()) {
CleanCase();
DeleteCase();
}
// A.3. Controle du fichier du maillage
@ -1525,7 +1477,7 @@ CORBA::Long HOMARD_Gen_i::Compute()
int codret = 0;
// A.0. Create Iteration 1
myIteration1 = CreateIteration();
CreateIteration();
myIteration1->SetInfoCompute(_VerboseLevel);
myIteration1->SetMeshName(_MeshNameOUT.c_str());
myIteration1->SetMeshFile(_MeshFileOUT.c_str());
@ -1647,7 +1599,7 @@ CORBA::Long HOMARD_Gen_i::Compute()
std::stringstream saux0;
Commentaire = "Mesh";
Commentaire += " " + siterp1;
if (_PublishMeshOUT) PublishResultInSmesh(MeshFile, 1);
if (_PublishMeshOUT) PublishResultInSmesh(MeshFile);
}
// H.3 Message d'erreur
if (codretexec != 0) {
@ -1705,25 +1657,26 @@ CORBA::Long HOMARD_Gen_i::Compute()
}
// Clean all data
CleanCase();
DeleteCase();
}
return codretexec;
}
void HOMARD_Gen_i::CleanCase()
void HOMARD_Gen_i::DeleteCase()
{
MESSAGE ("CleanCase");
MESSAGE ("DeleteCase");
if (myCase->_is_nil()) return;
// Delete all boundaries
_mesBoundarys.clear();
// Delete iteration
// Delete iterations
DeleteIteration(1);
DeleteIteration(0);
// Delete case
DeleteCase();
myCase = SMESHHOMARD::HOMARD_Cas::_nil();
// Delete tmp mesh file
if (!_CaseOnMedFile && !_TmpMeshFile.empty()) {
@ -2350,16 +2303,14 @@ int HOMARD_Gen_i::DriverTexteBoundary(SMESHHOMARDImpl::HomardDriver* myDriver)
//===========================================================================
//===========================================================================
// Publications
// Option = 0 : fichier issu d'une importation
// Option = 1 : fichier issu d'une execution HOMARD
// Publication
//===========================================================================
void HOMARD_Gen_i::PublishResultInSmesh(const char* NomFich, CORBA::Long Option)
void HOMARD_Gen_i::PublishResultInSmesh(const char* NomFich)
{
// Prevent dump of CreateMeshesFromMED
SMESH::TPythonDump pDump; // do not delete this line of code
MESSAGE("PublishResultInSmesh " << NomFich << ", avec Option = " << Option);
MESSAGE("PublishResultInSmesh " << NomFich);
if (CORBA::is_nil(SMESH_Gen_i::GetSMESHGen()->getStudyServant())) {
SALOME::ExceptionStruct es;
es.type = SALOME::BAD_PARAM;
@ -2388,6 +2339,8 @@ void HOMARD_Gen_i::PublishResultInSmesh(const char* NomFich, CORBA::Long Option)
if (strcmp((const char*)value, NomFich) == 0) {
MESSAGE ("PublishResultInSmesh : le fichier " << NomFich << " est deja publie.");
// Pour un fichier importe, on ne republie pas
// Option = 0 : fichier issu d'une importation
// Option = 1 : fichier issu d'une execution HOMARD
if (Option == 0) { return; }
// Pour un fichier calcule, on commence par faire la depublication
else {
@ -2439,10 +2392,7 @@ void HOMARD_Gen_i::PublishResultInSmesh(const char* NomFich, CORBA::Long Option)
SALOMEDS::GenericAttribute_var aPixMap =
aStudyBuilder->FindOrCreateAttribute(aSO, "AttributePixMap");
SALOMEDS::AttributePixMap_var anAttr2 = SALOMEDS::AttributePixMap::_narrow(aPixMap);
const char* icone;
if (Option == 0) { icone = "mesh_tree_importedmesh.png"; }
else { icone = "mesh_tree_mesh.png"; }
anAttr2->SetPixMap(icone);
anAttr2->SetPixMap("mesh_tree_mesh.png");
}
}

View File

@ -90,11 +90,6 @@ public:
void SetGroups(const SMESHHOMARD::ListGroupType& ListGroup);
SMESHHOMARD::ListGroupType* GetGroups();
// Liens avec les autres structures
void SetCaseCreation(const char* NomCaseCreation);
char* GetCaseCreation();
private:
SMESHHOMARDImpl::HOMARD_Boundary* myHomardBoundary;
SMESHHOMARD::HOMARD_Gen_var _gen_i;
@ -109,7 +104,6 @@ public:
virtual ~HOMARD_Cas_i();
char* GetName();
char* GetDumpPython();
// Caracteristiques
@ -243,7 +237,7 @@ public:
void InvalideBoundary(const char* nomBoundary);
CORBA::Long DeleteBoundary(const char* nomBoundary);
CORBA::Long DeleteCase();
void DeleteCase();
CORBA::Long DeleteIteration(int numIter);
void AddBoundaryGroup(const char* Boundary, const char* Group);
@ -259,7 +253,7 @@ public:
char* ComputeDirPaManagement();
int DriverTexteBoundary(SMESHHOMARDImpl::HomardDriver* myDriver);
void PublishResultInSmesh(const char* NomFich, CORBA::Long Option);
void PublishResultInSmesh(const char* NomFich);
void DeleteResultInSmesh(std::string NomFich, std::string MeshName);
void PythonDump();
@ -278,10 +272,9 @@ public:
void SetRemoveLogOnSuccess(bool theRemoveLogOnSuccess);
private:
SMESHHOMARD::HOMARD_Boundary_ptr newBoundary();
SMESHHOMARD::HOMARD_Cas_ptr newCase();
HOMARD_Iteration_i* newIteration();
void CleanCase();
SMESHHOMARD::HOMARD_Boundary_ptr newBoundary();
SMESHHOMARD::HOMARD_Cas_ptr newCase();
HOMARD_Iteration_i* newIteration();
private:
SMESHHOMARDImpl::HOMARD_Gen* myHomard;