{"id":23831960,"url":"https://github.com/csdms/bmi-example-c","last_synced_at":"2025-09-07T11:31:20.180Z","repository":{"id":47395959,"uuid":"214300622","full_name":"csdms/bmi-example-c","owner":"csdms","description":"An example of wrapping a model written in C with a BMI","archived":false,"fork":false,"pushed_at":"2024-08-28T16:24:38.000Z","size":79,"stargazers_count":1,"open_issues_count":0,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-08-28T18:08:46.977Z","etag":null,"topics":["bmi","c","csdms"],"latest_commit_sha":null,"homepage":"https://bmi.readthedocs.io","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/csdms.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-10-10T23:03:00.000Z","updated_at":"2024-08-28T16:24:31.000Z","dependencies_parsed_at":"2022-08-23T07:00:45.803Z","dependency_job_id":"95172608-b59a-4914-82c2-b7e82a6d3195","html_url":"https://github.com/csdms/bmi-example-c","commit_stats":{"total_commits":85,"total_committers":2,"mean_commits":42.5,"dds":0.2823529411764706,"last_synced_commit":"f47d0a65edf848ccd9d57d375e9fdd90354c1f4f"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csdms%2Fbmi-example-c","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csdms%2Fbmi-example-c/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csdms%2Fbmi-example-c/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csdms%2Fbmi-example-c/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csdms","download_url":"https://codeload.github.com/csdms/bmi-example-c/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232206387,"owners_count":18488512,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bmi","c","csdms"],"created_at":"2025-01-02T14:16:44.925Z","updated_at":"2025-01-02T14:16:45.539Z","avatar_url":"https://github.com/csdms.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Basic Model Interface](https://img.shields.io/badge/CSDMS-Basic%20Model%20Interface-green.svg)](https://bmi.readthedocs.io/)\n[![Build/Test](https://github.com/csdms/bmi-example-c/actions/workflows/test.yml/badge.svg)](https://github.com/csdms/bmi-example-c/actions/workflows/test.yml)\n\n# bmi-example-c\n\nAn example of implementing the\n[C bindings](https://github.com/csdms/bmi-c)\nfor the CSDMS\n[Basic Model Interface](https://bmi.readthedocs.io) (BMI).\n\n\n## Overview\n\nThis is an example of implementing a BMI for a simple model\nthat solves the diffusion equation\non a uniform rectangular plate\nwith Dirichlet boundary conditions.\nThe model and its BMI are written in C.\nTests of the BMI are provided.\n\nThis repository is organized with the following directories:\n\n\u003cdl\u003e\n    \u003cdt\u003eheat\u003c/dt\u003e\n\t\u003cdd\u003eHolds the model, the BMI for the model, and a sample main program\u003c/dd\u003e\n\t\u003cdt\u003etesting\u003c/dt\u003e\n\t\u003cdd\u003eTests that cover the BMI of the model\u003c/dd\u003e\n\u003c/dl\u003e\n\n## Build/Install\n\nThis example can be built on Linux, macOS, and Windows.\n\n**Prerequisites:**\n* A C compiler\n* CMake\n* pkg-config\n* The C BMI bindings. Follow the build and install directions\n  given in the\n  [README](https://github.com/csdms/bmi-c/blob/master/README.md)\n  in that repository. You can choose to install them from source or\n  through a conda binary.\n\n### Linux and macOS\n\nTo build and install this example from source with cmake,\nusing the current C BMI version, run\n\n    mkdir _build \u0026\u0026 cd _build\n    export PKG_CONFIG_PATH=\u003cpath-to-installation\u003e  # optional: only needed for non-standard install location\n    cmake .. -DCMAKE_INSTALL_PREFIX=\u003cpath-to-installation\u003e\n    make\n    make install\n\nwhere `\u003cpath-to-installation\u003e` is the base directory\nin which the C BMI bindings have been installed\n(`/usr/local` is the default).\nWhen installing into a conda environment,\nuse the `$CONDA_PREFIX` environment variable.\n\nThe installation will look like\n(on macOS, using v2.0 of the BMI specification):\n\n```bash\n.\n|-- bin\n|   |-- run_bmiheatc\n|   `-- run_heatc\n|-- include\n|   |-- bmi.h\n|   |-- heat.h\n|   `-- bmi_heat.h\n`-- lib\n    |-- libbmiheatc.dylib\n    |-- libheatc.dylib\n    `-- pkgconfig\n        |-- bmic.pc\n        |-- heatc.pc\n        `-- bmiheatc.pc\n\n4 directories, 10 files\n```\n\nFrom the build directory,\nrun unit tests on the sample implementation with\n\n    ctest\n\n### Windows\n\nAn additional prerequisite is needed for Windows:\n\n* Microsoft Visual Studio 2017 or Microsoft Build Tools for Visual Studio 2017\n\nTo configure this example from source with cmake\nusing the current C BMI version,\nrun the following in a [Developer Command Prompt](https://docs.microsoft.com/en-us/dotnet/framework/tools/developer-command-prompt-for-vs)\n\n    mkdir _build \u0026\u0026 cd _build\n    set \"PKG_CONFIG_PATH=\u003cpath-to-installation\u003e\"  \u0026:: optional: only needed for non-standard install location\n    cmake .. ^\n\t  -G \"NMake Makefiles\" ^\n\t  -DCMAKE_INSTALL_PREFIX=\u003cpath-to-installation\u003e ^\n\t  -DCMAKE_BUILD_TYPE=Release\n\nwhere `\u003cpath-to-installation\u003e` is the base directory\nin which the C BMI bindings have been installed.\nThe default is `\"C:\\Program Files (x86)\"`.\nNote that quotes and an absolute path are needed.\nWhen using a conda environment, use `\"%CONDA_PREFIX%\\Library\"`.\n\nThen, to build and install:\n\n\tcmake --build . --target install --config Release\n\nFrom the build directory,\nrun unit tests on the sample implementation with\n\n    ctest\n\n\n## Use\n\nRun the heat model through its BMI with the `run_bmiheatc` program,\nwhich takes a model configuration file\n(see the [testing](./testing) directory for a sample)\nas a required parameter.\nIf `run_bmiheatc` is in your path, run it with\n\n    run_bmiheatc config.txt\n\nOutput from the model is written to the file **bmiheatc.out**\nin the current directory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsdms%2Fbmi-example-c","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsdms%2Fbmi-example-c","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsdms%2Fbmi-example-c/lists"}