test

 

 

from paraview.simple import *

reader = ExodusIIReader(FileName=['C:\\Users\\paul\\.........\\exodusfile.e'])


def getBlockIndices(compositeDataInformation, index=0):

    localDict = {}

    if compositeDataInformation.GetDataIsMultiPiece():
        index += compositeDataInformation.GetNumberOfChildren()
    else:
        if compositeDataInformation.GetDataIsComposite():
            for i in range(compositeDataInformation.GetNumberOfChildren()):
                index += 1
                _blockName = compositeDataInformation.GetName(i)
                localDict[_blockName] = index
                leafDict, index = getBlockIndices(compositeDataInformation.GetDataInformation(i).GetCompositeDataInformation(), index)
                localDict.update(leafDict)

    return localDict, index


Indices=getBlockIndices(reader.GetDataInformation().DataInformation.GetCompositeDataInformation())
print(Indices)

 

 转自

 

##############################

posted @ 2024-12-01 22:22  西北逍遥  阅读(1)  评论(0编辑  收藏  举报