diff --git a/CMakeLists.txt b/CMakeLists.txt index 11fb0814..569e3bcf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,12 +99,12 @@ ecbuild_add_option( FEATURE HEALPIX_EXAMPLES ### Definitions used by the output manager ecbuild_add_option( FEATURE OUTPUT_MANAGER - DEFAULT ON + DEFAULT ON DESCRIPTION "Build the output manager" ) ecbuild_add_option( FEATURE OUTPUT_MANAGER_ENCODER_REPORT CONDITION HAVE_OUTPUT_MANAGER - DEFAULT OFF + DEFAULT OFF DESCRIPTION "Enable generation of the encoding report" ) ecbuild_add_option( FEATURE OUTPUT_MANAGER_TOOL @@ -114,7 +114,7 @@ ecbuild_add_option( FEATURE OUTPUT_MANAGER_TOOL ### export package info set( MULTIO_CONFIG_DIR share/multio/config ) -set( MULTIOM_CONFIG_DIR share/multiom ) +set( MULTIOM_CONFIG_DIR share/multiom ) set( MULTIO_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src ) set( MULTIO_LIBRARIES multio ) diff --git a/src/multiom/CMakeLists.txt b/src/multiom/CMakeLists.txt index ae38f6e4..cdcd81ef 100644 --- a/src/multiom/CMakeLists.txt +++ b/src/multiom/CMakeLists.txt @@ -101,6 +101,7 @@ set( DOFFSET " ") # # + ADD SUB-DIRECTORIES # ===================== +add_subdirectory( api ) add_subdirectory( common ) add_subdirectory( configuration ) add_subdirectory( containers ) @@ -123,6 +124,7 @@ add_subdirectory( tools ) # + ADD LOCAL FILES # ================= list( APPEND output_manager_src + ${MULTIOM_API_SOURCES} ${MULTIOM_COMMON_SOURCES} ${MULTIOM_CONFIGURATION_SOURCES} ${MULTIOM_CONTAINERS_SOURCES} diff --git a/src/multiom/api/CMakeLists.txt b/src/multiom/api/CMakeLists.txt new file mode 100644 index 00000000..1537e818 --- /dev/null +++ b/src/multiom/api/CMakeLists.txt @@ -0,0 +1,23 @@ +set(MULTIOM_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + +# Enter in the module +message("${OFFSET} + API sources: ${MULTIOM_API_DIR}") + +# Recursive print +set(OFFSET ${OFFSET}${DOFFSET}) + +# Collect source files in module2 +set( MULTIOM_API_SOURCES + ${MULTIOM_API_DIR}/api_wrapper_mod.F90 + CACHE INTERNAL "List of all sources in API directory" +) + +# Optionally, message what has been appended for debugging +foreach(source_file IN LISTS MULTIOM_API_SOURCES) + + # Extract the filename (without the directory) + get_filename_component(filename ${source_file} NAME) + + # Print the filename + message("${OFFSET} - ${filename}") +endforeach() \ No newline at end of file diff --git a/src/multiom/api/api_wrapper_mod.F90 b/src/multiom/api/api_wrapper_mod.F90 new file mode 100644 index 00000000..ac4bb206 --- /dev/null +++ b/src/multiom/api/api_wrapper_mod.F90 @@ -0,0 +1,401 @@ +! Include preprocessor utils +#include "output_manager_preprocessor_utils.h" +#include "output_manager_preprocessor_trace_utils.h" +#include "output_manager_preprocessor_logging_utils.h" +#include "output_manager_preprocessor_errhdl_utils.h" + + +#define PP_FILE_NAME 'api_wrapper_mod_mod.F90' +#define PP_SECTION_TYPE 'MODULE' +#define PP_SECTION_NAME 'GENERAL_UTILS_MOD' +MODULE API_WRAPPER_MOD + + ! USE :: ENCODERS_MAP_MOD, ONLY: ENCODERS_MAP_T + ! USE :: ENCODERS_MAP_MOD, ONLY: MARS_MAP_T + ! USE :: ENCODERS_MAP_MOD, ONLY: PAR_MAP_T + +IMPLICIT NONE + +!> Default visibility of the module +PRIVATE + +! In order to exchange data with c, we need to define the following maps +! TYPE(ENCODERS_MAP_T) :: ENCODERS_MAP +! TYPE(ENCODERS_MAP_T) :: MARS_MAP +! TYPE(ENCODERS_MAP_T) :: PAR_MAP + + +! Whitelist of public symbols +PUBLIC :: MULTIO_GRIB2_ENCODER_OPEN +PUBLIC :: MULTIO_GRIB2_ENCODER_CLOSE +PUBLIC :: MULTIO_GRIB2_ENCODER_ENCODE64 +PUBLIC :: MULTIO_GRIB2_ENCODER_ENCODE32 + +CONTAINS + +#define PP_PROCEDURE_TYPE 'FUNCTION' +#define PP_PROCEDURE_NAME 'TOUPPER' +PP_THREAD_SAFE FUNCTION MULTIO_GRIB2_ENCODER_OPEN( OPTIONS, MULTIO_GRIB2 ) & + BIND(C,NAME='multio_grib2_encoder_open') RESULT(RET) + + !> Symbols imported from intrinsic modules. + USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_INT + USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_PTR + USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_NULL_PTR + + ! Symbols imported from other modules within the project. + USE :: DATAKINDS_DEF_MOD, ONLY: JPIB_K + USE :: HOOKS_MOD, ONLY: HOOKS_T + + ! Symbols imported by the preprocessor for debugging purposes + PP_DEBUG_USE_VARS + + ! Symbols imported by the preprocessor for logging purposes + PP_LOG_USE_VARS + + ! Symbols imported by the preprocessor for tracing purposes + PP_TRACE_USE_VARS + +IMPLICIT NONE + + !> Dummy arguments + TYPE(C_PTR), VALUE, INTENT(IN) :: OPTIONS + TYPE(C_PTR), INTENT(INOUT) :: MULTIO_GRIB2 + + !> Function result + INTEGER(KIND=C_INT) :: RET + + ! Local variables declared by the preprocessor for debugging purposes + PP_DEBUG_DECL_VARS + + ! Local variables declared by the preprocessor for logging purposes + PP_LOG_DECL_VARS + + ! Local variables declared by the preprocessor for tracing purposes + PP_TRACE_DECL_VARS + + ! Trace begin of procedure + PP_TRACE_ENTER_PROCEDURE() + + ! Initialization of good path return value + PP_SET_ERR_SUCCESS( RET ) + + + ! Trace end of procedure (on success) + PP_TRACE_EXIT_PROCEDURE_ON_SUCCESS() + + ! Exit point (On success) + RETURN + +! Error handler +PP_ERROR_HANDLER + + ! Initialization of bad path return value + PP_SET_ERR_FAILURE( RET ) + + ! TODO: Add error handling code here + + RETURN + +END FUNCTION MULTIO_GRIB2_ENCODER_OPEN +#undef PP_PROCEDURE_NAME +#undef PP_PROCEDURE_TYPE + + + +#define PP_PROCEDURE_TYPE 'FUNCTION' +#define PP_PROCEDURE_NAME 'TOUPPER' +PP_THREAD_SAFE FUNCTION MULTIO_GRIB2_ENCODER_CLOSE( MULTIO_GRIB2 ) & + BIND(C,NAME='multio_grib2_encoder_close') RESULT(RET) + + !> Symbols imported from intrinsic modules. + USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_INT + USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_PTR + USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_NULL_PTR + + ! Symbols imported from other modules within the project. + USE :: DATAKINDS_DEF_MOD, ONLY: JPIB_K + USE :: HOOKS_MOD, ONLY: HOOKS_T + + ! Symbols imported by the preprocessor for debugging purposes + PP_DEBUG_USE_VARS + + ! Symbols imported by the preprocessor for logging purposes + PP_LOG_USE_VARS + + ! Symbols imported by the preprocessor for tracing purposes + PP_TRACE_USE_VARS + +IMPLICIT NONE + + !> Dummy arguments + TYPE(C_PTR), VALUE, INTENT(IN) :: MULTIO_GRIB2 + + !> Function result + INTEGER(KIND=C_INT) :: RET + + ! Local variables declared by the preprocessor for debugging purposes + PP_DEBUG_DECL_VARS + + ! Local variables declared by the preprocessor for logging purposes + PP_LOG_DECL_VARS + + ! Local variables declared by the preprocessor for tracing purposes + PP_TRACE_DECL_VARS + + ! Trace begin of procedure + PP_TRACE_ENTER_PROCEDURE() + + ! Initialization of good path return value + PP_SET_ERR_SUCCESS( RET ) + + + ! Trace end of procedure (on success) + PP_TRACE_EXIT_PROCEDURE_ON_SUCCESS() + + ! Exit point (On success) + RETURN + +! Error handler +PP_ERROR_HANDLER + + ! Initialization of bad path return value + PP_SET_ERR_FAILURE( RET ) + + ! TODO: Add error handling code here + + RETURN + +END FUNCTION MULTIO_GRIB2_ENCODER_CLOSE +#undef PP_PROCEDURE_NAME +#undef PP_PROCEDURE_TYPE + + +#define PP_PROCEDURE_TYPE 'FUNCTION' +#define PP_PROCEDURE_NAME 'MULTIO_GRIB2_ENCODER_ENCODE64' +PP_THREAD_SAFE FUNCTION MULTIO_GRIB2_ENCODER_ENCODE64( MULTIO_GRIB2, MARS_DICT, PAR_DICT, VALUES, DATA_LEN, GRIB_HANDLE ) & + BIND(C,NAME='multio_grib2_encoder_encode64') RESULT(RET) + + !> Symbols imported from intrinsic modules. + USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_DOUBLE + USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_INT + USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_PTR + USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_LONG_LONG + USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_NULL_PTR + USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_ASSOCIATED + USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_F_POINTER + + ! Symbols imported from other modules within the project. + USE :: DATAKINDS_DEF_MOD, ONLY: JPIB_K + USE :: HOOKS_MOD, ONLY: HOOKS_T + + ! Symbols imported by the preprocessor for debugging purposes + PP_DEBUG_USE_VARS + + ! Symbols imported by the preprocessor for logging purposes + PP_LOG_USE_VARS + + ! Symbols imported by the preprocessor for tracing purposes + PP_TRACE_USE_VARS + +IMPLICIT NONE + + !> Dummy arguments + TYPE(C_PTR), VALUE, INTENT(IN) :: MULTIO_GRIB2 + TYPE(C_PTR), VALUE, INTENT(IN) :: MARS_DICT + TYPE(C_PTR), VALUE, INTENT(IN) :: PAR_DICT + TYPE(C_PTR), VALUE, INTENT(IN) :: VALUES + INTEGER(KIND=C_INT), VALUE, INTENT(IN) :: DATA_LEN + TYPE(C_PTR), VALUE, INTENT(IN) :: GRIB_HANDLE + + !> Function result + INTEGER(KIND=C_INT) :: RET + + !> Local variables + REAL(KIND=C_DOUBLE), DIMENSION(:), POINTER :: VALUES_ARRAY32 + INTEGER(KIND=C_LONG_LONG), POINTER :: ENCODER_ID + INTEGER(KIND=C_LONG_LONG), POINTER :: MARS_ID + INTEGER(KIND=C_LONG_LONG), POINTER :: PAR_ID + + !> Local error flags + INTEGER(KIND=JPIB_K), PARAMETER :: ERRFLAG_WRONG_DATA_LEN=1_JPIB_K + INTEGER(KIND=JPIB_K), PARAMETER :: ERRFLAG_VALUES_IS_NULL_POINTER=2_JPIB_K + INTEGER(KIND=JPIB_K), PARAMETER :: ERRFLAG_MULTIO_GRIB2_IS_NULL_POINTER=3_JPIB_K + INTEGER(KIND=JPIB_K), PARAMETER :: ERRFLAG_MARS_DICT_IS_NULL_POINTER=4_JPIB_K + INTEGER(KIND=JPIB_K), PARAMETER :: ERRFLAG_PAR_DICT_IS_NULL_POINTER=5_JPIB_K + INTEGER(KIND=JPIB_K), PARAMETER :: ERRFLAG_GRIB_HANDLE_IS_NULL_POINTER=6_JPIB_K + + ! Local variables declared by the preprocessor for debugging purposes + PP_DEBUG_DECL_VARS + + ! Local variables declared by the preprocessor for logging purposes + PP_LOG_DECL_VARS + + ! Local variables declared by the preprocessor for tracing purposes + PP_TRACE_DECL_VARS + + ! Trace begin of procedure + PP_TRACE_ENTER_PROCEDURE() + + ! Initialization of good path return value + RET = 0_C_INT + + !> Error handling + PP_DEBUG_CRITICAL_COND_THROW( DATA_LEN .LE. 0, ERRFLAG_WRONG_DATA_LEN ) + PP_DEBUG_CRITICAL_COND_THROW( .NOT.C_ASSOCIATED(VALUES), ERRFLAG_VALUES_IS_NULL_POINTER ) + PP_DEBUG_CRITICAL_COND_THROW( .NOT.C_ASSOCIATED(MULTIO_GRIB2), ERRFLAG_MULTIO_GRIB2_IS_NULL_POINTER ) + PP_DEBUG_CRITICAL_COND_THROW( .NOT.C_ASSOCIATED(MARS_DICT), ERRFLAG_MARS_DICT_IS_NULL_POINTER ) + PP_DEBUG_CRITICAL_COND_THROW( .NOT.C_ASSOCIATED(PAR_DICT), ERRFLAG_PAR_DICT_IS_NULL_POINTER ) + PP_DEBUG_CRITICAL_COND_THROW( .NOT.C_ASSOCIATED(GRIB_HANDLE), ERRFLAG_GRIB_HANDLE_IS_NULL_POINTER ) + + !> Cast the VALUES pointer to a real array + CALL C_F_POINTER( VALUES, VALUES_ARRAY32, [DATA_LEN] ) + + !> Get encoder handle from the c pointer + CALL C_F_POINTER( MULTIO_GRIB2, ENCODER_ID ) + + !> Get mars dictionary handle from the c pointer + CALL C_F_POINTER( MARS_DICT, MARS_ID ) + + !> Parameterization handle from the c pointer + CALL C_F_POINTER( PAR_DICT, PAR_ID ) + + !> + + ! Trace end of procedure (on success) + PP_TRACE_EXIT_PROCEDURE_ON_SUCCESS() + + ! Exit point (On success) + RETURN + +! Error handler +PP_ERROR_HANDLER + + ! Initialization of bad path return value + PP_SET_ERR_FAILURE( RET ) + + ! TODO: Add error handling code here + + RETURN + +END FUNCTION MULTIO_GRIB2_ENCODER_ENCODE64 +#undef PP_PROCEDURE_NAME +#undef PP_PROCEDURE_TYPE + + +#define PP_PROCEDURE_TYPE 'FUNCTION' +#define PP_PROCEDURE_NAME 'MULTIO_GRIB2_ENCODER_ENCODE32' +PP_THREAD_SAFE FUNCTION MULTIO_GRIB2_ENCODER_ENCODE32( MULTIO_GRIB2, MARS_DICT, PAR_DICT, VALUES, DATA_LEN, GRIB_HANDLE ) & + BIND(C,NAME='multio_grib2_encoder_encode32') RESULT(RET) + + !> Symbols imported from intrinsic modules. + USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_FLOAT + USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_INT + USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_PTR + USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_LONG_LONG + USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_NULL_PTR + USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_ASSOCIATED + USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_F_POINTER + + ! Symbols imported from other modules within the project. + USE :: DATAKINDS_DEF_MOD, ONLY: JPIB_K + USE :: HOOKS_MOD, ONLY: HOOKS_T + + ! Symbols imported by the preprocessor for debugging purposes + PP_DEBUG_USE_VARS + + ! Symbols imported by the preprocessor for logging purposes + PP_LOG_USE_VARS + + ! Symbols imported by the preprocessor for tracing purposes + PP_TRACE_USE_VARS + +IMPLICIT NONE + + !> Dummy arguments + TYPE(C_PTR), VALUE, INTENT(IN) :: MULTIO_GRIB2 + TYPE(C_PTR), VALUE, INTENT(IN) :: MARS_DICT + TYPE(C_PTR), VALUE, INTENT(IN) :: PAR_DICT + TYPE(C_PTR), VALUE, INTENT(IN) :: VALUES + INTEGER(KIND=C_INT), VALUE, INTENT(IN) :: DATA_LEN + TYPE(C_PTR), VALUE, INTENT(IN) :: GRIB_HANDLE + + !> Function result + INTEGER(KIND=C_INT) :: RET + + !> Local variables + REAL(KIND=C_FLOAT), DIMENSION(:), POINTER :: VALUES_ARRAY32 + INTEGER(KIND=C_LONG_LONG), POINTER :: ENCODER_ID + INTEGER(KIND=C_LONG_LONG), POINTER :: MARS_ID + INTEGER(KIND=C_LONG_LONG), POINTER :: PAR_ID + + !> Local error flags + INTEGER(KIND=JPIB_K), PARAMETER :: ERRFLAG_WRONG_DATA_LEN=1_JPIB_K + INTEGER(KIND=JPIB_K), PARAMETER :: ERRFLAG_VALUES_IS_NULL_POINTER=2_JPIB_K + INTEGER(KIND=JPIB_K), PARAMETER :: ERRFLAG_MULTIO_GRIB2_IS_NULL_POINTER=3_JPIB_K + INTEGER(KIND=JPIB_K), PARAMETER :: ERRFLAG_MARS_DICT_IS_NULL_POINTER=4_JPIB_K + INTEGER(KIND=JPIB_K), PARAMETER :: ERRFLAG_PAR_DICT_IS_NULL_POINTER=5_JPIB_K + INTEGER(KIND=JPIB_K), PARAMETER :: ERRFLAG_GRIB_HANDLE_IS_NULL_POINTER=6_JPIB_K + + ! Local variables declared by the preprocessor for debugging purposes + PP_DEBUG_DECL_VARS + + ! Local variables declared by the preprocessor for logging purposes + PP_LOG_DECL_VARS + + ! Local variables declared by the preprocessor for tracing purposes + PP_TRACE_DECL_VARS + + ! Trace begin of procedure + PP_TRACE_ENTER_PROCEDURE() + + ! Initialization of good path return value + RET = 0_C_INT + + !> Error handling + PP_DEBUG_CRITICAL_COND_THROW( DATA_LEN .LE. 0, ERRFLAG_WRONG_DATA_LEN ) + PP_DEBUG_CRITICAL_COND_THROW( .NOT.C_ASSOCIATED(VALUES), ERRFLAG_VALUES_IS_NULL_POINTER ) + PP_DEBUG_CRITICAL_COND_THROW( .NOT.C_ASSOCIATED(MULTIO_GRIB2), ERRFLAG_MULTIO_GRIB2_IS_NULL_POINTER ) + PP_DEBUG_CRITICAL_COND_THROW( .NOT.C_ASSOCIATED(MARS_DICT), ERRFLAG_MARS_DICT_IS_NULL_POINTER ) + PP_DEBUG_CRITICAL_COND_THROW( .NOT.C_ASSOCIATED(PAR_DICT), ERRFLAG_PAR_DICT_IS_NULL_POINTER ) + PP_DEBUG_CRITICAL_COND_THROW( .NOT.C_ASSOCIATED(GRIB_HANDLE), ERRFLAG_GRIB_HANDLE_IS_NULL_POINTER ) + + !> Cast the VALUES pointer to a real array + CALL C_F_POINTER( VALUES, VALUES_ARRAY32, [DATA_LEN] ) + + !> Get encoder handle from the c pointer + CALL C_F_POINTER( MULTIO_GRIB2, ENCODER_ID ) + + !> Get mars dictionary handle from the c pointer + CALL C_F_POINTER( MARS_DICT, MARS_ID ) + + !> Parameterization handle from the c pointer + CALL C_F_POINTER( PAR_DICT, PAR_ID ) + + !> + + ! Trace end of procedure (on success) + PP_TRACE_EXIT_PROCEDURE_ON_SUCCESS() + + ! Exit point (On success) + RETURN + +! Error handler +PP_ERROR_HANDLER + + ! Initialization of bad path return value + PP_SET_ERR_FAILURE( RET ) + + ! TODO: Add error handling code here + + RETURN + +END FUNCTION MULTIO_GRIB2_ENCODER_ENCODE32 +#undef PP_PROCEDURE_NAME +#undef PP_PROCEDURE_TYPE + + +END MODULE API_WRAPPER_MOD +#undef PP_SECTION_NAME +#undef PP_SECTION_TYPE +#undef PP_FILE_NAME \ No newline at end of file diff --git a/src/multiom/common/enumerators_mod.F90 b/src/multiom/common/enumerators_mod.F90 index b4022316..11bd36e7 100644 --- a/src/multiom/common/enumerators_mod.F90 +++ b/src/multiom/common/enumerators_mod.F90 @@ -1023,7 +1023,7 @@ MODULE ENUMERATORS_MOD PUBLIC :: CFLOATOPFUNCCALL2IFLOATOPFUNCCALL PUBLIC :: IIFACES2CIFACES PUBLIC :: CIFACES2IIFACES - PUBLIC :: IPREF2MSGTYPE + PUBLIC :: IPREFIX2IMSGTYPE PUBLIC :: IPREFIX2ILEVTYPE PUBLIC :: IPARAMTYPE2CPARAMTYPE PUBLIC :: CPARAMTYPE2IPARAMTYPE @@ -1031,8 +1031,8 @@ MODULE ENUMERATORS_MOD CONTAINS #define PP_PROCEDURE_TYPE 'FUNCTION' -#define PP_PROCEDURE_NAME 'IPREF2MSGTYPE' -PP_THREAD_SAFE FUNCTION IPREF2MSGTYPE( KPREF, MSGTYPE, HOOKS ) RESULT(RET) +#define PP_PROCEDURE_NAME 'IPREFIX2IMSGTYPE' +PP_THREAD_SAFE FUNCTION IPREFIX2IMSGTYPE( KPREF, MSGTYPE, HOOKS ) RESULT(RET) ! Symbols imported from other modules within the project. USE :: DATAKINDS_DEF_MOD, ONLY: JPIB_K @@ -1130,7 +1130,7 @@ PP_THREAD_SAFE FUNCTION IPREF2MSGTYPE( KPREF, MSGTYPE, HOOKS ) RESULT(RET) ! Exit point (on error) RETURN -END FUNCTION IPREF2MSGTYPE +END FUNCTION IPREFIX2IMSGTYPE #undef PP_PROCEDURE_NAME #undef PP_PROCEDURE_TYPE diff --git a/src/multiom/common/general_utils_mod.F90 b/src/multiom/common/general_utils_mod.F90 index 28086a44..0229a31d 100644 --- a/src/multiom/common/general_utils_mod.F90 +++ b/src/multiom/common/general_utils_mod.F90 @@ -22,11 +22,69 @@ MODULE GENERAL_UTILS_MOD PUBLIC :: READ_TYPE_FROM_ENV PUBLIC :: READ_YAML_FROM_ENV PUBLIC :: CUSTOM_FINDLOC +PUBLIC :: NEED_FIT_SPECTRUM PUBLIC :: TOLOWER PUBLIC :: TOUPPER CONTAINS + +#define PP_PROCEDURE_TYPE 'FUNCTION' +#define PP_PROCEDURE_NAME 'NEED_FIT_SPECTRUM' +PP_THREAD_SAFE FUNCTION NEED_FIT_SPECTRUM( NSMAX, LNFT, HOOKS ) RESULT(RET) + + ! Symbols imported from other modules within the project. + USE :: DATAKINDS_DEF_MOD, ONLY: JPIB_K + USE :: HOOKS_MOD, ONLY: HOOKS_T + + ! Symbols imported by the preprocessor for debugging purposes + PP_DEBUG_USE_VARS + + ! Symbols imported by the preprocessor for logging purposes + PP_LOG_USE_VARS + + ! Symbols imported by the preprocessor for tracing purposes + PP_TRACE_USE_VARS + +IMPLICIT NONE + + ! Dummy arguments + INTEGER(KIND=JPIB_K), INTENT(IN) :: NSMAX + LOGICAL, INTENT(OUT) :: LNFT + TYPE(HOOKS_T), INTENT(INOUT) :: HOOKS + + !> Function result + INTEGER(KIND=JPIB_K) :: RET + + ! Local variables declared by the preprocessor for debugging purposes + PP_DEBUG_DECL_VARS + + ! Local variables declared by the preprocessor for logging purposes + PP_LOG_DECL_VARS + + ! Local variables declared by the preprocessor for tracing purposes + PP_TRACE_DECL_VARS + + ! Trace begin of procedure + PP_TRACE_ENTER_PROCEDURE() + + ! Initialization of good path return value + PP_SET_ERR_SUCCESS( RET ) + + ! Check if the number of spectral coefficients is greater than 10 + LNFT = NSMAX .GT. 10 + + ! Trace end of procedure (on success) + PP_TRACE_EXIT_PROCEDURE_ON_SUCCESS() + + ! Exit point + RETURN + +END FUNCTION NEED_FIT_SPECTRUM +#undef PP_PROCEDURE_NAME +#undef PP_PROCEDURE_TYPE + + #define PP_PROCEDURE_TYPE 'FUNCTION' #define PP_PROCEDURE_NAME 'REPLACE_ENVVAR_IN_STRING' PP_THREAD_SAFE FUNCTION REPLACE_ENVVAR_IN_STRING( INPSTR, OUTSTR, HOOKS ) RESULT(RET) diff --git a/src/multiom/multiom_api.F90 b/src/multiom/multiom_api.F90 index 0fea1dc1..8c2052da 100644 --- a/src/multiom/multiom_api.F90 +++ b/src/multiom/multiom_api.F90 @@ -22,15 +22,44 @@ MODULE MULTIOM_API USE :: DATAKINDS_DEF_MOD, ONLY: JPRD_K ! Enumerators + USE :: ENUMERATORS_MOD, ONLY: REPRES_GAUSSIANGRID_E + USE :: ENUMERATORS_MOD, ONLY: REPRES_SPHERICALHARMONICS_E + USE :: ENUMERATORS_MOD, ONLY: VALUES_SP_E + USE :: ENUMERATORS_MOD, ONLY: VALUES_DP_E + USE :: ENUMERATORS_MOD, ONLY: ATM_MSG_E + USE :: ENUMERATORS_MOD, ONLY: WAM_MSG_E + + ! Enumerators utils + USE :: ENUMERATORS_MOD, ONLY: CPREFIX2IPREFIX USE :: ENUMERATORS_MOD, ONLY: IPREFIX2ILEVTYPE + USE :: ENUMERATORS_MOD, ONLY: IPREFIX2IMSGTYPE USE :: ENUMERATORS_MOD, ONLY: ILEVTYPE2CLEVTYPE + USE :: ENUMERATORS_MOD, ONLY: CLEVTYPE2ILEVTYPE USE :: ENUMERATORS_MOD, ONLY: IREPRES2CREPRES - USE :: ENUMERATORS_MOD, ONLY: VALUES_SP_E - USE :: ENUMERATORS_MOD, ONLY: VALUES_DP_E + USE :: ENUMERATORS_MOD, ONLY: CREPRES2IREPRES - ! ifs interface + ! ifs-interface (datatypes) + USE :: IFS_MSG_MOD, ONLY: OM_BASE_MSG_A USE :: IFS_MSG_MOD, ONLY: OM_ATM_MSG_T USE :: IFS_MSG_MOD, ONLY: OM_WAM_MSG_T + USE :: IFS_PAR_MOD, ONLY: PROC_TOPO_T + USE :: IFS_PAR_MOD, ONLY: MODEL_PAR_T + + USE :: IFS_PAR_SERIALIZATION_MOD, ONLY: MODEL_PAR_SERIAL_T + + USE :: IFS_TOC_MOD, ONLY: TOC_CONTAINER_T + USE :: IFS_TOC_MOD, ONLY: TOC_CREATE_NAME + USE :: IFS_TOC_MOD, ONLY: TOC_ENTRY_BASE_T + USE :: IFS_TOC_MOD, ONLY: TOC_SIM_INIT_T + USE :: IFS_TOC_MOD, ONLY: TOC_ATM_FIELD_T + USE :: IFS_TOC_MOD, ONLY: TOC_WAM_FIELD_T + USE :: IFS_TOC_MOD, ONLY: TOC_FLUSH_STEP_T + USE :: IFS_TOC_MOD, ONLY: TOC_FLUSH_STEP_RST_T + USE :: IFS_TOC_MOD, ONLY: TOC_FLUSH_LAST_STEP_T + USE :: IFS_TOC_MOD, ONLY: TOC_SIM_END_T + + + ! ifs-interface (utils) USE :: IFS_MSG_MOD, ONLY: MSG_PRINT_ATM USE :: IFS_MSG_MOD, ONLY: MSG_PRINT_WAM USE :: IFS_MSG_MOD, ONLY: MSG_CREATE_NAME @@ -38,12 +67,15 @@ MODULE MULTIOM_API USE :: IFS_MSG_MOD, ONLY: MSG_READ_ATM USE :: IFS_MSG_MOD, ONLY: MSG_READ_WAM USE :: IFS_MSG_MOD, ONLY: MSG_CLOSE - USE :: IFS_PAR_MOD, ONLY: PROC_TOPO_T - USE :: IFS_PAR_MOD, ONLY: MODEL_PAR_T + USE :: IFS_PAR_MOD, ONLY: PAR_CREATE_NAME USE :: IFS_PAR_MOD, ONLY: PAR_ROPEN USE :: IFS_PAR_MOD, ONLY: PAR_READ USE :: IFS_PAR_MOD, ONLY: PAR_CLOSE + + USE :: IFS_PAR_SERIALIZATION_MOD, ONLY: PAR_SERIALIZE + USE :: IFS_PAR_SERIALIZATION_MOD, ONLY: PAR_DESERIALIZE + USE :: IFS_VAL_MOD, ONLY: VAL_CREATE_NAME USE :: IFS_VAL_MOD, ONLY: VAL_ROPEN USE :: IFS_VAL_MOD, ONLY: VAL_READ_SP @@ -51,16 +83,7 @@ MODULE MULTIOM_API USE :: IFS_VAL_MOD, ONLY: VAL_READ_DP USE :: IFS_VAL_MOD, ONLY: VAL_GENERATE_DP USE :: IFS_VAL_MOD, ONLY: VAL_CLOSE - USE :: IFS_TOC_MOD, ONLY: TOC_CONTAINER_T - USE :: IFS_TOC_MOD, ONLY: TOC_CREATE_NAME - USE :: IFS_TOC_MOD, ONLY: TOC_ENTRY_BASE_T - USE :: IFS_TOC_MOD, ONLY: TOC_SIM_INIT_T - USE :: IFS_TOC_MOD, ONLY: TOC_ATM_FIELD_T - USE :: IFS_TOC_MOD, ONLY: TOC_WAM_FIELD_T - USE :: IFS_TOC_MOD, ONLY: TOC_FLUSH_STEP_T - USE :: IFS_TOC_MOD, ONLY: TOC_FLUSH_STEP_RST_T - USE :: IFS_TOC_MOD, ONLY: TOC_FLUSH_LAST_STEP_T - USE :: IFS_TOC_MOD, ONLY: TOC_SIM_END_T + USE :: IFS_TOC_MOD, ONLY: TOC_READ_ALL USE :: IFS_TOC_MOD, ONLY: TOC_READ USE :: IFS_TOC_MOD, ONLY: TOC_FREE @@ -70,6 +93,11 @@ MODULE MULTIOM_API USE :: OUTPUT_MANAGER_FACTORY_MOD, ONLY: MAKE_OUTPUT_MANAGER USE :: OUTPUT_MANAGER_FACTORY_MOD, ONLY: DESTROY_OUTPUT_MANAGER + ! General utils + USE :: GENERAL_UTILS_MOD, ONLY: READ_TYPE_FROM_ENV + USE :: GENERAL_UTILS_MOD, ONLY: READ_YAML_FROM_ENV + USE :: GENERAL_UTILS_MOD, ONLY: NEED_FIT_SPECTRUM + IMPLICIT NONE ! Default visibility