PHASTA / vtkpytools

Internal tools for using VTK
https://fluid.colorado.edu/wiki/index.php/VTKpytools
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

feat: Add a "smart-load" function #32

Open jrwrigh opened 4 years ago

jrwrigh commented 4 years ago

It receives a dataBlockPath dictionary consisting of keys and Path objects to dataBlock vtk files and a dataBlock dictionary which may/may not have the dataBlocks specified already loaded.

Untested pseudo-code:

def smartLoad(dataBlockPathDict, dataBlockDict, force=False):                    
    for key, path in dataBlockPathDict.items():                                  
        if force or key not in dataBlockDict or path != dataBlockDict[key].path: 
            dataBlockDict[key] = loadDataBlock(path)