bmi-forum / bmi-builder

Autogenerate BMI code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bmi-builder

Autogenerate BMI code in C, C++, and Python.

Installation

Clone and install with setuptools.

$ git clone https://github.com/bmi-forum/bmi-builder.git
$ cd bmi-builder
$ python setup.py install

Test the install.

$ bmi-build --help
usage: bmi-build [-h] [--language {c,cxx,python}] [--clobber] file

positional arguments:
  file                  YAML file
  
optional arguments:
  -h, --help            show this help message and exit
  --language {c,cxx,python}
                        BMI language
  --clobber             Overwrite any existing files.

Use

Create a YAML file with name, language, grids, time, and exchange_items attributes, following this template:

name: <str>
long_name: <str>
language: {c, c++, python}
grids:
    - id: <int>
      type: <str>
      rank: <int>
time:
    units: <str>
    start: <float>
    end: <float>
exchange_items:
    - name: <str>
      grid: <id>
      type: <str>
      units: <str>
      intent: {in, out, inout}

and provide this file as the argument to bmi-build.

An example of building a Python BMI is given in the examples directory. Run the example with

$ cd examples
$ bmi-build --language=python --clobber bmi_python.yaml

The result, bmi_model.py, implements all the BMI methods for the model. Some methods, such as initialize, update_frac, and finalize, are stubbed, and require the developer to fill out the implementation details.

About

Autogenerate BMI code.

License:MIT License


Languages

Language:Python 61.2%Language:C 21.5%Language:C++ 17.3%