-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
extern const char * CPMESSAGE[];
-//#define MYDEBUG
#include <boost/type_traits/remove_all_extents.hpp>
// calcium_uses_port* myCalciumUsesPort=
// dynamic_cast<calcium_uses_port*>(myUsesPort);
-#ifdef MYDEBUG
- std::cerr << "-------- CalciumInterface(ecp_fin) MARK 1 -|"<< *it <<"|----"<<
- // typeid(myUsesPort).name() <<"-------------" <<
- typeid(myCalciumUsesPort).name() <<"-------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ {
+ std::cerr << "-------- CalciumInterface(ecp_fin) MARK 1 -|" << *it << "|----" <<
+ //typeid(myUsesPort).name() <<"-------------" <<
+ typeid(myCalciumUsesPort).name() << "-------------" << std::endl;
+ }
// if ( !myCalciumUsesPort )
// throw Superv_Component_i::BadCast(LOC(OSS()<<"Impossible de convertir le port "
CorbaDataType corbaData;
-#ifdef MYDEBUG
- std::cerr << "-------- CalciumInterface(ecp_lecture) MARK 1 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cerr << "-------- CalciumInterface(ecp_lecture) MARK 1 ------------------" << std::endl;
if (nomVar.empty())
{
throw CalciumException(CalciumTypes::CPNMVR, LOC("Empty variable name"));
}
PortType * port;
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(lecture) MARK 2 --"<<typeid(port).name()<<"----------------" << std::endl;
- T1 t1;
- T2 t2;
- std::cout << "-------- CalciumInterface(lecture) MARK 2b1 -----" << typeid(t1).name() << "-------------" << std::endl;
- std::cout << "-------- CalciumInterface(lecture) MARK 2b2 -----" << typeid(t2).name() << "-------------" << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ {
+ std::cout << "-------- CalciumInterface(lecture) MARK 2 --"<<typeid(port).name()<<"----------------" << std::endl;
+ T1 t1;
+ T2 t2;
+ std::cout << "-------- CalciumInterface(lecture) MARK 2b1 -----" << typeid(t1).name() << "-------------" << std::endl;
+ std::cout << "-------- CalciumInterface(lecture) MARK 2b2 -----" << typeid(t2).name() << "-------------" << std::endl;
+ }
try
{
port = component.Superv_Component_i::get_port< PortType > (nomVar.c_str());
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 3 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 3 ------------------" << std::endl;
}
catch ( const Superv_Component_i::PortNotDefined & ex)
{
Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),"",msg.str().c_str());
corbaData = port->get(tt,tf, 0);
msgout << "read t=" << tt ;
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 5 ------------------" << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 5 ------------------" << std::endl;
}
catch ( const DSC_Exception & ex)
{
Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),"",msg.str().c_str());
corbaData = port->get(0, i);
msgout << "read i=" << i ;
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 6 ------------------" << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 6 ------------------" << std::endl;
}
catch ( const DSC_Exception & ex)
{
// Sequential read
try
{
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 7 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 7 ------------------" << std::endl;
+
Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),"","Sequential read");
corbaData = port->next(ti,i);
msgout << "read ";
}
}
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 8 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 8 ------------------" << std::endl;
+
size_t corbaDataSize = DataManipulator::size(corbaData);
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(ecp_lecture) corbaDataSize : " << corbaDataSize << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumInterface(ecp_lecture) corbaDataSize : " << corbaDataSize << std::endl;
// Vérifie si l'utilisateur demande du 0 copie
if ( data == NULL )
nRead = corbaDataSize;
// Si les types T1 et InnerType sont différents, il faudra effectuer tout de même une recopie
if (!IsSameType<T1,InnerType>::value) data = new T1[nRead];
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 9 ------------------" << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 9 ------------------" << std::endl;
+
// On essaye de faire du 0 copy si les types T1 et InnerType sont les mêmes.
// Copy2UserSpace :
// La raison d'être du foncteur Copy2UserSpace est qu'il n'est pas possible de compiler
// En utilisant le foncteur Copy2UserSpace, seule la spécialisation en adéquation
// avec la compatibilité des types sera compilée
Copy2UserSpace< IsSameType<T1,InnerType>::value, DataManipulator >::apply(data,corbaData,nRead);
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 10 ------------------" << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 10 ------------------" << std::endl;
+
// Attention : Seul CalciumCouplingPolicy via eraseDataId doit décider de supprimer ou non
// la donnée corba associée à un DataId ! Ne pas effectuer la desallocation suivante :
// DataManipulator::delete_data(corbaData);
// de désallouer un buffer intermédiaire ( types différents) ou de rendre la propriété
}
else
- {
- nRead = std::min < size_t > (corbaDataSize,bufferLength);
-#ifdef MYDEBUG
+ {
+ nRead = std::min < size_t > (corbaDataSize,bufferLength);
+
+ if (SALOME::VerbosityActivated())
std::cout << "-------- CalciumInterface(ecp_lecture) MARK 11 ------------------" << std::endl;
-#endif
- Copy2UserSpace<false, DataManipulator >::apply(data,corbaData,nRead);
- //Déjà fait ci-dessus :
- //DataManipulator::copy(corbaData,data,nRead);
-#ifdef MYDEBUG
+
+ Copy2UserSpace<false, DataManipulator >::apply(data,corbaData,nRead);
+ //Déjà fait ci-dessus :
+ //DataManipulator::copy(corbaData,data,nRead);
+
+ if (SALOME::VerbosityActivated())
std::cout << "-------- CalciumInterface(ecp_lecture) MARK 12 ------------------" << std::endl;
-#endif
- }
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(ecp_lecture), Valeur de data : " << std::endl;
- std::copy(data,data+nRead,std::ostream_iterator<T1>(std::cout," "));
- std::cout << "Ptr :" << data << std::endl;
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 13 ------------------" << std::endl;
-#endif
+ }
+
+ if (SALOME::VerbosityActivated())
+ {
+ std::cout << "-------- CalciumInterface(ecp_lecture), Valeur de data : " << std::endl;
+ std::copy(data,data+nRead,std::ostream_iterator<T1>(std::cout," "));
+ std::cout << "Ptr :" << data << std::endl;
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 13 ------------------" << std::endl;
+ }
+
Engines_DSC_interface::writeEvent("END_READ",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPOK],msgout.str().c_str());
return;
}
CalciumTypes::DependencyType _dependencyType=
static_cast<CalciumTypes::DependencyType>(dependencyType);
-#ifdef MYDEBUG
- std::cerr << "-------- CalciumInterface(ecriture) MARK 1 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cerr << "-------- CalciumInterface(ecriture) MARK 1 ------------------" << std::endl;
+
if ( nomVar.empty() )
{
Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,"",CPMESSAGE[CalciumTypes::CPNMVR],"");
throw CalciumException(CalciumTypes::CPNMVR, LOC("Empty variable name"));
}
UsesPortType * port;
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(ecriture) MARK 2 ---"<<typeid(port).name()<<"---------------" << std::endl;
- T1 t1;
- T2 t2;
- std::cout << "-------- CalciumInterface(ecriture) MARK 2b1 -----" << typeid(t1).name() << "-------------" << std::endl;
- std::cout << "-------- CalciumInterface(ecriture) MARK 2b2 -----" << typeid(t2).name() << "-------------" << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ {
+ std::cout << "-------- CalciumInterface(ecriture) MARK 2 ---"<<typeid(port).name()<<"---------------" << std::endl;
+ T1 t1;
+ T2 t2;
+ std::cout << "-------- CalciumInterface(ecriture) MARK 2b1 -----" << typeid(t1).name() << "-------------" << std::endl;
+ std::cout << "-------- CalciumInterface(ecriture) MARK 2b2 -----" << typeid(t2).name() << "-------------" << std::endl;
+ }
try
{
port = component.Superv_Component_i::get_port< UsesPortType > (nomVar.c_str());
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(ecriture) MARK 3 ------------------" << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumInterface(ecriture) MARK 3 ------------------" << std::endl;
}
catch ( const Superv_Component_i::PortNotDefined & ex)
{
}
CorbaDataType corbaData;
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(ecriture) MARK 4 ------------------" << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumInterface(ecriture) MARK 4 ------------------" << std::endl;
// Si les types Utilisateurs et CORBA sont différents
// il faut effectuer une recopie sinon on utilise directement le
// OLD : Il faut effectuer une copie dans le port provides.
// OLD : Cette copie est effectuée dans GenericPortUses::put
// OLD : en fonction de la collocalisation ou non.
-#ifdef MYDEBUG
- T1_without_extent t1b;
- InnerType t2b;
- std::cout << "-------- CalciumInterface(ecriture) MARK 4b1 -----" << typeid(t1b).name() << "-------------" << std::endl;
- std::cout << "-------- CalciumInterface(ecriture) MARK 4b2 -----" << typeid(t2b).name() << "-------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ {
+ T1_without_extent t1b;
+ InnerType t2b;
+ std::cout << "-------- CalciumInterface(ecriture) MARK 4b1 -----" << typeid(t1b).name() << "-------------" << std::endl;
+ std::cout << "-------- CalciumInterface(ecriture) MARK 4b2 -----" << typeid(t2b).name() << "-------------" << std::endl;
+ }
Copy2CorbaSpace<IsSameType<T1_without_extent,InnerType>::value, DataManipulator >::apply(corbaData,_data,bufferLength);
}
//Le -1 peut être traité par le cst DataIdContainer et transformé en 0
//Etre obligé de mettre une étoile ds (*corbadata) va poser des pb pour les types <> seq
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(ecriture) MARK 5 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumInterface(ecriture) MARK 5 ------------------" << std::endl;
}
else if ( _dependencyType == CalciumTypes::ITERATION_DEPENDENCY )
{
Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPATAL],ex.what());
throw (CalciumException(CalciumTypes::CPATAL,ex.what()));
}
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(ecriture) MARK 6 ------------------" << std::endl;
-#endif
+
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumInterface(ecriture) MARK 6 ------------------" << std::endl;
}
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(ecriture), Valeur de corbaData : " << std::endl;
- for (int i = 0; i < corbaData->length(); ++i)
- std::cout << "-------- CalciumInterface(ecriture), corbaData[" << i << "] = " << (*corbaData)[i] << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ {
+ std::cout << "-------- CalciumInterface(ecriture), Valeur de corbaData : " << std::endl;
+ for (int i = 0; i < corbaData->length(); ++i)
+ std::cout << "-------- CalciumInterface(ecriture), corbaData[" << i << "] = " << (*corbaData)[i] << std::endl;
+ }
// if ( !IsSameType<T1,InnerType>::value ) delete corbaData;
// Supprime l'objet CORBA avec eventuellement les données qu'il contient (cas de la recopie)
delete corbaData;
-#ifdef MYDEBUG
- std::cout << "-------- CalciumInterface(ecriture) MARK 7 ------------------" << std::endl;
-#endif
+ if (SALOME::VerbosityActivated())
+ std::cout << "-------- CalciumInterface(ecriture) MARK 7 ------------------" << std::endl;
return;
- };
+ }
template <typename T1> static void
ecp_ecriture ( Superv_Component_i & component,
T1 const & data )
{
ecp_ecriture<T1,T1> (component,dependencyType,t,i,nomVar,bufferLength,data);
- };
+ }
static inline void
ecp_fini(Superv_Component_i & component,const std::string & nomVar,long const & i)
msg << "i<=" << i ;
Engines_DSC_interface::writeEvent("CP_FINI",containerName,componentName,nomVar.c_str(),"",msg.str().c_str());
- };
+ }
static inline void
ecp_fint(Superv_Component_i & component,const std::string & nomVar,double const & t)
msg << "t<=" << t ;
Engines_DSC_interface::writeEvent("CP_FINT",containerName,componentName,nomVar.c_str(),"",msg.str().c_str());
- };
+ }
static inline void
ecp_effi(Superv_Component_i & component,const std::string & nomVar,long const & i)
msg << "i>=" << i ;
Engines_DSC_interface::writeEvent("CP_EFFI",containerName,componentName,nomVar.c_str(),"",msg.str().c_str());
- };
+ }
static inline void
ecp_efft(Superv_Component_i & component,const std::string & nomVar,double const & t)
msg << "t>=" << t ;
Engines_DSC_interface::writeEvent("CP_EFFT",containerName,componentName,nomVar.c_str(),"",msg.str().c_str());
- };
+ }
-};
+}
#endif