Skip to main content

Constructive Solid Geometry helper for Gmsh

Project description

Constructive Solid helper for Gmsh

This project is an opinionated helper tool that aims to provide a high level Python API for 2D/3D Constructive Solid Geometry modelling, which is a very convenient way of defining geometries using boolean operations. A typical script looks like this:

from csgmsh import mesh, shape, field

rect = shape.Rectangle()
circ = shape.Circle(center=[1,1], radius=.5)

mesh.write(
    output_path = "demo.msh",
    physical_groups = {
        "domain": rect - circ,
        "top-right": rect.top | circ.boundary | rect.right,
        "bottom-left": rect.left | rect.bottom,
    },
    mesh_size = field.Threshold(
        d=field.Distance(rect.bottom),
        dmin=0, vmin=.01,
        dmax=.5, vmax=.1),
)

Context: gmsh supports GSG modelling via its OpenCASCADE kernel. Unfortunately it is set up in a way that makes it difficult to keep track of boundary segments, which is crucial for computational applications. Csgmsh fixes this by assuming that the (undocumented) order in which boundary entities are provided is stable, and keeps track of how these boundaries are subdivided via the BooleanFragments operation.

This project is very much a work in progress and the API may change extensively pre-1.0, so be sure to pin it to a version if you find a use for it.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

csgmsh-0.3.1.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

csgmsh-0.3.1-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file csgmsh-0.3.1.tar.gz.

File metadata

  • Download URL: csgmsh-0.3.1.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.20

File hashes

Hashes for csgmsh-0.3.1.tar.gz
Algorithm Hash digest
SHA256 f5160e3543e56ed03462ccfab17e722dd7a0cc42acc982d58d62f5f8bf954100
MD5 f29ce7e25a3e41b19e0fa6be9592ff95
BLAKE2b-256 f8cb8a2577ea1b09343ec440d34cc3339d5bf8cd2112a7be80f436a0c127929e

See more details on using hashes here.

File details

Details for the file csgmsh-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: csgmsh-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.20

File hashes

Hashes for csgmsh-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 98be770277ec893ae39c963dedeb60b0208bda3755189c733dc492d87ebd89f0
MD5 5f4c43b1732b42cfdaf43fbef22f7d1c
BLAKE2b-256 6d302c3e8f3dc0c6cb4926b270dc0acb4af45727f4bbb8f052e0997fac1bc165

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page