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('demo.msh',
    groups = {
        'domain': rect - circ,
        'top-right': rect.top | circ.boundary | rect.right,
        'bottom-left': rect.left | rect.bottom,
    },
    elemsize = 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.2.0.tar.gz (10.7 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.2.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for csgmsh-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f64de736b2f25077be235f123ec2ae505f4b2ccf8dcce9816a3619071c1b17eb
MD5 524ef31589581ecc2c474689b1795315
BLAKE2b-256 b8fc99cc76c13f60b73eda2dfebb23f0c0c7f3e28b521b8b89fe65e38ecba711

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for csgmsh-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 155ea7648856f514cb7009191caf941754d5ddd988b5988b2551a57061960a44
MD5 58a39b1d24dd0578a0a9a2f9f58388f6
BLAKE2b-256 deb3c6cb62dd864ded7fc3b21d8d0dd67e33f9562c60c00652def57e31092035

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