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.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-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for csgmsh-0.1.tar.gz
Algorithm Hash digest
SHA256 44c0c575b88383457297365fb5e4e37c7d10de4cf4b079d9b428a20ef5673f4e
MD5 8d4f9e8992e42c155217fa54f142679a
BLAKE2b-256 8da240a99fbcc1b152fe0f1b3d8e58503e2155b3a708bd0ab93b163b408daaab

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for csgmsh-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7bcc127ae0811eefffd020b881a0b71118575d3a34f6b4df2530daf7f12ebdb7
MD5 11259728924cc94e10f3acfcba468d39
BLAKE2b-256 ceaf6060ee54aca4b3e773681f5f36d5744057104a79788abc3d025e4ee418a9

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