TTFEMesh
TTFEMesh is a Python library for generating tensor train representations of finite element meshes. It provides a comprehensive toolkit for creating domains, generating meshes, and computing tensorized Jacobians, Dirichlet masks, and concatenation maps, all of which are essential for solving partial differential equations using tensor train decompositions.
Features
- Domain creation and manipulation
- Finite element mesh generation
- Tensor train representation of mesh components
- Computation of tensorized Jacobians
- Dirichlet boundary condition handling
- Concatenation map generation
- Integration with the
torchttpackage for TT decompositions - Support for 2D domains and meshes
- Flexible and extensible architecture
Installation
Platform Support
TTFEMesh is currently only supported on Linux systems due to dependencies on the torchtt package. For other platforms (macOS, Windows), we recommend using Docker.
Linux Installation
- Install system dependencies:
sudo apt-get update
sudo apt-get install -y libblas-dev liblapack-dev
- Install the package:
pip install ttfemesh
Quick Start
Here's a simple example to get you started:
from ttfemesh.domain import RectangleFactory, CurveConnection2D, DirichletBoundary2D, Domain2D
from ttfemesh.quadrature import GaussLegendre2D
from ttfemesh.mesh import DomainBilinearMesh2D
# Create a domain with two rectangles
rectangle1 = RectangleFactory.create((0, 0), (2, 1))
rectangle2 = RectangleFactory.create((2, 0), (3, 1))
# Connect the rectangles
edge = CurveConnection2D([0, 1], [1, 3])
# Set boundary conditions
bc = DirichletBoundary2D([(0, 3), (1, 1)])
# Create the domain
domain = Domain2D([rectangle1, rectangle2], [edge], bc)
# Generate a mesh
order = 1
qrule = GaussLegendre2D(order)
mesh_size_exponent = 3
mesh = DomainBilinearMesh2D(domain, qrule, mesh_size_exponent)
# Get tensorized components
subdmesh = mesh.get_subdomain_mesh(0)
jac_tts = subdmesh.get_jacobian_tensor_trains()
jac_dets = subdmesh.get_jacobian_det_tensor_trains()
jac_invdets = subdmesh.get_jacobian_invdet_tensor_trains()
# Get element to global index map
element2global_map = mesh.get_element2global_index_map()
# Get Dirichlet masks and concatenation maps
masks = mesh.get_dirichlet_masks()
concat_maps = mesh.get_concatenation_maps()
Documentation
For detailed documentation, including API reference and examples, visit our documentation.
Requirements
- Python >= 3.10, < 3.13
- Linux operating system (or Docker)
- BLAS and LAPACK libraries (system dependencies)
- torchtt (for tensor train operations)
- Other dependencies listed in
requirements.txt
Contributing
We welcome contributions! Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.
License
TTFEMesh is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for ttfemesh 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ttfemesh-0.1.3.tar.gz | 32.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ttfemesh-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 72.6 kB
Release files / ttfemesh-0.1.3.tar.gz
| Download URL | ttfemesh-0.1.3.tar.gz |
|---|---|
| Size | 32.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
75f93e982ee5f42dc690cb2931fe59bb6d5069cedd495685f037764ed233ddcb
|
|
BLAKE2b-256 checksum How to use checksums |
0b6da0750e2a17f2b1a6bbf19ef15a79866531f4a33a44ddcd5313ab48fe70e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.10
|
Release files / ttfemesh-0.1.3-py3-none-any.whl
| Download URL | ttfemesh-0.1.3-py3-none-any.whl |
|---|---|
| Size | 40.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c7f3984ce1b19d4c0cd061c81276d90bcc7ac1759b70cd890a75f9c52b567071
|
|
BLAKE2b-256 checksum How to use checksums |
1fc0ab8be23ed213c8de1b4e9e32f6c13e89a031f2af19ed2c52925f1791c4f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.10
|