Usage: results=jcmwave_solve([mode], project_file, [keys], [resultbag], [options])

  Starts JCMsolve.
  When running JCMsuite in daemon(=parallel) mode the process
  is started in the background and dispatched to an appropriate
  computer resource.

  mode: string value containing the solver mode option, e.g.
     --version --> prints version tag, needs no project_file
     --solve --> starts JCMsolve
     --post_process --> starts post process
     --license_info -> prints license information
    The mode parameter is optional, when missing '--solve' is used.

  project_file: path name of a JCMwave project or post-process file.
                A cell array of path names is also accepted and the referenced
                projects are solved sequentially. In daemon mode, use relative
                paths to refer to results of previous sub-projects.

  keys: parameter structure for embedded script input file (optional).
    When keys is present, the embedded script files materials.jcmt,
    sources.jcmt, boundary_conditions.jcmt and <project>.jcmpt
    are processed to generate the actual .jcm input files by call
    of jcmwave_jcmt2jcm(<jcmt-file>, keys). Additionally, the
    jcmwave_geo(<project_dir>, keys) is called to automatically update
    the grid file.

  resultbag: An instance of the class jcmwave_resultbag. jcmwave_solve()
       uses the result bag to check whether the result with the keys parameter
       was already computed. If not it adds the new result to the result bag.
       In daemon mode jcmwave_daemon_wait() has to be called with the resultbag
       parameter in order for the result to be added to the result bag.
       If the result is already stored in the result bag the daemon is
       not triggered.
       The resultbag can be created by calling
         my_resultbag = jcmwave_resultbag('filename.mat', [keys]);
       Results for a specific keys-structure can be retrieved by calling
         result =  my_resultbag.get_result(keys);
       Logs for a specific keys-structure can be retrieved by calling
         log =  my_resultbag.get_log(keys);

  options: key-value list (or matlab) structure to configure the output
     options.table_format -> table format option when loading table
       result files, cf. section 'Output' below. options.table_format is
       equivalent to the 'format' option of jcmwave_loadtable.
     options.cartesianfields_format -> format option when loading a
       cartesian fieldbag. options.cartesianfields_format is
       equivalent to the 'format' option of jcmwave_loadcartesianfields,
       but with a further allowed value 'filepath', for which the
       filepath of the cartesian field bag file is returned only.
     options.logfile -> redirects console output to file.
     options.workingdir -> copies .jcm into working directory, runs solver
       therein (excludes options.temporary)
     options.jcmt_pattern -> pattern for selection of .jcmt files.
       For example, sources.<pattern>.jcmt is used instead of sources.jcmt
       when present.
     options.project_suffix -> add suffix to project file name, e.g
       project.jcmp -> project.<suffix>.jcmp
     options.temporary -> project runs in a temporary directory working directory
       (excludes options.workingdir)
     options.cache_finished_jobs -> boolean (default true), In the daemon
       mode finished jobs with temporary data storage are cached and temporary
       disk storage is freed.

   The following options are only used in daemon mode
     options.resources -> list of resource identifier which can be used for this job

Output (sequential mode):
        cell array containing references to the computed data.
        When called with mode '--solve', results{1} refers to the
        solution. It is a structure with the fields
          results{1}.file -> file path to the solution fieldbag (if
          results{1}.computational_costs -> table with computation costs
          results{1}.eigenvalues -> eigenvalue table (only for eigenvalue
        results{1+1}, ... results{1+nPost} refer to the results of
        the post processes in the same order as they appear in the project
        file. For mode '--post_process', the results cell array refers to
        the performed post-process only.

        Each entry results{i} is a structure of the shape as loaded by
        jcmwave_loadtable (for tables), or jcmwave_loadcartesianfields
        (for Cartesian fieldbags).

Output (daemon mode):
       A job id is returned immediately. To access the results use
       the jcmwave_daemon_wait and jcmwave_daemon_wait4any command.