X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHOMARD_I%2FHOMARD_Hypothesis_i.cxx;h=3d5fd3abb4c61699a37a75c57595a3a3d3e6b8a8;hb=901dc2b7e146a3be930b3abfcd998cd8c49bb314;hp=adec5d80221160e550c5f429322c4d2ffbde7851;hpb=376361b76f3823b13f8f8d39f23326fc3bad2ff7;p=modules%2Fhomard.git diff --git a/src/HOMARD_I/HOMARD_Hypothesis_i.cxx b/src/HOMARD_I/HOMARD_Hypothesis_i.cxx index adec5d80..3d5fd3ab 100644 --- a/src/HOMARD_I/HOMARD_Hypothesis_i.cxx +++ b/src/HOMARD_I/HOMARD_Hypothesis_i.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2011-2012 CEA/DEN, EDF R&D +// Copyright (C) 2011-2019 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,6 +17,16 @@ // 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_Hypothesis_i.hxx" #include "HOMARD_Gen_i.hxx" #include "HOMARD_Hypothesis.hxx" @@ -58,17 +68,16 @@ HOMARD_Hypothesis_i::HOMARD_Hypothesis_i( CORBA::ORB_ptr orb, HOMARD_Hypothesis_i::~HOMARD_Hypothesis_i() { } - //============================================================================= -/*! - */ +//============================================================================= +// Generalites +//============================================================================= //============================================================================= void HOMARD_Hypothesis_i::SetName( const char* Name ) { ASSERT( myHomardHypothesis ); myHomardHypothesis->SetName( Name ); } - //============================================================================= char* HOMARD_Hypothesis_i::GetName() { @@ -76,39 +85,52 @@ char* HOMARD_Hypothesis_i::GetName() return CORBA::string_dup( myHomardHypothesis->GetName().c_str() ); } //============================================================================= -/*! - */ -//============================================================================= -void HOMARD_Hypothesis_i::SetCaseCreation( const char* NomCaseCreation ) +CORBA::Long HOMARD_Hypothesis_i::Delete() { ASSERT( myHomardHypothesis ); - myHomardHypothesis->SetCaseCreation( NomCaseCreation ); + char* HypoName = GetName() ; + MESSAGE ( "Delete : destruction de l'hypothese " << HypoName ); + return _gen_i->DeleteHypo(HypoName) ; } - //============================================================================= -char* HOMARD_Hypothesis_i::GetCaseCreation() +char* HOMARD_Hypothesis_i::GetDumpPython() { ASSERT( myHomardHypothesis ); - return CORBA::string_dup( myHomardHypothesis->GetCaseCreation().c_str() ); + return CORBA::string_dup( myHomardHypothesis->GetDumpPython().c_str() ); } //============================================================================= -char* HOMARD_Hypothesis_i::GetDumpPython() +std::string HOMARD_Hypothesis_i::Dump() const { - ASSERT( myHomardHypothesis ); - return CORBA::string_dup( myHomardHypothesis->GetDumpPython().c_str() ); + return HOMARD::Dump( *myHomardHypothesis ); } - //============================================================================= -/*! - */ +bool HOMARD_Hypothesis_i::Restore( const std::string& stream ) +{ + return HOMARD::Restore( *myHomardHypothesis, stream ); +} +//============================================================================= +//============================================================================= +// Caracteristiques +//============================================================================= //============================================================================= -void HOMARD_Hypothesis_i::SetAdapRefinUnRef( CORBA::Long TypeAdap,CORBA::Long TypeRaff, CORBA::Long TypeDera ) +void HOMARD_Hypothesis_i::SetUnifRefinUnRef( CORBA::Long TypeRaffDera ) { ASSERT( myHomardHypothesis ); - myHomardHypothesis->SetAdapType( TypeAdap ); + VERIFICATION( (TypeRaffDera==1) || (TypeRaffDera==-1) ); + int TypeRaff, TypeDera ; + if ( TypeRaffDera == 1 ) + { + TypeRaff = 1 ; + TypeDera = 0 ; + } + else if ( TypeRaffDera == -1 ) + { + TypeRaff = 0 ; + TypeDera = 1 ; + } + myHomardHypothesis->SetAdapType( -1 ); myHomardHypothesis->SetRefinTypeDera( TypeRaff, TypeDera ); } - //============================================================================= HOMARD::listeTypes* HOMARD_Hypothesis_i::GetAdapRefinUnRef() { @@ -138,40 +160,26 @@ CORBA::Long HOMARD_Hypothesis_i::GetUnRefType() ASSERT( myHomardHypothesis ); return CORBA::Long( myHomardHypothesis->GetUnRefType() ); } - -//============================================================================= -/*! - */ //============================================================================= void HOMARD_Hypothesis_i::SetField( const char* FieldName ) { myHomardHypothesis->SetField( FieldName ); } //============================================================================= -void HOMARD_Hypothesis_i::SetRefinThr( CORBA::Long TypeThR, CORBA::Double ThreshR ) -{ - myHomardHypothesis->SetRefinThr( TypeThR, ThreshR ); -} -//============================================================================= -void HOMARD_Hypothesis_i::SetUnRefThr( CORBA::Long TypeThC, CORBA::Double ThreshC ) -{ - myHomardHypothesis->SetUnRefThr( TypeThC, ThreshC ); -} -//============================================================================= -void HOMARD_Hypothesis_i::SetUseComp( CORBA::Long UsCmpI ) +char* HOMARD_Hypothesis_i::GetFieldName() { - myHomardHypothesis->SetUseComp( UsCmpI ); + ASSERT( myHomardHypothesis ); + return CORBA::string_dup( myHomardHypothesis->GetFieldName().c_str() ); } //============================================================================= void HOMARD_Hypothesis_i::SetUseField( CORBA::Long UsField ) { myHomardHypothesis->SetUseField( UsField ); } - //============================================================================= HOMARD::InfosHypo* HOMARD_Hypothesis_i::GetField() { - ASSERT(myHomardHypothesis); + ASSERT( myHomardHypothesis ); HOMARD::InfosHypo* aInfosHypo = new HOMARD::InfosHypo(); aInfosHypo->FieldName = CORBA::string_dup( myHomardHypothesis->GetFieldName().c_str() ); aInfosHypo->TypeThR = CORBA::Long( myHomardHypothesis->GetRefinThrType() ); @@ -179,14 +187,57 @@ HOMARD::InfosHypo* HOMARD_Hypothesis_i::GetField() aInfosHypo->TypeThC = CORBA::Long( myHomardHypothesis->GetUnRefThrType() ); aInfosHypo->ThreshC = CORBA::Double( myHomardHypothesis->GetThreshC() ); aInfosHypo->UsField = CORBA::Long( myHomardHypothesis->GetUseField() ); - aInfosHypo->UsCmpI = CORBA::Long( myHomardHypothesis->GetUseCompI() ); + aInfosHypo->UsCmpI = CORBA::Long( myHomardHypothesis->GetUseComp() ); return aInfosHypo; } //============================================================================= -char* HOMARD_Hypothesis_i::GetFieldName() +void HOMARD_Hypothesis_i::SetUseComp( CORBA::Long UsCmpI ) +{ + myHomardHypothesis->SetUseComp( UsCmpI ); +} +//============================================================================= +void HOMARD_Hypothesis_i::AddComp( const char* NomComp ) { ASSERT( myHomardHypothesis ); - return CORBA::string_dup( myHomardHypothesis->GetFieldName().c_str() ); + myHomardHypothesis->AddComp( NomComp ); +} +//============================================================================= +void HOMARD_Hypothesis_i::SupprComp( const char* NomComp ) +{ + ASSERT( myHomardHypothesis ); + myHomardHypothesis->SupprComp(NomComp); +} +//============================================================================= +void HOMARD_Hypothesis_i::SupprComps() +{ + ASSERT( myHomardHypothesis ); + myHomardHypothesis->SupprComps(); +} +//============================================================================= +HOMARD::listeComposantsHypo* HOMARD_Hypothesis_i::GetComps() +{ + ASSERT( myHomardHypothesis ); + const std::list& ListString = myHomardHypothesis->GetComps(); + HOMARD::listeComposantsHypo_var aResult = new HOMARD::listeComposantsHypo; + aResult->length( ListString.size() ); + std::list::const_iterator it; + int i = 0; + for ( it = ListString.begin(); it != ListString.end(); it++ ) + { + aResult[i++] = CORBA::string_dup( (*it).c_str() ); + } + return aResult._retn(); +} +//============================================================================= +void HOMARD_Hypothesis_i::SetRefinThr( CORBA::Long TypeThR, CORBA::Double ThreshR ) +{ + myHomardHypothesis->SetAdapType( 1 ); + if ( TypeThR > 0 ) + { + int TypeDera = myHomardHypothesis->GetUnRefType() ; + myHomardHypothesis->SetRefinTypeDera( 1, TypeDera ); + } + myHomardHypothesis->SetRefinThr( TypeThR, ThreshR ); } //============================================================================= CORBA::Long HOMARD_Hypothesis_i::GetRefinThrType() @@ -195,93 +246,69 @@ CORBA::Long HOMARD_Hypothesis_i::GetRefinThrType() return CORBA::Long( myHomardHypothesis->GetRefinThrType() ); } //============================================================================= +void HOMARD_Hypothesis_i::SetUnRefThr( CORBA::Long TypeThC, CORBA::Double ThreshC ) +{ + myHomardHypothesis->SetAdapType( 1 ); + if ( TypeThC > 0 ) + { + int TypeRaff = myHomardHypothesis->GetRefinType() ; + myHomardHypothesis->SetRefinTypeDera( TypeRaff, 1 ); + } + myHomardHypothesis->SetUnRefThr( TypeThC, ThreshC ); +} +//============================================================================= CORBA::Long HOMARD_Hypothesis_i::GetUnRefThrType() { ASSERT( myHomardHypothesis ); return CORBA::Long( myHomardHypothesis->GetUnRefThrType() ); } - -/*! - */ //============================================================================= -void HOMARD_Hypothesis_i::AddIteration( const char* NomIteration ) +void HOMARD_Hypothesis_i::SetNivMax( CORBA::Long NivMax ) { - ASSERT(myHomardHypothesis); - myHomardHypothesis->AddIteration( NomIteration ); + ASSERT( myHomardHypothesis ); + myHomardHypothesis->SetNivMax( NivMax ); } - //============================================================================= -void HOMARD_Hypothesis_i::AddZone( const char* NomZone, CORBA::Long TypeUse ) +CORBA::Long HOMARD_Hypothesis_i::GetNivMax() { ASSERT( myHomardHypothesis ); - myHomardHypothesis->AddZone( NomZone, TypeUse ); + return myHomardHypothesis->GetNivMax(); } //============================================================================= -void HOMARD_Hypothesis_i::SupprZone (const char * NomZone) +void HOMARD_Hypothesis_i::SetDiamMin( CORBA::Double DiamMin ) { - ASSERT(myHomardHypothesis); - myHomardHypothesis->SupprZone( NomZone); + ASSERT( myHomardHypothesis ); + myHomardHypothesis->SetDiamMin( DiamMin ); } //============================================================================= -HOMARD::listeZonesHypo* HOMARD_Hypothesis_i::GetZones() +CORBA::Double HOMARD_Hypothesis_i::GetDiamMin() { - ASSERT(myHomardHypothesis); - const std::list& ListString = myHomardHypothesis->GetZones(); - HOMARD::listeZonesHypo_var aResult = new HOMARD::listeZonesHypo; - aResult->length( ListString.size() ); - std::list::const_iterator it; - int i = 0; - for ( it = ListString.begin(); it != ListString.end(); it++ ) - { - aResult[i++] = CORBA::string_dup( (*it).c_str() ); - } - return aResult._retn(); + ASSERT( myHomardHypothesis ); + return myHomardHypothesis->GetDiamMin(); } - //============================================================================= -HOMARD::listeIters* HOMARD_Hypothesis_i::GetIterations() +void HOMARD_Hypothesis_i::SetAdapInit( CORBA::Long AdapInit ) { - ASSERT(myHomardHypothesis); - const std::list& ListString = myHomardHypothesis->GetIterations(); - HOMARD::listeIters_var aResult = new HOMARD::listeIters; - aResult->length( ListString.size() ); - std::list::const_iterator it; - int i = 0; - for ( it = ListString.begin(); it != ListString.end(); it++ ) - { - aResult[i++] = CORBA::string_dup( (*it).c_str() ); - } - return aResult._retn(); + ASSERT( myHomardHypothesis ); + myHomardHypothesis->SetAdapInit( AdapInit ); } - //============================================================================= -void HOMARD_Hypothesis_i::AddComp( const char* NomComposant ) +CORBA::Long HOMARD_Hypothesis_i::GetAdapInit() { ASSERT( myHomardHypothesis ); - myHomardHypothesis->AddComp( NomComposant ); + return myHomardHypothesis->GetAdapInit(); } - //============================================================================= -void HOMARD_Hypothesis_i::SupprComp() +void HOMARD_Hypothesis_i::SetExtraOutput( CORBA::Long ExtraOutput ) { ASSERT( myHomardHypothesis ); - myHomardHypothesis->SupprComp(); + myHomardHypothesis->SetExtraOutput( ExtraOutput ); } - //============================================================================= -HOMARD::listeComposantsHypo* HOMARD_Hypothesis_i::GetListComp() +CORBA::Long HOMARD_Hypothesis_i::GetExtraOutput() { ASSERT( myHomardHypothesis ); - const std::list& ListString = myHomardHypothesis->GetListComp(); - HOMARD::listeComposantsHypo_var aResult = new HOMARD::listeComposantsHypo; - aResult->length( ListString.size() ); - std::list::const_iterator it; - int i = 0; - for ( it = ListString.begin(); it != ListString.end(); it++ ) - { - aResult[i++] = CORBA::string_dup( (*it).c_str() ); - } - return aResult._retn(); + return myHomardHypothesis->GetExtraOutput(); } //============================================================================= void HOMARD_Hypothesis_i::AddGroup( const char* Group) @@ -290,13 +317,25 @@ void HOMARD_Hypothesis_i::AddGroup( const char* Group) myHomardHypothesis->AddGroup( Group ); } //============================================================================= +void HOMARD_Hypothesis_i::SupprGroup( const char* Group ) +{ + ASSERT( myHomardHypothesis ); + myHomardHypothesis->SupprGroup(Group); +} +//============================================================================= +void HOMARD_Hypothesis_i::SupprGroups() +{ + ASSERT( myHomardHypothesis ); + myHomardHypothesis->SupprGroups(); +} +//============================================================================= void HOMARD_Hypothesis_i::SetGroups(const HOMARD::ListGroupType& ListGroup) { ASSERT( myHomardHypothesis ); std::list ListString; for ( int i = 0; i < ListGroup.length(); i++ ) { - ListString.push_back(std::string(ListGroup[i])); + ListString.push_back(std::string(ListGroup[i])); } myHomardHypothesis->SetGroups( ListString ); } @@ -316,9 +355,6 @@ HOMARD::ListGroupType* HOMARD_Hypothesis_i::GetGroups() return aResult._retn(); } //============================================================================= -/*! - */ -//============================================================================= void HOMARD_Hypothesis_i::SetTypeFieldInterp( CORBA::Long TypeFieldInterp ) { ASSERT( myHomardHypothesis ); @@ -334,22 +370,32 @@ CORBA::Long HOMARD_Hypothesis_i::GetTypeFieldInterp() void HOMARD_Hypothesis_i::AddFieldInterp( const char* FieldInterp ) { ASSERT( myHomardHypothesis ); - myHomardHypothesis->AddFieldInterp( FieldInterp ); + myHomardHypothesis->AddFieldInterpType( FieldInterp, 0 ); } - //============================================================================= -void HOMARD_Hypothesis_i::SupprFieldInterp() +void HOMARD_Hypothesis_i::AddFieldInterpType( const char* FieldInterp, CORBA::Long TypeInterp ) { ASSERT( myHomardHypothesis ); - myHomardHypothesis->SupprFieldInterp(); + myHomardHypothesis->AddFieldInterpType( FieldInterp, TypeInterp ); +} +//============================================================================= +void HOMARD_Hypothesis_i::SupprFieldInterp( const char* FieldInterp ) +{ + ASSERT( myHomardHypothesis ); + myHomardHypothesis->SupprFieldInterp(FieldInterp); +} +//============================================================================= +void HOMARD_Hypothesis_i::SupprFieldInterps() +{ + ASSERT( myHomardHypothesis ); + myHomardHypothesis->SupprFieldInterps(); } - //============================================================================= -HOMARD::listFieldInterpHypo* HOMARD_Hypothesis_i::GetListFieldInterp() +HOMARD::listeFieldInterpsHypo* HOMARD_Hypothesis_i::GetFieldInterps() { ASSERT( myHomardHypothesis ); - const std::list& ListString = myHomardHypothesis->GetListFieldInterp(); - HOMARD::listFieldInterpHypo_var aResult = new HOMARD::listFieldInterpHypo; + const std::list& ListString = myHomardHypothesis->GetFieldInterps(); + HOMARD::listeFieldInterpsHypo_var aResult = new HOMARD::listeFieldInterpsHypo; aResult->length( ListString.size() ); std::list::const_iterator it; int i = 0; @@ -360,62 +406,101 @@ HOMARD::listFieldInterpHypo* HOMARD_Hypothesis_i::GetListFieldInterp() return aResult._retn(); } //============================================================================= -void HOMARD_Hypothesis_i::SetNivMax( CORBA::Long NivMax ) +//============================================================================= +// Liens avec les autres structures +//============================================================================= +//============================================================================= +void HOMARD_Hypothesis_i::SetCaseCreation( const char* NomCaseCreation ) { ASSERT( myHomardHypothesis ); - myHomardHypothesis->SetNivMax( NivMax ); + myHomardHypothesis->SetCaseCreation( NomCaseCreation ); } //============================================================================= -CORBA::Long HOMARD_Hypothesis_i::GetNivMax() +char* HOMARD_Hypothesis_i::GetCaseCreation() { ASSERT( myHomardHypothesis ); - return myHomardHypothesis->GetNivMax(); + return CORBA::string_dup( myHomardHypothesis->GetCaseCreation().c_str() ); } //============================================================================= -void HOMARD_Hypothesis_i::SetDiamMin( CORBA::Double DiamMin ) +void HOMARD_Hypothesis_i::LinkIteration( const char* NomIteration ) { ASSERT( myHomardHypothesis ); - myHomardHypothesis->SetDiamMin( DiamMin ); + myHomardHypothesis->LinkIteration( NomIteration ); } //============================================================================= -CORBA::Double HOMARD_Hypothesis_i::GetDiamMin() +void HOMARD_Hypothesis_i::UnLinkIteration( const char* NomIteration ) { ASSERT( myHomardHypothesis ); - return myHomardHypothesis->GetDiamMin(); + myHomardHypothesis->UnLinkIteration( NomIteration ); } //============================================================================= -void HOMARD_Hypothesis_i::SetAdapInit( CORBA::Long AdapInit ) +HOMARD::listeIters* HOMARD_Hypothesis_i::GetIterations() { ASSERT( myHomardHypothesis ); - myHomardHypothesis->SetAdapInit( AdapInit ); + const std::list& ListString = myHomardHypothesis->GetIterations(); + HOMARD::listeIters_var aResult = new HOMARD::listeIters; + aResult->length( ListString.size() ); + std::list::const_iterator it; + int i = 0; + for ( it = ListString.begin(); it != ListString.end(); it++ ) + { + aResult[i++] = CORBA::string_dup( (*it).c_str() ); + } + return aResult._retn(); } //============================================================================= -CORBA::Long HOMARD_Hypothesis_i::GetAdapInit() +void HOMARD_Hypothesis_i::AddZone( const char* NomZone, CORBA::Long TypeUse ) { + MESSAGE ("Dans AddZone pour " << NomZone << " et TypeUse = " << TypeUse ) ; ASSERT( myHomardHypothesis ); - return myHomardHypothesis->GetAdapInit(); + VERIFICATION( (TypeUse==1) || (TypeUse==-1) ); + myHomardHypothesis->SetAdapType( 0 ); + int TypeRaff, TypeDera ; + if ( TypeUse == 1 ) + { + TypeRaff = 1 ; + TypeDera = myHomardHypothesis->GetUnRefType() ; + } + else if ( TypeUse == -1 ) + { + TypeRaff = myHomardHypothesis->GetRefinType() ; + TypeDera = 1 ; + } + myHomardHypothesis->SetRefinTypeDera( TypeRaff, TypeDera ); + char* NomHypo = GetName() ; + return _gen_i->AssociateHypoZone(NomHypo, NomZone, TypeUse) ; } //============================================================================= -void HOMARD_Hypothesis_i::SetLevelOutput( CORBA::Long LevelOutput ) +void HOMARD_Hypothesis_i::AddZone0( const char* NomZone, CORBA::Long TypeUse ) { + MESSAGE ("Dans AddZone0 pour " << NomZone) ; ASSERT( myHomardHypothesis ); - myHomardHypothesis->SetLevelOutput( LevelOutput ); + myHomardHypothesis->AddZone( NomZone, TypeUse ); } //============================================================================= -CORBA::Long HOMARD_Hypothesis_i::GetLevelOutput() +void HOMARD_Hypothesis_i::SupprZone(const char * NomZone) { ASSERT( myHomardHypothesis ); - return myHomardHypothesis->GetLevelOutput(); + myHomardHypothesis->SupprZone( NomZone); } - //============================================================================= -std::string HOMARD_Hypothesis_i::Dump() const +void HOMARD_Hypothesis_i::SupprZones() { - return HOMARD::Dump( *myHomardHypothesis ); + ASSERT( myHomardHypothesis ); + myHomardHypothesis->SupprZones(); } - //============================================================================= -bool HOMARD_Hypothesis_i::Restore( const std::string& stream ) +HOMARD::listeZonesHypo* HOMARD_Hypothesis_i::GetZones() { - return HOMARD::Restore( *myHomardHypothesis, stream ); + ASSERT( myHomardHypothesis ); + const std::list& ListString = myHomardHypothesis->GetZones(); + HOMARD::listeZonesHypo_var aResult = new HOMARD::listeZonesHypo; + aResult->length( ListString.size() ); + std::list::const_iterator it; + int i = 0; + for ( it = ListString.begin(); it != ListString.end(); it++ ) + { + aResult[i++] = CORBA::string_dup( (*it).c_str() ); + } + return aResult._retn(); }