Install

Default pip install installs serial MFEM + wrapper

$ pip install mfem --no-binary mfem

For other configuration such as parallel version, one has to download
the package and run setup script. pip download command download tar-gziped
package.

$ pip download mfem --no-binary mfem

Once the package is expanded, enter the package directory and
use the setup.py on the top level. For example, --with-parallel option,
it build MFEM in both serial and parallel and build wrapper. It also
download Metis and Hypre for parallel MFEM.

Note: python3 setup.py instal is deprecated. A recommended way is to use
python -m pip install. Translation is straighforward.

(old) python setup.py install --with-parallel
(new) python -m pip install ./ --install-option="--with-parallel"

One can also specify the MFEM installed in other location using
--mfem-prefix=<xxxx>. This will regenerate the SWIG wrapper. Or
you can use --mfem-prefix-no-swig=<xxxx> to reuse the wrapper code
distributed with this package

setup.py allows various options. Some examples are listed below.
Use -help to see the full list.

$ python setup.py install --help


* building external (metis/hypre/mfem)
(old) $ python3 setup.py install --prefix=~/sandbox --verbose --ext-only --with-parallel

* building PyMFEM (after --ext-only)
(old) python3 setup.py install --prefix=~/sandbox --verbose --skip-ext --with-parallel
(new) python -m pip install ./ --verbose --install-option="--mfem-branch=master" --install-option="--mfem-source=external/mfem" --install-option="--skip-ext" --install-option="--with-parallel"

* run swig
(old) python3 setup.py install --prefix=~/sandbox --verbose --skip-ext --with-parallel --swig
(new) python -m pip install ./ --verbose --install-option="--mfem-branch=master" --install-option="--mfem-source=external/mfem" --install-option="--swig" --install-option="--with-parallel"

* clean up all externals
$ python3 setup.py clean --all-externals

* choosing compiler
$ python setup.py install --parallel --CC=xxx, --CXX=xxx, --MPICC=xxx, --MPICXX=xxx

* build with a specific mfem branch
$ python setup.py install --mfem-branch="mfem-4.3-dev"


* cuda
$ python3 setup.py install  --prefix=~/sandbox  --verbose --with-cuda

* libceed
** download libceed and build
$ python3 setup.py install  --with-libceed --libceed-only

** download/build libceed and build mfem serial (to turn on CEED in MFEM)
$ python3 setup.py install  --with-libceed --ext-only


Note Cuda support is only partially tested. One may want to build it step-by-step.
# build MFEM library with cuda
$ python3 setup.py install  --prefix=~/sandbox  --verbose --ext-only --with-cuda (--with-parallel)
# build Wrapper
$ python3 setup.py install  --prefix=~/sandbox  --verbose --skip-ext --with-cuda
# One may need to regenerate wrapper
$ touch mfem/*/*.i
$ python3 setup.py install  --prefix=~/sandbox  --verbose --swig





