//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// Remarques :
+// L'ordre de description des fonctions est le meme dans tous les fichiers
+// HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
+// 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
+// 2. Les caracteristiques
+// 3. Le lien avec les autres structures
+//
+// Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
+//
#include "HOMARD_Cas_i.hxx"
#include "HOMARD_Gen_i.hxx"
HOMARD_Cas_i::~HOMARD_Cas_i()
{
}
-
//=============================================================================
-/*!
- */
//=============================================================================
-void HOMARD_Cas_i::SetDirName( const char* NomDir )
-{
- ASSERT( myHomardCas );
- myHomardCas->SetDirName( NomDir );
-}
-
+// Generalites
//=============================================================================
-/*!
- */
//=============================================================================
void HOMARD_Cas_i::SetName( const char* Name )
{
ASSERT( myHomardCas );
myHomardCas->SetName( Name );
}
-
-//=============================================================================
-/*!
- */
//=============================================================================
char* HOMARD_Cas_i::GetName()
{
ASSERT( myHomardCas );
return CORBA::string_dup( myHomardCas->GetName().c_str() );
}
-
//=============================================================================
-/*!
- */
+CORBA::Long HOMARD_Cas_i::Delete()
+{
+ ASSERT( myHomardCas );
+ char* CaseName = GetName() ;
+ MESSAGE ( "Delete : destruction du cas " << CaseName );
+ return _gen_i->DeleteCase(CaseName) ;
+}
//=============================================================================
char* HOMARD_Cas_i::GetDumpPython()
{
ASSERT( myHomardCas );
return CORBA::string_dup( myHomardCas->GetDumpPython().c_str() );
}
-
//=============================================================================
-char* HOMARD_Cas_i::GetDirName()
+std::string HOMARD_Cas_i::Dump() const
{
- ASSERT( myHomardCas );
- return CORBA::string_dup( myHomardCas->GetDirName().c_str() );
+ return HOMARD::Dump( *myHomardCas );
}
-
//=============================================================================
-void HOMARD_Cas_i::SetConfType( CORBA::Long ConfType )
+bool HOMARD_Cas_i::Restore( const std::string& stream )
{
- ASSERT( myHomardCas );
- myHomardCas->SetConfType( ConfType );
+ return HOMARD::Restore( *myHomardCas, stream );
}
//=============================================================================
-CORBA::Long HOMARD_Cas_i::GetNumber()
+//=============================================================================
+// Caracteristiques
+//=============================================================================
+//=============================================================================
+void HOMARD_Cas_i::SetDirName( const char* NomDir )
{
ASSERT( myHomardCas );
- return myHomardCas->GetNumber();
+ myHomardCas->SetDirName( NomDir );
}
-
//=============================================================================
-CORBA::Long HOMARD_Cas_i::GetConfType()
+char* HOMARD_Cas_i::GetDirName()
{
ASSERT( myHomardCas );
- return myHomardCas->GetConfType();
+ return CORBA::string_dup( myHomardCas->GetDirName().c_str() );
}
-
//=============================================================================
-char* HOMARD_Cas_i::GetIter0Name()
+CORBA::Long HOMARD_Cas_i::GetNumber()
{
ASSERT( myHomardCas );
- return CORBA::string_dup( myHomardCas->GetIter0Name().c_str() );
+ return myHomardCas->GetNumber();
}
//=============================================================================
-HOMARD::HOMARD_Iteration_ptr HOMARD_Cas_i::GetIter0()
+void HOMARD_Cas_i::SetConfType( CORBA::Long ConfType )
{
-// Nom de l'iteration parent
- char* Iter0Name = GetIter0Name() ;
- MESSAGE ( "GetIter0 : Iter0Name = " << Iter0Name );
-// On passe par la methode sur l'objet HOMARD
-// Il serait plus elegant de tout faire ici, mais il est complexe de passer tout le contexte
- return _gen_i->GetIteration(Iter0Name) ;
+ ASSERT( myHomardCas );
+ myHomardCas->SetConfType( ConfType );
}
-
//=============================================================================
-HOMARD::HOMARD_Iteration_ptr HOMARD_Cas_i::NextIteration( const char* IterName )
+CORBA::Long HOMARD_Cas_i::GetConfType()
{
-// Nom de l'iteration parent
- char* NomIterParent = GetIter0Name() ;
- MESSAGE ( "NextIteration : IterName = " << IterName );
- MESSAGE ( "NextIteration : NomIterParent = " << NomIterParent );
-// On passe par la methode sur l'objet HOMARD
-// Il serait plus elegant de tout faire ici, mais il est complexe de passer tout le contexte
- return _gen_i->CreateIteration(IterName, NomIterParent) ;
+ ASSERT( myHomardCas );
+ return myHomardCas->GetConfType();
}
-
//=============================================================================
-void HOMARD_Cas_i::AddIteration( const char* NomIteration )
+void HOMARD_Cas_i::SetBoundingBox( const HOMARD::extrema& LesExtrema )
{
ASSERT( myHomardCas );
- myHomardCas->AddIteration( NomIteration );
+ std::vector<double> VExtrema;
+ ASSERT( LesExtrema.length() == 10 );
+ VExtrema.resize( LesExtrema.length() );
+ for ( int i = 0; i < LesExtrema.length(); i++ )
+ {
+ VExtrema[i] = LesExtrema[i];
+ }
+
+ myHomardCas->SetBoundingBox( VExtrema );
}
//=============================================================================
HOMARD::extrema* HOMARD_Cas_i::GetBoundingBox()
return aResult._retn();
}
//=============================================================================
-void HOMARD_Cas_i::SetBoundingBox( const HOMARD::extrema& LesExtrema )
-{
- ASSERT( myHomardCas );
- std::vector<double> VExtrema;
- ASSERT( LesExtrema.length() == 10 );
- VExtrema.resize( LesExtrema.length() );
- for ( int i = 0; i < LesExtrema.length(); i++ )
- {
- VExtrema[i] = LesExtrema[i];
- }
-
- myHomardCas->SetBoundingBox( VExtrema );
-}
-//=============================================================================
void HOMARD_Cas_i::AddGroup( const char* Group)
{
ASSERT( myHomardCas );
}
return aResult._retn();
}
-
//=============================================================================
-void HOMARD_Cas_i::AddBoundaryGroup( const char* Boundary, const char* Group)
+void HOMARD_Cas_i::AddBoundaryGroup( const char* BoundaryName, const char* Group)
{
- MESSAGE ("AddBoundaryGroup");
+ MESSAGE ("AddBoundaryGroup : BoundaryName = "<< BoundaryName << ", Group = " << Group );
ASSERT( myHomardCas );
- myHomardCas->AddBoundaryGroup( Boundary, Group );
+ // La frontiere est-elle deja enregistree pour ce cas ?
+ const std::list<std::string>& ListBoundaryGroup = myHomardCas->GetBoundaryGroup();
+ std::list<std::string>::const_iterator it;
+ int existe = 0;
+ for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ )
+ {
+ if ( *it == BoundaryName )
+ { existe = 1 ; }
+ it++ ;
+ }
+ // Enregistrement de la frontiere dans la reference du cas
+ myHomardCas->AddBoundaryGroup( BoundaryName, Group );
+ // Pour une nouvelle frontiere, publication dans l'arbre d'etudes sous le cas
+ if ( existe == 0 )
+ {
+ char* CaseName = GetName() ;
+ MESSAGE ( "AddBoundaryGroup : insertion de la frontiere dans l'arbre de " << CaseName );
+ _gen_i->PublishBoundaryUnderCase(CaseName, BoundaryName) ;
+ }
}
//=============================================================================
HOMARD::ListBoundaryGroupType* HOMARD_Cas_i::GetBoundaryGroup()
{
MESSAGE ("GetBoundaryGroup");
ASSERT(myHomardCas );
- const std::list<std::string>& ListString = myHomardCas->GetBoundaryGroup();
+ const std::list<std::string>& ListBoundaryGroup = myHomardCas->GetBoundaryGroup();
HOMARD::ListBoundaryGroupType_var aResult = new HOMARD::ListBoundaryGroupType();
- aResult->length( ListString.size() );
+ aResult->length( ListBoundaryGroup.size() );
std::list<std::string>::const_iterator it;
int i = 0;
- for ( it = ListString.begin(); it != ListString.end(); it++ )
+ for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ )
{
aResult[i++] = CORBA::string_dup( (*it).c_str() );
}
return aResult._retn();
}
-
//=============================================================================
void HOMARD_Cas_i::SetPyram( CORBA::Long Pyram )
{
return myHomardCas->GetPyram();
}
//=============================================================================
-std::string HOMARD_Cas_i::Dump() const
+//=============================================================================
+// Liens avec les autres structures
+//=============================================================================
+//=============================================================================
+char* HOMARD_Cas_i::GetIter0Name()
{
- return HOMARD::Dump( *myHomardCas );
+ ASSERT( myHomardCas );
+ return CORBA::string_dup( myHomardCas->GetIter0Name().c_str() );
}
-
//=============================================================================
-bool HOMARD_Cas_i::Restore( const std::string& stream )
+HOMARD::HOMARD_Iteration_ptr HOMARD_Cas_i::GetIter0()
{
- return HOMARD::Restore( *myHomardCas, stream );
+// Nom de l'iteration parent
+ char* Iter0Name = GetIter0Name() ;
+ MESSAGE ( "GetIter0 : Iter0Name = " << Iter0Name );
+ return _gen_i->GetIteration(Iter0Name) ;
+}
+//=============================================================================
+HOMARD::HOMARD_Iteration_ptr HOMARD_Cas_i::NextIteration( const char* IterName )
+{
+// Nom de l'iteration parent
+ char* NomIterParent = GetIter0Name() ;
+ MESSAGE ( "NextIteration : IterName = " << IterName );
+ MESSAGE ( "NextIteration : NomIterParent = " << NomIterParent );
+ return _gen_i->CreateIteration(IterName, NomIterParent) ;
+}
+//=============================================================================
+HOMARD::HOMARD_Iteration_ptr HOMARD_Cas_i::LastIteration( )
+{
+ HOMARD::HOMARD_Iteration_ptr Iter ;
+ HOMARD::listeIterFilles_var ListeIterFilles ;
+ char* IterName ;
+// Iteration initiale du cas
+ IterName = GetIter0Name() ;
+// On va explorer la descendance de cette iteration initiale
+// jusqu'a trouver celle qui n'a pas de filles
+ int nbiterfilles = 1 ;
+ while ( nbiterfilles == 1 )
+ {
+// L'iteration associee
+// MESSAGE ( ".. IterName = " << IterName );
+ Iter = _gen_i->GetIteration(IterName) ;
+// Les filles de cette iteration
+ ListeIterFilles = Iter->GetIterations() ;
+ nbiterfilles = ListeIterFilles->length() ;
+// MESSAGE ( ".. nbiterfilles = " << nbiterfilles );
+// S'il y a au moins 2 filles, arret : on ne sait pas faire
+ ASSERT( nbiterfilles <= 1 ) ;
+// S'il y a une fille unique, on recupere le nom de la fille et on recommence
+ if ( nbiterfilles == 1 )
+ { IterName = ListeIterFilles[0] ; }
+ }
+//
+ return Iter ;
+}
+//=============================================================================
+void HOMARD_Cas_i::AddIteration( const char* NomIteration )
+{
+ ASSERT( myHomardCas );
+ myHomardCas->AddIteration( NomIteration );
}