Back to index

salome-med  6.5.0
MEDCouplingMeshFieldFactoryComponentClt.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #include "MEDCouplingMeshFieldFactoryComponentClt.hxx"
00021 #include "MEDCouplingMeshFieldFactoryComponent.hxx"
00022 #include "MEDCouplingUMesh.hxx"
00023 #include "MEDCouplingUMeshClient.hxx"
00024 #include "MEDCouplingExtrudedMesh.hxx"
00025 #include "MEDCouplingExtrudedMeshClient.hxx"
00026 #include "MEDCouplingCMesh.hxx"
00027 #include "MEDCouplingCMeshClient.hxx"
00028 #include "MEDCouplingFieldDouble.hxx"
00029 #include "MEDCouplingFieldDoubleClient.hxx"
00030 #include "MEDCouplingFieldTemplate.hxx"
00031 #include "MEDCouplingFieldTemplateClient.hxx"
00032 #include "MEDCouplingMultiFields.hxx"
00033 #include "MEDCouplingMultiFieldsClient.hxx"
00034 #include "MEDCouplingFieldOverTime.hxx"
00035 #include "MEDCouplingFieldOverTimeClient.hxx"
00036 #include "DataArrayDoubleClient.hxx"
00037 #include "DataArrayIntClient.hxx"
00038 #include <fstream>
00039 #include <pthread.h>
00040 
00041 SALOME_TEST::MEDCouplingMeshFieldFactory_ptr SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::_objC;
00042 
00043 ParaMEDMEM::MEDCouplingUMesh *SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::_mesh_from_distant=0;
00044 
00045 int SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::_argc=0;
00046 
00047 char **SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::_argv=0;
00048 
00049 CORBA::ORB_var SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::_orb;
00050 
00051 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkBaseCorbaFetching()
00052 {
00053   _orb=CORBA::ORB_init(_argc,_argv);
00054   std::ifstream ifs(SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildFileNameForIOR().c_str());
00055   std::string ior;
00056   ifs >> ior;
00057   CORBA::Object_var obj=_orb->string_to_object(ior.c_str());
00058   _objC=SALOME_TEST::MEDCouplingMeshFieldFactory::_narrow(obj);
00059   CPPUNIT_ASSERT(!CORBA::is_nil(_objC));
00060 }
00061 
00062 
00063 
00064 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkContentOfFetched1DMesh()
00065 {
00066   SALOME_MED::MEDCouplingUMeshCorbaInterface_ptr meshPtr=_objC->get1DMesh();
00067   _mesh_from_distant=ParaMEDMEM::MEDCouplingUMeshClient::New(meshPtr);
00068   meshPtr->UnRegister();
00069   CORBA::release(meshPtr);
00070   CPPUNIT_ASSERT_EQUAL(3,_mesh_from_distant->getSpaceDimension());
00071   CPPUNIT_ASSERT_EQUAL(1,_mesh_from_distant->getMeshDimension());
00072   ParaMEDMEM::MEDCouplingUMesh *meshRef=SALOME_TEST::MEDCouplingCorbaServBasicsTest::build1DMesh();
00073   CPPUNIT_ASSERT(_mesh_from_distant->isEqual(meshRef,1e-12));
00074   meshRef->decrRef();
00075   _mesh_from_distant->decrRef();
00076 }
00077 
00078 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaFetching2D()
00079 {
00080   SALOME_MED::MEDCouplingUMeshCorbaInterface_ptr meshPtr=_objC->get2DMesh();
00081   _mesh_from_distant=ParaMEDMEM::MEDCouplingUMeshClient::New(meshPtr);
00082   meshPtr->UnRegister();
00083   CORBA::release(meshPtr);
00084   CPPUNIT_ASSERT_EQUAL(2,_mesh_from_distant->getSpaceDimension());
00085   CPPUNIT_ASSERT_EQUAL(2,_mesh_from_distant->getMeshDimension());
00086 }
00087 
00088 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkContentOfFetched2DMesh()
00089 {
00090   ParaMEDMEM::MEDCouplingUMesh *meshRef=SALOME_TEST::MEDCouplingCorbaServBasicsTest::build2DMesh();
00091   CPPUNIT_ASSERT(_mesh_from_distant->isEqual(meshRef,1e-12));
00092   meshRef->decrRef();
00093   _mesh_from_distant->decrRef();
00094 }
00095 
00096 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkMultiFetchingToTestMemoryManagement()
00097 {
00098   for(int i=0;i<1000;i++)
00099     {
00100       SALOME_MED::MEDCouplingUMeshCorbaInterface_ptr meshPtr=_objC->get2DMesh();
00101       _mesh_from_distant=ParaMEDMEM::MEDCouplingUMeshClient::New(meshPtr);
00102       meshPtr->UnRegister();
00103       CORBA::release(meshPtr);
00104       ParaMEDMEM::MEDCouplingUMesh *meshRef=SALOME_TEST::MEDCouplingCorbaServBasicsTest::build2DMesh();
00105       CPPUNIT_ASSERT(_mesh_from_distant->isEqual(meshRef,1e-12));
00106       meshRef->decrRef();
00107       _mesh_from_distant->decrRef();
00108     }
00109 }
00110 
00111 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaFetching3D()
00112 {
00113   SALOME_MED::MEDCouplingUMeshCorbaInterface_ptr meshPtr=_objC->get3DMesh();
00114   _mesh_from_distant=ParaMEDMEM::MEDCouplingUMeshClient::New(meshPtr);
00115   meshPtr->UnRegister();
00116   CORBA::release(meshPtr);
00117   CPPUNIT_ASSERT_EQUAL(3,_mesh_from_distant->getSpaceDimension());
00118   CPPUNIT_ASSERT_EQUAL(3,_mesh_from_distant->getMeshDimension());
00119 }
00120 
00121 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkContentOfFetched3DMesh()
00122 {
00123   ParaMEDMEM::MEDCouplingUMesh *meshRef=SALOME_TEST::MEDCouplingCorbaServBasicsTest::build3DMesh();
00124   CPPUNIT_ASSERT(_mesh_from_distant->isEqual(meshRef,1e-12));
00125   meshRef->decrRef();
00126   _mesh_from_distant->decrRef();
00127 }
00128 
00129 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaFetching3DSurf()
00130 {
00131   SALOME_MED::MEDCouplingUMeshCorbaInterface_ptr meshPtr=_objC->get3DSurfMesh();
00132   _mesh_from_distant=ParaMEDMEM::MEDCouplingUMeshClient::New(meshPtr);
00133   meshPtr->UnRegister();
00134   CORBA::release(meshPtr);
00135   CPPUNIT_ASSERT_EQUAL(3,_mesh_from_distant->getSpaceDimension());
00136   CPPUNIT_ASSERT_EQUAL(2,_mesh_from_distant->getMeshDimension());
00137 }
00138 
00139 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkContentOfFetched3DSurfMesh()
00140 {
00141   ParaMEDMEM::MEDCouplingUMesh *meshRef=SALOME_TEST::MEDCouplingCorbaServBasicsTest::build3DSurfMesh();
00142   CPPUNIT_ASSERT(_mesh_from_distant->isEqual(meshRef,1e-12));
00143   meshRef->decrRef();
00144   _mesh_from_distant->decrRef();
00145 }
00146 
00147 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaFetching0D()
00148 {
00149   SALOME_MED::MEDCouplingUMeshCorbaInterface_ptr meshPtr=_objC->get0DMesh();
00150   _mesh_from_distant=ParaMEDMEM::MEDCouplingUMeshClient::New(meshPtr);
00151   meshPtr->UnRegister();
00152   CORBA::release(meshPtr);
00153   ParaMEDMEM::MEDCouplingUMesh *meshRef=SALOME_TEST::MEDCouplingCorbaServBasicsTest::build0DMesh();
00154   CPPUNIT_ASSERT_EQUAL(3,_mesh_from_distant->getSpaceDimension());
00155   CPPUNIT_ASSERT_EQUAL(0,_mesh_from_distant->getMeshDimension());
00156   CPPUNIT_ASSERT(_mesh_from_distant->isEqual(meshRef,1e-12));
00157   meshRef->decrRef();
00158   _mesh_from_distant->decrRef();
00159 }
00160 
00161 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaFetchingM1D()
00162 {
00163   SALOME_MED::MEDCouplingUMeshCorbaInterface_ptr meshPtr=_objC->getM1DMesh();
00164   _mesh_from_distant=ParaMEDMEM::MEDCouplingUMeshClient::New(meshPtr);
00165   meshPtr->UnRegister();
00166   CORBA::release(meshPtr);
00167   ParaMEDMEM::MEDCouplingUMesh *meshRef=SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildM1DMesh();
00168   CPPUNIT_ASSERT_EQUAL(-1,_mesh_from_distant->getMeshDimension());
00169   CPPUNIT_ASSERT(_mesh_from_distant->isEqual(meshRef,1e-12));
00170   meshRef->decrRef();
00171   _mesh_from_distant->decrRef();
00172 }
00173 
00174 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaFetchingExtruded()
00175 {
00176   SALOME_MED::MEDCouplingExtrudedMeshCorbaInterface_ptr meshPtr=_objC->getExtrudedMesh();
00177   ParaMEDMEM::MEDCouplingExtrudedMesh *meshFromDistant=ParaMEDMEM::MEDCouplingExtrudedMeshClient::New(meshPtr);
00178   meshPtr->UnRegister();
00179   CORBA::release(meshPtr);
00180   ParaMEDMEM::MEDCouplingUMesh *meshRef2;
00181   ParaMEDMEM::MEDCouplingExtrudedMesh *meshRef=SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildExtrudedMesh(meshRef2);
00182   CPPUNIT_ASSERT(meshFromDistant->isEqual(meshRef,1e-12));
00183   CPPUNIT_ASSERT(meshFromDistant->getMesh2D()->isEqual(meshRef2,1e-12));
00184   meshRef2->decrRef();
00185   meshRef->decrRef();
00186   meshFromDistant->decrRef();
00187 }
00188 
00189 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaFetchingCMesh()
00190 {
00191   SALOME_MED::MEDCouplingCMeshCorbaInterface_ptr meshPtr=_objC->getCMesh();
00192   ParaMEDMEM::MEDCouplingCMesh *meshFromDistant=ParaMEDMEM::MEDCouplingCMeshClient::New(meshPtr);
00193   meshPtr->UnRegister();
00194   CORBA::release(meshPtr);
00195   ParaMEDMEM::MEDCouplingCMesh *meshRef=SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildCMesh();
00196   CPPUNIT_ASSERT(meshFromDistant->isEqual(meshRef,1e-12));
00197   meshRef->decrRef();
00198   meshFromDistant->decrRef();
00199 }
00200 
00201 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaField2DNTFetching()
00202 {
00203   SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr fieldPtr=_objC->getFieldScalarOn2DNT();
00204   ParaMEDMEM::MEDCouplingFieldDouble *fieldCpp=ParaMEDMEM::MEDCouplingFieldDoubleClient::New(fieldPtr);
00205   fieldPtr->UnRegister();
00206   CORBA::release(fieldPtr);
00207   ParaMEDMEM::MEDCouplingFieldDouble *refField=SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildFieldScalarOn2DNT();
00208   CPPUNIT_ASSERT(fieldCpp->isEqual(refField,1.e-12,1.e-15));
00209   CPPUNIT_ASSERT_THROW(fieldCpp->setTime(1.23,4,5),INTERP_KERNEL::Exception);
00210   refField->decrRef();
00211   fieldCpp->decrRef();
00212 }
00213 
00214 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaField2DNTMultiFetching()
00215 {
00216   SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr fieldPtr=_objC->getFieldScalarOn2DNT();
00217   ParaMEDMEM::MEDCouplingFieldDouble *fieldCpp=ParaMEDMEM::MEDCouplingFieldDoubleClient::New(fieldPtr);
00218   ParaMEDMEM::MEDCouplingFieldDouble *fieldCpp2=ParaMEDMEM::MEDCouplingFieldDoubleClient::New(fieldPtr);
00219   fieldPtr->UnRegister();
00220   CORBA::release(fieldPtr);
00221   CPPUNIT_ASSERT(fieldCpp->isEqual(fieldCpp2,1.e-12,1.e-15));
00222   fieldCpp->decrRef();
00223   fieldCpp2->decrRef();
00224 }
00225 
00226 void *SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaField2DNTMultiFetchingMTStatic(void *stack)
00227 {
00228   char *stackS=(char *)stack;
00229   CORBA::Object_var obj=_orb->string_to_object(stackS);
00230   SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr fieldPtr=SALOME_MED::MEDCouplingFieldDoubleCorbaInterface::_narrow(obj);
00231   ParaMEDMEM::MEDCouplingFieldDouble *fieldCpp=ParaMEDMEM::MEDCouplingFieldDoubleClient::New(fieldPtr);
00232   CORBA::release(fieldPtr);
00233   return fieldCpp;
00234 }
00235 
00236 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaField2DNTMultiFetchingMT()
00237 {
00238   const int nbOfThreads=8;
00239   SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr fieldPtr=_objC->getFieldScalarOn2DNT();
00240   //doing nbOfThreads-1 Register.
00241   char *ior=_orb->object_to_string(fieldPtr);
00242   pthread_t threads[nbOfThreads];
00243   ParaMEDMEM::MEDCouplingFieldDouble *rets[nbOfThreads];
00244   for(int i=0;i<nbOfThreads;i++)
00245     pthread_create(&threads[i],0,checkCorbaField2DNTMultiFetchingMTStatic,ior);
00246   for(int i=0;i<nbOfThreads;i++)
00247     pthread_join(threads[i],(void **)&rets[i]);
00248   for(int i=0;i<nbOfThreads-1;i++)
00249     CPPUNIT_ASSERT(rets[i]->isEqual(rets[i+1],1.e-12,1.e-15));
00250   for(int i=0;i<nbOfThreads;i++)
00251     rets[i]->decrRef();
00252   fieldPtr->UnRegister();
00253   CORBA::release(fieldPtr);
00254   CORBA::string_free(ior);
00255 }
00256 
00257 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaFieldNode2DNTFetching()
00258 {
00259   SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr fieldPtr=_objC->getFieldNodeScalarOn2DNT();
00260   ParaMEDMEM::MEDCouplingFieldDouble *fieldCpp=ParaMEDMEM::MEDCouplingFieldDoubleClient::New(fieldPtr);
00261   fieldPtr->UnRegister();
00262   CORBA::release(fieldPtr);
00263   ParaMEDMEM::MEDCouplingFieldDouble *refField=SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildFieldNodeScalarOn2DNT();
00264   CPPUNIT_ASSERT(fieldCpp->isEqual(refField,1.e-12,1.e-15));
00265   CPPUNIT_ASSERT_THROW(fieldCpp->setTime(1.23,4,5),INTERP_KERNEL::Exception);
00266   refField->decrRef();
00267   fieldCpp->decrRef();
00268 }
00269 
00270 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaField3DNTFetching()
00271 {
00272   SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr fieldPtr=_objC->getFieldScalarOn3DNT();
00273   ParaMEDMEM::MEDCouplingFieldDouble *fieldCpp=ParaMEDMEM::MEDCouplingFieldDoubleClient::New(fieldPtr);
00274   fieldPtr->UnRegister();
00275   CORBA::release(fieldPtr);
00276   ParaMEDMEM::MEDCouplingFieldDouble *refField=SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildFieldScalarOn3DNT();
00277   CPPUNIT_ASSERT(fieldCpp->isEqual(refField,1.e-12,1.e-15));
00278   CPPUNIT_ASSERT_THROW(fieldCpp->setTime(1.23,4,5),INTERP_KERNEL::Exception);
00279   refField->decrRef();
00280   fieldCpp->decrRef();
00281 }
00282 
00283 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaField3DSurfWTFetching()
00284 {
00285   SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr fieldPtr=_objC->getFieldScalarOn3DSurfWT();
00286   ParaMEDMEM::MEDCouplingFieldDouble *fieldCpp=ParaMEDMEM::MEDCouplingFieldDoubleClient::New(fieldPtr);
00287   fieldPtr->UnRegister();
00288   CORBA::release(fieldPtr);
00289   ParaMEDMEM::MEDCouplingFieldDouble *refField=SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildFieldScalarOn3DSurfWT();
00290   CPPUNIT_ASSERT(fieldCpp->isEqual(refField,1.e-12,1.e-15));
00291   int dt,it;
00292   fieldCpp->getTime(dt,it);
00293   CPPUNIT_ASSERT_EQUAL(1,dt);
00294   CPPUNIT_ASSERT_EQUAL(4,it);
00295   refField->decrRef();
00296   fieldCpp->decrRef();
00297 }
00298 
00299 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaField3DSurfCOTIFetching()
00300 {
00301   SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr fieldPtr=_objC->getFieldScalarOn3DSurfCOTI();
00302   ParaMEDMEM::MEDCouplingFieldDouble *fieldCpp=ParaMEDMEM::MEDCouplingFieldDoubleClient::New(fieldPtr);
00303   fieldPtr->UnRegister();
00304   CORBA::release(fieldPtr);
00305   ParaMEDMEM::MEDCouplingFieldDouble *refField=SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildFieldScalarOn3DSurfCOTI();
00306   CPPUNIT_ASSERT(fieldCpp->isEqual(refField,1.e-12,1.e-15));
00307   int dt,it;
00308   fieldCpp->getStartTime(dt,it);
00309   CPPUNIT_ASSERT_EQUAL(1,dt);
00310   CPPUNIT_ASSERT_EQUAL(4,it);
00311   fieldCpp->getEndTime(dt,it);
00312   CPPUNIT_ASSERT_EQUAL(2,dt);
00313   CPPUNIT_ASSERT_EQUAL(8,it);
00314   refField->decrRef();
00315   fieldCpp->decrRef();
00316 }
00317 
00318 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaField2DLTFetching()
00319 {
00320   SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr fieldPtr=_objC->getFieldScalarOn2DLT();
00321   ParaMEDMEM::MEDCouplingFieldDouble *fieldCpp=ParaMEDMEM::MEDCouplingFieldDoubleClient::New(fieldPtr);
00322   fieldPtr->UnRegister();
00323   CORBA::release(fieldPtr);
00324   double res[4];
00325   const double pos[2]={0.3,-0.2};
00326   fieldCpp->getValueOn(pos,10.,res);
00327   CPPUNIT_ASSERT_DOUBLES_EQUAL(25.4,res[0],1e-12);
00328   CPPUNIT_ASSERT_DOUBLES_EQUAL(25.04,res[1],1e-12);
00329   CPPUNIT_ASSERT_DOUBLES_EQUAL(25.004,res[2],1e-12);
00330   CPPUNIT_ASSERT_DOUBLES_EQUAL(25.0004,res[3],1e-12);
00331   ParaMEDMEM::MEDCouplingFieldDouble *refField=SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildFieldScalarOn2DLT();
00332   CPPUNIT_ASSERT(fieldCpp->isEqual(refField,1.e-12,1.e-15));
00333   int dt,it;
00334   CPPUNIT_ASSERT_DOUBLES_EQUAL(6.7,fieldCpp->getStartTime(dt,it),1e-14);
00335   CPPUNIT_ASSERT_EQUAL(25,dt);
00336   CPPUNIT_ASSERT_EQUAL(26,it);
00337   CPPUNIT_ASSERT_DOUBLES_EQUAL(17.2,fieldCpp->getEndTime(dt,it),1e-14);
00338   CPPUNIT_ASSERT_EQUAL(125,dt);
00339   CPPUNIT_ASSERT_EQUAL(126,it);
00340   refField->decrRef();
00341   fieldCpp->decrRef();
00342 }
00343 
00344 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaFieldGaussPt2DWTFetching()
00345 {
00346   SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr fieldPtr=_objC->getFieldGaussPt2DWT();
00347   ParaMEDMEM::MEDCouplingFieldDouble *fieldCpp=ParaMEDMEM::MEDCouplingFieldDoubleClient::New(fieldPtr);
00348   fieldPtr->UnRegister();
00349   CORBA::release(fieldPtr);
00350   //
00351   ParaMEDMEM::MEDCouplingFieldDouble *refField=SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildFieldGaussPt2DWT();
00352   CPPUNIT_ASSERT(fieldCpp->isEqual(refField,1.e-12,1.e-15));
00353   refField->decrRef();
00354   fieldCpp->decrRef();
00355 }
00356 
00357 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaFieldGaussPtNE2DWTFetching()
00358 {
00359   SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr fieldPtr=_objC->getFieldGaussPtNE2DWT();
00360   ParaMEDMEM::MEDCouplingFieldDouble *fieldCpp=ParaMEDMEM::MEDCouplingFieldDoubleClient::New(fieldPtr);
00361   fieldPtr->UnRegister();
00362   CORBA::release(fieldPtr);
00363   //
00364   ParaMEDMEM::MEDCouplingFieldDouble *refField=SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildFieldGaussPtNE2DWT();
00365   CPPUNIT_ASSERT(fieldCpp->isEqual(refField,1.e-12,1.e-15));
00366   refField->decrRef();
00367   fieldCpp->decrRef();
00368 }
00369 
00370 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaFieldVectorOnExtrudedWT()
00371 {
00372   SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr fieldPtr=_objC->getFieldVectorOnExtrudedWT();
00373   ParaMEDMEM::MEDCouplingFieldDouble *fieldCpp=ParaMEDMEM::MEDCouplingFieldDoubleClient::New(fieldPtr);
00374   fieldPtr->UnRegister();
00375   CORBA::release(fieldPtr);
00376   //
00377   ParaMEDMEM::MEDCouplingFieldDouble *refField=SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildFieldVectorOnExtrudedWT();
00378   CPPUNIT_ASSERT(fieldCpp->isEqual(refField,1.e-12,1.e-15));
00379   refField->decrRef();
00380   fieldCpp->decrRef();
00381 }
00382 
00383 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaFieldVectorOnCMeshWT()
00384 {
00385   SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr fieldPtr=_objC->getFieldVectorOnCMeshWT();
00386   ParaMEDMEM::MEDCouplingFieldDouble *fieldCpp=ParaMEDMEM::MEDCouplingFieldDoubleClient::New(fieldPtr);
00387   fieldPtr->UnRegister();
00388   CORBA::release(fieldPtr);
00389   //
00390   ParaMEDMEM::MEDCouplingFieldDouble *refField=SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildFieldVectorOnCMeshWT();
00391   CPPUNIT_ASSERT(fieldCpp->isEqual(refField,1.e-12,1.e-15));
00392   refField->decrRef();
00393   fieldCpp->decrRef();
00394 }
00395 
00396 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaFieldTemplateCellOn2D()
00397 {
00398   SALOME_MED::MEDCouplingFieldTemplateCorbaInterface_ptr fieldPtr=_objC->getFieldTemplateCellOn2D();
00399   ParaMEDMEM::MEDCouplingFieldTemplate *fieldCpp=ParaMEDMEM::MEDCouplingFieldTemplateClient::New(fieldPtr);
00400   fieldPtr->UnRegister();
00401   CORBA::release(fieldPtr);
00402   //
00403   ParaMEDMEM::MEDCouplingFieldTemplate *refField=SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildFieldTemplateCellOn2D();
00404   CPPUNIT_ASSERT(fieldCpp->isEqual(refField,1.e-12,1.e-15));
00405   refField->decrRef();
00406   fieldCpp->decrRef();
00407 }
00408 
00409 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaFieldTemplateNodeOn2D()
00410 {
00411   SALOME_MED::MEDCouplingFieldTemplateCorbaInterface_ptr fieldPtr=_objC->getFieldTemplateNodeOn2D();
00412   ParaMEDMEM::MEDCouplingFieldTemplate *fieldCpp=ParaMEDMEM::MEDCouplingFieldTemplateClient::New(fieldPtr);
00413   fieldPtr->UnRegister();
00414   CORBA::release(fieldPtr);
00415   //
00416   ParaMEDMEM::MEDCouplingFieldTemplate *refField=SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildFieldTemplateNodeOn2D();
00417   CPPUNIT_ASSERT(fieldCpp->isEqual(refField,1.e-12,1.e-15));
00418   refField->decrRef();
00419   fieldCpp->decrRef();
00420 }
00421 
00422 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaFieldTemplateGaussPtOn2D()
00423 {
00424   SALOME_MED::MEDCouplingFieldTemplateCorbaInterface_ptr fieldPtr=_objC->getFieldTemplateGaussPtOn2D();
00425   ParaMEDMEM::MEDCouplingFieldTemplate *fieldCpp=ParaMEDMEM::MEDCouplingFieldTemplateClient::New(fieldPtr);
00426   fieldPtr->UnRegister();
00427   CORBA::release(fieldPtr);
00428   //
00429   ParaMEDMEM::MEDCouplingFieldTemplate *refField=SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildFieldTemplateGaussPtOn2D();
00430   CPPUNIT_ASSERT(fieldCpp->isEqual(refField,1.e-12,1.e-15));
00431   refField->decrRef();
00432   fieldCpp->decrRef();
00433 }
00434 
00435 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaFieldTemplateGaussNEOn2D()
00436 {
00437   SALOME_MED::MEDCouplingFieldTemplateCorbaInterface_ptr fieldPtr=_objC->getFieldTemplateGaussNEOn2D();
00438   ParaMEDMEM::MEDCouplingFieldTemplate *fieldCpp=ParaMEDMEM::MEDCouplingFieldTemplateClient::New(fieldPtr);
00439   fieldPtr->UnRegister();
00440   CORBA::release(fieldPtr);
00441   //
00442   ParaMEDMEM::MEDCouplingFieldTemplate *refField=SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildFieldTemplateGaussNEOn2D();
00443   CPPUNIT_ASSERT(fieldCpp->isEqual(refField,1.e-12,1.e-15));
00444   refField->decrRef();
00445   fieldCpp->decrRef();
00446 }
00447 
00448 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaMultiFields1()
00449 {
00450   SALOME_MED::MEDCouplingMultiFieldsCorbaInterface_ptr fieldPtr=_objC->getMultiFields1();
00451   ParaMEDMEM::MEDCouplingMultiFields *fieldCpp=ParaMEDMEM::MEDCouplingMultiFieldsClient::New(fieldPtr);
00452   fieldPtr->UnRegister();
00453   CORBA::release(fieldPtr);
00454   //
00455   ParaMEDMEM::MEDCouplingMultiFields *refField=SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildMultiFields1();
00456   CPPUNIT_ASSERT(fieldCpp->isEqual(refField,1.e-12,1.e-15));
00457   refField->decrRef();
00458   fieldCpp->decrRef();
00459 }
00460 
00461 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaArrayDouble1()
00462 {
00463   SALOME_MED::DataArrayDoubleCorbaInterface_ptr fieldPtr=_objC->getArrayDouble1();
00464   ParaMEDMEM::DataArrayDouble *fieldCpp=ParaMEDMEM::DataArrayDoubleClient::New(fieldPtr);
00465   fieldPtr->UnRegister();
00466   CORBA::release(fieldPtr);
00467   //
00468   ParaMEDMEM::DataArrayDouble *refField=SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildArrayDouble1();
00469   CPPUNIT_ASSERT(fieldCpp->isEqual(*refField,1.e-12));
00470   refField->decrRef();
00471   fieldCpp->decrRef();
00472 }
00473 
00474 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaArrayDouble2()
00475 {
00476   SALOME_MED::DataArrayDoubleCorbaInterface_ptr fieldPtr=_objC->getArrayDouble2();
00477   ParaMEDMEM::DataArrayDouble *fieldCpp=ParaMEDMEM::DataArrayDoubleClient::New(fieldPtr);
00478   fieldPtr->UnRegister();
00479   CORBA::release(fieldPtr);
00480   //
00481   ParaMEDMEM::DataArrayDouble *refField=SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildArrayDouble2();
00482   CPPUNIT_ASSERT(fieldCpp->isEqual(*refField,1.e-12));
00483   refField->decrRef();
00484   fieldCpp->decrRef();
00485 }
00486 
00487 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaArrayDouble3()
00488 {
00489   SALOME_MED::DataArrayDoubleCorbaInterface_ptr fieldPtr=_objC->getArrayDouble3();
00490   ParaMEDMEM::DataArrayDouble *fieldCpp=ParaMEDMEM::DataArrayDoubleClient::New(fieldPtr);
00491   fieldPtr->UnRegister();
00492   CORBA::release(fieldPtr);
00493   //
00494   ParaMEDMEM::DataArrayDouble *refField=SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildArrayDouble3();
00495   CPPUNIT_ASSERT(fieldCpp->isEqual(*refField,1.e-12));
00496   refField->decrRef();
00497   fieldCpp->decrRef();
00498 }
00499 
00500 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaArrayInt1()
00501 {
00502   SALOME_MED::DataArrayIntCorbaInterface_ptr fieldPtr=_objC->getArrayInt1();
00503   ParaMEDMEM::DataArrayInt *fieldCpp=ParaMEDMEM::DataArrayIntClient::New(fieldPtr);
00504   fieldPtr->UnRegister();
00505   CORBA::release(fieldPtr);
00506   //
00507   ParaMEDMEM::DataArrayInt *refField=SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildArrayInt1();
00508   CPPUNIT_ASSERT(fieldCpp->isEqual(*refField));
00509   refField->decrRef();
00510   fieldCpp->decrRef();
00511 }
00512 
00513 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaArrayInt2()
00514 {
00515   SALOME_MED::DataArrayIntCorbaInterface_ptr fieldPtr=_objC->getArrayInt2();
00516   ParaMEDMEM::DataArrayInt *fieldCpp=ParaMEDMEM::DataArrayIntClient::New(fieldPtr);
00517   fieldPtr->UnRegister();
00518   CORBA::release(fieldPtr);
00519   //
00520   ParaMEDMEM::DataArrayInt *refField=SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildArrayInt2();
00521   CPPUNIT_ASSERT(fieldCpp->isEqual(*refField));
00522   refField->decrRef();
00523   fieldCpp->decrRef();
00524 }
00525 
00526 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaArrayInt3()
00527 {
00528   SALOME_MED::DataArrayIntCorbaInterface_ptr fieldPtr=_objC->getArrayInt3();
00529   ParaMEDMEM::DataArrayInt *fieldCpp=ParaMEDMEM::DataArrayIntClient::New(fieldPtr);
00530   fieldPtr->UnRegister();
00531   CORBA::release(fieldPtr);
00532   //
00533   ParaMEDMEM::DataArrayInt *refField=SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildArrayInt3();
00534   CPPUNIT_ASSERT(fieldCpp->isEqual(*refField));
00535   refField->decrRef();
00536   fieldCpp->decrRef();
00537 }
00538 
00539 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaFetchingCoords1()
00540 {
00541   SALOME_MED::MEDCouplingUMeshCorbaInterface_ptr meshPtr=_objC->get3DSurfMesh();
00542   SALOME_MED::DataArrayDoubleCorbaInterface_ptr cooPtr=meshPtr->getCoords();
00543   meshPtr->UnRegister();
00544   CORBA::release(meshPtr);
00545   ParaMEDMEM::DataArrayDouble *cooCpp=ParaMEDMEM::DataArrayDoubleClient::New(cooPtr);
00546   ParaMEDMEM::MEDCouplingUMesh *meshRef=SALOME_TEST::MEDCouplingCorbaServBasicsTest::build3DSurfMesh();
00547   //
00548   CPPUNIT_ASSERT(meshRef->getCoords()->isEqual(*cooCpp,1e-12));
00549   //
00550   cooPtr->UnRegister();
00551   CORBA::release(cooPtr);
00552   cooCpp->decrRef();
00553   meshRef->decrRef();
00554 }
00555 
00556 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::checkCorbaMultiFields2()
00557 {
00558   SALOME_MED::MEDCouplingFieldOverTimeCorbaInterface_ptr fotPtr=_objC->getMultiFields2();
00559   ParaMEDMEM::MEDCouplingFieldOverTimeClient *fotc=ParaMEDMEM::MEDCouplingFieldOverTimeClient::New(fotPtr);
00560   fotPtr->UnRegister();
00561   CORBA::release(fotPtr);
00562   //
00563   ParaMEDMEM::MEDCouplingFieldOverTime *refField=SALOME_TEST::MEDCouplingCorbaServBasicsTest::buildMultiFields2();
00564   CPPUNIT_ASSERT(fotc->isEqual(refField,1.e-12,1.e-15));
00565   refField->decrRef();
00566   std::vector<double> ts=fotc->getTimeSteps();
00567   CPPUNIT_ASSERT_EQUAL(6,(int)ts.size());
00568   const double expected[6]={0.2,0.7,1.2,1.35,1.7,2.7};
00569   for(int i=0;i<6;i++)
00570     CPPUNIT_ASSERT_DOUBLES_EQUAL(expected[i],ts[i],1e-12);
00571   fotc->decrRef();
00572 }
00573 
00574 void SALOME_TEST::MEDCouplingCorbaServBasicsTestClt::shutdownServer()
00575 {
00576   _objC->shutdownOrb();
00577 }