{"id":21969367,"url":"https://github.com/pawelkn/rainflow","last_synced_at":"2025-04-27T07:17:46.647Z","repository":{"id":143147962,"uuid":"486594009","full_name":"pawelkn/rainflow","owner":"pawelkn","description":"A C++ implementation of the ASTM E1049-85 rain flow cycle counting algorithm for fatigue analysis","archived":false,"fork":false,"pushed_at":"2024-01-04T13:58:34.000Z","size":55,"stargazers_count":7,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-27T07:17:37.782Z","etag":null,"topics":["astm","astm-e1049-85","crack","fatigue","fatigue-analysis","fatigue-crack-growth","metal-fatigue","rainflow","rainflow-counting","rainflow-cycles"],"latest_commit_sha":null,"homepage":"","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/pawelkn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2022-04-28T12:55:09.000Z","updated_at":"2025-02-17T05:15:53.000Z","dependencies_parsed_at":"2024-01-04T15:04:27.254Z","dependency_job_id":null,"html_url":"https://github.com/pawelkn/rainflow","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pawelkn%2Frainflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pawelkn%2Frainflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pawelkn%2Frainflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pawelkn%2Frainflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pawelkn","download_url":"https://codeload.github.com/pawelkn/rainflow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251099763,"owners_count":21536159,"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":["astm","astm-e1049-85","crack","fatigue","fatigue-analysis","fatigue-crack-growth","metal-fatigue","rainflow","rainflow-counting","rainflow-cycles"],"created_at":"2024-11-29T14:19:14.420Z","updated_at":"2025-04-27T07:17:46.624Z","avatar_url":"https://github.com/pawelkn.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"Rainflow\n========\n\n[![Test rainflow](https://github.com/pawelkn/rainflow/actions/workflows/test.yml/badge.svg)](https://github.com/pawelkn/rainflow/actions/workflows/test.yml)\n\n`rainflow` is a C++ implementation of the ASTM E1049-85 rain flow cycle counting\nalgorithm for fatigue analysis. It is based on Python library [rainflow](https://github.com/iamlikeme/rainflow)\n\nThe implementation consists of a single header `rainflow.h` and source file `rainflow.cpp` and has zero dependencies.\n\nUsage\n-----\n\nFunction `RainFlow::count_cycles` returns a map of ranges and the corresponding number of cycles.\n\nIt takes two arguments:\n\n* `RainFlow::Series series` - an input vector of samples to process,\n* `double binSize` - (optional) specifies the width of each cycle-counting bin\n\nReturns a `RainFlow::Counts` map.\n\nExample:\n\n```cpp\n#include \"rainflow.h\"\n\nint main()\n{\n    RainFlow::Series series { -2, 1, -3, 5, -1, 3, -4, 4, -2 };\n    auto counts = RainFlow::count_cycles( series, 2.0 );\n    /* counts:\n        { 2, 0.0 },\n        { 4, 2.0 },\n        { 6, 0.5 },\n        { 8, 1.0 },\n        { 10, 0.5 }\n    */\n}\n```\n\nIt is possible to obtain full information about each cycle using an `extract_cycles` function.\n\nIt takes a single argument:\n\n* `RainFlow::Series series` - an input vector of samples to process\n\nReturns a `RainFlow::Cycles` vector of `RainFlow::Cycle` structs.\n`RainFlow::Cycle` struct has fields: `range`, `mean`, `count`, `start_index` and `end_index`.\n\nExample:\n\n```cpp\n#include \"rainflow.h\"\n\nint main()\n{\n    RainFlow::Series series { -2, 1, -3, 5, -1, 3, -4, 4, -2 };\n    auto cycles = RainFlow::extract_cycles( series );\n    /* cycles:\n        { 3, -0.5, 0.5, 0, 1 },\n        { 4, -1.0, 0.5, 1, 2 },\n        { 4, 1.0, 1.0, 4, 5 },\n        { 8, 1.0, 0.5, 2, 3 },\n        { 9, 0.5, 0.5, 3, 6 },\n        { 8, 0.0, 0.5, 6, 7 },\n        { 6, 1.0, 0.5, 7, 8 }\n    */\n}\n```\n\nRunning example\n-----\n\nBuild and run the example using `docker`:\n\n```sh\ndocker build -t rainflow .\ndocker run --rm rainflow\n```\n\nor locally:\n\n```sh\ncmake -S . -B build\ncmake --build build\nbuild/example_rainflow example/samples.txt\n```\n\nRunning tests\n-----\n\nBuild and run unit tests using `docker`:\n\n```sh\ndocker build -t rainflow .\ndocker run --rm rainflow build/test_rainflow\n```\n\nor locally:\n\n```sh\ncmake -S . -B build\ncmake --build build\nbuild/test_rainflow\n```\n\nTo run tests locally the [GoogleTest](https://github.com/google/googletest) library is required. Under linux it can be installed via package manager eg.:\n\n```sh\napt-get install -y libgtest-dev\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpawelkn%2Frainflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpawelkn%2Frainflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpawelkn%2Frainflow/lists"}