The preprocessor, txpp.py, processes macros by substitution, giving numerical values that can be interpreted by Vorpal. However, there are times when one wuld like to selective process, e.g., one might like expand all of the algorithms in order to substitute others or to access features that are not yet exposed in Visual Setup, or to combine algorithms in new and creative ways. Selective processing, slso known as partial preprocessing, allows one to do this. With selective processing one substitutes only a subset of the macros that txpp.py normally substitutes.
Default Selective Processing¶
Default selective processing is set to process as much as possible while still being able to have a final processing. As usual, one must set up paths by doing,
on Linux:
source /path/to/vsim/VSimComposer.sh
on MacOS:
source /Applications/VSim-*/VSimComposer.app/Contents/Resources/VSimComposer.sh
on Windows:
\path\to\vsim\setupCmdEnv.bat
Then proceed with the default selective processing on Windows by
python -m txppp -n simnameT.pre simname
If on Mac or linux use
txppp.py -n simnameT.pre simname
This gives the default text-based input file, simnameT.pre, that one can further modify. A good practice is to copy simnameT.pre to simnameM.pre and modify the second one, so that if one changes simname.sdf, one can re-create simnameT.pre and merge in any differences to simnameM.pre.
Custom Selective Processing¶
The preprocessor, txpp.py, can also perform selective processing
using the --selective
flag to process a subset of the macros.
At present, this has been tested on files that were generated
from visual setup.
Running txpp.py with the selective option, e.g.
txpp.py --selective=fn input.pre -o input.ppp
expands the macros listed in the file named, fn. With
txpp.py --selective="" input.pre -o input.ppp
the file, expandmacros.txt, will be sought. It finds the file by following the usual import path, which includes the macros directory in which there is expandmacros.txt, containing, e.g.,
$ cat expandmacros.txt
# Below are the write macros that must be expanded
writeGrid
writeMultiField
writeEsFieldUpdaterBlock
writeParticleSpeciesBlock
writeImpactColliderBlock
writeParticleAbsorberEmitterHistoryBlock
# Below or the variables that must be expanded
VPMT_NDIM # Expanded for clean limits
VPMT_INCLUDE_PARTICLES # Remove condition blocks depending on this
# Add more expansions here
To have more macros or variables expanded, copy this file next to your input file and edit it to add all the macros you want expanded, one per line.
By this method you should be able to arbitrarily morph an sdf-generated pre file to any .ppp file that is between the sdf-written pre file and the final .in file. One can then run vorpal using the ppp file as input, or one can further or fully process the ppp file.