]> SALOME platform Git repositories - modules/med.git/blob - src/MEDMEM/MEDMEM_FieldConvert.hxx
Salome HOME
Fix problem of make distcheck
[modules/med.git] / src / MEDMEM / MEDMEM_FieldConvert.hxx
1 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #ifndef FIELD_CONVERT_HXX
24 #define FIELD_CONVERT_HXX
25
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"
30
31 namespace MEDMEM {
32 class FIELD_;
33
34 template <class T> FIELD<T,FullInterlace> *
35 FieldConvert(const FIELD<T,NoInterlace> & field )
36 {
37   typedef typename MEDMEM_ArrayInterface<T,FullInterlace,NoGauss>::Array ArrayFullNo;
38   typedef typename MEDMEM_ArrayInterface<T,FullInterlace,Gauss>::Array ArrayFullGa;
39
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?
45
46   if  ( field.getGaussPresence() ) {
47     ArrayFullGa * myArray = ArrayConvert( *(field.getArrayGauss()) );
48     myField->setArray(myArray);
49     return myField;
50   } else {
51     ArrayFullNo * myArray = ArrayConvert( *(field.getArrayNoGauss()) );
52     myField->setArray(myArray);
53     return myField;
54   }
55 }
56
57 template <class T> FIELD<T,NoInterlace> *
58 FieldConvert(const FIELD<T,FullInterlace> & field )
59 {
60   typedef typename MEDMEM_ArrayInterface<T,NoInterlace,NoGauss>::Array ArrayNoNo;
61   typedef typename MEDMEM_ArrayInterface<T,NoInterlace,Gauss>::Array ArrayNoGa;
62
63
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?
69
70   if  ( field.getGaussPresence() ) {
71     ArrayNoGa * myArray = ArrayConvert( *(field.getArrayGauss()) );
72     myField->setArray(myArray);
73     return myField;
74   } else {
75     ArrayNoNo * myArray = ArrayConvert( *(field.getArrayNoGauss()) );
76     myField->setArray(myArray);
77     return myField;
78   }
79
80 }
81
82 template <class T> FIELD<T,FullInterlace> *
83 FieldConvert(const FIELD<T,NoInterlaceByType> & field )
84 {
85   typedef typename MEDMEM_ArrayInterface<T,FullInterlace,NoGauss>::Array ArrayFullNo;
86   typedef typename MEDMEM_ArrayInterface<T,FullInterlace,Gauss>::Array ArrayFullGa;
87
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?
93
94   if  ( field.getGaussPresence() ) {
95     ArrayFullGa * myArray = ArrayConvert( *(field.getArrayGauss()) );
96     myField->setArray(myArray);
97     return myField;
98   } else {
99     ArrayFullNo * myArray = ArrayConvert( *(field.getArrayNoGauss()) );
100     myField->setArray(myArray);
101     return myField;
102   }
103 }
104
105 }
106 #endif