1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 template<class T, class INTERLACING_TAG>
24 FIELDClient<T,INTERLACING_TAG>::FIELDClient(typename FIELDI_TRAITS<T,INTERLACING_TAG>::SimpleFieldCorbaPtrType ptrCorba,MEDMEM::SUPPORT * S):_fieldPtr(FIELDI_TRAITS<T,INTERLACING_TAG>::SimpleFieldGlobalType::_duplicate(ptrCorba)),_refCounter(1)
29 SCRUTE(_fieldPtr->getSupport());
30 MEDMEM::FIELD<T,INTERLACING_TAG>::_support=new MEDMEM::SUPPORTClient(_fieldPtr->getSupport());
33 MEDMEM::FIELD<T,INTERLACING_TAG>::setSupport(S);
35 this->setName(_fieldPtr->getName());
37 MEDMEM::FIELD<T,INTERLACING_TAG>::setDescription(_fieldPtr->getDescription());
38 int nc = _fieldPtr->getNumberOfComponents();
39 MEDMEM::FIELD<T,INTERLACING_TAG>::setNumberOfComponents(nc);
41 MEDMEM::FIELD<T,INTERLACING_TAG>::setNumberOfValues( MEDMEM::FIELD<T,INTERLACING_TAG>::_support->getNumberOfElements(MED_EN::MED_ALL_ELEMENTS));
43 string * _s = new string[nc];
45 SALOME_TYPES::ListOfString_var s;
46 s = _fieldPtr->getComponentsNames();
47 for (int i=0; i<nc; i++)
49 MEDMEM::FIELD<T,INTERLACING_TAG>::setComponentsNames(_s);
51 s = _fieldPtr->getComponentsDescriptions();
52 for (int i=0; i<nc; i++)
54 MEDMEM::FIELD<T,INTERLACING_TAG>::setComponentsDescriptions(_s);
56 s = _fieldPtr->getComponentsUnits();
57 for (int i=0; i<nc; i++)
59 MEDMEM::FIELD<T,INTERLACING_TAG>::setMEDComponentsUnits(_s);
62 this->setIterationNumber(_fieldPtr->getIterationNumber());
63 this->setTime(_fieldPtr->getTime());
64 this->setOrderNumber(_fieldPtr->getOrderNumber());
68 template<class T, class INTERLACING_TAG>
69 void FIELDClient<T,INTERLACING_TAG>::fillCopy()
72 typename FIELDI_TRAITS<T,INTERLACING_TAG>::SenderVarType sender=_fieldPtr->getSenderForValue(MEDMEM::FIELD<T,INTERLACING_TAG>::_interlacingType);
73 T *v = (T *)ReceiverFactory::getValue(sender,n);
74 MEDMEM::MEDMEM_Array_ * array;
75 if(_fieldPtr->getGaussPresence())
77 //array=new typename MEDMEM::MEDMEM_ArrayInterface<T,INTERLACING_TAG,Gauss>::Array
78 // (v, MEDMEM::FIELD<T,INTERLACING_TAG>::getNumberOfComponents(),MEDMEM::FIELD<T,INTERLACING_TAG>::getNumberOfValues(),true,true);
80 array=new typename MEDMEM::MEDMEM_ArrayInterface<T,INTERLACING_TAG,NoGauss>::Array
81 (v, MEDMEM::FIELD<T,INTERLACING_TAG>::getNumberOfComponents(),MEDMEM::FIELD<T,INTERLACING_TAG>::getNumberOfValues(),true,true);
82 MEDMEM::FIELD<T,INTERLACING_TAG>::setArray(array);
85 template<class T, class INTERLACING_TAG>
86 FIELDClient<T,INTERLACING_TAG>::~FIELDClient()
88 CORBA::release(_fieldPtr);
89 /* CCAR : better put in FIELD_ destructor if support is a SUPPORTClient
90 if(FIELD<T,INTERLACING_TAG>::_support)
91 FIELD<T,INTERLACING_TAG>::_support->removeReference();