OpenMPCD
Public Member Functions | List of all members
MPCDAnalysis.StarPolymersAnalysis.Cache.Cache Class Reference

Public Member Functions

def __init__ (self, run, writePath=None)
 
def getPostProcessingPath (self, useWritePath=False)
 
def storeData (self, filename, data, metadata)
 
def hasData (self, filename, metadata)
 
def getDataOrderedDict (self, filename, metadata, keyInterpreter, valueInterpreter)
 

Detailed Description

Handles caching of star polymer results.

Definition at line 5 of file Cache.py.

Constructor & Destructor Documentation

◆ __init__()

def MPCDAnalysis.StarPolymersAnalysis.Cache.Cache.__init__ (   self,
  run,
  writePath = None 
)
    The constructor.

    @param[in] run
               The run in question, which must be an instance of `Run`.
    @param[in] writePath
               If not `None`, a path used to write data to.

Definition at line 16 of file Cache.py.

Member Function Documentation

◆ getDataOrderedDict()

def MPCDAnalysis.StarPolymersAnalysis.Cache.Cache.getDataOrderedDict (   self,
  filename,
  metadata,
  keyInterpreter,
  valueInterpreter 
)
    Returns the cached data under `filename`, with metadata matching the
    given `metadata`, as an instance of `collections.OrderedDict`.

    Each line of the stored file will be split at its first whitespace; the
    part of the line left of that whitespace will be fed to `keyInterpreter`
    to serve as that line's dictionary key, while the remainder of that line
    will be fed to `valueInterpreter` to generate that key's value.

    @throw RuntimeError
           Throws if `not self.hasData(filename, metadata)`.

    @param[in] filename
               The name of the cached data to query.
    @param[in] metadata
               The expected metadata.
    @param[in] keyInterpreter
               A function that will be called on each data line's key, the
               result of which will be used as the returned dictionary's
               key for that line.
    @param[in] valueInterpreter
               A function that will be called on each data line's value, the
               result of which will be used as the returned dictionary's
               value for that line.

Definition at line 126 of file Cache.py.

◆ getPostProcessingPath()

def MPCDAnalysis.StarPolymersAnalysis.Cache.Cache.getPostProcessingPath (   self,
  useWritePath = False 
)
    Returns the post-processing path for the given run.

    @param[in] useWritePath
               Set to `True` to use return a designated path to write data.

Definition at line 34 of file Cache.py.

◆ hasData()

def MPCDAnalysis.StarPolymersAnalysis.Cache.Cache.hasData (   self,
  filename,
  metadata 
)
    Returns whether there is cached data under `filename`, with metadata
    matching the given `metadata` dictionary.

    @param[in] filename
               The name of the cached data to query.
    @param[in] metadata
               The expected metadata.

Definition at line 80 of file Cache.py.

◆ storeData()

def MPCDAnalysis.StarPolymersAnalysis.Cache.Cache.storeData (   self,
  filename,
  data,
  metadata 
)
    Stores the given data and metadata in the given file name, relative to
    the post-processing path.

Definition at line 47 of file Cache.py.


The documentation for this class was generated from the following file: