X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=v8_work%2Fmedcoup7to8.py;h=e577a546e8ff484e9cbdd1f1a128aab5fa8a7ad2;hb=69fd460430f4507abe451a07ff684688c3ae15e8;hp=6b64d31f1cf1cc8fc1e128d9088ae2115486157c;hpb=8c382e13e72db06b26e6fa8408e920e5558b4c60;p=tools%2Fmedcoupling.git diff --git a/v8_work/medcoup7to8.py b/v8_work/medcoup7to8.py index 6b64d31f1..e577a546e 100755 --- a/v8_work/medcoup7to8.py +++ b/v8_work/medcoup7to8.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2015 CEA/DEN, EDF R&D +# Copyright (C) 2007-2016 CEA/DEN, EDF R&D # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -27,16 +27,73 @@ import argparse from optparse import OptionParser import os -DEFAULT_EXT = ['.hxx', '.cxx', '.txx', '.py', '.i', '.dox', '.rst', '.h', '.hh', '.hpp', '.c', '.cpp', ] +DEFAULT_EXT = ['.hxx', '.cxx', '.txx', '.py', '.i', '.dox', '.rst', '.h', '.hh', '.hpp', '.c', '.cpp'] ## The API changes: REPLACEMENTS = [("RevIntegral", "IntensiveConservation"), ("ConservativeVolumic", "IntensiveMaximum"), ("IntegralGlobConstraint", "ExtensiveConservation"), ("Integral", "ExtensiveMaximum"), - ("MEDCouplingNatureOfFieldEnum", "MEDCouplingNatureOfFieldEnum.hxx"), ("MEDCouplingAutoRefCountObjectPtr", "MCAuto"), - ("deepCpy", "deepCopy") + ("deepCpy", "deepCopy"), + ("performCpy", "performCopyOrIncrRef"), + ("MEDCouplingExtrudedMesh", "MEDCouplingMappedExtrudedMesh"), + ("getBarycenterAndOwner", "computeCellCenterOfMass"), + ("checkCoherency", "checkConsistencyLight"), + ("checkCoherency1", "checkConsistency"), + ("mergeNodes2", "mergeNodesCenter"), + ("renumberNodes2", "renumberNodesCenter"), + ("buildPartOfMySelf2", "buildPartOfMySelfSlice"), + ("buildPartOfMySelfKeepCoords2", "buildPartOfMySelfKeepCoordsSlice"), + ("deepCpyConnectivityOnly", "deepCopyConnectivityOnly"), + ("checkCoherencyOfConnectivity", "checkConsistencyOfConnectivity"), + ("getMeshLength", "getNodalConnectivityArrayLen"), + ("AreCellsEqual0", "AreCellsEqualPolicy0"), + ("AreCellsEqual1", "AreCellsEqualPolicy1"), + ("AreCellsEqual2", "AreCellsEqualPolicy2"), + ("AreCellsEqual7", "AreCellsEqualPolicy7"), + ("AreCellsEqual3", "AreCellsEqualPolicy2NoType"), + ("areCellsIncludedIn2", "areCellsIncludedInPolicy7"), + ("setPartOfMySelf2", "setPartOfMySelfSlice"), + ("ExtractFromIndexedArrays2", "ExtractFromIndexedArraysSlice"), + ("SetPartOfIndexedArrays2", "SetPartOfIndexedArraysSlice"), + ("SetPartOfIndexedArraysSameIdx2", "SetPartOfIndexedArraysSameIdxSlice"), + ("deepCpyConnectivityOnly", "deepCopyConnectivityOnly"), + ("setContigPartOfSelectedValues2", "setContigPartOfSelectedValuesSlice"), + ("selectByTupleId2", "selectByTupleIdSafeSlice"), + ("GetAxTypeRepr", "GetAxisTypeRepr"), + ("cpyFrom", "deepCopyFrom"), + ("selectByTupleId2", "selectByTupleIdSlice"), + ("BuildOld2NewArrayFromSurjectiveFormat2", "ConvertIndexArrayToO2N"), + ("getIdsEqual", "findIdsEqual"), + ("getIdsNotEqual", "findIdsNotEqual"), + ("getIdsEqualList", "findIdsEqualList"), + ("getIdsNotEqualList", "findIdsNotEqualList"), + ("getIdsEqualTuple", "findIdsEqualTuple"), + ("getIdsInRange", "findIdsInRange"), + ("getIdsNotInRange", "findIdsNotInRange"), + ("getIdsStrictlyNegative", "findIdsStricltyNegative"), + ("searchRangesInListOfIds", "findIdsRangesInListOfIds"), + ("computeOffsets2", "computeOffsetsFull"), + ("applyFunc2", "applyFuncCompo"), + ("applyFunc3", "applyFuncNamedCompo"), + ("getIdsInRange", "findIdsInRange"), + ("fillFromAnalytic2", "fillFromAnalyticCompo"), + ("fillFromAnalytic3", "fillFromAnalyticNamedCompo"), + ("applyFunc2", "applyFuncCompo"), + ("applyFunc3", "applyFuncNamedCompo"), + ("mergeNodes2", "mergeNodesCenter"), + ("setAxType", "setAxisType"), + ("getAxType", "getAxisType"), + ("isIdentity2", "isIota"), + ("SWIGTYPE_p_MEDCoupling__MEDCouplingExtrudedMesh", "SWIGTYPE_p_MEDCoupling__MEDCouplingMappedExtrudedMesh"), + ("MEDCouplingExtrudedMesh____new___", "MEDCouplingMappedExtrudedMesh____new___"), + ("locateValue", "findIdFirstEqual"), + ("locateTuple", "findIdFirstEqualTuple"), + ("MEDCoupling_DataArrayByte_locateTuple", "MEDCoupling_DataArrayByte_findIdFirstEqualTuple"), + ("MEDCoupling_DataArrayAsciiChar_locateTuple", "MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple"), + #("substr", "subArray"), # conflicts with regular C++ substr, to be handled manually + #("search", "findIdSequence"), # idem ] __myName = os.path.abspath(__file__) @@ -54,15 +111,18 @@ def convert(root_dir, ext, quiet): print "!!! Skipping script %s !!!" % __myName continue ok = False - for e in ext: - if fileName[-len(e):] == e: - ok = True - break + if fileName[-28:] != "MEDCouplingNatureOfFieldEnum": + for e in ext: + if fileName[-len(e):] == e: + ok = True + break + else: + ok = True if not ok: continue # skip file if not quiet: print "Handling %s ..." % fileName for line in fileinput.input(fileName, inplace=1, backup='.bak'): for before, after in REPLACEMENTS: - line = re.sub("(\W|^)(%s)(\W|$)" % before, r"\1%s\3" % after, line.rstrip()) + line = re.sub("(\W|^)(%s)(\W|$)" % before, r"\1%s\3" % after, line.rstrip('\r\n')) print(line) # print in file parser = OptionParser()