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)),_refCounter(1)
21 BEGIN_OF("SUPPORTClient::SUPPORTClient(SALOME_MED::SUPPORT_ptr m)");
29 _mesh=new MESHClient(IOR_Support->getMesh());
33 END_OF("SUPPORTClient::SUPPORTClient(SALOME_MED::SUPPORT_ptr m)");
35 //=============================================================================
37 * Remplit les informations générales
39 //=============================================================================
40 void SUPPORTClient::blankCopy()
42 BEGIN_OF("SUPPORTClient::blankCopy");
46 SALOME_MED::SUPPORT::supportInfos_var all = IOR_Support->getSupportGlobal();
49 _description = all->description;
50 setAll(all->isOnAllElements);
51 setEntity(all->entity);
53 setNumberOfGeometricType(all->numberOfGeometricType);
54 convertCorbaArray(_geometricType, _numberOfGeometricType,
57 //_name = IOR_Support->getName();
58 //_description = IOR_Support->getDescription();
59 //setAll(IOR_Support->isOnAllElements());
60 //setEntity(IOR_Support->getEntity());
64 //convertCorbaArray(_geometricType, _numberOfGeometricType,
65 // IOR_Support->getTypes());
67 int *nE = new int[_numberOfGeometricType];
69 for (i=0; i<_numberOfGeometricType; i++)
71 nE[i] = all->nbEltTypes[i];
73 setNumberOfElements(nE);
77 SCRUTE(_totalNumberOfElements);
78 _complete_support = false;
79 //Gauss points settings
80 _numberOfGaussPoint = new int[_numberOfGeometricType];
81 for (int i=0;i<_numberOfGeometricType;i++)
82 _numberOfGaussPoint[i] = 1 ;
84 catch( const CORBA::Exception &ex )
86 MESSAGE("Erreur CORBA dans la communication" ) ;
87 THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
88 SALOME::INTERNAL_ERROR);
91 END_OF("SUPPORTClient::blankCopy");
94 //=============================================================================
98 //=============================================================================
99 void SUPPORTClient::fillCopy()
101 BEGIN_OF("SUPPORTClient::fillCopy");
103 if (!_complete_support) {
105 const int * index, * value;
106 long n_index, n_value;
108 SALOME::SenderInt_var senderForValue=IOR_Support->getSenderForNumber(MED_ALL_ELEMENTS);
109 value=(const int *)ReceiverFactory::getValue(senderForValue,n_value);
110 SALOME::SenderInt_var senderForIndex=IOR_Support->getSenderForNumberIndex();
111 index=(const int *)ReceiverFactory::getValue(senderForIndex,n_index);
115 setNumber(index, value,true);
117 _complete_support = true;
120 END_OF("SUPPORTClient::fillCopy");
122 //=============================================================================
126 //=============================================================================
127 SUPPORTClient::~SUPPORTClient()
129 BEGIN_OF("SUPPORTClient::~SUPPORTClient");
130 IOR_Support->release();
132 _mesh->removeReference();
133 END_OF("SUPPORTClient::~SUPPORTClient");
136 //=============================================================================
140 //=============================================================================
141 MEDSKYLINEARRAY * SUPPORTClient::getnumber() const throw (MEDEXCEPTION)
143 BEGIN_OF("SUPPORTClient::getnumber()");
145 if (!_complete_support) (const_cast<SUPPORTClient *>(this))->fillCopy();
146 MEDSKYLINEARRAY *m = SUPPORT::getnumber();
148 END_OF("SUPPORTClient::getnumber()");
152 //=============================================================================
156 //=============================================================================
157 const int * SUPPORTClient::getNumber(medGeometryElement GeometricType)
158 const throw (MEDEXCEPTION)
160 BEGIN_OF("SUPPORTClient::getnumber(medGeometryElement)");
162 if (!_complete_support) (const_cast<SUPPORTClient *>(this))->fillCopy();
163 const int *n = SUPPORT::getNumber(GeometricType);
165 END_OF("SUPPORTClient::getnumber(medGeometryElement)");
169 //=============================================================================
173 //=============================================================================
174 const int * SUPPORTClient::getNumberIndex() const throw (MEDEXCEPTION)
176 BEGIN_OF("SUPPORTClient::getnumberIndex()");
178 if (!_complete_support) (const_cast<SUPPORTClient *>(this))->fillCopy();
179 const int * n = SUPPORT::getNumberIndex();
181 END_OF("SUPPORTClient::getnumberIndex()");
185 //=============================================================================
189 //=============================================================================
190 void SUPPORTClient::addReference() const
195 //=============================================================================
199 //=============================================================================
200 void SUPPORTClient::removeReference() const
202 if (--_refCounter <= 0)