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.1.1.tar.gz (10.6 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.1.1-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for csgmsh-0.1.1.tar.gz
Algorithm Hash digest
SHA256 de3c07392b54304a35beb08602d2b9b5c5687dfb923d4ab3368392162507a01f
MD5 1e2d4531fdde52a66e214ad4643771a4
BLAKE2b-256 2891bd8e7ef2c348c8c880f9fddbf7f4db36d48a5ee79394e5534715195498f4

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for csgmsh-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 253e30202d6ed540de93315b43f68649f78d68d268e27f378da5a92ba86ed8b5
MD5 d497fab515d07597dd9dbfd1cf224f63
BLAKE2b-256 bbf43d335a03951e8d8a562bd17fcbee897e8a8d48a3403128ae10e331a5d832

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