Back to index

salome-med  6.5.0
test_GaussLocalization.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #include <stdlib.h>
00024 #include <string>
00025 
00026 #define  INTERLACING_TAG FullInterlace
00027 
00028 #include "MEDMEM_Exception.hxx"
00029 #include "MEDMEM_define.hxx"
00030 #include "MEDMEM_GaussLocalization.hxx"
00031 #include "MEDMEM_ArrayInterface.hxx"
00032 
00033 using namespace std;
00034 using namespace MEDMEM;
00035 using namespace MED_EN;
00036 
00037 #define _a 0.446948490915965
00038 #define _b 0.091576213509771
00039 #define _p1 0.11169079483905
00040 #define _p2 0.0549758718227661
00041 
00042 int main (int argc, char ** argv) {
00043 
00044   typedef MEDMEM_ArrayInterface<double,INTERLACING_TAG,NoGauss>::Array Array;
00045 
00046 
00047  /* Caractéristiques du model n° 1 de localisation des points de gauss pour le champ n°1*/
00048   MED_EN::medGeometryElement typeGeo = MED_TRIA6;
00049 
00050   int       ngauss1_1 = 6;
00051   string    gauss1_1("Model n1");
00052   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 };
00053 
00054   double    gscoo1_1[12] = { 2*_b-1, 1-4*_b, 2*_b-1, 2*_b-1, 1-4*_b,
00055                              2*_b-1, 1-4*_a, 2*_a-1, 2*_a-1, 1-4*_a, 2*_a-1, 2*_a-1 };
00056   double    wg1_1[6]     = { 4*_p2, 4*_p2, 4*_p2, 4*_p1, 4*_p1, 4*_p1 };
00057 
00058 
00059   assert( ( (typeGeo%100)*(typeGeo/100) ) == 12 );
00060 
00061   GAUSS_LOCALIZATION<INTERLACING_TAG> myloc1 = GAUSS_LOCALIZATION<INTERLACING_TAG>(gauss1_1,typeGeo,ngauss1_1,
00062                                                                                    Array(refcoo1,typeGeo/100,(typeGeo%100) ),
00063                                                                                    Array(gscoo1_1,typeGeo/100,ngauss1_1),
00064                                                                                    vector<double> (wg1_1,wg1_1+ngauss1_1)
00065                                                                                    );
00066   GAUSS_LOCALIZATION<INTERLACING_TAG> myloc1bis = GAUSS_LOCALIZATION<INTERLACING_TAG>(gauss1_1,typeGeo,ngauss1_1,
00067                                                                                       refcoo1,gscoo1_1,
00068                                                                                       wg1_1);
00069 
00070   cout << "myloc1 == myloc1bis " << (myloc1 == myloc1bis) << endl;
00071   cout << "myloc1 : " << endl << myloc1 << endl;
00072 }