Skip to content
Snippets Groups Projects
Commit 62e0cc07 authored by Dave Moxey's avatar Dave Moxey
Browse files

Tidying

parent 6916179e
No related branches found
No related tags found
No related merge requests found
......@@ -5,36 +5,38 @@ spectral/_hp_ element framework. **As a disclaimer, thhese wrappings are
_experimental_ and _incomplete_.** You should not rely on their current
structure and API remaining unchanged.
Currently, representative classes from the `LibUtilities`, `StdRegions` and
`SpatialDomains` classes have been wrapped in order to show the
proof-of-concept. This allows us to write scripts such as
Currently, representative classes from the `LibUtilities`, `StdRegions`,
`SpatialDomains` and `LocalRegions` libraries have been wrapped in order to show
the proof-of-concept.
# Features and functionality
`NekPy` uses the `Boost.Python` library to provide a set of high-quality,
hand-written Python bindings for selected functions and classes in Nektar++. A
typical snippet could look something like
typical snippet could look something like:
```python
from NekPy.LibUtilities import PointsKey, PointsType, BasisKey, BasisType
from NekPy.LibUtilities import StdQuadExp
from NekPy.StdRegions import StdQuadExp
import numpy as np
numModes = 8
numPts = 9
ptsKey = PointsKey(numPts, PointsType.GaussLobattoLegendre)
basisKey = BasisKey(BasisType.Modified_A, numModes, ptsKey)
quadExp = StdQuadExp(basisKey, basisKey)
x, y = StdQuadExp.GetCoords()
x, y = quadExp.GetCoords()
fx = np.sin(x) * np.cos(y)
proj = quadExp.FwdTrans(fx)
```
`NekPy` also uses the `Boost.NumPy` library, contained in Boost 1.63+, to
`NekPy` uses the `Boost.NumPy` library, contained in Boost 1.63+, to
automatically convert C++ `Array<OneD, >` objects to and from the commonly-used
`numpy.ndarray` object, which makes the integration more seemless between Python
`numpy.ndarray` object, which makes the integration more seamless between Python
and C++.
# How do I wrap things?
`Boost.Python` is pretty comprehensive package and an extended discussion is
`Boost.Python` is a pretty comprehensive package and an extended discussion is
really beyond the scope of this project. See `doc/wrapping-guide.md` for some
basic concepts and frequently-encountered issues.
......@@ -140,8 +142,8 @@ with a sample mesh `newsquare_2x2.xml`:
- `StdProject.py` shows how to use some of the `StdRegions` wrappers and
duplicates the functionality of `Basis.py` using the `StdExpansion` class. Run
this as `python StdProject.py`.
- Finally, `MeshGraph.py` loads a mesh and prints out some basic properties of
its quadrilateral elements. Run it as `python MeshGraph.py newsquare_2x2.xml`.
- `MeshGraph.py` loads a mesh and prints out some basic properties of its
quadrilateral elements. Run it as `python MeshGraph.py newsquare_2x2.xml`.
If you want to modify the source files, it's advisable to edit them in the
`examples` directory and re-run `make install`, otherwise local changes will be
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment