Generate C/C++ Code from Tensor Expression and So On
-
Install free Wolfram Engine for Devolopers from https://www.wolfram.com/developer/. (If you are rich, you can install the totally worth-it Mathematica instead, versions that support
wolframscript.) -
Download xAct from http://www.xact.es and install it properly.
-
clone repo:
git clone https://github.com/lwJi/Generato.git -
set enviroment variable:
export GENERATO="/your/repo/path"
- Small toy
cd test/CarpetX
Generato test.wl- GHG formulation of Einstein's equations
Please take a look at the example script for GHG system: test/Nmesh/GHG_rhs.ipynb. Or
cd test/Nmesh
Generato GHG_rhs.wl- Use lower case to name variables (to aviod conflict with say
Pi)
-
Use
SetEQNDelayedif your right-hand side (rhs) includes anIfstatement to handle different component cases. Otherwise,SetEQNis preferred because it has an option,CheckRHS, which checks if all the terms appearing in the rhs are well-defined. -
IsDefined[term]is very useful for debugging.