Git Product home page Git Product logo

bmi-cxx's Introduction

DOI Build and Test Anaconda-Server Badge Anaconda-Server Badge Anaconda-Server Badge

bmi-cxx

C++ bindings for the CSDMS Basic Model Interface.

Build/Install

The C++ BMI bindings can be built on Linux, macOS, and Windows. Instructions are given below.

Prerequisites:

  • A C++ compiler
  • CMake

Alternately, conda binaries have been built for Linux, macOS, and Windows. Install the C++ BMI bindings (no build needed) into an Anaconda distribution with

conda install bmi-cxx -c conda-forge

Linux and macOS

To install the C++ BMI bindings from source with cmake, run

mkdir _build && cd _build
cmake .. -DCMAKE_INSTALL_PREFIX=<path-to-installation>
make install

where <path-to-installation> is the base directory in which to install the bindings (/usr/local is the default). When using a conda environment, use the $CONDA_PREFIX environment variable.

The installation will look like:

.
|-- include
|   `-- bmi.hxx
`-- lib
    `-- pkgconfig
        `-- bmicxx.pc

Windows

An additional prerequisite is needed for Windows:

  • Microsoft Visual Studio 2017 or Microsoft Build Tools for Visual Studio 2017

To configure and install the C++ BMI bindings from source with cmake, run the following in a Developer Command Prompt

mkdir _build && cd _build
cmake .. ^
  -G "NMake Makefiles" ^
  -DCMAKE_INSTALL_PREFIX=<path-to-installation> ^
  -DCMAKE_BUILD_TYPE=Release
cmake --build . --target install --config Release

where <path-to-installation> is the base directory in which to install the bindings. The default is "C:\Program Files (x86)". Note that quotes and an absolute path are needed. When using a conda environment, use "%CONDA_PREFIX%\Library".

Use

To write a BMI for a model, include the bmi.hxx header and implement all the BMI functions included in the interface defined therein. BMI functions that aren't used (e.g., get_grid_x for a uniform rectilinear grid) can simply return the BMI_FAILURE status code. A sample implementation is given in the https://github.com/csdms/bmi-example-cxx repository.

bmi-cxx's People

Contributors

mcflugen avatar mdpiper avatar philmiller avatar r-barnes avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bmi-cxx's Issues

Missing standard library includes for std::string and std::vector

The reference header's definition of class Bmi uses the standard library classes std::string and std::vector. Use of those types requires headers, but bmi.hxx doesn't include them. Thus, client code is required to ensure an inclusion order that names them first, which is normally very poor form.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.