{"id":19706017,"url":"https://github.com/llnl/irep","last_synced_at":"2025-10-10T21:43:23.269Z","repository":{"id":46677884,"uuid":"67538186","full_name":"LLNL/irep","owner":"LLNL","description":"A tool for filling C/C++ or Fortran data structures from Lua input tables","archived":false,"fork":false,"pushed_at":"2023-10-26T23:21:40.000Z","size":185,"stargazers_count":15,"open_issues_count":1,"forks_count":1,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-29T16:47:53.019Z","etag":null,"topics":["app-infrastructure","c","cplusplus","fortran","input-deck","interoperability","lua"],"latest_commit_sha":null,"homepage":"","language":"Lua","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/LLNL.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}},"created_at":"2016-09-06T19:03:42.000Z","updated_at":"2023-03-15T17:59:02.000Z","dependencies_parsed_at":"2023-01-28T00:00:48.744Z","dependency_job_id":"f60cbe38-65c1-4e5e-b73f-afb7f269c841","html_url":"https://github.com/LLNL/irep","commit_stats":{"total_commits":49,"total_committers":7,"mean_commits":7.0,"dds":0.4897959183673469,"last_synced_commit":"b9b6b3ee2228278a0b159908b6ed72a8c963a9d3"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/LLNL/irep","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LLNL%2Firep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LLNL%2Firep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LLNL%2Firep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LLNL%2Firep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LLNL","download_url":"https://codeload.github.com/LLNL/irep/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LLNL%2Firep/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279005427,"owners_count":26083883,"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","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["app-infrastructure","c","cplusplus","fortran","input-deck","interoperability","lua"],"created_at":"2024-11-11T21:33:09.175Z","updated_at":"2025-10-10T21:43:23.242Z","avatar_url":"https://github.com/LLNL.png","language":"Lua","readme":"# IREP\n\n[![linux builds](https://github.com/LLNL/irep/actions/workflows/linux_build_tests.yaml/badge.svg)](https://github.com/LLNL/irep/actions/workflows/linux_build_tests.yaml)\n[![Documentation Status](https://readthedocs.org/projects/irep/badge/?version=latest)](https://irep.readthedocs.io/en/latest/?badge=latest)\n\nIREP is a tool that enables mixed-language simulation codes to use a\ncommon, Lua-based format for their input decks. Essentially, the input\nformat is a set of [tables](https://www.lua.org/pil/2.5.html) -- Lua's\none (and only?) data structure. IREP is an *intermediate representation*\nthat is used to generate plain-old-data (POD) structures in C, C++,\nFortran, and Lua.\n\n## Documentation\n\nThere are some high-level docs here to get you started, but you can find\nmore in the [full IREP Documentation](https://irep.readthedocs.io/).\n\n## Installation\n\nTo build IREP, run `make` in the root directory. This will create\n`libIR.a`.  IREP does not (yet) have a proper installation target.\n\n## Building with IREP\n\nIREP has integration for both CMake and gmake-based builds. You can find\nmore about how to intgrate IREP into your project here:\n\n* [IREP Build Docs](https://irep.readthedocs.io/en/latest/build.html) on ReadTheDocs.\n* [IREP Examples](https://github.com/LLNL/irep/tree/master/examples) in this repository.\n\nYou can build and run the examples by running running `make test` in the\nroot of this repository.\n\n## Basics\n\nTo use IREP, you can write a header, like this one for defining a\nvery simple structured mesh. Let's call it `wkt_mesh.h`:\n\n```c\n#ifndef wkt_mesh_h\n#define wkt_mesh_h\n#include \"ir_start.h\"\n\nBeg_struct(irt_box)\n  ir_int(nx, 1)        Doc(( Number of grid cells in 1st dimension ))\n  ir_int(ny, 1)        Doc(( Number of grid cells in 2nd dimension ))\n  ir_int(nz, 1)        Doc(( Number of grid cells in 3rd dimension ))\n  ir_dbl(xmin, 0.0)    Doc(( Location of left-most cell face ))\n  ir_dbl(xmax, 1.0)    Doc(( Location of right-most cell face ))\n  ir_dbl(ymin, 0.0)    Doc(( Location of nearest cell face ))\n  ir_dbl(ymax, 1.0)    Doc(( Location of farthest cell face ))\n  ir_dbl(zmin, 0.0)    Doc(( Location of lowest cell face ))\n  ir_dbl(zmax, 1.0)    Doc(( Location of highest cell face ))\nEnd_struct(irt_box)\n\nBeg_struct(irt_mesh)\n  ir_str(file, FILENAMESIZE, 'none')  Doc(( Name of mesh ))\n  ir_int(refinement_level, 0)\n  ir_log(amr, false)                  Doc(( Use amr? ))\n  Structure(irt_box,box)\nEnd_struct(irt_mesh)\n\n// Declare the structure\nir_wkt(irt_mesh, mesh)\n\n#include \"ir_end.h\"\n#endif  // wkt_mesh_h\n```\n\nIn IREP, headers like this are called \"Well Known Tables\", or \"WKTs\". WKT\nheaders are includable directly into C and C++ code, and you can refer to\nelements of the defined structures like this:\n\n```c\n#include \"wkt_mesh.h\"\n\nvoid do_something() {\n    double xrange = mesh.box.xmax - mesh.xmin;\n    double yrange = mesh.box.ymax - mesh.ymin;\n    double zrange = mesh.box.zmax - mesh.zmin;\n}\n```\n\nIREP can also be used to generate Fortran modules and Lua code for WKTs,\nand you can refer to their elements in a similarly direct way in those\nlanguages, e.g.:\n\n```\nmesh.box.xmax  // C, C++\nmesh.box.xmax  -- Lua C\nmesh.box.xmax  ! Fortran\n```\n\n## Using IREP for input decks\n\nIREP's main use is to allow multi-language (usually C, C++, and Fortran)\nintegrated codes to read Lua input files (\"input decks\" for those of use\nwho've been in the simulation field for a while). With the `wkt_mesh.h`\nwe've seen so far, we could write an input file like this:\n\n```lua\nmesh = {\n   file = 'my_mesh',\n   refinement_level = 1,\n   amr = true,\n   box = {\n      nx = 100,\n      ny = 100,\n      nz = 100,\n   },\n}\n```\n\nNote that the `xmin`, `xmax`, `ymin`, `ymax`, `zmin`, and `zmax` fields\nin `box` are not defined in the input, but they will take on the default\nvalues from the `wkt_mesh.h` header.\n\nIf you want to read this input file from `C`, you could write some code\nlike this:\n\n```c\n#include \"ir_extern.h\"\n#include \"wkt_mesh.h\"\n#include \"lua.h\"\n\nint main(int argc, char **argv) {\n    // set up lua and load some lua code\n    lua_State *L = luaL_newstate();\n    luaL_openlibs(L);\n    luaL_loadfile(L, \"mesh_example.lua\");\n\n    ir_read(L, \"mesh\");\n    printf(\"mesh.box.xmax = %d\\n\", mesh.box.xmax);\n    printf(\"mesh.box.ymax = %d\\n\", mesh.box.ymax);\n    printf(\"mesh.box.zmax = %d\\n\", mesh.box.zmax);\n```\n\nThis sets up an embedded Lua interpreter, loads the Lua input file, and\nthen reads WKT values out of the native Lua tables and into a global\n`mesh` structure that can be accessed from `C`.\n\n## Authors\n\nIREP was created by Lee Busby, busby1@llnl.gov.\n\nThanks also to `irep`'s\n[contributors](https://github.com/LLNL/irep/graphs/contributors)!.\n\n## License\n\nIREP is distributed under the terms of the MIT license. Copyrights in the\nIREP project are retained by contributors. No copyright assignment is\nrequired to contribute to IREP. All new contributions must be made under\nthe MIT license.\n\nSee [LICENSE](https://github.com/LLNL/irep/blob/master/LICENSE) and\n[NOTICE](https://github.com/LLNL/irep/blob/master/NOTICE) for details.\n\nSPDX-License-Identifier: MIT\n\nLLNL-CODE-702338\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fllnl%2Firep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fllnl%2Firep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fllnl%2Firep/lists"}