{"id":25730340,"url":"https://github.com/qtiptip/thbsplines","last_synced_at":"2025-07-23T19:33:52.047Z","repository":{"id":83435197,"uuid":"156692006","full_name":"qTipTip/THBSplines","owner":"qTipTip","description":"Truncated Hierarchical B-Splines in Python","archived":false,"fork":false,"pushed_at":"2020-05-14T09:52:35.000Z","size":3819,"stargazers_count":13,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-07T14:11:19.256Z","etag":null,"topics":["finite-element-method","python3","splines"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qTipTip.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-11-08T10:48:15.000Z","updated_at":"2025-04-18T10:06:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"f29c084c-1273-4a86-b85a-063b6b21d757","html_url":"https://github.com/qTipTip/THBSplines","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/qTipTip/THBSplines","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qTipTip%2FTHBSplines","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qTipTip%2FTHBSplines/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qTipTip%2FTHBSplines/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qTipTip%2FTHBSplines/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qTipTip","download_url":"https://codeload.github.com/qTipTip/THBSplines/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qTipTip%2FTHBSplines/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266738316,"owners_count":23976416,"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-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["finite-element-method","python3","splines"],"created_at":"2025-02-26T01:47:27.137Z","updated_at":"2025-07-23T19:33:52.031Z","avatar_url":"https://github.com/qTipTip.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# THBSplines\n\n## Truncated Hierarchical B-Splines in Python\n\nThis repository contains a dimension-independent Python-implementation of truncated hierarchical B-splines, and methods for the assembly of stiffness\nand mass matrices. The code is currently in a fairly undocumented state, and may contain bugs - so use at your own discretion.\n\nThe implementation is based on the article [Algorithms for the implementation of adaptive isogeometric methods using hierarchical B-splines](https://doi.org/10.1016/j.apnum.2017.08.006),\nand is heavily influenced by the [GeoPDEs](http://rafavzqz.github.io/geopdes/) Matlab/Octave package for isogeometric analysis developed by the authors.\n\n## Example - computing the mass and stiffness matrix\n\nThe computation of finite element matrices is fairly simple. Initialize the hierarchical space. Refine the space by choosing specific elements, or a rectangular region of refinement, and finally, assemble the matrices.\n\n```python\nimport THBSplines as thb\nimport matplotlib.pyplot as plt\n\n# Initialize a biquadraic space of Truncated Hierarchical B-Splines\nknots = [\n  [0, 0, 1/3, 2/3, 1, 1],\n  [0, 0, 1/3, 2/3, 1, 1]\n]\ndegrees = [2, 2]\ndimension = 2\nT = thb.HierarchicalSpace(knots, degrees, dimension)\n\n# Select cells to refine at each level, either by explicitly marking the elements, or by choosing a rectangular region.\ncells_to_refine = {}\ncells_to_refine[0] = [0, 1, 2, 3, 4, 5, 6]\nT = thb.refine(T, cells_to_refine)\n\nrect = np.array([[0, 1 / 3], [0, 2 / 3]])\ncells_to_refine[1] = T.refine_in_rectangle(rect, level = 1)\nT = thb.refine(T, cells_to_refine)\nT.mesh.plot_cells()\n```\n\n![](THBSplines/images/refined_mesh.png)\n\n```python\n# If no integration order is specified, exact gauss quadrature suitable for the given basis is used.\nmass_matrix = thb.hierarchical_mass_matrix(T)\nstiffness_matrix = thb.hierarchical_stiffness_matrix(T)\n\nplt.spy(mass_matrix, markersize=1)\nplt.show()\n```\n\n![](THBSplines/images/mass_matrix.png)\n\n## Installation\n\nSimply clone or download the repository and execute\n\n```shell\npip install .\n```\n\nfrom the root directory. Verify the installation by calling \n\n```shell\npytest\n```\nfrom the root directory. \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqtiptip%2Fthbsplines","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqtiptip%2Fthbsplines","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqtiptip%2Fthbsplines/lists"}