jcmwave_jcmt2jcm.mΒΆ

Usage: jcmwave_jcmt2jcm(jcmt_file, keys, [options])

Purpose:
  Process template .jcmt file with embedded matlab blocks to create a .jcm
  file with the same basename.

Input:
  jcmt_file: pathname of the .jcmt file to be processed.

  keys: Structure containing the values for template parameter
    substitution.

  options: key-value list (or matlab structure) to pass optional
    parameters:
      options.outputfile -> sets name of the output .jcm file.


To embed a matlab script into the file use the tag "<?" to
start a script block and use "?>" to end a script block.

Outside a script block one refers to the values of a parameter
by the following tags:
    %(parName)i, %(parName)d --> integer values
    %(parName)f, %(parName)e --> float values
    %(parName)[3-15]e --> rounded float values, e.g. %(parName)10e
      truncates floating point number to ten digits.
    %(parName)s --> string values
Here, parName is the parameter name. The tags are the substituted
by the value of the field "parName" if present in the structure "keys"
(e.g. %(parName)i --> keys.parName) and if the types are matching (integer,
floats, integer and string). Integer and float vector arguments are also
allowed.

Simple Example: Definition of a material block (materials.jcm file).
The user provides the refractive index (e.g. keys.refractive_index = 1.5).
The refractive index is converted to the relative permittivity value
needed as needed by JCMsolve.

... # non script block
Material {
  DomainId = 1
  <?Matlab % start script block
     keys.permittivity = (keys.refractive_index)^2
  ?> # end matlab block
  RelPermittivity = %(permittivity)e # key word substitution
  RelPermeability = 1.0
}
...

After processing the file the following Material definition is created,

... # non script block
Material {
  DomainId = 1
  RelPermittivity = 2.25
  RelPermeability = 1.0
}
...