1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
4 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
5 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License.
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 ###################################################################################
25 # This Python script is to test the API of the C++ GAUSS_LOCALIZATION class
26 # defined in MEDMEM_GaussLocalization.hxx. This test is the Python equivalent
27 # of the test_GaussLocalization.cxx program.
28 ###################################################################################
30 from libMEDMEM_Swig import *
35 p2 = 0.0549758718227661
41 gaussLocName = "Model n1"
50 gsCoo = [2*b-1, 1-4*b,
57 weight = [4*p2, 4*p2, 4*p2, 4*p1, 4*p1, 4*p1]
59 interlacingType = MED_FULL_INTERLACE
61 gaussLoc = GAUSS_LOCALIZATION_FULL(gaussLocName, typeGeo, ngauss, refCoo,
64 print "Gauss Localization via the str operator: ", gaussLoc
66 print "Gauss Localization via the get methods from the class API"
68 typeGeoVerif = gaussLoc.getType()
70 ngaussVerif = gaussLoc.getNbGauss()
72 gaussLocNameVerif = gaussLoc.getName()
74 refCooVerif = gaussLoc.getRefCoo()
76 gsCooVerif = gaussLoc.getGsCoo()
78 weightVerif = gaussLoc.getWeight()
80 interlacingTypeVerif = gaussLoc.getInterlacingType()
82 lenrefCoo = len(refCoo)
83 lenrefCooVerif = len(refCooVerif)
86 lengsCooVerif = len(gsCooVerif)
88 lenweight = len(weight)
89 lenweightVerif = len(weightVerif)
91 if (typeGeo != typeGeoVerif):
92 print "the geometric type does not match"
93 print typeGeo, " verif ", typeGeo
96 if (ngauss != ngaussVerif):
97 print "the number of Gauss points does not match"
98 print ngauss, " verif ", ngaussVerif
101 if (interlacingType != interlacingTypeVerif):
102 print "the interlacing type does not match"
103 print interlacingType, " verif ", interlacingTypeVerif
106 if (gaussLocName != gaussLocNameVerif):
107 print "the Gauss Location name does not match"
108 print gaussLocName, " verif ", gaussLocNameVerif
111 if (lenrefCoo == lenrefCooVerif):
112 print "refCoo verification -- length ",lenrefCoo
113 for i in range(lenrefCoo):
114 if (refCoo[i] != refCooVerif[i]):
115 print " * ",i," ",refCoo[i], " --- ",refCooVerif[i]
117 print "the array of referrence element coordinates does not match"
119 if (lengsCoo == lengsCooVerif):
120 print "gsCoo verification -- length ",lengsCoo
121 for i in range(lengsCoo):
122 if (gsCoo[i] != gsCooVerif[i]):
123 print " * ",i," ",gsCoo[i], " --- ",gsCooVerif[i]
125 print "the array of gauss points coordinates does not match"
127 if (lenweight == lenweightVerif):
128 print "weight verification -- length ",lenweight
129 for i in range(lenweight):
130 if (weight[i] != weightVerif[i]):
131 print " * ",i," ",weight[i], " --- ",weightVerif[i]
133 print "the array of gauss points weight does not match"
135 print "seems to be OK"
137 print "END of the Pyhton script ..... Ctrl D to exit"