Salome HOME
ParaUMesh.redistributeCells implementation.
[tools/medcoupling.git] / src / MEDCoupling / MEDCouplingTraits.hxx
1 // Copyright (C) 2016-2020  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Anthony Geay (EDF R&D)
20
21 #ifndef __MEDCOUPLINGTRAITS_HXX__
22 #define __MEDCOUPLINGTRAITS_HXX__
23
24 #include "MEDCoupling.hxx"
25 #include "MCType.hxx"
26 #include <vector>
27
28 namespace MEDCoupling
29 {
30   template<class T>
31   struct MEDCOUPLING_EXPORT Traits
32   {
33     using EltType = T;
34   };
35
36   class DataArrayInt32;
37   class DataArrayFloat;
38   class DataArrayDouble;
39   class DataArrayChar;
40   class DataArrayByte;
41   class DataArrayInt64;
42   class MEDCouplingFieldDouble;
43   class MEDCouplingFieldFloat;
44   class MEDCouplingFieldInt;
45   class DataArrayInt32Tuple;
46   class DataArrayInt64Tuple;
47   class DataArrayFloatTuple;
48   class DataArrayDoubleTuple;
49   class DataArrayByteTuple;
50   class DataArrayInt32Iterator;
51   class DataArrayInt64Iterator;
52   class DataArrayByteIterator;
53   
54   template<>
55   struct MEDCOUPLING_EXPORT Traits<double>
56   {
57     static const char ArrayTypeName[];
58     static const char FieldTypeName[];
59     static const char NPYStr[];
60     static const char ReprStr[];
61     using ArrayType = DataArrayDouble;
62     using ArrayTypeCh = DataArrayDouble;
63     using FieldType = MEDCouplingFieldDouble;
64     using ArrayTuple = DataArrayDoubleTuple;
65   };
66
67   template<>
68   struct MEDCOUPLING_EXPORT Traits<float>
69   {
70     static const char ArrayTypeName[];
71     static const char FieldTypeName[];
72     static const char NPYStr[];
73     static const char ReprStr[];
74     using ArrayType = DataArrayFloat;
75     using ArrayTypeCh = DataArrayFloat;
76     using FieldType = MEDCouplingFieldFloat;
77     using ArrayTuple = DataArrayFloatTuple;
78   };
79   
80   template<>
81   struct MEDCOUPLING_EXPORT Traits<Int32>
82   {
83     static const char ArrayTypeName[];
84     static const char FieldTypeName[];
85     static const char NPYStr[];
86     static const char ReprStr[];
87     static const char VTKReprStr[];
88     using ArrayType = DataArrayInt32;
89     using ArrayTypeCh = DataArrayInt32;
90     using FieldType = MEDCouplingFieldInt;
91     using ArrayTuple = DataArrayInt32Tuple;
92     using IteratorType = DataArrayInt32Iterator;
93   };
94
95   template<>
96   struct MEDCOUPLING_EXPORT Traits<Int64>
97   {
98     static const char ArrayTypeName[];
99     static const char FieldTypeName[];
100     static const char NPYStr[];
101     static const char ReprStr[];
102     static const char VTKReprStr[];
103     using ArrayType = DataArrayInt64;
104     using ArrayTypeCh = DataArrayInt64;
105     //using FieldType = MEDCouplingFieldInt64;
106     using ArrayTuple = DataArrayInt64Tuple;
107     using IteratorType = DataArrayInt64Iterator;
108   };
109
110   template<>
111   struct MEDCOUPLING_EXPORT Traits<char>
112   {
113     static const char ArrayTypeName[];
114     using ArrayTypeCh = DataArrayByte;
115     using ArrayType = DataArrayChar;
116     using ArrayTuple = DataArrayByteTuple;
117     using IteratorType = DataArrayByteIterator;
118   };
119 }
120
121 #endif