Skip to main content

A tool for building DSLs for scientific purposes.

Project description

https://cdn.rawgit.com/gpkc/ELLIPTIc/master/logo.png

https://img.shields.io/pypi/v/elliptic.svg https://travis-ci.org/padmec-reservoir/ELLIPTIc.svg?branch=master https://readthedocs.org/projects/elliptic/badge/?version=latest https://coveralls.io/repos/github/padmec-reservoir/ELLIPTIc/badge.svg?branch=master https://api.codacy.com/project/badge/Grade/025660097e6a41fa9fa6fa590ef28148 https://img.shields.io/badge/license-MIT-blue.svg

https://cdn.rawgit.com/gpkc/ELLIPTIc/master/pic.png

Description

ELLIPTIc, The ExtensibLe LIbrary for Physical simulaTIons, is a library / framework for creating reusable and extensible Domain Specific Languages (DSL) for scientific purposes.

ELLIPTIc’s workflow is as follows:

  • An ELLIPTIc DSL contract is created to define how the DSL syntax looks like. This DSL contract defines the operations that will be available when using the DSL.

  • A DSL implementation is built based on the DSL contract. The DSL implementation tells ELLIPTIc how to generate the corresponding Cython code.

  • When using ELLIPTIc-based DSLs, a tree-like intermediate representation is built.

  • This intermediate representation is used together with the DSL implementation to generate Cython code.

DSL Syntax

ELLIPTIc-based DSLs use a Fluent Interface syntax. This allows for elegant development of algorithms.

Below is an example of how using an ELLIPTIc-based DSL to iterate in a unstructured mesh would look like:

dsl = DSL(...)  # Instatiating a DSL object


with dsl.root() as root:
    all_ents = root.Entities(dim=3).Adjacencies(bridge_dim=2, to_dim=3)  # Operation chaining
    internal_ents = all_ents.Where(boundary=False)  # Continuing an operation chain
    boundary_ents = all_ents.Where(boundary=True)  # Operation branching

    perm_ents = internal_ents.GetField(name="permeability")
    dirichlet = boundary_ents.GetField(name="dirichlet")
    neumann = boundary_ents.GetField(name="neumann")

dsl.get_built_module().run()  # Run the generated Cython code

It is also possible to export the intermediate representation to a image file, allowing for visual debugging:

https://cdn.rawgit.com/gpkc/ELLIPTIc/master/tree_example.png

Documentation

Please refer to the documentation page.

Testing

Run python setup.py test.

Building and installing

Run python setup.py build and python setup.py install.

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

ELLIPTIc-1.0.1.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

ELLIPTIc-1.0.1-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file ELLIPTIc-1.0.1.tar.gz.

File metadata

  • Download URL: ELLIPTIc-1.0.1.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ELLIPTIc-1.0.1.tar.gz
Algorithm Hash digest
SHA256 558146659eb7f7b355bc75fefc6365c2f63b2b98e69e2c7a9a916139dd40e22e
MD5 6456f6dabf770f84b5fb629b4e4f2807
BLAKE2b-256 fa79400348f3ca271d16edb284e8f951d5b8d9ab0b26f3a139dfee31f9a8473f

See more details on using hashes here.

File details

Details for the file ELLIPTIc-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ELLIPTIc-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d55dc2999357f8adf59443adff7dd1dbee98e282458eb7ce01fc553e43a7cbfd
MD5 7642a9cd75ffb775c7946b3a4aa36379
BLAKE2b-256 f665e3f540f50e15075d85a2c807dd48e8b7978848c93431b080980ade049d06

See more details on using hashes here.

Supported by

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