Python Script Tutorial: Writing a JSon configuration file

From KratosWiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "As complexity increases one needs more and more flexibility in “configuring” a simulation. This is typically achieved by defining a "configuration file" which organizes all ...")
 
Line 3: Line 3:
  
 
Some requirements for this configuration are:
 
Some requirements for this configuration are:
- Must allow nesting of parameters (tree-like structure)
+
* Must allow nesting of parameters (tree-like structure)
- Should allow using default values
+
* Should allow using default values
- Must allow some form of type checking
+
* Must allow some form of type checking
- Should permit to echo all of the defaults in a single place  
+
* Should permit to echo all of the defaults in a single place  
  
 
In order to meet such requirements Kratos introduces a "Parameters" object, which provides a thin wrapper to JSon strings.
 
In order to meet such requirements Kratos introduces a "Parameters" object, which provides a thin wrapper to JSon strings.
  
 
The typical structure of a JSon file is like the following:
 
The typical structure of a JSon file is like the following:

Revision as of 16:07, 1 June 2016

As complexity increases one needs more and more flexibility in “configuring” a simulation. This is typically achieved by defining a "configuration file" which organizes all of the "user instructions" to be used in the configuration of the solver.

Some requirements for this configuration are:

  • Must allow nesting of parameters (tree-like structure)
  • Should allow using default values
  • Must allow some form of type checking
  • Should permit to echo all of the defaults in a single place

In order to meet such requirements Kratos introduces a "Parameters" object, which provides a thin wrapper to JSon strings.

The typical structure of a JSon file is like the following:

Personal tools
Categories