1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 template<class T, class INTERLACING_TAG>
21 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)
26 SCRUTE(_fieldPtr->getSupport());
27 MEDMEM::FIELD<T,INTERLACING_TAG>::_support=new MEDMEM::SUPPORTClient(_fieldPtr->getSupport());
30 MEDMEM::FIELD<T,INTERLACING_TAG>::setSupport(S);
32 setName(_fieldPtr->getName());
34 MEDMEM::FIELD<T,INTERLACING_TAG>::setDescription(_fieldPtr->getDescription());
35 int nc = _fieldPtr->getNumberOfComponents();
36 MEDMEM::FIELD<T,INTERLACING_TAG>::setNumberOfComponents(nc);
38 MEDMEM::FIELD<T,INTERLACING_TAG>::setNumberOfValues( MEDMEM::FIELD<T,INTERLACING_TAG>::_support->getNumberOfElements(MED_EN::MED_ALL_ELEMENTS));
40 string * _s = new string[nc];
42 SALOME_MED::string_array_var s;
43 s = _fieldPtr->getComponentsNames();
44 for (int i=0; i<nc; i++)
46 MEDMEM::FIELD<T,INTERLACING_TAG>::setComponentsNames(_s);
48 s = _fieldPtr->getComponentsDescriptions();
49 for (int i=0; i<nc; i++)
51 MEDMEM::FIELD<T,INTERLACING_TAG>::setComponentsDescriptions(_s);
53 s = _fieldPtr->getComponentsUnits();
54 for (int i=0; i<nc; i++)
56 MEDMEM::FIELD<T,INTERLACING_TAG>::setMEDComponentsUnits(_s);
59 setIterationNumber(_fieldPtr->getIterationNumber());
60 setTime(_fieldPtr->getTime());
61 setOrderNumber(_fieldPtr->getOrderNumber());
65 template<class T, class INTERLACING_TAG>
66 void FIELDClient<T,INTERLACING_TAG>::fillCopy()
69 typename FIELDI_TRAITS<T,INTERLACING_TAG>::SenderVarType sender=_fieldPtr->getSenderForValue(MEDMEM::FIELD<T,INTERLACING_TAG>::_interlacingType);
70 T *v = (T *)ReceiverFactory::getValue(sender,n);
71 MEDMEM::MEDMEM_Array_ * array;
72 if(_fieldPtr->getGaussPresence())
74 //array=new typename MEDMEM::MEDMEM_ArrayInterface<T,INTERLACING_TAG,Gauss>::Array
75 // (v, MEDMEM::FIELD<T,INTERLACING_TAG>::getNumberOfComponents(),MEDMEM::FIELD<T,INTERLACING_TAG>::getNumberOfValues(),true,true);
77 array=new typename MEDMEM::MEDMEM_ArrayInterface<T,INTERLACING_TAG,NoGauss>::Array
78 (v, MEDMEM::FIELD<T,INTERLACING_TAG>::getNumberOfComponents(),MEDMEM::FIELD<T,INTERLACING_TAG>::getNumberOfValues(),true,true);
79 MEDMEM::FIELD<T,INTERLACING_TAG>::setArray(array);
82 template<class T, class INTERLACING_TAG>
83 FIELDClient<T,INTERLACING_TAG>::~FIELDClient()
86 CORBA::release(_fieldPtr);
87 /* CCAR : better put in FIELD_ destructor if support is a SUPPORTClient
88 if(FIELD<T,INTERLACING_TAG>::_support)
89 FIELD<T,INTERLACING_TAG>::_support->removeReference();