X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FINTERP_KERNEL%2FGaussPoints%2FCleanUpGauss.py;h=cc1f908eb11ab8f6259b2a9475a30d75d056dfe6;hb=b832b15337be013a56e0976170e5e235b89fcb03;hp=3e1b43a65eec3b205ec20174d84ace502932cc4e;hpb=c1a99376f5e8a6804d29ea0b42057ac87fd9890c;p=tools%2Fmedcoupling.git diff --git a/src/INTERP_KERNEL/GaussPoints/CleanUpGauss.py b/src/INTERP_KERNEL/GaussPoints/CleanUpGauss.py index 3e1b43a65..cc1f908eb 100644 --- a/src/INTERP_KERNEL/GaussPoints/CleanUpGauss.py +++ b/src/INTERP_KERNEL/GaussPoints/CleanUpGauss.py @@ -1,4 +1,4 @@ -# Copyright (C) 2007-2017 CEA/DEN, EDF R&D +# Copyright (C) 2007-2024 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -15,12 +15,13 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# # Author : Anthony Geay (EDF R&D) import re -s1=1080 -s2=1104 +s1=2709 +s2=2848 f=file("InterpKernelGaussCoords.cxx","r") lines=[elt[:-1] for elt in f.readlines()[s1:s2]] pat0=re.compile("void[\s]+GaussInfo\:\:([^\(]+)\([\s]*\)[\s]*$") @@ -39,7 +40,7 @@ if not mEnd: # nbLines=len(lines)-4 casePat=re.compile("[\s]+case[\s]+([\d]+)\:[\s]*$") -entries=filter(lambda (i,x): casePat.match(x),enumerate(lines[offsetLines:-1])) +entries=[i_x for i_x in enumerate(lines[offsetLines:-1]) if casePat.match(i_x[1])] # nbPts=len(entries) if nbLines%nbPts!=0: @@ -48,15 +49,15 @@ dim=nbLines/nbPts-2 if dim<1 or dim>3: raise Exception("Ooops invalid dim !") entries=[(i,int(casePat.match(elt).group(1))) for i,elt in entries] -assert(set([elt[1] for elt in entries])==set(range(nbPts))) +assert({elt[1] for elt in entries} == set(range(nbPts))) # partEndEntries=re.compile("[\s]*break[\s]*\;[\s]*$") -zePat=re.compile("[\s]+coords\[([\d]+)\][\s]*=[\s]*([\d]+[\.]?[\d]*)[\s]*\;[\s]*$") +zePat=re.compile("[\s]+coords\[([\d]+)\][\s]*=[\s]*([\-]?[\d]+[\.]?[\d]*)[\s]*\;[\s]*$") zeTab=(nbPts*dim)*[None] for lineId,ptId in entries: endLine=lines[offsetLines+lineId+1+dim] assert(partEndEntries.match(endLine)) - for j in xrange(dim): + for j in range(dim): curLine=lines[offsetLines+lineId+1+j] m=zePat.match(curLine) assert(m) @@ -68,11 +69,11 @@ assert(None not in zeTab) patInit="Init" assert(m0.group(1)[-len(patInit):]==patInit) varName="%s_REF"%((m0.group(1)[:-len(patInit)]).upper()) -print("const double %s[%d]={%s};"%(varName,len(zeTab),", ".join(zeTab))) -for i in xrange(nbPts): - print(" case %d:"%(i)) - for j in xrange(dim): - print(" coords[%d] = %s[%d];"%(j,varName,i*dim+j)) +print(("const double %s[%d]={%s};"%(varName,len(zeTab),", ".join(zeTab)))) +for i in range(nbPts): + print((" case %d:"%(i))) + for j in range(dim): + print((" coords[%d] = %s[%d];"%(j,varName,i*dim+j))) pass print(" break;")