Quick start guide
Installation
To install the package, use pip:
pip install AutoRPE
Basic Usage
Once installed, you can start using the package. Here’s a simple example:
from AutoRPE.UtilsRPE.ImplementRPE import Implement_RPE
from AutoRPE.Scripts.ImplementRPEtoSource import load_list_of_files_to_keep_unmodified
import AutoRPE.UtilsRPE.VariablePrecision as VariablePrecision
from shutil import rmtree
from pathlib import Path
# Define path of the pre-processed sources of the Fortran code
input_dir = "my/input/sources/dir"
# Define path of the directory where the rpe-sources will be written
output_dir = "my/output/sources/dir"
# Define path to the database
database_path = "path/to/database"
# Define of the file to store the namelist of precisions
namelist_path = "path/to/namelist"
files_to_keep_unmodified = []
# Optional: add file that contains a list of files that should not be modified by the tool
path_to_list_of_files = "list/of/files/not/to/modify"
files_to_keep_unmodified = load_list_of_files_to_keep_unmodified(path_to_list_of_files)
# Create directory of the rpe-sources
if output_dir.exists():
rmtree(output_dir)
output_dir.mkdir(parents=True)
# Set working precision to "double precision"
VariablePrecision.set_working_precision('dp')
# Create database and generate the namelist of the precisions of the variables
vault = Implement_RPE(path_to_input_sources = str(input_dir),
path_to_output_sources = str(output_dir),
blacklist = files_to_keep_unmodified)
vault.generate_namelist_precisions(str(namelist_path))
vault.save(str(database_path))
This creates a directory containing the pre-processed source files with the implemented emulator, a namelist file (namelist_path) specifying the precisions of all real variables found in the source files (input_dir), and a database (vault, stored at database_path). The database contains detailed information about the sources, including functions, subroutines, interfaces, variables, and all associated dependencies.
And that’s it! Check out the full documentation for more details.
What’s Next?
For more elaborate examples, see Examples.
For API documentation, see Python API.