Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/med.git] / src / MEDMEMBinTest / test_GaussLocalization.cxx
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 #include <stdlib.h>
24 #include <string>
25
26 #define  INTERLACING_TAG FullInterlace
27
28 #include "MEDMEM_Exception.hxx"
29 #include "MEDMEM_define.hxx"
30 #include "MEDMEM_GaussLocalization.hxx"
31 #include "MEDMEM_ArrayInterface.hxx"
32
33 using namespace std;
34 using namespace MEDMEM;
35 using namespace MED_EN;
36
37 #define _a 0.446948490915965
38 #define _b 0.091576213509771
39 #define _p1 0.11169079483905
40 #define _p2 0.0549758718227661
41
42 int main (int argc, char ** argv) {
43
44   typedef MEDMEM_ArrayInterface<double,INTERLACING_TAG,NoGauss>::Array Array;
45
46
47  /* Caractéristiques du model n° 1 de localisation des points de gauss pour le champ n°1*/
48   MED_EN::medGeometryElement typeGeo = MED_TRIA6;
49
50   int       ngauss1_1 = 6;
51   string    gauss1_1("Model n1");
52   double    refcoo1 [12] = { -1.0,1.0, -1.0,-1.0, 1.0,-1.0, -1.0,0.0, 0.0,-1.0, 0.0,0.0 };
53
54   double    gscoo1_1[12] = { 2*_b-1, 1-4*_b, 2*_b-1, 2*_b-1, 1-4*_b,
55                              2*_b-1, 1-4*_a, 2*_a-1, 2*_a-1, 1-4*_a, 2*_a-1, 2*_a-1 };
56   double    wg1_1[6]     = { 4*_p2, 4*_p2, 4*_p2, 4*_p1, 4*_p1, 4*_p1 };
57
58
59   assert( ( (typeGeo%100)*(typeGeo/100) ) == 12 );
60
61   GAUSS_LOCALIZATION<INTERLACING_TAG> myloc1 = GAUSS_LOCALIZATION<INTERLACING_TAG>(gauss1_1,typeGeo,ngauss1_1,
62                                                                                    Array(refcoo1,typeGeo/100,(typeGeo%100) ),
63                                                                                    Array(gscoo1_1,typeGeo/100,ngauss1_1),
64                                                                                    vector<double> (wg1_1,wg1_1+ngauss1_1)
65                                                                                    );
66   GAUSS_LOCALIZATION<INTERLACING_TAG> myloc1bis = GAUSS_LOCALIZATION<INTERLACING_TAG>(gauss1_1,typeGeo,ngauss1_1,
67                                                                                       refcoo1,gscoo1_1,
68                                                                                       wg1_1);
69
70   cout << "myloc1 == myloc1bis " << (myloc1 == myloc1bis) << endl;
71   cout << "myloc1 : " << endl << myloc1 << endl;
72 }