1 // Copyright (C) 2007-2008 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
22 #ifndef FIELD_CONVERT_HXX
23 #define FIELD_CONVERT_HXX
25 #include "MEDMEM_FieldForward.hxx"
26 #include "MEDMEM_ArrayInterface.hxx"
27 #include "MEDMEM_ArrayConvert.hxx"
32 template <class T> FIELD<T,FullInterlace> *
33 FieldConvert(const FIELD<T,NoInterlace> & field )
35 typedef typename MEDMEM_ArrayInterface<T,FullInterlace,NoGauss>::Array ArrayFullNo;
36 typedef typename MEDMEM_ArrayInterface<T,FullInterlace,Gauss>::Array ArrayFullGa;
38 FIELD<T,FullInterlace> * myField = new FIELD<T,FullInterlace>();
39 FIELD_ * myField_ = myField;
40 FIELD_ * field_ = &(const_cast< FIELD<T,NoInterlace> &> (field));
41 *myField_ = *field_; // Opérateur d'affectation de FIELD_ OK
42 // *((FIELD_ *) myField) = (FIELD_ ) field; //Contructeur par recopie de FIELD_ Pourquoi?
44 if ( field.getGaussPresence() ) {
45 ArrayFullGa * myArray = ArrayConvert( *(field.getArrayGauss()) );
46 myField->setArray(myArray);
49 ArrayFullNo * myArray = ArrayConvert( *(field.getArrayNoGauss()) );
50 myField->setArray(myArray);
55 template <class T> FIELD<T,NoInterlace> *
56 FieldConvert(const FIELD<T,FullInterlace> & field )
58 typedef typename MEDMEM_ArrayInterface<T,NoInterlace,NoGauss>::Array ArrayNoNo;
59 typedef typename MEDMEM_ArrayInterface<T,NoInterlace,Gauss>::Array ArrayNoGa;
62 FIELD<T,NoInterlace> * myField = new FIELD<T,NoInterlace>();
63 FIELD_ * myField_ = myField;
64 FIELD_ * field_ = &(const_cast< FIELD<T,FullInterlace> &> (field));
65 *myField_ = *field_; // Opérateur d'affectation de FIELD_ OK
66 // *((FIELD_*) myField) = (FIELD_) field; //Contructeur par recopie de FIELD_ Pourquoi?
68 if ( field.getGaussPresence() ) {
69 ArrayNoGa * myArray = ArrayConvert( *(field.getArrayGauss()) );
70 myField->setArray(myArray);
73 ArrayNoNo * myArray = ArrayConvert( *(field.getArrayNoGauss()) );
74 myField->setArray(myArray);
80 template <class T> FIELD<T,FullInterlace> *
81 FieldConvert(const FIELD<T,NoInterlaceByType> & field )
83 typedef typename MEDMEM_ArrayInterface<T,FullInterlace,NoGauss>::Array ArrayFullNo;
84 typedef typename MEDMEM_ArrayInterface<T,FullInterlace,Gauss>::Array ArrayFullGa;
86 FIELD<T,FullInterlace> * myField = new FIELD<T,FullInterlace>();
87 FIELD_ * myField_ = myField;
88 FIELD_ * field_ = &(const_cast< FIELD<T,NoInterlaceByType> &> (field));
89 *myField_ = *field_; // Opérateur d'affectation de FIELD_ OK
90 // *((FIELD_ *) myField) = (FIELD_ ) field; //Contructeur par recopie de FIELD_ Pourquoi?
92 if ( field.getGaussPresence() ) {
93 ArrayFullGa * myArray = ArrayConvert( *(field.getArrayGauss()) );
94 myField->setArray(myArray);
97 ArrayFullNo * myArray = ArrayConvert( *(field.getArrayNoGauss()) );
98 myField->setArray(myArray);