The NekPy wrapper is designed to mimic the library structure of Nektar++, with directories
for the LibUtilities
, SpatialDomains
and StdRegions
libraries. This is a deliberate design
decision, so that classes and definitions in Nektar++ can be easily located inside
NekPy.
There are also some other directories and files:
LibUtilities/Python/NekPyConfig.hpp is a convenience header that all .cpp
files should import. It sets appropriate namespaces and defines commonly used
macros.
cmake/python contains templates for init.py
and setup.py
files which every
Python package should contain,
cmake/ThirdPartyPython.cmake is a CMake configuration file which searches
for Python and prepares make
targets for installing NekPy.
Figure 20.1 shows the location of Python wrapper files within Nektar++ structure.
Every sub-module of Nektar++ hosts an additional folder for Python files and the
structure of the Python folder mimics the structure of the sub-module itself, as
shown on the left of the figure with LibUtilities
sub-module. Individual .cpp
files, such as Expansion.cpp
contain the wrappers for classes and methods from
corresponding Nektar++ library files whereas .cpp
files named after sub-modules (e.g.
LibUtilities.cpp
) contain PYBIND11_MODULE
definitions which create package modules (e.g.
NekPy.LibUtilities
).