Skip to main content

Domain-specific language for developing partial differential equation solvers

Project description

XGrid

Installation

pip install xgrid

Test

Invoke python3 test.py in the root folder to perform the test cases.

Usage

See document for more information. Let's start with a simple kernel, the element-wise multiplication of two grid:

import xgrid
import numpy as np
import random

xgrid.init()

fvec = xgrid.grid[float, 1]

@xgrid.kernel()
def elementwise_mul(result: fvec, a: fvec, b: fvec) -> None:
    result[0] = a[0] * b[0]

and let's define some data:

a = xgrid.Grid((10000, ), float)
b = xgrid.Grid((10000, ), float)

for i in range(10000):
    a[i] = random.random()
    b[i] = random.random()

and the result:

result = xgrid.Grid((10000, ), float)

and invoke the kernel:

elementwise_mul(result, a, b)

We could check the result using numpy dot:

assert np.sum(result.now) == np.dot(a.now, b.now)

Examples

Solve the 2D Cavity flow with xgrid, see in examples folder.

cavity

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

xgrid-0.0.3.tar.gz (801.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xgrid-0.0.3-py3-none-any.whl (26.4 kB view details)

Uploaded Python 3

File details

Details for the file xgrid-0.0.3.tar.gz.

File metadata

  • Download URL: xgrid-0.0.3.tar.gz
  • Upload date:
  • Size: 801.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for xgrid-0.0.3.tar.gz
Algorithm Hash digest
SHA256 3e6ea4fea6bcf2a02081974b0cfcdc68739fbcf4bb3084b5eb45d2fd6fa90e1a
MD5 1b72c4c6f514795d0b5c591bc3327b93
BLAKE2b-256 a295b91947da2fffbb75ebf68df8c8971bf9b1913d49d88c93aa9602dad4ff3f

See more details on using hashes here.

File details

Details for the file xgrid-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: xgrid-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 26.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for xgrid-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d9f0a9479c73d7b6f4014f03050e619727b32affbad64f5effde4a644b55380d
MD5 7ef14fa00b6a3e9e6d2b49cc8dbe9d00
BLAKE2b-256 3fa0f4c3bd54a7617ef9ca7c3798d12423e5b17762979c114fae08675d137d29

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