#!/usr/bin/env bash

# https://hub.docker.com/r/mwolleben/openems 1.3G
# https://github.com/tclin0122/openEMS_docker
exit

VERSION=$(lastversion --format version  thliebig/openEMS-Project)
# 0.0.36-93 2023

# freia/forky
VTK_VER=9

sudo apt-get install \
  build-essential \
  cmake \
  git \
  libhdf5-dev \
  libboost-all-dev \
  libcgal-dev \
  libtinyxml-dev \
  qtbase5-dev \
  libvtk${VTK_VER}-dev \
  libvtk${VTK_VER}-qt-dev

# Optional: Install octave and octave devel packages:
sudo apt-get install octave liboctave-dev

# Optional: For the package hyp2mat you need additonal dependencies:
sudo apt-get install gengetopt help2man groff pod2pdf bison flex libhpdf-dev libtool

# Optional: For python interface
sudo pip install numpy matplotlib cython h5py

# Clone, build and install

# Clone this repository, build openEMS and install e.g. to “~/opt/openEMS”:

git clone --recursive https://github.com/thliebig/openEMS-Project.git

cd openEMS-Project

./update_openEMS.sh ~/opt/openEMS

# Optional: Build all including hyp2mat, CTB and python:
./update_openEMS.sh ~/opt/openEMS --with-hyp2mat --with-CTB --python

# update_openEMS
# cd openEMS-Project
# git pull --recurse-submodules
# ./update_openEMS.sh ~/opt/openEMS --python


# Instructions how to install the CSXCAD & openEMS Octave/Matlab interface.
# To run the simulation scripts it is necessary to tell Octave (or Matlab) where to find the interface scripts.
# On Linux these folders are usually located under e.g. /usr/share/openEMS/matlab and /usr/share/CSXCAD/matlab 
# or if you installed from source (e.g. to /opt) under /opt/share/openEMS/matlab and /opt/share/CSXCAD/matlab. 
# You may add this folders manually using:

addpath('/opt/share/openEMS/matlab');
addpath('/opt/share/CSXCAD/matlab');

Alternatively you can setup these path more permanently using the “Edit”-Menu using “Set Path” in Octave.


# Instructions how to install the CSXCAD & openEMS python interface.
# Additionally Cython is required to compile CSXCAD and openEMS e.g. on Linux.
pip install cython

# Build or update CSXCAD and openEMS using the “–python” flag (Recommended). See Install from Source for more details.
./update_openEMS.sh ~/opt/openEMS --python

# 
