Пример #1
0
def postprocess(custom_config):
    """
    Configure and then run the postprocessor

    Args:
        custom_config, dict The custom configuration dictionary
    """
    signature = __name__ + '.postprocess(custom_config)'
    logger = logging.getLogger(__name__)
    utility.log_entrance(logger, signature,
                        {'custom_config': custom_config})

    if not custom_config:
        custom_config = {}

    hdf5_file = utility.get_setting(settings.HDF5_FILE, custom_config, 'HDF5_FILE')
    utility.check_is_file(hdf5_file, 'The path to the hdf5 file configured by HDF5_FILE')

    #utility.validate_file(hdf5_file, 'HDF5_FILE')
    with h5py.File(hdf5_file, "a") as hdf5_db:
        run(hdf5_db, custom_config)

    utility.log_and_print(logger, 'The post processing results are saved in the hdf5 file '
                          + utility.get_abs(hdf5_file))

    utility.log_exit(logging.getLogger(__name__), signature, [None])
Пример #2
0
def postprocess(custom_config):
    """
    Configure and then run the postprocessor

    Args:
        custom_config, dict The custom configuration dictionary
    """
    signature = __name__ + '.postprocess(custom_config)'
    logger = logging.getLogger(__name__)
    utility.log_entrance(logger, signature, {'custom_config': custom_config})

    if not custom_config:
        custom_config = {}

    hdf5_file = utility.get_setting(settings.HDF5_FILE, custom_config,
                                    'HDF5_FILE')
    utility.check_is_file(hdf5_file,
                          'The path to the hdf5 file configured by HDF5_FILE')

    #utility.validate_file(hdf5_file, 'HDF5_FILE')
    with h5py.File(hdf5_file, "a") as hdf5_db:
        run(hdf5_db, custom_config)

    utility.log_and_print(
        logger, 'The post processing results are saved in the hdf5 file ' +
        utility.get_abs(hdf5_file))

    utility.log_exit(logging.getLogger(__name__), signature, [None])
Пример #3
0
def solve(custom_config):
    """
    Configure and then run the solver

    Args:
        custom_config, dict The custom configuration dictionary
    Returns:
        the output of the fortran function as string if successful
    """

    signature = __name__ + '.solve(custom_config)'
    logger = logging.getLogger(__name__)
    utility.log_entrance(logger, signature, {'custom_config': custom_config})

    if not custom_config:
        custom_config = {}

    hdf5_file = utility.get_setting(settings.HDF5_FILE, custom_config,
                                    'HDF5_FILE')
    utility.check_is_file(hdf5_file,
                          'The path to the hdf5 file configured by HDF5_FILE')

    n_tabulatedx = utility.get_setting(settings.GREEN_TABULATION_NUMX,
                                       custom_config, 'GREEN_TABULATION_NUMX')

    n_tabulatedz = utility.get_setting(settings.GREEN_TABULATION_NUMZ,
                                       custom_config, 'GREEN_TABULATION_NUMZ')

    n_points_simpson = utility.get_setting(
        settings.GREEN_TABULATION_SIMPSON_NPOINTS, custom_config,
        'GREEN_TABULATION_SIMPSON_NPOINTS')

    with h5py.File(hdf5_file, "a") as hdf5_db:
        if n_tabulatedx and n_tabulatedx > 0:
            dset = utility.require_dataset(
                hdf5_db,
                structure.H5_SOLVER_GREEN_TABULATION_NUMX, (1, ),
                dtype='i')
            dset[:] = n_tabulatedx

        if n_tabulatedz and n_tabulatedz > 0:
            dset = utility.require_dataset(
                hdf5_db,
                structure.H5_SOLVER_GREEN_TABULATION_NUMZ, (1, ),
                dtype='i')
            dset[:] = n_tabulatedz

        if n_points_simpson and n_points_simpson > 0:
            dset = utility.require_dataset(
                hdf5_db,
                structure.H5_SOLVER_GREEN_TABULATION_SIMPSON_NPOINTS, (1, ),
                dtype='i')
            dset[:] = n_points_simpson

        return run(hdf5_db)
Пример #4
0
def solve(custom_config):
    """
    Configure and then run the solver

    Args:
        custom_config, dict The custom configuration dictionary
    Returns:
        the output of the fortran function as string if successful
    """

    signature = __name__ + '.solve(custom_config)'
    logger = logging.getLogger(__name__)
    utility.log_entrance(logger, signature,
                        {'custom_config': custom_config})

    if not custom_config:
        custom_config = {}

    hdf5_file = utility.get_setting(settings.HDF5_FILE, custom_config, 'HDF5_FILE')
    utility.check_is_file(hdf5_file, 'The path to the hdf5 file configured by HDF5_FILE')

    n_tabulatedx = utility.get_setting(settings.GREEN_TABULATION_NUMX, custom_config,
                                       'GREEN_TABULATION_NUMX')

    n_tabulatedz = utility.get_setting(settings.GREEN_TABULATION_NUMZ, custom_config,
                                       'GREEN_TABULATION_NUMZ')

    

    n_points_simpson = utility.get_setting(settings.GREEN_TABULATION_SIMPSON_NPOINTS, custom_config,
                                           'GREEN_TABULATION_SIMPSON_NPOINTS')

    with h5py.File(hdf5_file, "a") as hdf5_db:
        if n_tabulatedx and n_tabulatedx > 0:
            dset = utility.require_dataset(hdf5_db, structure.H5_SOLVER_GREEN_TABULATION_NUMX, (1, ), dtype='i')
            dset[:] = n_tabulatedx

        if n_tabulatedz and n_tabulatedz > 0:
            dset = utility.require_dataset(hdf5_db, structure.H5_SOLVER_GREEN_TABULATION_NUMZ, (1, ), dtype='i')
            dset[:] = n_tabulatedz

        if n_points_simpson and n_points_simpson > 0:
            dset = utility.require_dataset(hdf5_db, structure.H5_SOLVER_GREEN_TABULATION_SIMPSON_NPOINTS, (1, ), dtype='i')
            dset[:] = n_points_simpson

        return run(hdf5_db)