1 #include "Utils_CorbaException.hxx"
2 #include "UtilClient.hxx"
3 #include "SUPPORTClient.hxx"
4 #include "MESHClient.hxx"
5 #include "ReceiverFactory.hxx"
7 using namespace MEDMEM;
8 using namespace MED_EN;
10 //=============================================================================
14 //=============================================================================
16 SUPPORTClient::SUPPORTClient(const SALOME_MED::SUPPORT_ptr S,
19 IOR_Support(SALOME_MED::SUPPORT::_duplicate(S)),
22 BEGIN_OF("SUPPORTClient::SUPPORTClient(SALOME_MED::SUPPORT_ptr m)");
30 _mesh=new MESHClient(IOR_Support->getMesh());
35 END_OF("SUPPORTClient::SUPPORTClient(SALOME_MED::SUPPORT_ptr m)");
37 //=============================================================================
39 * Remplit les informations générales
41 //=============================================================================
42 void SUPPORTClient::blankCopy()
44 BEGIN_OF("SUPPORTClient::blankCopy");
48 SALOME_MED::SUPPORT::supportInfos_var all = IOR_Support->getSupportGlobal();
51 _description = all->description;
52 setAll(all->isOnAllElements);
53 setEntity(all->entity);
55 setNumberOfGeometricType(all->numberOfGeometricType);
56 convertCorbaArray(_geometricType, _numberOfGeometricType,
59 //_name = IOR_Support->getName();
60 //_description = IOR_Support->getDescription();
61 //setAll(IOR_Support->isOnAllElements());
62 //setEntity(IOR_Support->getEntity());
66 //convertCorbaArray(_geometricType, _numberOfGeometricType,
67 // IOR_Support->getTypes());
69 int *nE = new int[_numberOfGeometricType];
71 for (i=0; i<_numberOfGeometricType; i++)
73 nE[i] = all->nbEltTypes[i];
75 setNumberOfElements(nE);
79 SCRUTE(_totalNumberOfElements);
80 _complete_support = false;
82 catch( const CORBA::Exception &ex )
84 MESSAGE("Erreur CORBA dans la communication" ) ;
85 THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
86 SALOME::INTERNAL_ERROR);
89 END_OF("SUPPORTClient::blankCopy");
92 //=============================================================================
96 //=============================================================================
97 void SUPPORTClient::fillCopy()
99 BEGIN_OF("SUPPORTClient::fillCopy");
101 if (!_complete_support) {
103 const int * index, * value;
104 long n_index, n_value;
106 value=(const int *)ReceiverFactory::getValue(IOR_Support->getSenderForNumber(MED_ALL_ELEMENTS),n_value);
107 index=(const int *)ReceiverFactory::getValue(IOR_Support->getSenderForNumberIndex(),n_index);
111 setNumber(index, value,true);
113 _complete_support = true;
116 END_OF("SUPPORTClient::fillCopy");
118 //=============================================================================
122 //=============================================================================
123 SUPPORTClient::~SUPPORTClient()
125 BEGIN_OF("SUPPORTClient::~SUPPORTClient");
126 IOR_Support->release();
129 END_OF("SUPPORTClient::~SUPPORTClient");
132 //=============================================================================
136 //=============================================================================
137 MEDSKYLINEARRAY * SUPPORTClient::getnumber() const throw (MEDEXCEPTION)
139 BEGIN_OF("SUPPORTClient::getnumber()");
141 if (!_complete_support) (const_cast<SUPPORTClient *>(this))->fillCopy();
142 MEDSKYLINEARRAY *m = SUPPORT::getnumber();
144 END_OF("SUPPORTClient::getnumber()");
148 //=============================================================================
152 //=============================================================================
153 const int * SUPPORTClient::getNumber(medGeometryElement GeometricType)
154 const throw (MEDEXCEPTION)
156 BEGIN_OF("SUPPORTClient::getnumber(medGeometryElement)");
158 if (!_complete_support) (const_cast<SUPPORTClient *>(this))->fillCopy();
159 const int *n = SUPPORT::getNumber(GeometricType);
161 END_OF("SUPPORTClient::getnumber(medGeometryElement)");
165 //=============================================================================
169 //=============================================================================
170 const int * SUPPORTClient::getNumberIndex() const throw (MEDEXCEPTION)
172 BEGIN_OF("SUPPORTClient::getnumberIndex()");
174 if (!_complete_support) (const_cast<SUPPORTClient *>(this))->fillCopy();
175 const int * n = SUPPORT::getNumberIndex();
177 END_OF("SUPPORTClient::getnumberIndex()");