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

Uploaded Python 3

File details

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

File metadata

  • Download URL: csgmsh-0.3.0.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.0.tar.gz
Algorithm Hash digest
SHA256 63831538282b0049aea7c15ae76b603851507c595c83749767aac8efd89ade0f
MD5 f023059a12229ea926f2465346b383b7
BLAKE2b-256 a3112818e314e7c3e829dd0efd136c6ab573dc5b4a9e636a330df43f5af7afa0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: csgmsh-0.3.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c853fa7ece7038bdec7bc39e61e62addf9ec78b418cf0474a9d8cc87e03a6c56
MD5 ded43e4d0e74672d9789abe02beded3d
BLAKE2b-256 a9bffe5dbc2df8f36bd71532079086f819760ff3d3425676dfbb602fba1c8a5a

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