1 ###################################################################################
3 # This Python script is to test the API of the C++ GAUSS_LOCALIZATION class
4 # defined in MEDMEM_GaussLocalization.hxx. This test is the Python equivalent
5 # of the test_GaussLocalization.cxx program.
7 ###################################################################################
9 from libMEDMEM_Swig import *
14 p2 = 0.0549758718227661
20 gaussLocName = "Model n1"
29 gsCoo = [2*b-1, 1-4*b,
36 weight = [4*p2, 4*p2, 4*p2, 4*p1, 4*p1, 4*p1]
38 interlacingType = MED_FULL_INTERLACE
40 gaussLoc = GAUSS_LOCALIZATION_FULL(gaussLocName, typeGeo, ngauss, refCoo,
43 print "Gauss Localization via the str operator: ", gaussLoc
45 print "Gauss Localization via the get methods from the class API"
47 typeGeoVerif = gaussLoc.getType()
49 ngaussVerif = gaussLoc.getNbGauss()
51 gaussLocNameVerif = gaussLoc.getName()
53 refCooVerif = gaussLoc.getRefCoo()
55 gsCooVerif = gaussLoc.getGsCoo()
57 weightVerif = gaussLoc.getWeight()
59 interlacingTypeVerif = gaussLoc.getInterlacingType()
61 lenrefCoo = len(refCoo)
62 lenrefCooVerif = len(refCooVerif)
65 lengsCooVerif = len(gsCooVerif)
67 lenweight = len(weight)
68 lenweightVerif = len(weightVerif)
70 if (typeGeo != typeGeoVerif):
71 print "the geometric type does not match"
72 print typeGeo, " verif ", typeGeo
75 if (ngauss != ngaussVerif):
76 print "the number of Gauss points does not match"
77 print ngauss, " verif ", ngaussVerif
80 if (interlacingType != interlacingTypeVerif):
81 print "the interlacing type does not match"
82 print interlacingType, " verif ", interlacingTypeVerif
85 if (gaussLocName != gaussLocNameVerif):
86 print "the Gauss Location name does not match"
87 print gaussLocName, " verif ", gaussLocNameVerif
90 if (lenrefCoo == lenrefCooVerif):
91 print "refCoo verification -- length ",lenrefCoo
92 for i in range(lenrefCoo):
93 if (refCoo[i] != refCooVerif[i]):
94 print " * ",i," ",refCoo[i], " --- ",refCooVerif[i]
96 print "the array of referrence element coordinates does not match"
98 if (lengsCoo == lengsCooVerif):
99 print "gsCoo verification -- length ",lengsCoo
100 for i in range(lengsCoo):
101 if (gsCoo[i] != gsCooVerif[i]):
102 print " * ",i," ",gsCoo[i], " --- ",gsCooVerif[i]
104 print "the array of gauss points coordinates does not match"
106 if (lenweight == lenweightVerif):
107 print "weight verification -- length ",lenweight
108 for i in range(lenweight):
109 if (weight[i] != weightVerif[i]):
110 print " * ",i," ",weight[i], " --- ",weightVerif[i]
112 print "the array of gauss points weight does not match"
114 print "seems to be OK"
116 print "END of the Pyhton script ..... Ctrl D to exit"