Commit 194894e2 authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Create executable guess_resources script

parent 69751ef1
Loading
Loading
Loading
Loading
+71 −0
Original line number Diff line number Diff line
#!/usr/bin/env python3

#   Copyright (C) 2026   INAF - Osservatorio Astronomico di Cagliari
#
#   This program is free software: you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#   
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#   
#   A copy of the GNU General Public License is distributed along with
#   this program in the COPYING file. If not, see: <https://www.gnu.org/licenses/>.

## @package guess_resources
#  \brief Script to estimate the computational cost of a model.
#
#  Script to assist in the creation of model input files starting
#  from a YAML descriptor.
#
#  The script requires python3.

import math
from sys import argv

## \cond
__version__ = "0.10.10"
## \endcond

## \brief Main execution code.
#
# `main()` is the function that handles the creation of the code configuration.
# It returns an integer value as exit code, using 0 to signal successful execution.
#
# \returns result: `int` Exit code (0 = SUCCESS).
def main():
    result = 0
    config = parse_arguments()
    if config['version_mode']:
        print("guess_resources.py v%s."%__version__)
        exit(0)
    elif (config['help_mode']):
        print_help()
    else:
        # Will do something here.
    return result

def print_help():
    print("###############################################           ")
    print("#                                             #           ")
    print("#           NPTM_code MODEL_MAKER             #           ")
    print("#                                             #           ")
    print("###############################################           ")
    print("                                                          ")
    print("Create input files for FORTRAN and C++ code.              ")
    print("                                                          ")
    print("Usage: \"./model_maker.py CONFIG [OPTIONS]\"              ")
    print("                                                          ")
    print("CONFIG must be a valid YAML configuration file.           ")
    print("                                                          ")
    print("Valid options are:                                        ")
    print("--help                Print this help and exit.           ")
    print("--version             Print script version and exit.      ")
    print("                                                          ")

## \brief Exit code (0 for success).
exit_code = main()
exit(exit_code)