Name | polyquad JSON |
Version |
1.2.5
JSON |
| download |
home_page | None |
Summary | Frugal generation of quadrature for polytopal domain |
upload_time | 2024-12-06 17:38:02 |
maintainer | christophe langlois |
docs_url | None |
author | christophe langlois, thijs van putten, hadrien beriot, elke deckers |
requires_python | <3.13 |
license | MIT License Copyright (c) 2024 KU Leuven Mecha(tro)nic System Dynamics (LMSD) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
quadrature
cubature
integration
scheme
polygon
polyhedron
polytope
polytopal
polytopic
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
polyquad
========
Frugal generation of quadrature for polytopal domains
Python package associated with [this paper](https://link.springer.com/article/10.1007/s00366-024-02080-1).
About
-----
polyquad is a tool that generates quadratures (or cubatures) for non
necessarily convex polytopal domains. Important points:
- the distribution of points is **shape independent**
- the number of integration points depends **only** on the polynomial
order of the integrand
- expensive operations (QR decomposition) are done **only once per
polynomial order**, their results are reused from one shape to the
other
- integration points are defined on a bounding box encapsulating the
polytope (and can thus **fall outside of the polytope**), so the
integrand should be defined there as well.
## Installation
The package is deployed on pypi, so it can be installed simply using pip
```
pip install polyquad
```
*Note:* this package depends on `numba`. It seems that, at the moment,
it's not compatible with the latest python (3.13). Therefore you may
need to revert to an older python for a while.
## Usage
For a basic usage you have at your disposal 2 functions:
- `polyquad.get_quadrature_2d`
- `polyquad.get_quadrature_3d`
These should behave nicely as long as you feed them the right data
structures. We will explain these just after. Before we need to talk
about mapping.
### Mapping
Both `polyquad.get_quadrature_2d` and `polyquad.get_quadrature_3d`
come with an argument `mapping` which should be either True or False
(False is default).
I you use this library, chances are you already have a `bounding box`
concept in your code, thus your polytope is probably already lying in
its bounding box if so put `mapping = False` (or don't specify
anything as False is the default value) to avoid useless mappings.
On the contrary maybe you polytope isn't already in the reference
bounding box, in that case you should specify `mapping = True`.
### `polyquad.get_quadrature_2d`
As the name suggests, the function should be used to get quadratures
over a 2d polygon. Let us tackle the case of a simple pentagon:
We first need to declare the coordinates of vertices
```
verts = np.array(((1,-1), (-1,0), (0,3), (2,3), (3,0)))
```
Then we need to specify the ordering of vertices, which is quite
straightforward in that case
```
face = np.array((0,1,2,3,4))
```
Then, getting the quadrature for a polynomial order `k` is as simple as
```
points, weights = polyquad.get_quadrature_2d(k, verts, face, mapping = True)
```
### `polyquad.get_quadrature_3d`
This one is for polyhedra. The only difference lies the declaration of
faces. For sake of simplicity we here give the example of a simple
pyramid (this library is intended to be used with way more complex
polyhedra)
Again we first declare the coordinates of vertices
```
verts = np.array(((0, 0, 0),
(1, 0, 0),
(1, 1, 0),
(0, 1, 0),
(.5, .5, 1)))
```
Then we need to declare each planar face. A planar face is defined by
the list of the index of vertices comprising it. For example the
square base of the pyramid contains the four first vertices defined
above, so it is defined as : `[0,1,2,3]`
This is done for each face and gathered in a list of list as follows:
```
faces = [[0,1,2,3],
[0,1,4],
[1,2,4],
[2,3,4],
[3,0,4]]
```
**Note**: if the faces of the polyhedron all have the same number of
vertices then `faces` can be casted to a `np.array` of shape (number of
faces, number of vertices per face). This slightly speeds up the
computation.
## cite this work
If you use this code for you work, you are kindly invited to cite the
associated paper
```
@article{langlois2024,
title= {Frugal numerical integration scheme for polytopal domains},
author= {Langlois,C. and van Putten,T. and B\'eriot,H. and Deckers,E.},
journal= {Engineering with computers},
doi={https://doi.org/10.1007/s00366-024-02080-1},
url = {https://link.springer.com/article/10.1007/s00366-024-02080-1}
}
```
<hr/>
Feedback and comments can be addressed to corresponding authors
of the paper.
Raw data
{
"_id": null,
"home_page": null,
"name": "polyquad",
"maintainer": "christophe langlois",
"docs_url": null,
"requires_python": "<3.13",
"maintainer_email": "christophe.langlois@kuleuven.be",
"keywords": "quadrature, cubature, integration, scheme, polygon, polyhedron, polytope, polytopal, polytopic",
"author": "christophe langlois, thijs van putten, hadrien beriot, elke deckers",
"author_email": "christophe.langlois@kuleuven.be",
"download_url": "https://files.pythonhosted.org/packages/87/f4/5e9b2b8cbc12e1c8ccfbbc0ef82fff1ca881dca3b31cfb1ca8c79e471072/polyquad-1.2.5.tar.gz",
"platform": null,
"description": "polyquad\n========\nFrugal generation of quadrature for polytopal domains\n\nPython package associated with [this paper](https://link.springer.com/article/10.1007/s00366-024-02080-1).\n\nAbout\n-----\npolyquad is a tool that generates quadratures (or cubatures) for non\nnecessarily convex polytopal domains. Important points:\n- the distribution of points is **shape independent**\n- the number of integration points depends **only** on the polynomial\n order of the integrand\n- expensive operations (QR decomposition) are done **only once per\n polynomial order**, their results are reused from one shape to the\n other\n- integration points are defined on a bounding box encapsulating the\n polytope (and can thus **fall outside of the polytope**), so the\n integrand should be defined there as well.\n\n\n## Installation\n\nThe package is deployed on pypi, so it can be installed simply using pip\n\n```\npip install polyquad\n```\n\n*Note:* this package depends on `numba`. It seems that, at the moment,\nit's not compatible with the latest python (3.13). Therefore you may\nneed to revert to an older python for a while.\n\n## Usage\nFor a basic usage you have at your disposal 2 functions:\n- `polyquad.get_quadrature_2d`\n- `polyquad.get_quadrature_3d`\n\nThese should behave nicely as long as you feed them the right data\nstructures. We will explain these just after. Before we need to talk\nabout mapping.\n\n### Mapping\nBoth `polyquad.get_quadrature_2d` and `polyquad.get_quadrature_3d`\ncome with an argument `mapping` which should be either True or False\n(False is default).\n\nI you use this library, chances are you already have a `bounding box`\nconcept in your code, thus your polytope is probably already lying in\nits bounding box if so put `mapping = False` (or don't specify\nanything as False is the default value) to avoid useless mappings.\n\nOn the contrary maybe you polytope isn't already in the reference\nbounding box, in that case you should specify `mapping = True`.\n\n### `polyquad.get_quadrature_2d`\nAs the name suggests, the function should be used to get quadratures\nover a 2d polygon. Let us tackle the case of a simple pentagon:\n\nWe first need to declare the coordinates of vertices\n\n```\nverts = np.array(((1,-1), (-1,0), (0,3), (2,3), (3,0)))\n```\n\nThen we need to specify the ordering of vertices, which is quite\nstraightforward in that case\n\n```\nface = np.array((0,1,2,3,4))\n```\n\nThen, getting the quadrature for a polynomial order `k` is as simple as\n\n```\npoints, weights = polyquad.get_quadrature_2d(k, verts, face, mapping = True)\n```\n\n### `polyquad.get_quadrature_3d`\nThis one is for polyhedra. The only difference lies the declaration of\nfaces. For sake of simplicity we here give the example of a simple\npyramid (this library is intended to be used with way more complex\npolyhedra)\n\nAgain we first declare the coordinates of vertices\n\n```\nverts = np.array(((0, 0, 0),\n (1, 0, 0),\n (1, 1, 0),\n (0, 1, 0),\n (.5, .5, 1)))\n```\n\nThen we need to declare each planar face. A planar face is defined by\nthe list of the index of vertices comprising it. For example the\nsquare base of the pyramid contains the four first vertices defined\nabove, so it is defined as : `[0,1,2,3]`\nThis is done for each face and gathered in a list of list as follows:\n\n```\nfaces = [[0,1,2,3],\n [0,1,4],\n [1,2,4],\n [2,3,4],\n [3,0,4]]\n```\n\n**Note**: if the faces of the polyhedron all have the same number of\nvertices then `faces` can be casted to a `np.array` of shape (number of\nfaces, number of vertices per face). This slightly speeds up the\ncomputation.\n\n## cite this work\n\nIf you use this code for you work, you are kindly invited to cite the\nassociated paper\n```\n@article{langlois2024,\n\ttitle= {Frugal numerical integration scheme for polytopal domains},\n\tauthor= {Langlois,C. and van Putten,T. and B\\'eriot,H. and Deckers,E.},\n\tjournal= {Engineering with computers},\n\tdoi={https://doi.org/10.1007/s00366-024-02080-1},\n\turl = {https://link.springer.com/article/10.1007/s00366-024-02080-1}\n\t}\n```\n\n<hr/> \n\nFeedback and comments can be addressed to corresponding authors\nof the paper.\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 KU Leuven Mecha(tro)nic System Dynamics (LMSD) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"summary": "Frugal generation of quadrature for polytopal domain",
"version": "1.2.5",
"project_urls": {
"Homepage": "https://github.com/LMSD-KULeuven/polyquad"
},
"split_keywords": [
"quadrature",
" cubature",
" integration",
" scheme",
" polygon",
" polyhedron",
" polytope",
" polytopal",
" polytopic"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5c5210bb5003046d4e207d3a0c1e559fe938011ac7db5533d5619819746615a7",
"md5": "d532a409087e2bbe5daaf57b17dad3a5",
"sha256": "65a963f0fcd9e2a342c7763ed707b63a0c71cef3b1b305793c5bb907c3ffc06a"
},
"downloads": -1,
"filename": "polyquad-1.2.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d532a409087e2bbe5daaf57b17dad3a5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.13",
"size": 13291,
"upload_time": "2024-12-06T17:38:01",
"upload_time_iso_8601": "2024-12-06T17:38:01.450245Z",
"url": "https://files.pythonhosted.org/packages/5c/52/10bb5003046d4e207d3a0c1e559fe938011ac7db5533d5619819746615a7/polyquad-1.2.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "87f45e9b2b8cbc12e1c8ccfbbc0ef82fff1ca881dca3b31cfb1ca8c79e471072",
"md5": "160e91aaf0f8648c7641ee728573a964",
"sha256": "012b1a32c7e11d062f72d7dfaf04a94e4e811da382f40761c3e2ece71f204809"
},
"downloads": -1,
"filename": "polyquad-1.2.5.tar.gz",
"has_sig": false,
"md5_digest": "160e91aaf0f8648c7641ee728573a964",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13",
"size": 13756,
"upload_time": "2024-12-06T17:38:02",
"upload_time_iso_8601": "2024-12-06T17:38:02.656758Z",
"url": "https://files.pythonhosted.org/packages/87/f4/5e9b2b8cbc12e1c8ccfbbc0ef82fff1ca881dca3b31cfb1ca8c79e471072/polyquad-1.2.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-06 17:38:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "LMSD-KULeuven",
"github_project": "polyquad",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "polyquad"
}