Newer
Older
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Bootstrap script to create a new mesh based on the CORE 2 Resolution.
Dr. Paul Gierz, Jan 2020
"""
import os
import shutil
if __name__ == "__main__":
print(80*"=")
print("Starting generation of a mesh: {{cookiecutter.mesh_name}}.")
print(40*"- ")
print("Gathering input data:")
if not os.path.exists("./raw_input_data"):
os.makedirs("./raw_input_data")
shutil.copyfile("{{cookiecutter.input_fpath}}", "./raw_input_data/{{cookiecutter.input_fname}}")
print(40*"- ")
print("* MATLAB Part:")
os.system("matlab.sh -s -S\"--mem=36000\" -M\"-nodisplay -r run('mg_topo_prep_triangle_input.m')\"")
os.system("matlab.sh -s -S\"--mem=36000\" -M\"-nodisplay -r run('mg_coastline.m')\"")
os.rename("{{cookiecutter.mesh_name}}_cst.txt", "mesh_CORE2_{{cookiecutter.mesh_name}}/{{cookiecutter.mesh_name}}_cst.txt")
# TODO: Get count from the other python script and write it somewhere
# TODO: C reads count from the file just written...
print(40*"- ")
print("* Triangle Part:")
os.system("sbatch -W run_triangle.sh")
print("Finished!")
print("You should now inspect your mesh!")
print(80*"=")