1 // Copyright (C) 2007-2012 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 #ifndef FIELD_CONVERT_HXX
24 #define FIELD_CONVERT_HXX
26 //#include "MEDMEM_FieldForward.hxx"
27 #include "MEDMEM_Field.hxx" // issue 0021050: compilation with clang
28 #include "MEDMEM_ArrayInterface.hxx"
29 #include "MEDMEM_ArrayConvert.hxx"
34 template <class T> FIELD<T,FullInterlace> *
35 FieldConvert(const FIELD<T,NoInterlace> & field )
37 typedef typename MEDMEM_ArrayInterface<T,FullInterlace,NoGauss>::Array ArrayFullNo;
38 typedef typename MEDMEM_ArrayInterface<T,FullInterlace,Gauss>::Array ArrayFullGa;
40 FIELD<T,FullInterlace> * myField = new FIELD<T,FullInterlace>();
41 FIELD_ * myField_ = myField;
42 FIELD_ * field_ = &(const_cast< FIELD<T,NoInterlace> &> (field));
43 *myField_ = *field_; // Opérateur d'affectation de FIELD_ OK
44 // *((FIELD_ *) myField) = (FIELD_ ) field; //Contructeur par recopie de FIELD_ Pourquoi?
46 if ( field.getGaussPresence() ) {
47 ArrayFullGa * myArray = ArrayConvert( *(field.getArrayGauss()) );
48 myField->setArray(myArray);
51 ArrayFullNo * myArray = ArrayConvert( *(field.getArrayNoGauss()) );
52 myField->setArray(myArray);
57 template <class T> FIELD<T,NoInterlace> *
58 FieldConvert(const FIELD<T,FullInterlace> & field )
60 typedef typename MEDMEM_ArrayInterface<T,NoInterlace,NoGauss>::Array ArrayNoNo;
61 typedef typename MEDMEM_ArrayInterface<T,NoInterlace,Gauss>::Array ArrayNoGa;
64 FIELD<T,NoInterlace> * myField = new FIELD<T,NoInterlace>();
65 FIELD_ * myField_ = myField;
66 FIELD_ * field_ = &(const_cast< FIELD<T,FullInterlace> &> (field));
67 *myField_ = *field_; // Opérateur d'affectation de FIELD_ OK
68 // *((FIELD_*) myField) = (FIELD_) field; //Contructeur par recopie de FIELD_ Pourquoi?
70 if ( field.getGaussPresence() ) {
71 ArrayNoGa * myArray = ArrayConvert( *(field.getArrayGauss()) );
72 myField->setArray(myArray);
75 ArrayNoNo * myArray = ArrayConvert( *(field.getArrayNoGauss()) );
76 myField->setArray(myArray);
82 template <class T> FIELD<T,FullInterlace> *
83 FieldConvert(const FIELD<T,NoInterlaceByType> & field )
85 typedef typename MEDMEM_ArrayInterface<T,FullInterlace,NoGauss>::Array ArrayFullNo;
86 typedef typename MEDMEM_ArrayInterface<T,FullInterlace,Gauss>::Array ArrayFullGa;
88 FIELD<T,FullInterlace> * myField = new FIELD<T,FullInterlace>();
89 FIELD_ * myField_ = myField;
90 FIELD_ * field_ = &(const_cast< FIELD<T,NoInterlaceByType> &> (field));
91 *myField_ = *field_; // Opérateur d'affectation de FIELD_ OK
92 // *((FIELD_ *) myField) = (FIELD_ ) field; //Contructeur par recopie de FIELD_ Pourquoi?
94 if ( field.getGaussPresence() ) {
95 ArrayFullGa * myArray = ArrayConvert( *(field.getArrayGauss()) );
96 myField->setArray(myArray);
99 ArrayFullNo * myArray = ArrayConvert( *(field.getArrayNoGauss()) );
100 myField->setArray(myArray);