jcmwave_resultbag.mΒΆ

This class provides a handle to store and access computational
results and logs. It can be passed as a parameter to jcmwave_solve and
jcmwave_daemon_wait such that new computational results are
automatically added to the resultbag and the numerical computations
of results that are already included in the resultbag are skipped.

Methods:

   jcmwave_resultbag

      Purpose: Constructor
      Usage: resultbag=jcmwave_resultbag(filepath, [keys])
      Input:
       filepath: If not existent a file with the filename is created that saves the
         content of the resultbag. Whenever some result is added, the file is automatically updated.
         If the file exists, the resultbag is loaded from the file.
       keys (optional): Prototype of parameter structure for templated jcmt-files or cell of fieldnames.
         If keys is present, when adding or getting results the keys structure is filtered to the
         prototypic structure, such that other fieldnames in keys
         structure are ignored.

   check_result

      Purpose: Check if results for specific keys exist
      Usage: exists=resultbag.check_result(keys)
      Input:
          keys: Parameter structure for templated jcmt-files.
      Output: boolean (true if results exist)

   get_result

      Purpose: Get results for specific keys
      Usage: result=resultbag.get_result(keys)
      Input:
          keys: Parameter structure for templated jcmt-files.
      Output: result cell array

   get_log

      Purpose: Get log for specific keys
      Usage: log=resultbag.get_log(keys)
      Input:
          keys: Parameter structure for templated jcmt-files.
      Output: log struct

   get_tag

      Purpose: Get md5 tag of keys struct. Usefull e.g. for creating
          unique folder names for workingdir option of jcmwave_solve
      Usage: tag=resultbag.get_tag(keys)
      Input:
          keys: Parameter structure for templated jcmt-files.
      Output: string

   reset

      Purpose: Clear all results in resultbag
      Usage: resultbag.reset()

   backup

      Purpose: Create a backup of resultbag on disk
      Usage: resultbag.backup(backup_path)

   remove

      Purpose: Remove result and log for keys meeting certain criteria
      Usage: resultbag.remove(fun) where fun is a boolean function with keys
             as argument
      Example: resultbag.remove(@(keys) keys.somefield > 0)

   release_all

      Purpose: In daemon mode jcmwave_solve associates the job to a
        keys struct. Once the computation is running additional
        computations with the same corresponding keys struct are
        skipped. The jobid-keys association is released by
        jcmwave_daemon_wait after the computation has finished. In case
        of a scripting error in Matlab the jcmwave_daemon_wait()
        command may not be reached such that the associations are not
        released and new jobs are not started. In this case call
        release_all().
      Usage: resultbag.release_all()



Properties (SetAccess = private, GetAccess = public):

   filepath_     - path to file for disk storage of resultbag
   results_      - struct of results
   fieldnames_   - struct of relevant fieldnames in keys structure
   keys_         - struct holding keys of corresponding job ids
   source_files_ - struct with information about source files

Internal methods used by jcmwave_solve or jcmwave_daemon_wait:

   set_job_id         - Set job id of keys struct
   is_running         - Check if computation of keys is running
   release            - Release job id
   get_keys_by_job_id - Get keys of job id
   add                - Add results and log for specific keys
   set_source_files   - Set source files of results
   check_source_files - Check if source files are unchanged
   has_results        - Check if any results are registered