From 060a6ec67a6751670972a25386701d8e19439b7a Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Wed, 1 Aug 2018 13:36:03 -0600 Subject: [PATCH 01/16] Run cmake-format and fix copyright --- CMakeLists.txt | 849 +++++++++++-------- ThirdParty/fmt/CMakeLists.txt | 264 +++--- docs/CMakeLists.txt | 35 +- examples/CMakeLists.txt | 38 +- examples/CppInterface/CMakeLists.txt | 70 +- examples/comboFederates1/CMakeLists.txt | 50 +- src/CMakeLists.txt | 4 +- src/helics/CMakeLists.txt | 88 +- src/helics/application_api/CMakeLists.txt | 114 +-- src/helics/apps/CMakeLists.txt | 198 +++-- src/helics/common/CMakeLists.txt | 180 ++-- src/helics/core/CMakeLists.txt | 369 ++++---- src/helics/cpp98/CMakeLists.txt | 55 +- src/helics/shared_api_library/CMakeLists.txt | 116 ++- swig/CMakeLists.txt | 6 +- swig/java/CMakeLists.txt | 152 ++-- swig/matlab/CMakeLists.txt | 219 +++-- swig/octave/CMakeLists.txt | 8 +- swig/python/CMakeLists.txt | 184 ++-- swig/python2/CMakeLists.txt | 73 +- tests/CMakeLists.txt | 4 +- tests/helics/CMakeLists.txt | 4 +- tests/helics/application_api/CMakeLists.txt | 89 +- tests/helics/apps/CMakeLists.txt | 76 +- tests/helics/common/CMakeLists.txt | 70 +- tests/helics/core/CMakeLists.txt | 88 +- tests/helics/shared_library/CMakeLists.txt | 193 +++-- tests/helics/system_tests/CMakeLists.txt | 72 +- tests/java_helics/CMakeLists.txt | 219 +++-- tests/matlab_helics/CMakeLists.txt | 6 +- tests/python_helics/CMakeLists.txt | 37 +- 31 files changed, 2229 insertions(+), 1701 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c5c1949db8..a3f79d6adc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,49 +1,58 @@ -############################################################################## -#Copyright © 2017-2018, -#Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC -#All rights reserved. See LICENSE file and DISCLAIMER for more details. -############################################################################## +# +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore +# National Security, LLC; Alliance for Sustainable Energy, LLC All rights +# reserved. See LICENSE file and DISCLAIMER for more details. +# -cmake_minimum_required (VERSION 3.4) +cmake_minimum_required(VERSION 3.4) cmake_policy(VERSION 3.4) -project (HELICS VERSION 1.3.0) +project(HELICS VERSION 1.3.0) -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # HELICS Version number -#----------------------------------------------------------------------------- -set (HELICS_VERSION_BUILD ) -set (HELICS_DATE "07-31-18") +# ----------------------------------------------------------------------------- +set(HELICS_VERSION_BUILD) +set(HELICS_DATE "07-31-18") -set (HELICS_VERSION_UNDERSCORE "${HELICS_VERSION_MAJOR}_${HELICS_VERSION_MINOR}_${HELICS_VERSION_PATCH}") +set(HELICS_VERSION_UNDERSCORE + "${HELICS_VERSION_MAJOR}_${HELICS_VERSION_MINOR}_${HELICS_VERSION_PATCH}") if(HELICS_VERSION_BUILD) - set (HELICS_VERSION "${HELICS_VERSION}-${HELICS_VERSION_BUILD}") - set (HELICS_VERSION_UNDERSCORE "${HELICS_VERSION_UNDERSCORE}-${HELICS_VERSION_BUILD}") + set(HELICS_VERSION "${HELICS_VERSION}-${HELICS_VERSION_BUILD}") + set(HELICS_VERSION_UNDERSCORE + "${HELICS_VERSION_UNDERSCORE}-${HELICS_VERSION_BUILD}") endif() -set (HELICS_VERSION_STRING "${HELICS_VERSION} (${HELICS_DATE})") +set(HELICS_VERSION_STRING "${HELICS_VERSION} (${HELICS_DATE})") -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # set the module path and include some common macros -#----------------------------------------------------------------------------- -set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/config/cmake/") +# ----------------------------------------------------------------------------- +set( + CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/config/cmake/") include(extraMacros) include(CMakeDependentOption) -#include(BuildType) -#----------------------------------------------------------------------------- +# include(BuildType) +# ----------------------------------------------------------------------------- # set the install path to a local directory -#----------------------------------------------------------------------------- -if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - if (WIN32) - if (MSYS) - set (CMAKE_INSTALL_PREFIX "/usr/local/helics_${HELICS_VERSION_UNDERSCORE}/" CACHE PATH "default install path" FORCE ) - else(MSYS) - set (CMAKE_INSTALL_PREFIX "C:/local/helics_${HELICS_VERSION_UNDERSCORE}/" CACHE PATH "default install path" FORCE ) - endif(MSYS) - endif(WIN32) +# ----------------------------------------------------------------------------- +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + if(WIN32) + if(MSYS) + set(CMAKE_INSTALL_PREFIX "/usr/local/helics_${HELICS_VERSION_UNDERSCORE}/" + CACHE PATH "default install path" + FORCE) + else(MSYS) + set(CMAKE_INSTALL_PREFIX "C:/local/helics_${HELICS_VERSION_UNDERSCORE}/" + CACHE PATH "default install path" + FORCE) + endif(MSYS) + endif(WIN32) endif() -SHOW_VARIABLE(AUTOBUILD_INSTALL_PATH PATH - "location to install the autobuild libraries and Headers" "${PROJECT_BINARY_DIR}/libs") +show_variable(AUTOBUILD_INSTALL_PATH + PATH + "location to install the autobuild libraries and Headers" + "${PROJECT_BINARY_DIR}/libs") mark_as_advanced(AUTOBUILD_INSTALL_PATH) @@ -51,8 +60,8 @@ file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/logs) option(BUILD_HELICS_TESTS "Enable the test Executables to be built" ON) # enable testing -if (BUILD_HELICS_TESTS) - include(CTest) +if(BUILD_HELICS_TESTS) + include(CTest) endif(BUILD_HELICS_TESTS) set_property(GLOBAL PROPERTY USE_FOLDERS ON) @@ -60,129 +69,177 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) option(BUILD_HELICS_EXAMPLES "Enable the example Executables to be built" ON) option(BUILD_PYTHON_INTERFACE "Build Python extension" OFF) -option(BUILD_PYTHON2_INTERFACE "Build Python2.7 extension(Requires swig and will not build if \"PYTHON_INTERFACE\" is active)" OFF) +option( + BUILD_PYTHON2_INTERFACE + "Build Python2.7 extension(Requires swig and will not build if \"PYTHON_INTERFACE\" is active)" + OFF) option(BUILD_MATLAB_INTERFACE "Build Matlab Extension" OFF) option(BUILD_OCTAVE_INTERFACE "Build Octave extension (very experimental)" OFF) option(BUILD_JAVA_INTERFACE "Build Java extension" OFF) -if (BUILD_PYTHON_INTERFACE OR BUILD_PYTHON2_INTERFACE OR BUILD_MATLAB_INTERFACE OR BUILD_JAVA_INTERFACE OR BUILD_OCTAVE_INTERFACE) - set(INTERFACE_BUILD ON) +if(BUILD_PYTHON_INTERFACE + OR BUILD_PYTHON2_INTERFACE + OR BUILD_MATLAB_INTERFACE + OR BUILD_JAVA_INTERFACE + OR BUILD_OCTAVE_INTERFACE) + set(INTERFACE_BUILD ON) else() - set(INTERFACE_BUILD OFF) + set(INTERFACE_BUILD OFF) endif() -cmake_dependent_option(BUILD_C_SHARED_LIB "Build the Shared Libraries with a C interface" ON "NOT INTERFACE_BUILD" ON) -option(DISABLE_SWIG "disable the use of the swig executable to generate interface code and use repository code instead" OFF) +cmake_dependent_option(BUILD_C_SHARED_LIB + "Build the Shared Libraries with a C interface" + ON + "NOT INTERFACE_BUILD" + ON) +option( + DISABLE_SWIG + "disable the use of the swig executable to generate interface code and use repository code instead" + OFF) option(BUILD_CXX_SHARED_LIB "Build a Shared Libraries of the CXX interface" OFF) - -if (INTERFACE_BUILD OR BUILD_C_SHARED_LIB OR BUILD_CXX_SHARED_LIB) - set(BUILD_SHARED_LIBS ON) +if(INTERFACE_BUILD OR BUILD_C_SHARED_LIB OR BUILD_CXX_SHARED_LIB) + set(BUILD_SHARED_LIBS ON) endif() -cmake_dependent_option(USE_POSITION_INDEPENDENT_CODE "Build the libraries with Position independent code Useful if only building the static library and it will be used later in a shared library" OFF "NOT BUILD_SHARED_LIBS" ON) +cmake_dependent_option( + USE_POSITION_INDEPENDENT_CODE + "Build the libraries with Position independent code Useful if only building the static library and it will be used later in a shared library" + OFF + "NOT BUILD_SHARED_LIBS" + ON) if(BUILD_SHARED_LIBS OR USE_POSITION_INDEPENDENT_CODE) - set(CMAKE_POSITION_INDEPENDENT_CODE ON) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) endif() - -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # General project wide configuration -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- -if (NOT CMAKE_DEBUG_POSTFIX) - set(CMAKE_DEBUG_POSTFIX d) +if(NOT CMAKE_DEBUG_POSTFIX) + set(CMAKE_DEBUG_POSTFIX d) endif() -#add a baseline library for underlying dependencies and flags +# add a baseline library for underlying dependencies and flags add_library(helics_base INTERFACE) add_library(helics_base_includes INTERFACE) target_link_libraries(helics_base INTERFACE helics_base_includes) # Prohibit in-source build if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") - message(FATAL_ERROR "In-source build is not supported. Please, use an empty directory for building the project.") + message( + FATAL_ERROR + "In-source build is not supported. Please, use an empty directory for building the project." + ) endif() include(compiler_flags) message(STATUS "setting version build options to \"${VERSION_OPTION}\"") -if (VERSION_OPTION) - if (MSVC) - target_compile_options(helics_base_includes INTERFACE ${VERSION_OPTION}) - else() - target_compile_options(helics_base_includes INTERFACE $<$:${VERSION_OPTION}>) - endif (MSVC) +if(VERSION_OPTION) + if(MSVC) + target_compile_options(helics_base_includes INTERFACE ${VERSION_OPTION}) + else() + target_compile_options( + helics_base_includes + INTERFACE $<$:${VERSION_OPTION}>) + endif(MSVC) endif(VERSION_OPTION) -cmake_dependent_option(STATIC_STANDARD_LIB "Link against a static standard lib" OFF "NOT USE_LIBCXX" OFF) +cmake_dependent_option(STATIC_STANDARD_LIB + "Link against a static standard lib" + OFF + "NOT USE_LIBCXX" + OFF) include(ucm) mark_as_advanced(STATIC_STANDARD_LIB) -if (STATIC_STANDARD_LIB) - ucm_set_runtime(STATIC) +if(STATIC_STANDARD_LIB) + ucm_set_runtime(STATIC) else() - ucm_set_runtime(DYNAMIC) + ucm_set_runtime(DYNAMIC) endif() -if (MSVC) - option(EMBEDDED_DEBUG_INFO "embed debug info into obj files" OFF) - mark_as_advanced(EMBEDDED_DEBUG_INFO) - if (EMBEDDED_DEBUG_INFO) - ucm_set_embedded_debug(EMBEDDED) - else() - ucm_set_embedded_debug(EXTERNAL) - endif() +if(MSVC) + option(EMBEDDED_DEBUG_INFO "embed debug info into obj files" OFF) + mark_as_advanced(EMBEDDED_DEBUG_INFO) + if(EMBEDDED_DEBUG_INFO) + ucm_set_embedded_debug(EMBEDDED) + else() + ucm_set_embedded_debug(EXTERNAL) + endif() endif(MSVC) # ------------------------------------------------------------- # add coverage target # ------------------------------------------------------------- if(BUILD_HELICS_TESTS) - cmake_dependent_option (TEST_CODE_COVERAGE "Build a target for testing code coverage" OFF "BUILD_HELICS_TESTS" OFF) - if (TEST_CODE_COVERAGE) - if (CMAKE_BUILD_TYPE STREQUAL "Coverage") - include(CodeCoverage) - - set(COVERAGE_EXCLUDES 'usr/*' 'dependencies/*' 'ThirdParty/*' 'tests/*' 'swig/*' 'examples/*') - SETUP_TARGET_FOR_COVERAGE( - NAME helics_coverage # New target name - EXECUTABLE CTest # Executable in PROJECT_BINARY_DIR - ) - else() - message(FATAL_ERROR "CMAKE_BUILD_TYPE must be set to Coverage for testing code coverage") - endif() - endif(TEST_CODE_COVERAGE) - endif(BUILD_HELICS_TESTS) + cmake_dependent_option(TEST_CODE_COVERAGE + "Build a target for testing code coverage" + OFF + "BUILD_HELICS_TESTS" + OFF) + if(TEST_CODE_COVERAGE) + if(CMAKE_BUILD_TYPE STREQUAL "Coverage") + include(CodeCoverage) + + set(COVERAGE_EXCLUDES + 'usr/*' + 'dependencies/*' + 'ThirdParty/*' + 'tests/*' + 'swig/*' + 'examples/*') + setup_target_for_coverage(NAME + helics_coverage # New target name + EXECUTABLE + CTest # Executable in PROJECT_BINARY_DIR + ) + else() + message( + FATAL_ERROR + "CMAKE_BUILD_TYPE must be set to Coverage for testing code coverage") + endif() + endif(TEST_CODE_COVERAGE) +endif(BUILD_HELICS_TESTS) mark_as_advanced(TEST_CODE_COVERAGE) # ------------------------------------------------------------- # Get some configuration for C++17 as that becomes available # ------------------------------------------------------------- -#message(STATUS ${CMAKE_CXX_FLAGS}) +# message(STATUS ${CMAKE_CXX_FLAGS}) set(CONFIGURE_TARGET_LOCATION ${AUTOBUILD_INSTALL_PATH}/include/helics/) include(configGenerator) -option (GENERATE_DOXYGEN_DOC "Generate Doxygen doc target" OFF) - -if (GENERATE_DOXYGEN_DOC) - find_package(Doxygen) - if(DOXYGEN_FOUND) - - SHOW_VARIABLE(DOXYGEN_OUTPUT_DIR PATH "location to put Doxygen docs" "${PROJECT_BINARY_DIR}/docs") - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) - add_custom_target(doc - ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile - WORKING_DIRECTORY ${DOXYGET_OUTPUT_DIR} - COMMENT "Generating API documentation with Doxygen" VERBATIM - ) - endif(DOXYGEN_FOUND) -endif (GENERATE_DOXYGEN_DOC) - - +option(GENERATE_DOXYGEN_DOC "Generate Doxygen doc target" OFF) + +if(GENERATE_DOXYGEN_DOC) + find_package(Doxygen) + if(DOXYGEN_FOUND) + + show_variable(DOXYGEN_OUTPUT_DIR + PATH + "location to put Doxygen docs" + "${PROJECT_BINARY_DIR}/docs") + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config/Doxyfile.in + ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) + add_custom_target(doc ${DOXYGEN_EXECUTABLE} + ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile + WORKING_DIRECTORY ${DOXYGET_OUTPUT_DIR} + COMMENT "Generating API documentation with Doxygen" + VERBATIM) + endif(DOXYGEN_FOUND) +endif(GENERATE_DOXYGEN_DOC) # ------------------------------------------------------------- # BOOST find the boost libraries # ------------------------------------------------------------- -set(BOOST_REQUIRED_LIBRARIES program_options unit_test_framework filesystem system date_time timer chrono) +set(BOOST_REQUIRED_LIBRARIES + program_options + unit_test_framework + filesystem + system + date_time + timer + chrono) include(addBoost) target_link_libraries(helics_base INTERFACE Boostlibs::core) @@ -191,54 +248,54 @@ target_link_libraries(helics_base INTERFACE Boostlibs::core) # ------------------------------------------------------------- option(MPI_ENABLE "Enable MPI networking library" OFF) -if (MPI_ENABLE) - include(addMPI) - if (MPI_C_FOUND) - set(HELICS_HAVE_MPI TRUE) - target_link_libraries(helics_base INTERFACE MPI::MPI_C) - else() - set(HELICS_HAVE_MPI FALSE) - endif (MPI_C_FOUND) +if(MPI_ENABLE) + include(addMPI) + if(MPI_C_FOUND) + set(HELICS_HAVE_MPI TRUE) + target_link_libraries(helics_base INTERFACE MPI::MPI_C) + else() + set(HELICS_HAVE_MPI FALSE) + endif(MPI_C_FOUND) else(MPI_ENABLE) - set(HELICS_HAVE_MPI FALSE) + set(HELICS_HAVE_MPI FALSE) endif(MPI_ENABLE) # ------------------------------------------------------------- # add threading support # ------------------------------------------------------------- -if (NOT WIN32) - set(THREADS_PREFER_PTHREAD_FLAG ON) -elseif (MSYS) - set(THREADS_PREFER_PTHREAD_FLAG ON) +if(NOT WIN32) + set(THREADS_PREFER_PTHREAD_FLAG ON) +elseif(MSYS) + set(THREADS_PREFER_PTHREAD_FLAG ON) else() - set(CMAKE_USE_WIN32_THREADS_INIT ON) + set(CMAKE_USE_WIN32_THREADS_INIT ON) endif() find_package(Threads REQUIRED) target_link_libraries(helics_base INTERFACE Threads::Threads) -if (UNIX AND NOT APPLE) - target_link_libraries(helics_base INTERFACE rt) +if(UNIX AND NOT APPLE) + target_link_libraries(helics_base INTERFACE rt) endif() # ------------------------------------------------------------- # check for some things with TCP core and boost # ------------------------------------------------------------- if(MSYS) - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - if (BOOST_VERSION_LEVEL GREATER 1) - #set(DISABLE_TCP_CORE TRUE) - set(DISABLE_TCP_CORE FALSE) - target_link_libraries(helics_base INTERFACE wsock32 ws2_32) - else() - set(DISABLE_TCP_CORE TRUE) - message(STATUS, "disabling TCP core |${DISABLE_TCP_CORE}|") - target_link_libraries(helics_base INTERFACE ws2_32) - endif() - - else() - target_link_libraries(helics_base INTERFACE wsock32 ws2_32) - endif() + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + if(BOOST_VERSION_LEVEL GREATER 1) + # set(DISABLE_TCP_CORE TRUE) + set(DISABLE_TCP_CORE FALSE) + target_link_libraries(helics_base INTERFACE wsock32 ws2_32) + else() + set(DISABLE_TCP_CORE TRUE) + message(STATUS, "disabling TCP core |${DISABLE_TCP_CORE}|") + target_link_libraries(helics_base INTERFACE ws2_32) + endif() + + else() + target_link_libraries(helics_base INTERFACE wsock32 ws2_32) + endif() endif(MSYS) @@ -246,52 +303,54 @@ endif(MSYS) # Enable ZeroMQ # ------------------------------------------------------------- -### just check some intenal options -if (BUILD_DEBUG_ONLY AND BUILD_RELEASE_ONLY) -message(fatal "BOTH BUILD_DEBUG_ONLY AND BUILD_RELEASE_ONLY cannot be specified together otherwise nothing works") +# just check some intenal options +if(BUILD_DEBUG_ONLY AND BUILD_RELEASE_ONLY) + message( + fatal + "BOTH BUILD_DEBUG_ONLY AND BUILD_RELEASE_ONLY cannot be specified together otherwise nothing works" + ) endif() option(ZeroMQ_ENABLE "Enable ZeroMQ networking library" ON) mark_as_advanced(ZeroMQ_ENABLE) # If ZeroMQ library is enabled try to locate it and link against it -if (ZeroMQ_ENABLE) - include(addZeroMQ) - - if (ZeroMQ_FOUND) - set(HELICS_HAVE_ZEROMQ TRUE) - if (ZMQ_USE_STATIC_LIBRARY) - set(ZeroMQ_DEPENDENCY libzmq-static) - target_compile_definitions(helics_base_includes INTERFACE -DZMQ_STATIC) - else() - set(ZeroMQ_DEPENDENCY libzmq) - endif() - #message(STATUS "zmq dep ${ZeroMQ_DEPENDENCY}") - target_link_libraries(helics_base INTERFACE ${ZeroMQ_DEPENDENCY}) - else(ZeroMQ_FOUND) - set(HELICS_HAVE_ZEROMQ FALSE) - endif(ZeroMQ_FOUND) - else(ZeroMQ_ENABLE) - set(HELICS_HAVE_ZEROMQ FALSE) - if (ZeroMQ_ENABLE) - message(WARNING "ZeroMQ not found") - endif() +if(ZeroMQ_ENABLE) + include(addZeroMQ) + + if(ZeroMQ_FOUND) + set(HELICS_HAVE_ZEROMQ TRUE) + if(ZMQ_USE_STATIC_LIBRARY) + set(ZeroMQ_DEPENDENCY libzmq-static) + target_compile_definitions(helics_base_includes INTERFACE -DZMQ_STATIC) + else() + set(ZeroMQ_DEPENDENCY libzmq) + endif() + # message(STATUS "zmq dep ${ZeroMQ_DEPENDENCY}") + target_link_libraries(helics_base INTERFACE ${ZeroMQ_DEPENDENCY}) + else(ZeroMQ_FOUND) + set(HELICS_HAVE_ZEROMQ FALSE) + endif(ZeroMQ_FOUND) +else(ZeroMQ_ENABLE) + set(HELICS_HAVE_ZEROMQ FALSE) + if(ZeroMQ_ENABLE) + message(WARNING "ZeroMQ not found") + endif() endif(ZeroMQ_ENABLE) - # ------------------------------------------------------------- # global include directories # ------------------------------------------------------------- -target_include_directories(helics_base_includes INTERFACE - $ - $ - $ -) +target_include_directories( + helics_base_includes + INTERFACE $ + $ + $) -target_include_directories(helics_base_includes SYSTEM INTERFACE - $ - $ -) +target_include_directories( + helics_base_includes SYSTEM + INTERFACE $ + $) include(GNUInstallDirs) @@ -299,279 +358,351 @@ include(GNUInstallDirs) # setting the RPATH # ------------------------------------------------------------- # use, i.e. don't skip the full RPATH for the build tree -set(CMAKE_SKIP_BUILD_RPATH FALSE) +set(CMAKE_SKIP_BUILD_RPATH FALSE) -# when building, don't use the install RPATH already -# (but later on when installing) +# when building, don't use the install RPATH already (but later on when +# installing) set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) set(CMAKE_MACOSX_RPATH ON) -set(CMAKE_BUILD_RPATH "./;${AUTOBUILD_INSTALL_PATH}/bin;${AUTOBUILD_INSTALL_PATH}/lib;${AUTOBUILD_INSTALL_PATH}/lib64") +set( + CMAKE_BUILD_RPATH + "./;${AUTOBUILD_INSTALL_PATH}/bin;${AUTOBUILD_INSTALL_PATH}/lib;${AUTOBUILD_INSTALL_PATH}/lib64" + ) -# add the automatically determined parts of the RPATH -# which point to directories outside the build tree to the install RPATH +# add the automatically determined parts of the RPATH which point to directories +# outside the build tree to the install RPATH set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) # the RPATH to be used when installing, but only if it's not a system directory -list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}" isSystemDir) +list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}" isSystemDir) if("${isSystemDir}" STREQUAL "-1") - list(APPEND CMAKE_INSTALL_RPATH CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") + list(APPEND CMAKE_INSTALL_RPATH CMAKE_INSTALL_RPATH + "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") endif() -list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" isSystemDir) +list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" isSystemDir) if("${isSystemDir}" STREQUAL "-1") - list(APPEND CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + list(APPEND CMAKE_INSTALL_RPATH + "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") endif() -if (NOT Boost_USE_STATIC_LIBS) - list(APPEND CMAKE_INSTALL_RPATH ${Boost_LIBRARY_DIRS}) - list(APPEND CMAKE_BUILD_RPATH ${Boost_LIBRARY_DIRS}) +if(NOT Boost_USE_STATIC_LIBS) + list(APPEND CMAKE_INSTALL_RPATH ${Boost_LIBRARY_DIRS}) + list(APPEND CMAKE_BUILD_RPATH ${Boost_LIBRARY_DIRS}) endif() - -#add the local directory to the rpath +# add the local directory to the rpath list(APPEND CMAKE_INSTALL_RPATH "./") -if (NOT WIN32) - if (HELICS_HAVE_ZEROMQ AND NOT ZMQ_USE_STATIC_LIBRARY) - get_target_property(zmqlibfile libzmq IMPORTED_LOCATION) - if (NOT zmqlibfile) - get_target_property(zmqlibfile libzmq IMPORTED_LOCATION_RELEASE) - endif() - # message(STATUS "zmqlib file =${zmqlibfile}") - get_filename_component(zmqdir ${zmqlibfile} DIRECTORY) - # message(STATUS "zmqdir path =${zmqdir}") - if (APPLE) - # TODO: Make sure it works for building ZMQ from source automatically using CMake - list(APPEND CMAKE_INSTALL_RPATH ${ZeroMQ_INSTALL_PATH}/lib) - list(APPEND CMAKE_BUILD_RPATH ${ZeroMQ_INSTALL_PATH}/lib) - endif() - list(APPEND CMAKE_INSTALL_RPATH "${zmqdir}") - list(APPEND CMAKE_BUILD_RPATH "${zmqdir}") - endif() +if(NOT WIN32) + if(HELICS_HAVE_ZEROMQ AND NOT ZMQ_USE_STATIC_LIBRARY) + get_target_property(zmqlibfile libzmq IMPORTED_LOCATION) + if(NOT zmqlibfile) + get_target_property(zmqlibfile libzmq IMPORTED_LOCATION_RELEASE) + endif() + # message(STATUS "zmqlib file =${zmqlibfile}") + get_filename_component(zmqdir ${zmqlibfile} DIRECTORY) + # message(STATUS "zmqdir path =${zmqdir}") + if(APPLE) + # TODO: Make sure it works for building ZMQ from source automatically + # using CMake + list(APPEND CMAKE_INSTALL_RPATH ${ZeroMQ_INSTALL_PATH}/lib) + list(APPEND CMAKE_BUILD_RPATH ${ZeroMQ_INSTALL_PATH}/lib) + endif() + list(APPEND CMAKE_INSTALL_RPATH "${zmqdir}") + list(APPEND CMAKE_BUILD_RPATH "${zmqdir}") + endif() endif() -option(BUILD_APPS "Build helics applications to run various apps, including broker, player, recorder, and helics_apps" ON) - -FILE(GLOB KEY_LIBRARY_FILES ${AUTOBUILD_INSTALL_PATH}/bin/*) -#message(STATUS "key files ${KEY_LIBRARY_FILES}") - -option(DISABLE_LOGGING "disable all normal, debug, and trace logging in HELICS" OFF) - -cmake_dependent_option(DISABLE_TRACE_LOGGING "disable trace logging" OFF "NOT DISABLE_LOGGING" OFF) -cmake_dependent_option(DISABLE_DEBUG_LOGGING "disable debug logging" OFF "NOT DISABLE_LOGGING" OFF) +option( + BUILD_APPS + "Build helics applications to run various apps, including broker, player, recorder, and helics_apps" + ON) + +file(GLOB KEY_LIBRARY_FILES ${AUTOBUILD_INSTALL_PATH}/bin/*) +# message(STATUS "key files ${KEY_LIBRARY_FILES}") + +option(DISABLE_LOGGING "disable all normal, debug, and trace logging in HELICS" + OFF) + +cmake_dependent_option(DISABLE_TRACE_LOGGING + "disable trace logging" + OFF + "NOT DISABLE_LOGGING" + OFF) +cmake_dependent_option(DISABLE_DEBUG_LOGGING + "disable debug logging" + OFF + "NOT DISABLE_LOGGING" + OFF) mark_as_advanced(DISABLE_TRACE_LOGGING) mark_as_advanced(DISABLE_DEBUG_LOGGING) -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # create the fmt header only targets -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- set(FMT_TEST OFF) set(FMT_ASSUME_CPP14_SUPPORT ON) set(FMT_SILENT ON) -#get the FMT header only library +# get the FMT header only library add_subdirectory(ThirdParty/fmt EXCLUDE_FROM_ALL) -HIDE_VARIABLE(FMT_DOC) -HIDE_VARIABLE(FMT_INSTALL) -HIDE_VARIABLE(FMT_PEDANTIC) -HIDE_VARIABLE(FMT_TEST) -HIDE_VARIABLE(FMT_USE_CPP14) +hide_variable(FMT_DOC) +hide_variable(FMT_INSTALL) +hide_variable(FMT_PEDANTIC) +hide_variable(FMT_TEST) +hide_variable(FMT_USE_CPP14) -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # CMAKE Subdirectories -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- -add_subdirectory (src) +add_subdirectory(src) -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # Setup CTEST environment -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- if(BUILD_HELICS_TESTS AND BUILD_TESTING) - mark_as_advanced(BUILD_TESTING) - add_subdirectory (tests) + mark_as_advanced(BUILD_TESTING) + add_subdirectory(tests) endif() -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # Setup Examples -#----------------------------------------------------------------------------- -if (BUILD_HELICS_EXAMPLES) - add_subdirectory (examples) +# ----------------------------------------------------------------------------- +if(BUILD_HELICS_EXAMPLES) + add_subdirectory(examples) endif(BUILD_HELICS_EXAMPLES) install(FILES ${KEY_LIBRARY_FILES} - DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT runtime) - -install(DIRECTORY ${AUTOBUILD_INSTALL_PATH}/lib/ DESTINATION ${CMAKE_INSTALL_LIBDIR}/ OPTIONAL) -install(DIRECTORY ${AUTOBUILD_INSTALL_PATH}/lib64/ DESTINATION ${CMAKE_INSTALL_LIBDIR}/ OPTIONAL) - -if (HELICS_HAVE_ZEROMQ) - if (WIN32 AND NOT MSYS) - install(FILES $ DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs) - endif() + DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT + runtime) + +install(DIRECTORY ${AUTOBUILD_INSTALL_PATH}/lib/ + DESTINATION ${CMAKE_INSTALL_LIBDIR}/ + OPTIONAL) +install(DIRECTORY ${AUTOBUILD_INSTALL_PATH}/lib64/ + DESTINATION ${CMAKE_INSTALL_LIBDIR}/ + OPTIONAL) + +if(HELICS_HAVE_ZEROMQ) + if(WIN32 AND NOT MSYS) + install(FILES $ + DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT libs) + endif() endif() # ------------------------------------------------------------- # Enable clang analysis and formatting tools # ------------------------------------------------------------- -option(ENABLE_CLANG_TOOLS "if clang is found enable some custom targets for clang formatting and tidy" OFF) +option( + ENABLE_CLANG_TOOLS + "if clang is found enable some custom targets for clang formatting and tidy" + OFF) mark_as_advanced(ENABLE_CLANG_TOOLS) -if (ENABLE_CLANG_TOOLS) - include(clang-cxx-dev-tools) +if(ENABLE_CLANG_TOOLS) + include(clang-cxx-dev-tools) endif(ENABLE_CLANG_TOOLS) -if (INTERFACE_BUILD) - add_subdirectory(swig) +if(INTERFACE_BUILD) + add_subdirectory(swig) endif() - add_subdirectory(docs) +install(TARGETS helics_base EXPORT helics-targets) +install(TARGETS helics_base_includes EXPORT helics-targets) -install (TARGETS helics_base EXPORT helics-targets) -install (TARGETS helics_base_includes EXPORT helics-targets) - -set(helics_static_file "${CMAKE_STATIC_LIBRARY_PREFIX}helics-static${CMAKE_STATIC_LIBRARY_SUFFIX}") -set(helics_static_file_debug "${CMAKE_STATIC_LIBRARY_PREFIX}helics-static${CMAKE_DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") +set(helics_static_file + "${CMAKE_STATIC_LIBRARY_PREFIX}helics-static${CMAKE_STATIC_LIBRARY_SUFFIX}") +set( + helics_static_file_debug + "${CMAKE_STATIC_LIBRARY_PREFIX}helics-static${CMAKE_DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) if(BUILD_CXX_SHARED_LIB) - set(helics_cxx_shared_file "${CMAKE_SHARED_LIBRARY_PREFIX}helics-shared${CMAKE_SHARED_LIBRARY_SUFFIX}") - set(helics_cxx_shared_file_debug "${CMAKE_SHARED_LIBRARY_PREFIX}helics-shared${CMAKE_DEBUG_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}") -else (BUILD_CXX_SHARED_LIB) - set(helics_cxx_shared_file ) - set(helics_cxx_shared_file_debug ) + set( + helics_cxx_shared_file + "${CMAKE_SHARED_LIBRARY_PREFIX}helics-shared${CMAKE_SHARED_LIBRARY_SUFFIX}") + set( + helics_cxx_shared_file_debug + "${CMAKE_SHARED_LIBRARY_PREFIX}helics-shared${CMAKE_DEBUG_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}" + ) +else(BUILD_CXX_SHARED_LIB) + set(helics_cxx_shared_file) + set(helics_cxx_shared_file_debug) endif(BUILD_CXX_SHARED_LIB) if(BUILD_C_SHARED_LIB OR INTERFACE_BUILD) - set(helics_c_shared_file "${CMAKE_SHARED_LIBRARY_PREFIX}helicsSharedLib${CMAKE_SHARED_LIBRARY_SUFFIX}") - set(helics_c_shared_file_debug "${CMAKE_SHARED_LIBRARY_PREFIX}helicsSharedLib${CMAKE_DEBUG_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}") + set( + helics_c_shared_file + "${CMAKE_SHARED_LIBRARY_PREFIX}helicsSharedLib${CMAKE_SHARED_LIBRARY_SUFFIX}" + ) + set( + helics_c_shared_file_debug + "${CMAKE_SHARED_LIBRARY_PREFIX}helicsSharedLib${CMAKE_DEBUG_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}" + ) else() - set(helics_c_shared_file ) - set(helics_c_shared_file_debug ) + set(helics_c_shared_file) + set(helics_c_shared_file_debug) endif() -set(HELICS_CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" CACHE STRING "install path for HELICSConfig.cmake") +set(HELICS_CMAKECONFIG_INSTALL_DIR + "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" + CACHE STRING "install path for HELICSConfig.cmake") mark_as_advanced(HELICS_CMAKECONFIG_INSTALL_DIR) -install (EXPORT helics-targets - NAMESPACE HELICS:: - DESTINATION ${HELICS_CMAKECONFIG_INSTALL_DIR} - COMPONENT libs - ) +install(EXPORT helics-targets + NAMESPACE HELICS:: + DESTINATION ${HELICS_CMAKECONFIG_INSTALL_DIR} + COMPONENT libs) -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # Setup configure.h file for accessing configure options -#----------------------------------------------------------------------------- -configure_file ( - "config/helics-config.h.in" - "${AUTOBUILD_INSTALL_PATH}/include/helics/helics-config.h" - ) - install(FILES ${AUTOBUILD_INSTALL_PATH}/include/helics/helics-config.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics - COMPONENT headers) - install(FILES ${AUTOBUILD_INSTALL_PATH}/include/helics/compiler-config.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics - COMPONENT headers) - install(DIRECTORY ThirdParty/cereal DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - COMPONENT headers) - -install(DIRECTORY ThirdParty/helics_includes DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - COMPONENT headers) - - +# ----------------------------------------------------------------------------- +configure_file("config/helics-config.h.in" + "${AUTOBUILD_INSTALL_PATH}/include/helics/helics-config.h") +install(FILES ${AUTOBUILD_INSTALL_PATH}/include/helics/helics-config.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics + COMPONENT headers) +install(FILES ${AUTOBUILD_INSTALL_PATH}/include/helics/compiler-config.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics + COMPONENT headers) +install(DIRECTORY ThirdParty/cereal + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + COMPONENT headers) + +install(DIRECTORY ThirdParty/helics_includes + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + COMPONENT headers) include(CMakePackageConfigHelpers) - -configure_package_config_file(config/${PROJECT_NAME}Config.cmake.in - "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" - INSTALL_DESTINATION ${HELICS_CMAKECONFIG_INSTALL_DIR}) -write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake - VERSION ${HELICS_VERSION} - COMPATIBILITY SameMajorVersion) +configure_package_config_file( + config/${PROJECT_NAME}Config.cmake.in + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + INSTALL_DESTINATION + ${HELICS_CMAKECONFIG_INSTALL_DIR}) +write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake + VERSION + ${HELICS_VERSION} + COMPATIBILITY + SameMajorVersion) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake - DESTINATION ${HELICS_CMAKECONFIG_INSTALL_DIR} - COMPONENT libs) -#install required additional cmake files + DESTINATION ${HELICS_CMAKECONFIG_INSTALL_DIR} + COMPONENT libs) +# install required additional cmake files install(FILES config/cmake/addMPI.cmake - config/cmake/FindZeroMQ.cmake - config/cmake/addBoost.cmake - config/cmake/extraMacros.cmake - DESTINATION ${HELICS_CMAKECONFIG_INSTALL_DIR} - COMPONENT libs) + config/cmake/FindZeroMQ.cmake + config/cmake/addBoost.cmake + config/cmake/extraMacros.cmake + DESTINATION ${HELICS_CMAKECONFIG_INSTALL_DIR} + COMPONENT libs) # ------------------------------------------------------------- # CPack # ------------------------------------------------------------- -option(ENABLE_PACKAGE_BUILD "Add projects for making packages and installers for HELICS" OFF) +option(ENABLE_PACKAGE_BUILD + "Add projects for making packages and installers for HELICS" OFF) if(ENABLE_PACKAGE_BUILD) -set(CPACK_PACKAGE_NAME "Helics") -set(CPACK_PACKAGE_VENDOR "GMLC") -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "HELICS") -set(CPACK_PACKAGE_VERSION "${HELICS_VERSION}") -set(CPACK_PACKAGE_VERSION_MAJOR ${HELICS_VERSION_MAJOR}) -set(CPACK_PACKAGE_VERSION_MINOR ${HELICS_VERSION_MINOR}) -set(CPACK_PACKAGE_VERSION_PATCH ${HELICS_VERSION_PATCH}) -set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "HELICS") - -set(CPACK_COMPONENTS_ALL applications headers libs runtime matlab python java octave) -if (WIN32) -set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}\\\\LICENSE") -else(WIN32) -set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE") -endif(WIN32) - -set(CPACK_COMPONENT_APPLICATIONS_DISPLAY_NAME "Application") - set(CPACK_COMPONENT_LIBS_DISPLAY_NAME "Libraries") - set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "Headers") - set(CPACK_COMPONENT_RUNTIME_DISPLAY_NAME "Runtime Libraries") - - - set(CPACK_COMPONENT_MATLAB_GROUP interfaces) - set(CPACK_COMPONENT_JAVA_GROUP interfaces) - set(CPACK_COMPONENT_OCTAVE_GROUP interfaces) - set(CPACK_COMPONENT_PYTHON_GROUP interfaces) - - set(CPACK_COMPONENT_APPLICATION_DESCRIPTION "Executables and helper applications for HELICS") - set(CPACK_COMPONENT_LIBS_DESCRIPTION "Libraries for compiling and linking with HELICS") - set(CPACK_COMPONENT_HEADERS_DESCRIPTION "Headers for linking and compiling with HELICS") - set(CPACK_COMPONENT_RUNTIME_DESCRIPTION "Runtime libraries for HELICS") - - set(CPACK_COMPONENT_GROUP_INTERFACES_DESCRIPTION "additional language interfaces for HELICS") - - set(CPACK_COMPONENT_LIBS_DEPENDS headers) - set(CPACK_COMPONENT_RUNTIME_REQUIRED ON) - - set(CPACK_PACKAGE_EXECUTABLES "helics_broker" "Helics Broker" "helics_app" "Helics app executable" "helics_recorder" "Helics recorder" "helics_player" "Helics Player") - if (WIN32) - set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}\\\\docs\\\\img\\\\HELICS.ico") - set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/docs/img/HELICS.ico") - set(CPACK_NSIS_INSTALL_ROOT "C:\\\\local\\\\") - set(CPACK_NSIS_URL_INFO_ABOUT "https://www.github.com/GMLC-TDC/Helics-src") - set(CPACK_NSIS_HELP_LINK "https://gmlc-tdc.github.io/HELICS-src/") - set(CPACK_NSIS_CONTACT "helicsteam@helics.org") - set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) - set(CPACK_NSIS_MODIFY_PATH ON) - set(CPACK_NSIS_EXECUTABLES_DIRECTORY ${CMAKE_INSTALL_BINDIR}) -set(CPACK_NSIS_MENU_LINKS - "https://www.github.com/GMLC-TDC/Helics-src" "HELICS Github" - "https://gmlc-tdc.github.io/HELICS-src/" "Helics Documentation" - "https://www.helics.org" "Helics Web page" - "https://www.youtube.com/channel/UCPa81c4BVXEYXt2EShTzbcg" "TDC YouTube channel") -else (WIN32) - set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/docs/img/HELICS.ico") -endif(WIN32) - -if (APPLE) + set(CPACK_PACKAGE_NAME "Helics") + set(CPACK_PACKAGE_VENDOR "GMLC") + set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "HELICS") + set(CPACK_PACKAGE_VERSION "${HELICS_VERSION}") + set(CPACK_PACKAGE_VERSION_MAJOR ${HELICS_VERSION_MAJOR}) + set(CPACK_PACKAGE_VERSION_MINOR ${HELICS_VERSION_MINOR}) + set(CPACK_PACKAGE_VERSION_PATCH ${HELICS_VERSION_PATCH}) + set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "HELICS") + + set(CPACK_COMPONENTS_ALL + applications + headers + libs + runtime + matlab + python + java + octave) + if(WIN32) + set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}\\\\LICENSE") + else(WIN32) + set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE") + endif(WIN32) + + set(CPACK_COMPONENT_APPLICATIONS_DISPLAY_NAME "Application") + set(CPACK_COMPONENT_LIBS_DISPLAY_NAME "Libraries") + set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "Headers") + set(CPACK_COMPONENT_RUNTIME_DISPLAY_NAME "Runtime Libraries") + + set(CPACK_COMPONENT_MATLAB_GROUP interfaces) + set(CPACK_COMPONENT_JAVA_GROUP interfaces) + set(CPACK_COMPONENT_OCTAVE_GROUP interfaces) + set(CPACK_COMPONENT_PYTHON_GROUP interfaces) + + set(CPACK_COMPONENT_APPLICATION_DESCRIPTION + "Executables and helper applications for HELICS") + set(CPACK_COMPONENT_LIBS_DESCRIPTION + "Libraries for compiling and linking with HELICS") + set(CPACK_COMPONENT_HEADERS_DESCRIPTION + "Headers for linking and compiling with HELICS") + set(CPACK_COMPONENT_RUNTIME_DESCRIPTION "Runtime libraries for HELICS") + + set(CPACK_COMPONENT_GROUP_INTERFACES_DESCRIPTION + "additional language interfaces for HELICS") + + set(CPACK_COMPONENT_LIBS_DEPENDS headers) + set(CPACK_COMPONENT_RUNTIME_REQUIRED ON) + + set(CPACK_PACKAGE_EXECUTABLES + "helics_broker" + "Helics Broker" + "helics_app" + "Helics app executable" + "helics_recorder" + "Helics recorder" + "helics_player" + "Helics Player") + if(WIN32) + set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}\\\\docs\\\\img\\\\HELICS.ico") + set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/docs/img/HELICS.ico") + set(CPACK_NSIS_INSTALL_ROOT "C:\\\\local\\\\") + set(CPACK_NSIS_URL_INFO_ABOUT "https://www.github.com/GMLC-TDC/Helics-src") + set(CPACK_NSIS_HELP_LINK "https://gmlc-tdc.github.io/HELICS-src/") + set(CPACK_NSIS_CONTACT "helicsteam@helics.org") + set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) + set(CPACK_NSIS_MODIFY_PATH ON) + set(CPACK_NSIS_EXECUTABLES_DIRECTORY ${CMAKE_INSTALL_BINDIR}) + set(CPACK_NSIS_MENU_LINKS + "https://www.github.com/GMLC-TDC/Helics-src" + "HELICS Github" + "https://gmlc-tdc.github.io/HELICS-src/" + "Helics Documentation" + "https://www.helics.org" + "Helics Web page" + "https://www.youtube.com/channel/UCPa81c4BVXEYXt2EShTzbcg" + "TDC YouTube channel") + else(WIN32) + set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/docs/img/HELICS.ico") + endif(WIN32) + + if(APPLE) set(CPACK_BUNDLE_NAME "libhelics") - configure_file("${PROJECT_SOURCE_DIR}/config/Info.plist.in" "${CMAKE_CURRENT_BINARY_DIR}/Info.plist" @ONLY) + configure_file("${PROJECT_SOURCE_DIR}/config/Info.plist.in" + "${CMAKE_CURRENT_BINARY_DIR}/Info.plist" @ONLY) set(CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_BINARY_DIR}/Info.plist") set(CPACK_BUNDLE_ICON "${PROJECT_SOURCE_DIR}/docs/img/HELICS.ico") -endif (APPLE) + endif(APPLE) -set(CPACK_SOURCE_IGNORE_FILES "/Build*/;/build*/;/.git/") -#THIS LINE MUST BE LAST -include(CPack) + set(CPACK_SOURCE_IGNORE_FILES "/Build*/;/build*/;/.git/") + # THIS LINE MUST BE LAST + include(CPack) endif(ENABLE_PACKAGE_BUILD) diff --git a/ThirdParty/fmt/CMakeLists.txt b/ThirdParty/fmt/CMakeLists.txt index bd4a9c491f..506e3d8789 100644 --- a/ThirdParty/fmt/CMakeLists.txt +++ b/ThirdParty/fmt/CMakeLists.txt @@ -1,34 +1,33 @@ -if (NOT FMT_SILENT) - message(STATUS "CMake version: ${CMAKE_VERSION}") +if(NOT FMT_SILENT) + message(STATUS "CMake version: ${CMAKE_VERSION}") endif() cmake_minimum_required(VERSION 2.8.12) - -# Determine if fmt is built as a subproject (using add_subdirectory) -# or if it is the master project. +# Determine if fmt is built as a subproject (using add_subdirectory) or if it is +# the master project. set(MASTER_PROJECT OFF) -if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) +if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) set(MASTER_PROJECT ON) -endif () +endif() # Joins arguments and places the results in ${result_var}. function(join result_var) - set(result ) - foreach (arg ${ARGN}) + set(result) + foreach(arg ${ARGN}) set(result "${result}${arg}") - endforeach () + endforeach() set(${result_var} "${result}" PARENT_SCOPE) endfunction() -# Set the default CMAKE_BUILD_TYPE to Release. -# This should be done before the project command since the latter can set -# CMAKE_BUILD_TYPE itself (it does so for nmake). -if (NOT CMAKE_BUILD_TYPE) +# Set the default CMAKE_BUILD_TYPE to Release. This should be done before the +# project command since the latter can set CMAKE_BUILD_TYPE itself (it does so +# for nmake). +if(NOT CMAKE_BUILD_TYPE) join(doc "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or " - "CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.") + "CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.") set(CMAKE_BUILD_TYPE Release CACHE STRING ${doc}) -endif () +endif() option(FMT_PEDANTIC "Enable extra warnings and expensive tests." OFF) @@ -38,196 +37,237 @@ option(FMT_INSTALL "Generate the install target." ${MASTER_PROJECT}) option(FMT_TEST "Generate the test target." ${MASTER_PROJECT}) option(FMT_USE_CPP14 "Enable the addition of C++14 compiler flags." ON) - - # Get version from core.h file(READ include/fmt/core.h core_h) -if (NOT core_h MATCHES "FMT_VERSION ([0-9]+)([0-9][0-9])([0-9][0-9])") +if(NOT core_h MATCHES "FMT_VERSION ([0-9]+)([0-9][0-9])([0-9][0-9])") message(FATAL_ERROR "Cannot get FMT_VERSION from core.h.") -endif () +endif() # Use math to skip leading zeros if any. math(EXPR CPACK_PACKAGE_VERSION_MAJOR ${CMAKE_MATCH_1}) math(EXPR CPACK_PACKAGE_VERSION_MINOR ${CMAKE_MATCH_2}) math(EXPR CPACK_PACKAGE_VERSION_PATCH ${CMAKE_MATCH_3}) join(FMT_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}. - ${CPACK_PACKAGE_VERSION_PATCH}) - -if (NOT FMT_SILENT) - message(STATUS "Version: ${FMT_VERSION}") + ${CPACK_PACKAGE_VERSION_PATCH}) - message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") +if(NOT FMT_SILENT) + message(STATUS "Version: ${FMT_VERSION}") + + message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") endif() -if (CMAKE_VERSION VERSION_LESS 3.0) -project(FMT) +if(CMAKE_VERSION VERSION_LESS 3.0) + project(FMT) else() - cmake_policy(SET CMP0048 NEW) -project(FMT VERSION "${FMT_VERSION}") + cmake_policy(SET CMP0048 NEW) + project(FMT VERSION "${FMT_VERSION}") endif() set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} - "${CMAKE_CURRENT_SOURCE_DIR}/support/cmake") + "${CMAKE_CURRENT_SOURCE_DIR}/support/cmake") include(cxx14) -if (CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) +if(CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) set(PEDANTIC_COMPILE_FLAGS -Wall -Wextra -Wshadow -pedantic) -endif () +endif() -if (MASTER_PROJECT AND CMAKE_GENERATOR MATCHES "Visual Studio") - # If Microsoft SDK is installed create script run-msbuild.bat that - # calls SetEnv.cmd to set up build environment and runs msbuild. - # It is useful when building Visual Studio projects with the SDK - # toolchain rather than Visual Studio. +if(MASTER_PROJECT AND CMAKE_GENERATOR MATCHES "Visual Studio") + # If Microsoft SDK is installed create script run-msbuild.bat that calls + # SetEnv.cmd to set up build environment and runs msbuild. It is useful when + # building Visual Studio projects with the SDK toolchain rather than Visual + # Studio. include(FindSetEnv) - if (WINSDK_SETENV) + if(WINSDK_SETENV) set(MSBUILD_SETUP "call \"${WINSDK_SETENV}\"") - endif () + endif() # Set FrameworkPathOverride to get rid of MSB3644 warnings. - set(netfxpath "C:\\Program Files\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0") + set( + netfxpath + "C:\\Program Files\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0" + ) file(WRITE run-msbuild.bat " ${MSBUILD_SETUP} ${CMAKE_MAKE_PROGRAM} -p:FrameworkPathOverride=\"${netfxpath}\" %*") -endif () +endif() include(CheckSymbolExists) -if (WIN32) +if(WIN32) check_symbol_exists(open io.h HAVE_OPEN) -else () +else() check_symbol_exists(open fcntl.h HAVE_OPEN) -endif () +endif() function(add_headers VAR) set(headers ${${VAR}}) - foreach (header ${ARGN}) + foreach(header ${ARGN}) set(headers ${headers} include/fmt/${header}) endforeach() set(${VAR} ${headers} PARENT_SCOPE) endfunction() # Define the fmt library, its includes and the needed defines. -add_headers(FMT_HEADERS core.h format.h format-inl.h ostream.h printf.h time.h - ranges.h) +add_headers(FMT_HEADERS + core.h + format.h + format-inl.h + ostream.h + printf.h + time.h + ranges.h) set(FMT_SOURCES src/format.cc) -if (HAVE_OPEN) +if(HAVE_OPEN) add_headers(FMT_HEADERS posix.h) set(FMT_SOURCES ${FMT_SOURCES} src/posix.cc) -endif () +endif() add_library(fmt ${FMT_SOURCES} ${FMT_HEADERS} README.rst ChangeLog.rst) add_library(fmt::fmt ALIAS fmt) -# Starting with CMake 3.1 the CXX_STANDARD property can be used instead. -# Don't export -std since it may break projects that use other standards. +# Starting with CMake 3.1 the CXX_STANDARD property can be used instead. Don't +# export -std since it may break projects that use other standards. target_compile_options(fmt PRIVATE ${CPP14_FLAG}) -if (FMT_PEDANTIC) +if(FMT_PEDANTIC) target_compile_options(fmt PRIVATE ${PEDANTIC_COMPILE_FLAGS}) -endif () +endif() -if (MSVC) +if(MSVC) target_compile_options(fmt PRIVATE /W4) -endif () - -target_include_directories(fmt PUBLIC - $ - $) - -set_target_properties(fmt PROPERTIES - VERSION ${FMT_VERSION} SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR} - DEBUG_POSTFIX d) +endif() -if (BUILD_SHARED_LIBS) - if (UNIX AND NOT APPLE) - # Fix rpmlint warning: - # unused-direct-shlib-dependency /usr/lib/libformat.so.1.1.0 /lib/libm.so.6. +target_include_directories( + fmt + PUBLIC $ + $) + +set_target_properties(fmt + PROPERTIES VERSION + ${FMT_VERSION} + SOVERSION + ${CPACK_PACKAGE_VERSION_MAJOR} + DEBUG_POSTFIX + d) + +if(BUILD_SHARED_LIBS) + if(UNIX AND NOT APPLE) + # Fix rpmlint warning: unused-direct-shlib-dependency + # /usr/lib/libformat.so.1.1.0 /lib/libm.so.6. target_link_libraries(fmt -Wl,--as-needed) - endif () + endif() target_compile_definitions(fmt PRIVATE FMT_EXPORT INTERFACE FMT_SHARED) -endif () +endif() # Additionally define a header-only library when CMake is new enough. -if (CMAKE_VERSION VERSION_GREATER 3.1.0 OR CMAKE_VERSION VERSION_EQUAL 3.1.0) +if(CMAKE_VERSION VERSION_GREATER 3.1.0 OR CMAKE_VERSION VERSION_EQUAL 3.1.0) add_library(fmt-header-only INTERFACE) add_library(fmt::fmt-header-only ALIAS fmt-header-only) target_compile_definitions(fmt-header-only INTERFACE FMT_HEADER_ONLY=1) - target_include_directories(fmt-header-only INTERFACE - $ - $) -endif () + target_include_directories( + fmt-header-only + INTERFACE $ + $) +endif() # Install targets. -if (FMT_INSTALL) +if(FMT_INSTALL) include(GNUInstallDirs) include(CMakePackageConfigHelpers) - set(FMT_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/fmt CACHE STRING - "Installation directory for cmake files, relative to ${CMAKE_INSTALL_PREFIX}.") + set( + FMT_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/fmt + CACHE + STRING + "Installation directory for cmake files, relative to ${CMAKE_INSTALL_PREFIX}." + ) set(version_config ${PROJECT_BINARY_DIR}/fmt-config-version.cmake) set(project_config ${PROJECT_BINARY_DIR}/fmt-config.cmake) set(targets_export_name fmt-targets) - set (INSTALL_TARGETS fmt) - if (TARGET fmt-header-only) + set(INSTALL_TARGETS fmt) + if(TARGET fmt-header-only) set(INSTALL_TARGETS ${INSTALL_TARGETS} fmt-header-only) - endif () - - set(FMT_LIB_DIR ${CMAKE_INSTALL_LIBDIR} CACHE STRING - "Installation directory for libraries, relative to ${CMAKE_INSTALL_PREFIX}.") - - set(FMT_INC_DIR ${CMAKE_INSTALL_INCLUDEDIR}/fmt CACHE STRING - "Installation directory for include files, relative to ${CMAKE_INSTALL_PREFIX}.") + endif() + + set( + FMT_LIB_DIR ${CMAKE_INSTALL_LIBDIR} + CACHE + STRING + "Installation directory for libraries, relative to ${CMAKE_INSTALL_PREFIX}." + ) + + set( + FMT_INC_DIR ${CMAKE_INSTALL_INCLUDEDIR}/fmt + CACHE + STRING + "Installation directory for include files, relative to ${CMAKE_INSTALL_PREFIX}." + ) # Generate the version, config and target files into the build directory. - write_basic_package_version_file( - ${version_config} - VERSION ${FMT_VERSION} - COMPATIBILITY AnyNewerVersion) + write_basic_package_version_file(${version_config} + VERSION + ${FMT_VERSION} + COMPATIBILITY + AnyNewerVersion) configure_package_config_file( ${PROJECT_SOURCE_DIR}/support/cmake/fmt-config.cmake.in ${project_config} - INSTALL_DESTINATION ${FMT_CMAKE_DIR}) + INSTALL_DESTINATION + ${FMT_CMAKE_DIR}) # Use a namespace because CMake provides better diagnostics for namespaced # imported targets. - export(TARGETS ${INSTALL_TARGETS} NAMESPACE fmt:: + export(TARGETS ${INSTALL_TARGETS} + NAMESPACE fmt:: FILE ${PROJECT_BINARY_DIR}/${targets_export_name}.cmake) # Install version, config and target files. - install( - FILES ${project_config} ${version_config} - DESTINATION ${FMT_CMAKE_DIR}) - install(EXPORT ${targets_export_name} DESTINATION ${FMT_CMAKE_DIR} + install(FILES ${project_config} ${version_config} + DESTINATION ${FMT_CMAKE_DIR}) + install(EXPORT ${targets_export_name} + DESTINATION ${FMT_CMAKE_DIR} NAMESPACE fmt::) # Install the library and headers. - install(TARGETS ${INSTALL_TARGETS} EXPORT ${targets_export_name} + install(TARGETS ${INSTALL_TARGETS} + EXPORT ${targets_export_name} DESTINATION ${FMT_LIB_DIR}) install(FILES ${FMT_HEADERS} DESTINATION ${FMT_INC_DIR}) -endif () +endif() -if (FMT_DOC) +if(FMT_DOC) add_subdirectory(doc) -endif () +endif() -if (FMT_TEST) +if(FMT_TEST) enable_testing() add_subdirectory(test) -endif () +endif() set(gitignore ${PROJECT_SOURCE_DIR}/.gitignore) -if (MASTER_PROJECT AND EXISTS ${gitignore}) +if(MASTER_PROJECT AND EXISTS ${gitignore}) # Get the list of ignored files from .gitignore. - file (STRINGS ${gitignore} lines) - LIST(REMOVE_ITEM lines /doc/html) - foreach (line ${lines}) - string(REPLACE "." "[.]" line "${line}") - string(REPLACE "*" ".*" line "${line}") + file(STRINGS ${gitignore} lines) + list(REMOVE_ITEM lines /doc/html) + foreach(line ${lines}) + string(REPLACE "." + "[.]" + line + "${line}") + string(REPLACE "*" + ".*" + line + "${line}") set(ignored_files ${ignored_files} "${line}$" "${line}/") - endforeach () - set(ignored_files ${ignored_files} - /.git /breathe /format-benchmark sphinx/ .buildinfo .doctrees) + endforeach() + set(ignored_files + ${ignored_files} + /.git + /breathe + /format-benchmark + sphinx/ + .buildinfo + .doctrees) set(CPACK_SOURCE_GENERATOR ZIP) set(CPACK_SOURCE_IGNORE_FILES ${ignored_files}) @@ -235,4 +275,4 @@ if (MASTER_PROJECT AND EXISTS ${gitignore}) set(CPACK_PACKAGE_NAME fmt) set(CPACK_RESOURCE_FILE_README ${PROJECT_SOURCE_DIR}/README.rst) include(CPack) -endif () +endif() diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 0c9cfb1d25..2ca6729a9a 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -1,21 +1,20 @@ -if (MSVC) +if(MSVC) -set(doc_sources - apps/Echo.md - apps/Broker.md - apps/App.md - apps/Player.md - apps/index.md - apps/Source.md - configuration/CoreTypes.md - configuration/Federate.md - configuration/index.md - configuration/Timing.md - configuration/Filters.md - configuration/MessageFederate.md - configuration/ValueFederate.md - ) + set(doc_sources + apps/Echo.md + apps/Broker.md + apps/App.md + apps/Player.md + apps/index.md + apps/Source.md + configuration/CoreTypes.md + configuration/Federate.md + configuration/index.md + configuration/Timing.md + configuration/Filters.md + configuration/MessageFederate.md + configuration/ValueFederate.md) -add_custom_target(helics_docs SOURCES ${doc_sources}) + add_custom_target(helics_docs SOURCES ${doc_sources}) -endif(MSVC) \ No newline at end of file +endif(MSVC) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 5e90257b10..8a43748a41 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,25 +1,25 @@ -############################################################################## -#Copyright © 2017-2018, -#Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC -#All rights reserved. See LICENSE file and DISCLAIMER for more details. -############################################################################## +# +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore +# National Security, LLC; Alliance for Sustainable Energy, LLC All rights +# reserved. See LICENSE file and DISCLAIMER for more details. +# -if (EXAMPLES_WARNINGS_AS_ERROR) - #the examples had better compile without warnings otherwise they should not be allowed - if(WIN32) - if (MSVC) - add_compile_options(/WX) - else(MSVC) - add_compile_options(-Werror) - endif(MSVC) - else(WIN32) - add_compile_options(-Werror) - endif(WIN32) +if(EXAMPLES_WARNINGS_AS_ERROR) + # the examples had better compile without warnings otherwise they should not + # be allowed + if(WIN32) + if(MSVC) + add_compile_options(/WX) + else(MSVC) + add_compile_options(-Werror) + endif(MSVC) + else(WIN32) + add_compile_options(-Werror) + endif(WIN32) endif() -add_subdirectory (comboFederates1) +add_subdirectory(comboFederates1) if(BUILD_C_SHARED_LIB) - add_subdirectory (CppInterface) + add_subdirectory(CppInterface) endif(BUILD_C_SHARED_LIB) - diff --git a/examples/CppInterface/CMakeLists.txt b/examples/CppInterface/CMakeLists.txt index 05c8c84943..414150308e 100644 --- a/examples/CppInterface/CMakeLists.txt +++ b/examples/CppInterface/CMakeLists.txt @@ -1,47 +1,59 @@ -############################################################################## -# Copyright © 2017-2018, -# Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC -#All rights reserved. See LICENSE file and DISCLAIMER for more details. -############################################################################## +# +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore +# National Security, LLC; Alliance for Sustainable Energy, LLC All rights +# reserved. See LICENSE file and DISCLAIMER for more details. +# -include_directories ("${PROJECT_SOURCE_DIR}/src/helics") -include_directories ("${PROJECT_SOURCE_DIR}/src/helics/cpp98") +include_directories("${PROJECT_SOURCE_DIR}/src/helics") +include_directories("${PROJECT_SOURCE_DIR}/src/helics/cpp98") add_executable(nonlings_fed1_cpp nonlings_fed1.cpp) add_executable(nonlings_fed2_cpp nonlings_fed2.cpp) -target_link_libraries(nonlings_fed1_cpp helicsCpp98 ) -target_link_libraries(nonlings_fed2_cpp helicsCpp98 ) +target_link_libraries(nonlings_fed1_cpp helicsCpp98) +target_link_libraries(nonlings_fed2_cpp helicsCpp98) set_property(TARGET nonlings_fed1_cpp PROPERTY CXX_STANDARD 98) set_property(TARGET nonlings_fed2_cpp PROPERTY CXX_STANDARD 98) -if (!MSVC) -target_compile_options(nonlings_fed1_cpp PRIVATE -pedantic -Werror) -target_compile_options(nonlings_fed2_cpp PRIVATE -pedantic -Werror) +if(!MSVC) + target_compile_options(nonlings_fed1_cpp PRIVATE -pedantic -Werror) + target_compile_options(nonlings_fed2_cpp PRIVATE -pedantic -Werror) endif() -set_target_properties (nonlings_fed1_cpp PROPERTIES - FOLDER examples) +set_target_properties(nonlings_fed1_cpp PROPERTIES FOLDER examples) -set_target_properties (nonlings_fed2_cpp PROPERTIES - FOLDER examples) +set_target_properties(nonlings_fed2_cpp PROPERTIES FOLDER examples) -if (BUILD_HELICS_TESTS AND NOT MSVC) - add_test(NAME nonlings_example - COMMAND ${PROJECT_SOURCE_DIR}/scripts/test_example.sh 10 $ $) - set_property(TEST nonlings_example PROPERTY LABELS Continuous) +if(BUILD_HELICS_TESTS AND NOT MSVC) + add_test(NAME nonlings_example + COMMAND ${PROJECT_SOURCE_DIR}/scripts/test_example.sh 10 + $ + $) + set_property(TEST nonlings_example PROPERTY LABELS Continuous) endif() foreach(keyfile IN LISTS KEY_LIBRARY_FILES) -add_custom_command(TARGET nonlings_fed1_cpp POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." - "${keyfile}" # <--this is in-file - "$/") # <--this is out-file path + add_custom_command(TARGET + nonlings_fed1_cpp + POST_BUILD # Adds a post-build event to api tests + COMMAND ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E + # copy_if_different..." + "${keyfile}" # <--this is in-file + "$/") + # <--this is out-file path endforeach(keyfile) -add_custom_command(TARGET nonlings_fed1_cpp POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." - "$" # <--this is in-file - "$/") # <--this is out-file path - +add_custom_command(TARGET + nonlings_fed1_cpp + POST_BUILD # Adds a post-build event to api tests + COMMAND ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E + # copy_if_different..." + "$" # <--this is in-file + "$/") # <--this is + # out-file + # path diff --git a/examples/comboFederates1/CMakeLists.txt b/examples/comboFederates1/CMakeLists.txt index 2ffde729bd..d371bdf527 100644 --- a/examples/comboFederates1/CMakeLists.txt +++ b/examples/comboFederates1/CMakeLists.txt @@ -1,31 +1,39 @@ -############################################################################## -# Copyright © 2017-2018, -# Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC -#All rights reserved. See LICENSE file and DISCLAIMER for more details. -############################################################################## +# +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore +# National Security, LLC; Alliance for Sustainable Energy, LLC All rights +# reserved. See LICENSE file and DISCLAIMER for more details. +# add_executable(comboFed comboFed.cpp) target_link_libraries(comboFed helics_apps-static) +set_target_properties(comboFed PROPERTIES FOLDER examples) -set_target_properties (comboFed PROPERTIES - FOLDER examples -) +# configure_file(${CMAKE_CURRENT_SOURCE_DIR}/run.sh +# ${CMAKE_CURRENT_BINARY_DIR}/run.sh COPYONLY) -#configure_file(${CMAKE_CURRENT_SOURCE_DIR}/run.sh -# ${CMAKE_CURRENT_BINARY_DIR}/run.sh -# COPYONLY) - -add_custom_command(TARGET comboFed POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." - "${CMAKE_CURRENT_SOURCE_DIR}/run.sh" # <--this is in-file - "$/") # <--this is out-file path +add_custom_command(TARGET + comboFed + POST_BUILD # Adds a post-build event to api tests + COMMAND ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E + # copy_if_different..." + "${CMAKE_CURRENT_SOURCE_DIR}/run.sh" # <--this is in- + # file + "$/") # <--this is out-file + # path foreach(keyfile IN LISTS KEY_LIBRARY_FILES) -add_custom_command(TARGET comboFed POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." - "${keyfile}" # <--this is in-file - "$/") # <--this is out-file path + add_custom_command(TARGET + comboFed + POST_BUILD # Adds a post-build event to api tests + COMMAND ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E + # copy_if_different..." + "${keyfile}" # <--this is in-file + "$/") # <--this is out- + # file path endforeach(keyfile) - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9810e76be3..719ee89972 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,3 +1 @@ - -add_subdirectory (helics) - +add_subdirectory(helics) diff --git a/src/helics/CMakeLists.txt b/src/helics/CMakeLists.txt index c159e203f9..bc4203da50 100644 --- a/src/helics/CMakeLists.txt +++ b/src/helics/CMakeLists.txt @@ -1,9 +1,8 @@ -############################################################################## -# Copyright © 2017-2018, -# Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC -#All rights reserved. See LICENSE file and DISCLAIMER for more details. -############################################################################## - +# +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore +# National Security, LLC; Alliance for Sustainable Energy, LLC All rights +# reserved. See LICENSE file and DISCLAIMER for more details. +# add_subdirectory(common) add_subdirectory(core) @@ -13,56 +12,65 @@ add_subdirectory(application_api) # Add the main HELICS library # ------------------------------------------------------------- - -add_library(helics-static STATIC - $ - $ - $ -) +add_library(helics-static + STATIC + $ + $ + $) target_link_libraries(helics-static PUBLIC helics_base) -#add and alias library to match the find_package +# add and alias library to match the find_package add_library(HELICS::helics-static ALIAS helics-static) if(BUILD_CXX_SHARED_LIB) - add_library(helics-shared SHARED - ../empty.cpp - $ - $ - $ -) + add_library(helics-shared + SHARED + ../empty.cpp + $ + $ + $) - add_library(HELICS::helics-shared ALIAS helics-shared) - target_link_libraries(helics-shared PRIVATE helics_base) + add_library(HELICS::helics-shared ALIAS helics-shared) + target_link_libraries(helics-shared PRIVATE helics_base) - if (WIN32) - set_target_properties(helics-shared PROPERTIES - WINDOWS_EXPORT_ALL_SYMBOLS TRUE) + if(WIN32) + set_target_properties(helics-shared + PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) - endif () + endif() endif() -install(FILES flag-definitions.h helics.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics COMPONENT headers) +install(FILES flag-definitions.h helics.hpp + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics + COMPONENT headers) -install (TARGETS helics-static EXPORT helics-targets - DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs) +install(TARGETS helics-static + EXPORT helics-targets + DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT libs) if(BUILD_CXX_SHARED_LIB) - install (TARGETS helics-shared EXPORT helics-targets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) - - install(FILES $ DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs) - install(FILES $ DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs) + install(TARGETS helics-shared + EXPORT helics-targets + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + + install(FILES $ + DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT libs) + install(FILES $ + DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT libs) endif(BUILD_CXX_SHARED_LIB) add_subdirectory(apps) -if (BUILD_C_SHARED_LIB OR INTERFACE_BUILD) - add_subdirectory(shared_api_library) - add_subdirectory(cpp98) - install(FILES chelics.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics COMPONENT headers) +if(BUILD_C_SHARED_LIB OR INTERFACE_BUILD) + add_subdirectory(shared_api_library) + add_subdirectory(cpp98) + install(FILES chelics.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics + COMPONENT headers) endif() - diff --git a/src/helics/application_api/CMakeLists.txt b/src/helics/application_api/CMakeLists.txt index 7a2f330b47..4dc7ac0a36 100644 --- a/src/helics/application_api/CMakeLists.txt +++ b/src/helics/application_api/CMakeLists.txt @@ -1,59 +1,71 @@ -############################################################################## -# Copyright © 2017-2018, -# Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC -#All rights reserved. See LICENSE file and DISCLAIMER for more details. -############################################################################## +# +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore +# National Security, LLC; Alliance for Sustainable Energy, LLC All rights +# reserved. See LICENSE file and DISCLAIMER for more details. +# set(public_application_api_headers -CombinationFederate.hpp -Publications.hpp -Subscriptions.hpp -Endpoints.hpp -Filters.hpp -Federate.hpp -helicsTypes.hpp -data_view.hpp -MessageFederate.hpp -MessageOperators.hpp -ValueConverter.hpp -ValueConverter_impl.hpp -ValueFederate.hpp -HelicsPrimaryTypes.hpp -queryFunctions.hpp -) + CombinationFederate.hpp + Publications.hpp + Subscriptions.hpp + Endpoints.hpp + Filters.hpp + Federate.hpp + helicsTypes.hpp + data_view.hpp + MessageFederate.hpp + MessageOperators.hpp + ValueConverter.hpp + ValueConverter_impl.hpp + ValueFederate.hpp + HelicsPrimaryTypes.hpp + queryFunctions.hpp) set(private_application_api_headers -MessageFederateManager.hpp -ValueFederateManager.hpp -AsyncFedCallInfo.hpp -FilterOperations.hpp -) + MessageFederateManager.hpp + ValueFederateManager.hpp + AsyncFedCallInfo.hpp + FilterOperations.hpp) set(application_api_sources -CombinationFederate.cpp -Federate.cpp -MessageFederate.cpp -MessageFederateManager.cpp -MessageOperators.cpp -ValueFederate.cpp -ValueConverter.cpp -ValueFederateManager.cpp -helicsPrimaryTypes.cpp -Subscriptions.cpp -Publications.cpp -Filters.cpp -FilterOperations.cpp -Endpoints.cpp -helicsTypes.cpp -queryFunctions.cpp -FederateInfo.cpp -) + CombinationFederate.cpp + Federate.cpp + MessageFederate.cpp + MessageFederateManager.cpp + MessageOperators.cpp + ValueFederate.cpp + ValueConverter.cpp + ValueFederateManager.cpp + helicsPrimaryTypes.cpp + Subscriptions.cpp + Publications.cpp + Filters.cpp + FilterOperations.cpp + Endpoints.cpp + helicsTypes.cpp + queryFunctions.cpp + FederateInfo.cpp) -add_library(application_api OBJECT ${application_api_sources} ${public_application_api_headers} ${private_application_api_headers}) +add_library(application_api + OBJECT + ${application_api_sources} + ${public_application_api_headers} + ${private_application_api_headers}) -target_include_directories(application_api PRIVATE $) -target_include_directories(application_api SYSTEM PRIVATE $) -target_compile_definitions(application_api PRIVATE $) -target_compile_options(application_api PRIVATE $) - -install(FILES ${public_application_api_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics/application_api COMPONENT headers) +target_include_directories( + application_api + PRIVATE $) +target_include_directories( + application_api SYSTEM + PRIVATE + $ + ) +target_compile_definitions( + application_api PRIVATE + $) +target_compile_options( + application_api + PRIVATE $) +install(FILES ${public_application_api_headers} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics/application_api + COMPONENT headers) diff --git a/src/helics/apps/CMakeLists.txt b/src/helics/apps/CMakeLists.txt index 468e02cdb5..b95391ac04 100644 --- a/src/helics/apps/CMakeLists.txt +++ b/src/helics/apps/CMakeLists.txt @@ -1,99 +1,119 @@ -############################################################################## -# Copyright © 2017-2018, -# Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC -#All rights reserved. See LICENSE file and DISCLAIMER for more details. -############################################################################## +# +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore +# National Security, LLC; Alliance for Sustainable Energy, LLC All rights +# reserved. See LICENSE file and DISCLAIMER for more details. +# if(BUILD_APPS) -set(helics_apps_public_headers - Player.hpp - Recorder.hpp - Echo.hpp - Source.hpp - Tracer.hpp - helicsApp.hpp - BrokerApp.hpp - ) - -set(helics_apps_private_headers - PrecHelper.hpp - SignalGenerators.hpp - ) - -set(helics_apps_library_files - Player.cpp - Recorder.cpp - PrecHelper.cpp - SignalGenerators.cpp - Echo.cpp - Source.cpp - Tracer.cpp - helicsApp.cpp - BrokerApp.cpp -) - -add_library(helics_apps-static STATIC ${helics_apps_library_files} ${helics_apps_public_headers} ${helics_apps_private_headers}) - -target_link_libraries(helics_apps-static PUBLIC helics-static) -target_include_directories(helics_apps-static SYSTEM PRIVATE $) -target_compile_definitions(helics_apps-static PRIVATE $) -#add and alias library to match the find_package -add_library(HELICS::helics_apps-static ALIAS helics_apps-static) - - - add_executable(helics_player playerMain.cpp) - target_link_libraries(helics_player helics_apps-static ) - set_target_properties (helics_player PROPERTIES FOLDER apps) - install(TARGETS helics_player DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT applications) - - add_executable(helics_recorder recorderMain.cpp) - target_link_libraries(helics_recorder helics_apps-static) - set_target_properties (helics_recorder PROPERTIES FOLDER apps) - install(TARGETS helics_recorder DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT applications) - - add_executable(helics_broker helics-broker.cpp) - target_link_libraries(helics_broker helics_apps-static) - set_target_properties (helics_broker PROPERTIES FOLDER apps) - set(HELICS_BROKER_LOC ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "build folder location of the broker") - install(TARGETS helics_broker DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT applications) - - add_executable(helics_app appMain.cpp) - target_link_libraries(helics_app helics_apps-static) - set_target_properties (helics_app PROPERTIES FOLDER apps) - install(TARGETS helics_app DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT applications) - - if (WIN32) - foreach(keyfile IN LISTS KEY_LIBRARY_FILES) - add_custom_command(TARGET helics_app POST_BUILD # Adds a post-build event to core tests - COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." - "${keyfile}" # <--this is in-file - "$/") # <--this is out-file path - endforeach(keyfile) - - endif() - - install(TARGETS helics_apps-static EXPORT helics-targets - DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT libs) - - install(FILES ${helics_apps_public_headers} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics/apps COMPONENT headers) - -endif() #if build any app - -#configure executable app - -configure_file(helicsConfigMain.h.in ${CMAKE_CURRENT_BINARY_DIR}/helicsConfigMain.h) -add_executable(helics-config helicsConfigMain.cpp ${CMAKE_CURRENT_BINARY_DIR}/helicsConfigMain.h) + set(helics_apps_public_headers + Player.hpp + Recorder.hpp + Echo.hpp + Source.hpp + Tracer.hpp + helicsApp.hpp + BrokerApp.hpp) + + set(helics_apps_private_headers PrecHelper.hpp SignalGenerators.hpp) + + set(helics_apps_library_files + Player.cpp + Recorder.cpp + PrecHelper.cpp + SignalGenerators.cpp + Echo.cpp + Source.cpp + Tracer.cpp + helicsApp.cpp + BrokerApp.cpp) + + add_library(helics_apps-static + STATIC + ${helics_apps_library_files} + ${helics_apps_public_headers} + ${helics_apps_private_headers}) + + target_link_libraries(helics_apps-static PUBLIC helics-static) + target_include_directories( + helics_apps-static SYSTEM + PRIVATE $) + target_compile_definitions( + helics_apps-static PRIVATE + $) + # add and alias library to match the find_package + add_library(HELICS::helics_apps-static ALIAS helics_apps-static) + + add_executable(helics_player playerMain.cpp) + target_link_libraries(helics_player helics_apps-static) + set_target_properties(helics_player PROPERTIES FOLDER apps) + install(TARGETS helics_player + DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT applications) + + add_executable(helics_recorder recorderMain.cpp) + target_link_libraries(helics_recorder helics_apps-static) + set_target_properties(helics_recorder PROPERTIES FOLDER apps) + install(TARGETS helics_recorder + DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT applications) + + add_executable(helics_broker helics-broker.cpp) + target_link_libraries(helics_broker helics_apps-static) + set_target_properties(helics_broker PROPERTIES FOLDER apps) + set(HELICS_BROKER_LOC ${CMAKE_CURRENT_BINARY_DIR} + CACHE INTERNAL "build folder location of the broker") + install(TARGETS helics_broker + DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT applications) + + add_executable(helics_app appMain.cpp) + target_link_libraries(helics_app helics_apps-static) + set_target_properties(helics_app PROPERTIES FOLDER apps) + install(TARGETS helics_app + DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT applications) + + if(WIN32) + foreach(keyfile IN LISTS KEY_LIBRARY_FILES) + add_custom_command(TARGET + helics_app + POST_BUILD # Adds a post-build event to core tests + COMMAND ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E + # copy_if_different..." + "${keyfile}" # <--this is in-file + "$/") # <--this is + # out-file + # path + endforeach(keyfile) + + endif() + + install(TARGETS helics_apps-static + EXPORT helics-targets + DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT libs) + + install(FILES ${helics_apps_public_headers} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics/apps + COMPONENT headers) + +endif() # if build any app + +# configure executable app + +configure_file(helicsConfigMain.h.in + ${CMAKE_CURRENT_BINARY_DIR}/helicsConfigMain.h) +add_executable(helics-config helicsConfigMain.cpp + ${CMAKE_CURRENT_BINARY_DIR}/helicsConfigMain.h) target_include_directories(helics-config PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) -set_target_properties (helics-config PROPERTIES FOLDER apps) +set_target_properties(helics-config PROPERTIES FOLDER apps) target_link_libraries(helics-config PUBLIC Boostlibs::core) target_include_directories(helics-config SYSTEM PRIVATE ${Boost_INCLUDE_DIR}) install(TARGETS helics-config - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs -) - + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs) diff --git a/src/helics/common/CMakeLists.txt b/src/helics/common/CMakeLists.txt index 512c7843a0..71bff19871 100644 --- a/src/helics/common/CMakeLists.txt +++ b/src/helics/common/CMakeLists.txt @@ -1,107 +1,115 @@ -############################################################################## -# Copyright © 2017-2018, -# Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC -#All rights reserved. See LICENSE file and DISCLAIMER for more details. -############################################################################## +# +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore +# National Security, LLC; Alliance for Sustainable Energy, LLC All rights +# reserved. See LICENSE file and DISCLAIMER for more details. +# set(common_headers -AirLock.hpp -simpleQueue.hpp -BlockingQueue.hpp -BlockingPriorityQueue.hpp -timeRepresentation.hpp -delayedDestructor.hpp -DelayedObjects.hpp -searchableObjectHolder.hpp -argParser.h -JsonProcessingFunctions.hpp -TomlProcessingFunctions.hpp -stringToCmdLine.h -AsioServiceManager.h -logger.h -stringOps.h -MapTraits.hpp -GuardedTypes.hpp -generic_string_ops.hpp -charMapper.h -base64.h -MappedVector.hpp -DualMappedVector.hpp -MappedPointerVector.hpp -DualMappedPointerVector.hpp -TripWire.hpp -fmt_format.h -fmt_ostream.h -) + AirLock.hpp + simpleQueue.hpp + BlockingQueue.hpp + BlockingPriorityQueue.hpp + timeRepresentation.hpp + delayedDestructor.hpp + DelayedObjects.hpp + searchableObjectHolder.hpp + argParser.h + JsonProcessingFunctions.hpp + TomlProcessingFunctions.hpp + stringToCmdLine.h + AsioServiceManager.h + logger.h + stringOps.h + MapTraits.hpp + GuardedTypes.hpp + generic_string_ops.hpp + charMapper.h + base64.h + MappedVector.hpp + DualMappedVector.hpp + MappedPointerVector.hpp + DualMappedPointerVector.hpp + TripWire.hpp + fmt_format.h + fmt_ostream.h) set(common_sources -stringToCmdLine.cpp -AsioServiceManager.cpp -JsonProcessingFunctions.cpp -TomlProcessingFunctions.cpp -logger.cpp -stringOps.cpp -charMapper.cpp -base64.cpp -argParser.cpp -TripWire.cpp -) + stringToCmdLine.cpp + AsioServiceManager.cpp + JsonProcessingFunctions.cpp + TomlProcessingFunctions.cpp + logger.cpp + stringOps.cpp + charMapper.cpp + base64.cpp + argParser.cpp + TripWire.cpp) set(zmq_headers - #zmqReactor.h - zmqContextManager.h - zmqHelper.h - #zmqSocketDescriptor.h - #zmqProxyHub.h - cppzmq/zmq.hpp - cppzmq/zmq_addon.hpp - ) + # zmqReactor.h + zmqContextManager.h zmqHelper.h + # zmqSocketDescriptor.h + # zmqProxyHub.h + cppzmq/zmq.hpp cppzmq/zmq_addon.hpp) set(zmq_sources - #zmqReactor.cpp - zmqContextManager.cpp - #zmqSocketDescriptor.cpp - zmqHelper.cpp - #zmqProxyHub.cpp -) + # zmqReactor.cpp + zmqContextManager.cpp + # zmqSocketDescriptor.cpp + zmqHelper.cpp + # zmqProxyHub.cpp + ) -#headers that are part of the public interface -set (helics_public_common -timeRepresentation.hpp -argParser.h -JsonProcessingFunctions.hpp -stringToCmdLine.h -AsioServiceManager.h -logger.h -stringOps.h -MapTraits.hpp -GuardedTypes.hpp -generic_string_ops.hpp -) +# headers that are part of the public interface +set(helics_public_common + timeRepresentation.hpp + argParser.h + JsonProcessingFunctions.hpp + stringToCmdLine.h + AsioServiceManager.h + logger.h + stringOps.h + MapTraits.hpp + GuardedTypes.hpp + generic_string_ops.hpp) -if (HELICS_HAVE_ZEROMQ) - list(APPEND common_headers ${zmq_headers}) - list(APPEND common_sources ${zmq_sources}) -endif (HELICS_HAVE_ZEROMQ) +if(HELICS_HAVE_ZEROMQ) + list(APPEND common_headers ${zmq_headers}) + list(APPEND common_sources ${zmq_sources}) +endif(HELICS_HAVE_ZEROMQ) list(APPEND common_sources ${PROJECT_SOURCE_DIR}/ThirdParty/jsoncpp.cpp) add_library(helics_common OBJECT ${common_sources} ${common_headers}) set_target_properties(helics_common PROPERTIES LINKER_LANGUAGE CXX) -target_include_directories(helics_common PRIVATE $) -target_include_directories(helics_common SYSTEM PRIVATE $) -target_compile_definitions(helics_common PRIVATE $) +target_include_directories( + helics_common + PRIVATE $) +target_include_directories( + helics_common SYSTEM + PRIVATE + $ + ) +target_compile_definitions( + helics_common PRIVATE + $) -target_compile_options(helics_common PRIVATE $) +target_compile_options( + helics_common + PRIVATE $) -if (HELICS_HAVE_ZEROMQ) - target_include_directories(helics_common SYSTEM PRIVATE $) -endif (HELICS_HAVE_ZEROMQ) +if(HELICS_HAVE_ZEROMQ) + target_include_directories( + helics_common SYSTEM + PRIVATE + $) +endif(HELICS_HAVE_ZEROMQ) -if (APPLE) - target_compile_definitions(helics_common PUBLIC "-DSTX_NO_STD_ANY=1") +if(APPLE) + target_compile_definitions(helics_common PUBLIC "-DSTX_NO_STD_ANY=1") endif(APPLE) -install(FILES ${helics_public_common} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics/common COMPONENT headers) - +install(FILES ${helics_public_common} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics/common + COMPONENT headers) diff --git a/src/helics/core/CMakeLists.txt b/src/helics/core/CMakeLists.txt index e5ddd44e45..c2f6b631a8 100644 --- a/src/helics/core/CMakeLists.txt +++ b/src/helics/core/CMakeLists.txt @@ -1,210 +1,215 @@ -############################################################################## -# Copyright © 2017-2018, -# Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC -#All rights reserved. See LICENSE file and DISCLAIMER for more details. -############################################################################## +# +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore +# National Security, LLC; Alliance for Sustainable Energy, LLC All rights +# reserved. See LICENSE file and DISCLAIMER for more details. +# set(SRC_FILES CoreFactory.cpp - BrokerFactory.cpp - BrokerBase.cpp - CommonCore.cpp - FederateState.cpp - SubscriptionInfo.cpp - PublicationInfo.cpp - InterfaceInfo.cpp - #FilterInfo.cpp - EndpointInfo.cpp - ActionMessage.cpp - CoreBroker.cpp - core-types.cpp - core-data.cpp - TimeCoordinator.cpp - ForwardingTimeCoordinator.cpp - TimeDependencies.cpp - CommsInterface.cpp - CommsBroker.cpp - NetworkBrokerData.cpp - helics-time.cpp - HandleManager.cpp - HandlePointerManager.cpp - MessageTimer.cpp - JsonMapBuilder.cpp - -) - -set(TESTCORE_SOURCE_FILES - TestBroker.cpp - TestCore.cpp -) - -set (IPC_SOURCE_FILES - ipc/IpcCore.cpp - ipc/IpcBroker.cpp - ipc/IpcComms.cpp - ipc/IpcQueueHelper.cpp -) - -set (MPI_SOURCE_FILES - mpi/MpiCore.cpp - mpi/MpiBroker.cpp - mpi/MpiComms.cpp - mpi/MpiService.cpp -) - -set (ZMQ_SOURCE_FILES - zmq/ZmqCore.cpp - zmq/ZmqBroker.cpp - zmq/ZmqComms.cpp - zmq/ZmqRequestSets.cpp -) - -set (UDP_SOURCE_FILES - udp/UdpCore.cpp - udp/UdpBroker.cpp - udp/UdpComms.cpp -) - -set (TCP_SOURCE_FILES - tcp/TcpCore.cpp - tcp/TcpBroker.cpp - tcp/TcpComms.cpp - tcp/TcpHelperClasses.cpp -) - -set (PUBLIC_INCLUDE_FILES -Core.hpp -Broker.hpp -CoreFactory.hpp -BrokerFactory.hpp -core-exceptions.hpp -core-types.hpp -core-data.hpp -helics-time.hpp -CoreFederateInfo.hpp -helicsVersion.hpp -../flag-definitions.h -) + BrokerFactory.cpp + BrokerBase.cpp + CommonCore.cpp + FederateState.cpp + SubscriptionInfo.cpp + PublicationInfo.cpp + InterfaceInfo.cpp + # FilterInfo.cpp + EndpointInfo.cpp + ActionMessage.cpp + CoreBroker.cpp + core-types.cpp + core-data.cpp + TimeCoordinator.cpp + ForwardingTimeCoordinator.cpp + TimeDependencies.cpp + CommsInterface.cpp + CommsBroker.cpp + NetworkBrokerData.cpp + helics-time.cpp + HandleManager.cpp + HandlePointerManager.cpp + MessageTimer.cpp + JsonMapBuilder.cpp) + +set(TESTCORE_SOURCE_FILES TestBroker.cpp TestCore.cpp) + +set(IPC_SOURCE_FILES + ipc/IpcCore.cpp + ipc/IpcBroker.cpp + ipc/IpcComms.cpp + ipc/IpcQueueHelper.cpp) + +set(MPI_SOURCE_FILES + mpi/MpiCore.cpp + mpi/MpiBroker.cpp + mpi/MpiComms.cpp + mpi/MpiService.cpp) + +set(ZMQ_SOURCE_FILES + zmq/ZmqCore.cpp + zmq/ZmqBroker.cpp + zmq/ZmqComms.cpp + zmq/ZmqRequestSets.cpp) + +set(UDP_SOURCE_FILES udp/UdpCore.cpp udp/UdpBroker.cpp udp/UdpComms.cpp) + +set(TCP_SOURCE_FILES + tcp/TcpCore.cpp + tcp/TcpBroker.cpp + tcp/TcpComms.cpp + tcp/TcpHelperClasses.cpp) + +set(PUBLIC_INCLUDE_FILES + Core.hpp + Broker.hpp + CoreFactory.hpp + BrokerFactory.hpp + core-exceptions.hpp + core-types.hpp + core-data.hpp + helics-time.hpp + CoreFederateInfo.hpp + helicsVersion.hpp + ../flag-definitions.h) set(INCLUDE_FILES - BrokerBase.hpp - TimeDependencies.hpp - TimeCoordinator.hpp - ForwardingTimeCoordinator.hpp - loggingHelper.hpp - CommsBroker.hpp - CommsBroker_impl.hpp - CoreBroker.hpp - InterfaceInfo.hpp - ActionMessageDefintions.hpp - ActionMessage.hpp - CommonCore.hpp - CommsInterface.hpp - FederateState.hpp - SubscriptionInfo.hpp - PublicationInfo.hpp - EndpointInfo.hpp - FilterInfo.hpp - BasicHandleInfo.hpp - FilterFunctions.hpp - NetworkBrokerData.hpp - HandleManager.hpp - HandlePointerManager.hpp - queryHelpers.hpp - MessageTimer.hpp - JsonMapBuilder.hpp -) - -set(TESTCORE_HEADER_FILES - TestCore.h - TestBroker.h -) + BrokerBase.hpp + TimeDependencies.hpp + TimeCoordinator.hpp + ForwardingTimeCoordinator.hpp + loggingHelper.hpp + CommsBroker.hpp + CommsBroker_impl.hpp + CoreBroker.hpp + InterfaceInfo.hpp + ActionMessageDefintions.hpp + ActionMessage.hpp + CommonCore.hpp + CommsInterface.hpp + FederateState.hpp + SubscriptionInfo.hpp + PublicationInfo.hpp + EndpointInfo.hpp + FilterInfo.hpp + BasicHandleInfo.hpp + FilterFunctions.hpp + NetworkBrokerData.hpp + HandleManager.hpp + HandlePointerManager.hpp + queryHelpers.hpp + MessageTimer.hpp + JsonMapBuilder.hpp) + +set(TESTCORE_HEADER_FILES TestCore.h TestBroker.h) set(IPC_HEADER_FILES - ipc/IpcCore.h - ipc/IpcBroker.h - ipc/IpcComms.h - ipc/IpcQueueHelper.h -) + ipc/IpcCore.h + ipc/IpcBroker.h + ipc/IpcComms.h + ipc/IpcQueueHelper.h) set(ZMQ_HEADER_FILES - zmq/ZmqCore.h - zmq/ZmqBroker.h - zmq/ZmqComms.h - zmq/ZmqRequestSets.h -) + zmq/ZmqCore.h + zmq/ZmqBroker.h + zmq/ZmqComms.h + zmq/ZmqRequestSets.h) set(MPI_HEADER_FILES - mpi/MpiCore.h - mpi/MpiBroker.h - mpi/MpiComms.h - mpi/MpiService.h - ) - -set(UDP_HEADER_FILES - udp/UdpCore.h - udp/UdpBroker.h - udp/UdpComms.h - ) + mpi/MpiCore.h + mpi/MpiBroker.h + mpi/MpiComms.h + mpi/MpiService.h) -set(TCP_HEADER_FILES - tcp/TcpCore.h - tcp/TcpBroker.h - tcp/TcpComms.h - tcp/TcpHelperClasses.h - ) - - list(APPEND SRC_FILES ${TESTCORE_SOURCE_FILES} ${UDP_SOURCE_FILES} ${IPC_SOURCE_FILES}) - list(APPEND INCLUDE_FILES ${TESTCORE_HEADER_FILES} ${UDP_HEADER_FILES} ${IPC_HEADER_FILES}) - - if (NOT DISABLE_TCP_CORE) - list(APPEND SRC_FILES ${TCP_SOURCE_FILES}) - list(APPEND INCLUDE_FILES ${TCP_HEADER_FILES} ) - endif() - - -if (HELICS_HAVE_ZEROMQ) - list(APPEND SRC_FILES ${ZMQ_SOURCE_FILES}) - list(APPEND INCLUDE_FILES ${ZMQ_HEADER_FILES}) -endif (HELICS_HAVE_ZEROMQ) - -if (HELICS_HAVE_MPI) - list(APPEND SRC_FILES ${MPI_SOURCE_FILES}) - list(APPEND INCLUDE_FILES ${MPI_HEADER_FILES}) -endif (HELICS_HAVE_MPI) +set(UDP_HEADER_FILES udp/UdpCore.h udp/UdpBroker.h udp/UdpComms.h) -add_library(helics_core OBJECT ${SRC_FILES} ${INCLUDE_FILES} ${PUBLIC_INCLUDE_FILES}) +set(TCP_HEADER_FILES + tcp/TcpCore.h + tcp/TcpBroker.h + tcp/TcpComms.h + tcp/TcpHelperClasses.h) + +list(APPEND SRC_FILES + ${TESTCORE_SOURCE_FILES} + ${UDP_SOURCE_FILES} + ${IPC_SOURCE_FILES}) +list(APPEND INCLUDE_FILES + ${TESTCORE_HEADER_FILES} + ${UDP_HEADER_FILES} + ${IPC_HEADER_FILES}) + +if(NOT DISABLE_TCP_CORE) + list(APPEND SRC_FILES ${TCP_SOURCE_FILES}) + list(APPEND INCLUDE_FILES ${TCP_HEADER_FILES}) +endif() -target_include_directories(helics_core PRIVATE $) -target_include_directories(helics_core SYSTEM PRIVATE $) -target_compile_definitions(helics_core PRIVATE $) -target_compile_options(helics_core PRIVATE $) +if(HELICS_HAVE_ZEROMQ) + list(APPEND SRC_FILES ${ZMQ_SOURCE_FILES}) + list(APPEND INCLUDE_FILES ${ZMQ_HEADER_FILES}) +endif(HELICS_HAVE_ZEROMQ) -target_include_directories(helics_core SYSTEM PRIVATE $) -target_compile_definitions(helics_core PRIVATE $) +if(HELICS_HAVE_MPI) + list(APPEND SRC_FILES ${MPI_SOURCE_FILES}) + list(APPEND INCLUDE_FILES ${MPI_HEADER_FILES}) +endif(HELICS_HAVE_MPI) -if (APPLE) - target_compile_definitions(helics_core PUBLIC "-DSTX_NO_STD_ANY=1") +add_library(helics_core + OBJECT + ${SRC_FILES} + ${INCLUDE_FILES} + ${PUBLIC_INCLUDE_FILES}) + +target_include_directories( + helics_core + PRIVATE $) +target_include_directories( + helics_core SYSTEM + PRIVATE + $ + ) +target_compile_definitions( + helics_core PRIVATE + $) +target_compile_options( + helics_core + PRIVATE $) + +target_include_directories( + helics_core SYSTEM + PRIVATE $) +target_compile_definitions( + helics_core PRIVATE + $) + +if(APPLE) + target_compile_definitions(helics_core PUBLIC "-DSTX_NO_STD_ANY=1") endif(APPLE) -if (HELICS_HAVE_MPI) - source_group("mpi" FILES ${MPI_SOURCE_FILES} ${MPI_HEADER_FILES}) -endif (HELICS_HAVE_MPI) +if(HELICS_HAVE_MPI) + source_group("mpi" FILES ${MPI_SOURCE_FILES} ${MPI_HEADER_FILES}) +endif(HELICS_HAVE_MPI) -if (HELICS_HAVE_ZEROMQ) - target_include_directories(helics_core SYSTEM PRIVATE $) - source_group("zmq" FILES ${ZMQ_SOURCE_FILES} ${ZMQ_HEADER_FILES}) +if(HELICS_HAVE_ZEROMQ) + target_include_directories( + helics_core SYSTEM + PRIVATE + $) + source_group("zmq" FILES ${ZMQ_SOURCE_FILES} ${ZMQ_HEADER_FILES}) endif(HELICS_HAVE_ZEROMQ) source_group("udp" FILES ${UDP_SOURCE_FILES} ${UDP_HEADER_FILES}) source_group("ipc" FILES ${IPC_SOURCE_FILES} ${IPC_HEADER_FILES}) source_group("test" FILES ${TESTCORE_SOURCE_FILES} ${TESTCORE_HEADER_FILES}) -if (NOT DISABLE_TCP_CORE) - source_group("tcp" FILES ${TCP_SOURCE_FILES} ${TCP_HEADER_FILES}) +if(NOT DISABLE_TCP_CORE) + source_group("tcp" FILES ${TCP_SOURCE_FILES} ${TCP_HEADER_FILES}) endif() -if (HELICS_HAVE_MPI) - target_include_directories(helics_core PRIVATE "${MPI_C_INCLUDE_DIR}" "${MPI_C_HEADER_DIR}" "${MPI_C_ADDITIONAL_INCLUDE_DIRS}") +if(HELICS_HAVE_MPI) + target_include_directories(helics_core + PRIVATE "${MPI_C_INCLUDE_DIR}" + "${MPI_C_HEADER_DIR}" + "${MPI_C_ADDITIONAL_INCLUDE_DIRS}") endif(HELICS_HAVE_MPI) -install (FILES ${PUBLIC_INCLUDE_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics/core COMPONENT headers) +install(FILES ${PUBLIC_INCLUDE_FILES} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics/core + COMPONENT headers) diff --git a/src/helics/cpp98/CMakeLists.txt b/src/helics/cpp98/CMakeLists.txt index 590bbedb04..815d393dfc 100644 --- a/src/helics/cpp98/CMakeLists.txt +++ b/src/helics/cpp98/CMakeLists.txt @@ -1,35 +1,38 @@ -############################################################################## -# Copyright © 2017-2018, -# Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC -#All rights reserved. See LICENSE file and DISCLAIMER for more details. -############################################################################## +# +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore +# National Security, LLC; Alliance for Sustainable Energy, LLC All rights +# reserved. See LICENSE file and DISCLAIMER for more details. +# set(helicsCpp98_headers -Broker.hpp -Core.hpp -CombinationFederate.hpp -Federate.hpp -MessageFederate.hpp -ValueFederate.hpp -helics.hpp -Publication.hpp -Subscription.hpp -Endpoint.hpp -Filter.hpp -config.hpp -) + Broker.hpp + Core.hpp + CombinationFederate.hpp + Federate.hpp + MessageFederate.hpp + ValueFederate.hpp + helics.hpp + Publication.hpp + Subscription.hpp + Endpoint.hpp + Filter.hpp + config.hpp) add_library(helicsCpp98 INTERFACE) -target_include_directories(helicsCpp98 INTERFACE "${PROJECT_SOURCE_DIR}/src/helics") +target_include_directories(helicsCpp98 + INTERFACE "${PROJECT_SOURCE_DIR}/src/helics") target_link_libraries(helicsCpp98 INTERFACE helicsSharedLib) add_library(HELICS::helicsCpp98 ALIAS helicsCpp98) -#this is purely so the files show up nicely in an IDE, other ides might use it as well but that can be added when/if the need arises -if (MSVC) - add_library(helicsCpp98_ide STATIC ${helicsCpp98_headers} ../../empty.cpp) - target_include_directories(helicsCpp98_ide PRIVATE "${PROJECT_SOURCE_DIR}/src/helics") - set_target_properties (helicsCpp98_ide PROPERTIES FOLDER interfaces) +# this is purely so the files show up nicely in an IDE, other ides might use it +# as well but that can be added when/if the need arises +if(MSVC) + add_library(helicsCpp98_ide STATIC ${helicsCpp98_headers} ../../empty.cpp) + target_include_directories(helicsCpp98_ide + PRIVATE "${PROJECT_SOURCE_DIR}/src/helics") + set_target_properties(helicsCpp98_ide PROPERTIES FOLDER interfaces) endif(MSVC) -install(FILES ${helicsCpp98_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cpp98 COMPONENT headers) - +install(FILES ${helicsCpp98_headers} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cpp98 + COMPONENT headers) diff --git a/src/helics/shared_api_library/CMakeLists.txt b/src/helics/shared_api_library/CMakeLists.txt index c2f3cf198e..eb4ae33e09 100644 --- a/src/helics/shared_api_library/CMakeLists.txt +++ b/src/helics/shared_api_library/CMakeLists.txt @@ -1,67 +1,89 @@ -############################################################################## -# Copyright © 2017-2018, -# Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC -#All rights reserved. See LICENSE file and DISCLAIMER for more details. -############################################################################## +# +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore +# National Security, LLC; Alliance for Sustainable Energy, LLC All rights +# reserved. See LICENSE file and DISCLAIMER for more details. +# set(helicsShared_headers -helics.h -api-data.h -ValueFederate.h -MessageFederate.h -MessageFilters.h -helicsCallbacks.h -) + helics.h + api-data.h + ValueFederate.h + MessageFederate.h + MessageFilters.h + helicsCallbacks.h) set(helicsShared_sources -helicsExport.cpp -FederateExport.cpp -ValueFederateExport.cpp -MessageFederateExport.cpp -MessageFiltersExport.cpp -helicsCallbacks.cpp -internal/api_objects.h -) + helicsExport.cpp + FederateExport.cpp + ValueFederateExport.cpp + MessageFederateExport.cpp + MessageFiltersExport.cpp + helicsCallbacks.cpp + internal/api_objects.h) include(GenerateExportHeader) -add_library(helicsSharedLib SHARED ${helicsShared_sources} ${helicsShared_headers}) +add_library(helicsSharedLib + SHARED + ${helicsShared_sources} + ${helicsShared_headers}) add_library(HELICS::helicsSharedLib ALIAS helicsSharedLib) -generate_export_header(helicsSharedLib - BASE_NAME helics) - -target_include_directories(helicsSharedLib PUBLIC - $ -) +generate_export_header(helicsSharedLib BASE_NAME helics) -set_target_properties(helicsSharedLib PROPERTIES CXX_VISIBILITY_PRESET hidden C_VISIBILITY_PRESET hidden) +target_include_directories( + helicsSharedLib + PUBLIC $) + +set_target_properties(helicsSharedLib + PROPERTIES CXX_VISIBILITY_PRESET + hidden + C_VISIBILITY_PRESET + hidden) target_link_libraries(helicsSharedLib PRIVATE helics-static) -if (UNIX OR MINGW) - if (NOT APPLE) - target_link_libraries(helicsSharedLib PRIVATE -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.txt) - endif(NOT APPLE) +if(UNIX OR MINGW) + if(NOT APPLE) + target_link_libraries( + helicsSharedLib + PRIVATE -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.txt) + endif(NOT APPLE) endif() -set_target_properties (helicsSharedLib PROPERTIES FOLDER interfaces) +set_target_properties(helicsSharedLib PROPERTIES FOLDER interfaces) -install(TARGETS helicsSharedLib EXPORT helics-targets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(TARGETS helicsSharedLib + EXPORT helics-targets + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) -if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 3.6) - install(FILES $ DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs EXCLUDE_FROM_ALL) - install(FILES $ DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime EXCLUDE_FROM_ALL) +if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 3.6) + install(FILES $ + DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT libs EXCLUDE_FROM_ALL) + install(FILES $ + DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT + runtime EXCLUDE_FROM_ALL) else() - install(FILES $ DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs ) - install(FILES $ DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime) + install(FILES $ + DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT libs) + install(FILES $ + DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT + runtime) endif() -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/helics_export.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics/shared_api_library COMPONENT headers) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/helics_export.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics/shared_api_library + COMPONENT headers) -if (MSVC AND NOT EMBEDDED_DEBUG_INFO) - install(FILES $ DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL COMPONENT libs) +if(MSVC AND NOT EMBEDDED_DEBUG_INFO) + install(FILES $ + DESTINATION ${CMAKE_INSTALL_BINDIR} + OPTIONAL COMPONENT libs) endif() -install(FILES ${helicsShared_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics/shared_api_library COMPONENT headers) - +install(FILES ${helicsShared_headers} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics/shared_api_library + COMPONENT headers) diff --git a/swig/CMakeLists.txt b/swig/CMakeLists.txt index cf35e03bb1..feb1a3b027 100644 --- a/swig/CMakeLists.txt +++ b/swig/CMakeLists.txt @@ -1,5 +1,5 @@ ############################################################################## -#Copyright © 2017-2018, +#Copyright © 2017-2018, #Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC #All rights reserved. See LICENSE file and DISCLAIMER for more details. ############################################################################## @@ -20,7 +20,7 @@ endif() include_directories(${CMAKE_CURRENT_SOURCE_DIR}) include_directories("${PROJECT_SOURCE_DIR}/src/helics/shared_api_library") include_directories("${PROJECT_BINARY_DIR}/src/helics/shared_api_library") - + if (BUILD_PYTHON_INTERFACE) add_subdirectory(python) @@ -45,4 +45,4 @@ endif() if (BUILD_CSHARP_INTERFACE) #add_subdirectory(csharp) -endif() \ No newline at end of file +endif() diff --git a/swig/java/CMakeLists.txt b/swig/java/CMakeLists.txt index 0224b4d544..20b83e8d9b 100644 --- a/swig/java/CMakeLists.txt +++ b/swig/java/CMakeLists.txt @@ -1,8 +1,8 @@ -############################################################################## -#Copyright (c) 2017-2018, -#Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC -#All rights reserved. See LICENSE file and DISCLAIMER for more details. -############################################################################## +# +# Copyright (c) 2017-2018, Battelle Memorial Institute; Lawrence Livermore +# National Security, LLC; Alliance for Sustainable Energy, LLC All rights +# reserved. See LICENSE file and DISCLAIMER for more details. +# find_package(Java REQUIRED) find_package(JNI REQUIRED) @@ -11,79 +11,97 @@ include(UseJava) include_directories(${JAVA_INCLUDE_PATH}) include_directories(${JNI_INCLUDE_DIRS}) -if (DISABLE_SWIG OR NOT SWIG_EXECUTABLE) - file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/interface/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) - # Update if necessary - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long") - endif() - add_library(JNIhelics SHARED interface/helicsJavaJAVA_wrap.c) - target_link_libraries(JNIhelics helicsSharedLib ${JAVA_LIBRARIES}) - set_target_properties (JNIhelics PROPERTIES FOLDER interfaces) +if(DISABLE_SWIG OR NOT SWIG_EXECUTABLE) + file(COPY + ${CMAKE_CURRENT_SOURCE_DIR}/interface/ + DESTINATION + ${CMAKE_CURRENT_BINARY_DIR}) + if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) + # Update if necessary + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long") + endif() + add_library(JNIhelics SHARED interface/helicsJavaJAVA_wrap.c) + target_link_libraries(JNIhelics helicsSharedLib ${JAVA_LIBRARIES}) + set_target_properties(JNIhelics PROPERTIES FOLDER interfaces) else(DISABLE_SWIG) - #Enable generation using swig + # Enable generation using swig - set_property(SOURCE helicsJava.i PROPERTY SWIG_MODULE_NAME JNIhelics) + set_property(SOURCE helicsJava.i PROPERTY SWIG_MODULE_NAME JNIhelics) - set(CMAKE_SWIG_FLAGS "-package;com.java.helics") - if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 3.7) - SWIG_ADD_LIBRARY(JNIhelics TYPE MODULE LANGUAGE java SOURCES helicsJava.i) - else () - SWIG_ADD_MODULE(JNIhelics java helicsJava.i) - endif () + set(CMAKE_SWIG_FLAGS "-package;com.java.helics") + if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 3.7) + swig_add_library(JNIhelics TYPE MODULE LANGUAGE java SOURCES helicsJava.i) + else() + swig_add_module(JNIhelics java helicsJava.i) + endif() - SWIG_LINK_LIBRARIES(JNIhelics helicsSharedLib) - SWIG_LINK_LIBRARIES(JNIhelics ${JAVA_LIBRARIES}) + swig_link_libraries(JNIhelics helicsSharedLib) + swig_link_libraries(JNIhelics ${JAVA_LIBRARIES}) + set_target_properties(JNIhelics PROPERTIES FOLDER interfaces) - set_target_properties (JNIhelics PROPERTIES FOLDER interfaces) +endif() # DISABLE_SWIG -endif() #DISABLE_SWIG - -configure_file(MakeJarCMakeLists.txt.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt @ONLY) +configure_file(MakeJarCMakeLists.txt.in + ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt @ONLY) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/buildjar/) -# -D ADDITIONAL_JAR_FILES=$;$ -add_custom_command( - TARGET "JNIhelics" POST_BUILD - COMMAND ${CMAKE_COMMAND} -D LIBRARY_FILE=$ -P ${CMAKE_CURRENT_SOURCE_DIR}/addLoadLibraryCommand.cmake -) - -add_custom_command( - TARGET "JNIhelics" POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS .. - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/buildjar" - VERBATIM -) - +# -D +# ADDITIONAL_JAR_FILES=$;$ add_custom_command( - TARGET "JNIhelics" POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS --build . --target helics - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/buildjar/" - COMMENT "Building jar file" - VERBATIM -) - -if (WIN32) -foreach(keyfile IN LISTS KEY_LIBRARY_FILES) -add_custom_command(TARGET JNIhelics POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." - "${keyfile}" # <--this is in-file - "$/") # <--this is out-file path -endforeach(keyfile) - -add_custom_command(TARGET JNIhelics POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." - "$" # <--this is in-file - "$/") # <--this is out-file path - -endif (WIN32) - -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/buildjar/helics-${HELICS_VERSION}.jar DESTINATION java COMPONENT java) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/buildjar/helics.jar DESTINATION java COMPONENT java OPTIONAL) + TARGET "JNIhelics" POST_BUILD + COMMAND ${CMAKE_COMMAND} -D LIBRARY_FILE=$ -P + ${CMAKE_CURRENT_SOURCE_DIR}/addLoadLibraryCommand.cmake) + +add_custom_command(TARGET "JNIhelics" POST_BUILD + COMMAND ${CMAKE_COMMAND} ARGS .. + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/buildjar" + VERBATIM) + +add_custom_command(TARGET "JNIhelics" POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS + --build . + --target helics + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/buildjar/" + COMMENT "Building jar file" + VERBATIM) + +if(WIN32) + foreach(keyfile IN LISTS KEY_LIBRARY_FILES) + add_custom_command(TARGET + JNIhelics + POST_BUILD # Adds a post-build event to api tests + COMMAND ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E + # copy_if_different..." + "${keyfile}" # <--this is in-file + "$/") # <--this is + # out-file path + endforeach(keyfile) + + add_custom_command(TARGET + JNIhelics + POST_BUILD # Adds a post-build event to api tests + COMMAND ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E + # copy_if_different..." + "$" # <--this is in- + # file + "$/") # <--this is out- + # file path + +endif(WIN32) + +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/buildjar/helics-${HELICS_VERSION}.jar + DESTINATION java + COMPONENT java) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/buildjar/helics.jar + DESTINATION java + COMPONENT java OPTIONAL) install(FILES $ DESTINATION java COMPONENT java) install(TARGETS JNIhelics DESTINATION java COMPONENT java) install(FILES ${KEY_LIBRARY_FILES} DESTINATION java COMPONENT java) diff --git a/swig/matlab/CMakeLists.txt b/swig/matlab/CMakeLists.txt index acdf27a8aa..258f4c33a1 100644 --- a/swig/matlab/CMakeLists.txt +++ b/swig/matlab/CMakeLists.txt @@ -1,111 +1,148 @@ -############################################################################## -#Copyright © 2017-2018, -#Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC -#All rights reserved. See LICENSE file and DISCLAIMER for more details. -############################################################################## +# +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore +# National Security, LLC; Alliance for Sustainable Energy, LLC All rights +# reserved. See LICENSE file and DISCLAIMER for more details. +# # Generate SWIG wrapper for MATLAB -if (NOT MATLAB_GENERATE_ONLY) - set(Matlab_FIND_COMPONENTS "MAIN_PROGRAM") - find_package(MATLAB) +if(NOT MATLAB_GENERATE_ONLY) + set(Matlab_FIND_COMPONENTS "MAIN_PROGRAM") + find_package(MATLAB) endif() -if (NOT DISABLE_SWIG AND SWIG_EXECUTABLE) +if(NOT DISABLE_SWIG AND SWIG_EXECUTABLE) - execute_process(COMMAND ${SWIG_EXECUTABLE} -help OUTPUT_VARIABLE SWIG_HELP_OUTPUT) - STRING(FIND "${SWIG_HELP_OUTPUT}" "-matlab" MATLAB_HELP_FOUND) - if (${MATLAB_HELP_FOUND} LESS 0) - set (MATLAB_SWIG_NOT_AVAILABLE 1) - message(warning " SWIG VERSION does not support matlab, reverting to build only") - endif() + execute_process(COMMAND ${SWIG_EXECUTABLE} -help + OUTPUT_VARIABLE SWIG_HELP_OUTPUT) + string(FIND "${SWIG_HELP_OUTPUT}" "-matlab" MATLAB_HELP_FOUND) + if(${MATLAB_HELP_FOUND} LESS 0) + set(MATLAB_SWIG_NOT_AVAILABLE 1) + message( + warning " SWIG VERSION does not support matlab, reverting to build only") + endif() endif() message(STATUS "Building MATLAB") -if (DISABLE_SWIG OR MATLAB_SWIG_NOT_AVAILABLE) +if(DISABLE_SWIG OR MATLAB_SWIG_NOT_AVAILABLE) add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp - COMMAND "${CMAKE_COMMAND}" - -E copy ${CMAKE_CURRENT_SOURCE_DIR}/helicsMEX.cpp ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/helicsMEX.cpp - ) - install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/+helics DESTINATION matlab COMPONENT matlab) + COMMAND "${CMAKE_COMMAND}" -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/helicsMEX.cpp + ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/helicsMEX.cpp) + install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/+helics + DESTINATION matlab + COMPONENT matlab) file(GLOB MATLAB_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.m) - install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/+helics DESTINATION matlab COMPONENT matlab) + install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/+helics + DESTINATION matlab + COMPONENT matlab) install(FILES ${MATLAB_FILES} DESTINATION matlab COMPONENT matlab) else() - FILE(GLOB SHARED_LIB_HEADERS ${CMAKE_SOURCE_DIR}/src/helics/shared_api_library/*.h) - - #custom command for building the wrap file - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp - COMMAND "${SWIG_EXECUTABLE}" - "-matlab" "-c++" - -o "helicsMEX.cpp" - "-I${CMAKE_SOURCE_DIR}/src/helics/shared_api_library" - ${CMAKE_CURRENT_SOURCE_DIR}/helicsMatlab.i - DEPENDS ${CMAKE_SOURCE_DIR}/swig/helics.i ${CMAKE_CURRENT_SOURCE_DIR}/helicsMatlab.i ${SHARED_LIB_HEADERS} ${CMAKE_CURRENT_SOURCE_DIR}/matlab_maps.i - ) - - if (OVERWRITE_MATLAB_FILES) - add_custom_target(mfile_overwrite ALL - COMMAND ${CMAKE_COMMAND} - -D TARGET_DIR=${CMAKE_CURRENT_SOURCE_DIR} - -P ${CMAKE_CURRENT_SOURCE_DIR}/overwriteMatlabFiles.cmake - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp - ) - endif(OVERWRITE_MATLAB_FILES) - - #add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp - # COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/modifyOctSourceFile.cmake - # DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp - #) - - install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/+helics DESTINATION matlab COMPONENT matlab) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/SwigGet.m ${CMAKE_CURRENT_BINARY_DIR}/SwigMem.m ${CMAKE_CURRENT_BINARY_DIR}/SwigRef.m DESTINATION matlab COMPONENT matlab) - install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pisender.m ${CMAKE_CURRENT_SOURCE_DIR}/pireceiver.m ${CMAKE_CURRENT_SOURCE_DIR}/GetFullPath.m DESTINATION matlab COMPONENT matlab) + file(GLOB SHARED_LIB_HEADERS + ${CMAKE_SOURCE_DIR}/src/helics/shared_api_library/*.h) + + # custom command for building the wrap file + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp + COMMAND "${SWIG_EXECUTABLE}" "-matlab" "-c++" -o "helicsMEX.cpp" + "-I${CMAKE_SOURCE_DIR}/src/helics/shared_api_library" + ${CMAKE_CURRENT_SOURCE_DIR}/helicsMatlab.i + DEPENDS ${CMAKE_SOURCE_DIR}/swig/helics.i + ${CMAKE_CURRENT_SOURCE_DIR}/helicsMatlab.i + ${SHARED_LIB_HEADERS} + ${CMAKE_CURRENT_SOURCE_DIR}/matlab_maps.i) + + if(OVERWRITE_MATLAB_FILES) + add_custom_target( + mfile_overwrite ALL + COMMAND ${CMAKE_COMMAND} -D TARGET_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P + ${CMAKE_CURRENT_SOURCE_DIR}/overwriteMatlabFiles.cmake + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp) + endif(OVERWRITE_MATLAB_FILES) + + # add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp COMMAND + # ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/modifyOctSourceFile.cmake + # DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp ) + + install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/+helics + DESTINATION matlab + COMPONENT matlab) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/SwigGet.m + ${CMAKE_CURRENT_BINARY_DIR}/SwigMem.m + ${CMAKE_CURRENT_BINARY_DIR}/SwigRef.m + DESTINATION matlab + COMPONENT matlab) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pisender.m + ${CMAKE_CURRENT_SOURCE_DIR}/pireceiver.m + ${CMAKE_CURRENT_SOURCE_DIR}/GetFullPath.m + DESTINATION matlab + COMPONENT matlab) endif() -add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mkhelicsMEXFile.m - COMMAND ${CMAKE_COMMAND} - -D LIBRARY_FILE=$ - -D BUILD_FILE=${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp - -D LIBRARY_INCLUDE_LOCATION=${CMAKE_SOURCE_DIR}/src/helics/shared_api_library/ - -D OTHER_INCLUDE_LOCATION=${PROJECT_BINARY_DIR}/src/helics/shared_api_library/ - -D SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} - -P ${CMAKE_CURRENT_SOURCE_DIR}/generateMEXcreationScript.cmake - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp -) - - - if (WIN32) - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.${Matlab_MEX_EXTENSION} - COMMAND ${Matlab_MAIN_PROGRAM} -nojvm -nosplash -minimize -r "\"run('${CMAKE_CURRENT_BINARY_DIR}/mkhelicsMEXFile.m');quit;\"" - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mkhelicsMEXFile.m helicsSharedLib ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp - ) - else() - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.${Matlab_MEX_EXTENSION} - COMMAND ${Matlab_MAIN_PROGRAM} -nojvm -nodisplay -nosplash -r "\"run('${CMAKE_CURRENT_BINARY_DIR}/mkhelicsMEXFile.m');quit;\"" - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mkhelicsMEXFile.m helicsSharedLib ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp - ) - endif() +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mkhelicsMEXFile.m + COMMAND + ${CMAKE_COMMAND} -D LIBRARY_FILE=$ -D + BUILD_FILE=${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp -D + LIBRARY_INCLUDE_LOCATION=${CMAKE_SOURCE_DIR}/src/helics/shared_api_library/ + -D + OTHER_INCLUDE_LOCATION=${PROJECT_BINARY_DIR}/src/helics/shared_api_library/ + -D SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P + ${CMAKE_CURRENT_SOURCE_DIR}/generateMEXcreationScript.cmake + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp) + +if(WIN32) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.${Matlab_MEX_EXTENSION} + COMMAND ${Matlab_MAIN_PROGRAM} -nojvm -nosplash -minimize -r + "\"run('${CMAKE_CURRENT_BINARY_DIR}/mkhelicsMEXFile.m');quit;\"" + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mkhelicsMEXFile.m helicsSharedLib + ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp) +else() + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.${Matlab_MEX_EXTENSION} + COMMAND ${Matlab_MAIN_PROGRAM} -nojvm -nodisplay -nosplash -r + "\"run('${CMAKE_CURRENT_BINARY_DIR}/mkhelicsMEXFile.m');quit;\"" + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mkhelicsMEXFile.m helicsSharedLib + ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp) +endif() -if (NOT MATLAB_GENERATE_ONLY) - ADD_CUSTOM_TARGET(helicsMEX ALL - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.${Matlab_MEX_EXTENSION} helicsSharedLib - ) - set_target_properties (helicsMEX PROPERTIES FOLDER interfaces) +if(NOT MATLAB_GENERATE_ONLY) + add_custom_target( + helicsMEX ALL + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.${Matlab_MEX_EXTENSION} + helicsSharedLib) + set_target_properties(helicsMEX PROPERTIES FOLDER interfaces) endif(NOT MATLAB_GENERATE_ONLY) - -file( GLOB HSHARED_LIB_SOURCES ${CMAKE_SOURCE_DIR}/src/helics/shared_api_library/*.h ) - -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.${Matlab_MEX_EXTENSION} DESTINATION matlab COMPONENT matlab) -install(FILES $ DESTINATION matlab COMPONENT matlab) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp DESTINATION matlab COMPONENT matlab) -install(FILES $ DESTINATION matlab COMPONENT matlab) +file(GLOB HSHARED_LIB_SOURCES + ${CMAKE_SOURCE_DIR}/src/helics/shared_api_library/*.h) + +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.${Matlab_MEX_EXTENSION} + DESTINATION matlab + COMPONENT matlab) +install(FILES $ + DESTINATION matlab + COMPONENT matlab) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp + DESTINATION matlab + COMPONENT matlab) +install(FILES $ + DESTINATION matlab + COMPONENT matlab) install(FILES ${KEY_LIBRARY_FILES} DESTINATION matlab COMPONENT matlab) -install(FILES ${HSHARED_LIB_SOURCES} DESTINATION matlab/headers COMPONENT matlab) -install(FILES ${PROJECT_BINARY_DIR}/src/helics/shared_api_library/helics_export.h DESTINATION matlab/headers COMPONENT matlab) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/generatehelicsMEXFile.m DESTINATION matlab COMPONENT matlab) -install(FILES helicsSharedLib.h libhelicsSharedLib.h DESTINATION matlab COMPONENT matlab) - +install(FILES ${HSHARED_LIB_SOURCES} + DESTINATION matlab/headers + COMPONENT matlab) +install( + FILES ${PROJECT_BINARY_DIR}/src/helics/shared_api_library/helics_export.h + DESTINATION matlab/headers + COMPONENT matlab) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/generatehelicsMEXFile.m + DESTINATION matlab + COMPONENT matlab) +install(FILES helicsSharedLib.h libhelicsSharedLib.h + DESTINATION matlab + COMPONENT matlab) diff --git a/swig/octave/CMakeLists.txt b/swig/octave/CMakeLists.txt index 3fe8984ee3..124f382f5d 100644 --- a/swig/octave/CMakeLists.txt +++ b/swig/octave/CMakeLists.txt @@ -1,5 +1,5 @@ ############################################################################## -#Copyright © 2017-2018, +#Copyright © 2017-2018, #Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC #All rights reserved. See LICENSE file and DISCLAIMER for more details. ############################################################################## @@ -40,9 +40,9 @@ endif() add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mkhelicsOCTFile.m - COMMAND ${CMAKE_COMMAND} - -D LIBRARY_FILE=$ - -D BUILD_FILE=${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cpp + COMMAND ${CMAKE_COMMAND} + -D LIBRARY_FILE=$ + -D BUILD_FILE=${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cpp -D LIBRARY_INCLUDE_LOCATION=${CMAKE_SOURCE_DIR}/src/helics/shared_api_library/ -D OTHER_INCLUDE_LOCATION=${PROJECT_BINARY_DIR}/src/helics/shared_api_library/ -D SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} diff --git a/swig/python/CMakeLists.txt b/swig/python/CMakeLists.txt index 91101df715..fbd49fb5d5 100644 --- a/swig/python/CMakeLists.txt +++ b/swig/python/CMakeLists.txt @@ -1,94 +1,116 @@ -############################################################################## -#Copyright © 2017-2018, -#Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC -#All rights reserved. See LICENSE file and DISCLAIMER for more details. -############################################################################## - -if (BUILD_PYTHON_INTERFACE) - SET(Python_ADDITIONAL_VERSIONS 3.4 3.5 3.6 3.7 3.8) - find_package(PythonInterp 3) - find_package(PythonLibs 3 REQUIRED ) +# +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore +# National Security, LLC; Alliance for Sustainable Energy, LLC All rights +# reserved. See LICENSE file and DISCLAIMER for more details. +# + +if(BUILD_PYTHON_INTERFACE) + set(Python_ADDITIONAL_VERSIONS 3.4 3.5 3.6 3.7 3.8) + find_package(PythonInterp 3) + find_package(PythonLibs 3 REQUIRED) endif(BUILD_PYTHON_INTERFACE) -if (DISABLE_SWIG OR NOT SWIG_EXECUTABLE) +if(DISABLE_SWIG OR NOT SWIG_EXECUTABLE) -message("Building without swig") + message("Building without swig") -add_custom_target("helicsPYTHON" ALL) + add_custom_target("helicsPYTHON" ALL) -# Set directories to use as defaults in setup.py for the location of ZeroMQ -set(ZMQ_INCLUDE_DIR ${ZeroMQ_INCLUDE_DIR}) -get_filename_component(ZMQ_LIB_DIR ${ZeroMQ_LIBRARY} DIRECTORY) + # Set directories to use as defaults in setup.py for the location of ZeroMQ + set(ZMQ_INCLUDE_DIR ${ZeroMQ_INCLUDE_DIR}) + get_filename_component(ZMQ_LIB_DIR ${ZeroMQ_LIBRARY} DIRECTORY) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in ${CMAKE_CURRENT_BINARY_DIR}/setup.py) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/helics_wrap.c ${CMAKE_CURRENT_BINARY_DIR}/helics_wrap.c COPYONLY) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/helics.py ${CMAKE_CURRENT_BINARY_DIR}/helics.py COPYONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in + ${CMAKE_CURRENT_BINARY_DIR}/setup.py) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/helics_wrap.c + ${CMAKE_CURRENT_BINARY_DIR}/helics_wrap.c COPYONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/helics.py + ${CMAKE_CURRENT_BINARY_DIR}/helics.py COPYONLY) -add_custom_target("helicsPYTHONEXT" ALL DEPENDS helicsSharedLib helicsPYTHON) + add_custom_target("helicsPYTHONEXT" ALL DEPENDS helicsSharedLib helicsPYTHON) -add_custom_command( - TARGET "helicsPYTHONEXT" POST_BUILD - COMMAND ${PYTHON_EXECUTABLE} - ARGS "-m" "pip" "install" "-e" "." - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" - COMMENT "Building Python extension" -) + add_custom_command(TARGET "helicsPYTHONEXT" POST_BUILD + COMMAND ${PYTHON_EXECUTABLE} + ARGS "-m" + "pip" + "install" + "-e" + "." + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + COMMENT "Building Python extension") else() -# https://stackoverflow.com/a/3818084/5451769 -if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) - # Update if necessary - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -Wno-overlength-strings -Wno-ignored-attributes") -endif() - -include_directories(${PYTHON_INCLUDE_PATH}) -include_directories(${PYTHON_INCLUDE_DIRS}) - -set(CMAKE_SWIG_FLAGS "-py3") - -set_property(SOURCE ../helics.i PROPERTY SWIG_MODULE_NAME helics) - + # https://stackoverflow.com/a/3818084/5451769 + if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) + # Update if necessary + set( + CMAKE_C_FLAGS + "${CMAKE_C_FLAGS} -Wno-long-long -Wno-overlength-strings -Wno-ignored-attributes" + ) + endif() + + include_directories(${PYTHON_INCLUDE_PATH}) + include_directories(${PYTHON_INCLUDE_DIRS}) + + set(CMAKE_SWIG_FLAGS "-py3") + + set_property(SOURCE ../helics.i PROPERTY SWIG_MODULE_NAME helics) + + if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 3.7) + swig_add_library(helics TYPE MODULE LANGUAGE python SOURCES helicsPython.i) + else() + swig_add_module(helics python helicsPython.i) + endif() + + swig_link_libraries(helics helicsSharedLib) + + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + # https://groups.google.com/a/continuum.io/d/msg/anaconda/057P4uNWyCU/Iem6Ot + # jBCQAJ + set_target_properties(_helics + PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") + else() + swig_link_libraries(helics ${PYTHON_LIBRARIES}) + endif() + + set_target_properties(_helics PROPERTIES FOLDER interfaces) + + # execute_process(COMMAND python -c "from distutils.sysconfig import + # get_python_lib; print get_python_lib()" OUTPUT_VARIABLE PYTHON_SITE_PACKAGES + # OUTPUT_STRIP_TRAILING_WHITESPACE) + + install(TARGETS _helics DESTINATION python COMPONENT python) + + foreach(keyfile IN LISTS KEY_LIBRARY_FILES) + add_custom_command(TARGET + _helics + POST_BUILD # Adds a post-build event to api tests + COMMAND ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E + # copy_if_different..." + "${keyfile}" # <--this is in-file + "$/") # <--this is out- + # file path + endforeach(keyfile) + + add_custom_command(TARGET + _helics + POST_BUILD # Adds a post-build event to api tests + COMMAND ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E + # copy_if_different..." + "$" # <--this is in- + # file + "$/") # <--this is out- + # file path -if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 3.7) - SWIG_ADD_LIBRARY(helics TYPE MODULE LANGUAGE python SOURCES helicsPython.i) -else () - SWIG_ADD_MODULE(helics python helicsPython.i) -endif () - -SWIG_LINK_LIBRARIES(helics helicsSharedLib) - - -if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - # https://groups.google.com/a/continuum.io/d/msg/anaconda/057P4uNWyCU/Iem6OtjBCQAJ - set_target_properties(_helics PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") -else () - SWIG_LINK_LIBRARIES(helics ${PYTHON_LIBRARIES}) endif() -set_target_properties (_helics PROPERTIES FOLDER interfaces) - - - -# execute_process(COMMAND python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" OUTPUT_VARIABLE PYTHON_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE) - -install(TARGETS _helics DESTINATION python COMPONENT python) - -foreach(keyfile IN LISTS KEY_LIBRARY_FILES) -add_custom_command(TARGET _helics POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." - "${keyfile}" # <--this is in-file - "$/") # <--this is out-file path -endforeach(keyfile) - -add_custom_command(TARGET _helics POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." - "$" # <--this is in-file - "$/") # <--this is out-file path - -endif () - - - -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/helics.py DESTINATION python COMPONENT python) -install(FILES $ DESTINATION python COMPONENT python) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/helics.py + DESTINATION python + COMPONENT python) +install(FILES $ + DESTINATION python + COMPONENT python) install(FILES ${KEY_LIBRARY_FILES} DESTINATION python COMPONENT python) - diff --git a/swig/python2/CMakeLists.txt b/swig/python2/CMakeLists.txt index ef29071a40..1d498682dd 100644 --- a/swig/python2/CMakeLists.txt +++ b/swig/python2/CMakeLists.txt @@ -1,22 +1,25 @@ -############################################################################## -#Copyright © 2017-2018, -#Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC -#All rights reserved. See LICENSE file and DISCLAIMER for more details. -############################################################################## +# +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore +# National Security, LLC; Alliance for Sustainable Energy, LLC All rights +# reserved. See LICENSE file and DISCLAIMER for more details. +# -if (DISABLE_SWIG OR NOT SWIG_EXECUTABLE) +if(DISABLE_SWIG OR NOT SWIG_EXECUTABLE) - message(ERROR "Python 2 build requires swig") + message(ERROR "Python 2 build requires swig") endif() # https://stackoverflow.com/a/3818084/5451769 if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) # Update if necessary - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -Wno-overlength-strings -Wno-ignored-attributes") + set( + CMAKE_C_FLAGS + "${CMAKE_C_FLAGS} -Wno-long-long -Wno-overlength-strings -Wno-ignored-attributes" + ) endif() -find_package(PythonLibs 2 REQUIRED ) +find_package(PythonLibs 2 REQUIRED) include_directories(${PYTHON_INCLUDE_PATH}) include_directories(${PYTHON_INCLUDE_DIRS}) @@ -25,36 +28,44 @@ set(CMAKE_SWIG_FLAGS "") set_property(SOURCE ../helics.i PROPERTY SWIG_MODULE_NAME helics) +if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 3.7) + swig_add_library(helics TYPE MODULE LANGUAGE python SOURCES helicsPython2.i) +else() + swig_add_module(helics python helicsPython2.i) +endif() -if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 3.7) - SWIG_ADD_LIBRARY(helics TYPE MODULE LANGUAGE python SOURCES helicsPython2.i) -else () - SWIG_ADD_MODULE(helics python helicsPython2.i) -endif () - -SWIG_LINK_LIBRARIES(helics helicsSharedLib) - +swig_link_libraries(helics helicsSharedLib) -if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - # https://groups.google.com/a/continuum.io/d/msg/anaconda/057P4uNWyCU/Iem6OtjBCQAJ - set_target_properties(_helics PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") -else () - SWIG_LINK_LIBRARIES(helics ${PYTHON_LIBRARIES}) +if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + # https://groups.google.com/a/continuum.io/d/msg/anaconda/057P4uNWyCU/Iem6OtjB + # CQAJ + set_target_properties(_helics + PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") +else() + swig_link_libraries(helics ${PYTHON_LIBRARIES}) endif() -set_target_properties (_helics PROPERTIES FOLDER interfaces) +set_target_properties(_helics PROPERTIES FOLDER interfaces) install(TARGETS _helics DESTINATION python COMPONENT python) foreach(keyfile IN LISTS KEY_LIBRARY_FILES) -add_custom_command(TARGET _helics POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." - "${keyfile}" # <--this is in-file - "$/") # <--this is out-file path + add_custom_command(TARGET + _helics + POST_BUILD # Adds a post-build event to api tests + COMMAND ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E + # copy_if_different..." + "${keyfile}" # <--this is in-file + "$/") # <--this is out- + # file path endforeach(keyfile) - -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/helics.py DESTINATION python COMPONENT python) -install(FILES $ DESTINATION python COMPONENT python) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/helics.py + DESTINATION python + COMPONENT python) +install(FILES $ + DESTINATION python + COMPONENT python) install(FILES ${KEY_LIBRARY_FILES} DESTINATION python COMPONENT python) - diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f50832ccc8..b070f891a4 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,5 +1,5 @@ ############################################################################## -#Copyright © 2017-2018, +#Copyright © 2017-2018, #Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC #All rights reserved. See LICENSE file and DISCLAIMER for more details. ############################################################################## @@ -24,4 +24,4 @@ endif() if (BUILD_OCTAVE_INTERFACE) # add_subdirectory(octave_helics) -endif() \ No newline at end of file +endif() diff --git a/tests/helics/CMakeLists.txt b/tests/helics/CMakeLists.txt index 19fa3f2239..504d55a889 100644 --- a/tests/helics/CMakeLists.txt +++ b/tests/helics/CMakeLists.txt @@ -1,5 +1,5 @@ ############################################################################## -#Copyright © 2017-2018, +#Copyright © 2017-2018, #Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC #All rights reserved. See LICENSE file and DISCLAIMER for more details. ############################################################################## @@ -9,7 +9,7 @@ add_library(helics_test_base INTERFACE) target_link_libraries(helics_test_base INTERFACE Boostlibs::test) target_link_libraries(helics_test_base INTERFACE helics_base_includes) - + add_subdirectory(common) add_subdirectory (core) diff --git a/tests/helics/application_api/CMakeLists.txt b/tests/helics/application_api/CMakeLists.txt index bdf01f9fd5..294d0e5a5a 100644 --- a/tests/helics/application_api/CMakeLists.txt +++ b/tests/helics/application_api/CMakeLists.txt @@ -1,54 +1,65 @@ -############################################################################## -# Copyright © 2017-2018, -# Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC -#All rights reserved. See LICENSE file and DISCLAIMER for more details. -############################################################################## +# +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore +# National Security, LLC; Alliance for Sustainable Energy, LLC All rights +# reserved. See LICENSE file and DISCLAIMER for more details. +# -set(application_api_test_headers -testFixtures.hpp -ValueFederateTestTemplates.hpp -) +set( + application_api_test_headers testFixtures.hpp ValueFederateTestTemplates.hpp) set(application_api_test_sources -MessageFederateKeyTests.cpp -ValueFederateKeyTests.cpp -FilterTests.cpp -testFixtures.cpp -PrimaryTypeConversionTests.cpp -FilterAdditionalTests.cpp -ValueConverterTests.cpp -application-api-tests.cpp -data_viewTests.cpp -MessageFederateAdditionalTests.cpp -FederateTests.cpp -subPubObjectTests.cpp -ValueFederateAdditionalTests.cpp -CombinationFederateTests.cpp -ValueFederateExtendedTests.cpp -) - - -add_executable(application-api-tests ${application_api_test_sources} ${application_api_test_headers}) + MessageFederateKeyTests.cpp + ValueFederateKeyTests.cpp + FilterTests.cpp + testFixtures.cpp + PrimaryTypeConversionTests.cpp + FilterAdditionalTests.cpp + ValueConverterTests.cpp + application-api-tests.cpp + data_viewTests.cpp + MessageFederateAdditionalTests.cpp + FederateTests.cpp + subPubObjectTests.cpp + ValueFederateAdditionalTests.cpp + CombinationFederateTests.cpp + ValueFederateExtendedTests.cpp) + +add_executable(application-api-tests ${application_api_test_sources} + ${application_api_test_headers}) target_link_libraries(application-api-tests helics-static helics_test_base) -set_target_properties (application-api-tests PROPERTIES FOLDER tests) +set_target_properties(application-api-tests PROPERTIES FOLDER tests) -target_compile_definitions(application-api-tests PRIVATE "-DHELICS_BROKER_LOCATION=\"${HELICS_BROKER_LOC}\"") -target_compile_definitions(application-api-tests PRIVATE "-DHELICS_INSTALL_LOCATION=\"${CMAKE_INSTALL_PREFIX}\"") -target_compile_definitions(application-api-tests PRIVATE "-DTEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"") +target_compile_definitions(application-api-tests PRIVATE + "-DHELICS_BROKER_LOCATION=\"${HELICS_BROKER_LOC}\"") +target_compile_definitions( + application-api-tests PRIVATE + "-DHELICS_INSTALL_LOCATION=\"${CMAKE_INSTALL_PREFIX}\"") +target_compile_definitions(application-api-tests PRIVATE + "-DTEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"") target_compile_definitions(application-api-tests PRIVATE "-DQUICK_TESTS_ONLY") -add_test(NAME application-api-tests COMMAND application-api-tests --log_level=message --report_level=short) +add_test(NAME application-api-tests + COMMAND application-api-tests --log_level=message --report_level=short) set_property(TEST application-api-tests PROPERTY LABELS ApplicationApi Daily) # Tests for Continuous Integration builds -add_test(NAME application-api-ci-tests COMMAND application-api-tests --run_test=@ci --log_level=message --report_level=short) +add_test(NAME application-api-ci-tests + COMMAND application-api-tests + --run_test=@ci + --log_level=message + --report_level=short) set_property(TEST application-api-ci-tests PROPERTY LABELS Continuous) foreach(keyfile IN LISTS KEY_LIBRARY_FILES) -add_custom_command(TARGET application-api-tests POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." - "${keyfile}" # <--this is in-file - "$/") # <--this is out-file path + add_custom_command(TARGET + application-api-tests + POST_BUILD # Adds a post-build event to api tests + COMMAND ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E + # copy_if_different..." + "${keyfile}" # <--this is in-file + "$/") + # <--this is out-file path endforeach(keyfile) - diff --git a/tests/helics/apps/CMakeLists.txt b/tests/helics/apps/CMakeLists.txt index cb7596c9a9..8a2c1758d0 100644 --- a/tests/helics/apps/CMakeLists.txt +++ b/tests/helics/apps/CMakeLists.txt @@ -1,53 +1,63 @@ -############################################################################## -# Copyright © 2017-2018, -# Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC -#All rights reserved. See LICENSE file and DISCLAIMER for more details. -############################################################################## +# +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore +# National Security, LLC; Alliance for Sustainable Energy, LLC All rights +# reserved. See LICENSE file and DISCLAIMER for more details. +# set(helics_apps_test_sources -helics_apps_tests.cpp -multi_player_tests.cpp -multi_tests.cpp -PlayerTests.cpp -RecorderTests.cpp -exeTestHelper.cpp -combo_tests.cpp -EchoTests.cpp -TracerTests.cpp -SourceTests.cpp -exeTestHelper.h -) - + helics_apps_tests.cpp + multi_player_tests.cpp + multi_tests.cpp + PlayerTests.cpp + RecorderTests.cpp + exeTestHelper.cpp + combo_tests.cpp + EchoTests.cpp + TracerTests.cpp + SourceTests.cpp + exeTestHelper.h) add_executable(helics_apps-tests ${helics_apps_test_sources}) -set_target_properties (helics_apps-tests PROPERTIES FOLDER tests) +set_target_properties(helics_apps-tests PROPERTIES FOLDER tests) target_link_libraries(helics_apps-tests helics_apps-static helics_test_base) target_include_directories(helics_apps-tests PRIVATE ${PROJECT_SOURCE_DIR}/src) -target_compile_definitions(helics_apps-tests PRIVATE -DTEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\") -target_compile_definitions(helics_apps-tests PRIVATE -DHELICS_BUILD_LOC=\"${CMAKE_BINARY_DIR}/src/helics/\") -target_compile_definitions(helics_apps-tests PRIVATE -DHELICS_INSTALL_LOC=\"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}\") - -if (DISABLE_SYSTEM_CALL_TESTS) - target_compile_definitions(helics_apps-tests PRIVATE -DDISABLE_SYSTEM_CALL_TESTS=1) +target_compile_definitions(helics_apps-tests PRIVATE + -DTEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\") +target_compile_definitions( + helics_apps-tests PRIVATE + -DHELICS_BUILD_LOC=\"${CMAKE_BINARY_DIR}/src/helics/\") +target_compile_definitions( + helics_apps-tests PRIVATE + -DHELICS_INSTALL_LOC=\"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}\") + +if(DISABLE_SYSTEM_CALL_TESTS) + target_compile_definitions(helics_apps-tests PRIVATE + -DDISABLE_SYSTEM_CALL_TESTS=1) endif() add_test(NAME helics_apps-tests COMMAND helics_apps-tests --report_level=short) set_property(TEST helics_apps-tests PROPERTY LABELS HelicsApps Daily) # Tests for Continous Integration builds -add_test(NAME helics_apps-ci-tests COMMAND helics_apps-tests --run_test=@ci --report_level=short) +add_test(NAME helics_apps-ci-tests + COMMAND helics_apps-tests --run_test=@ci --report_level=short) set_property(TEST helics_apps-ci-tests PROPERTY LABELS Continuous) if(WIN32) -foreach(keyfile IN LISTS KEY_LIBRARY_FILES) -add_custom_command(TARGET helics_apps-tests POST_BUILD # Adds a post-build event to core tests - COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." - "${keyfile}" # <--this is in-file - "$/") # <--this is out-file path -endforeach(keyfile) + foreach(keyfile IN LISTS KEY_LIBRARY_FILES) + add_custom_command(TARGET + helics_apps-tests + POST_BUILD # Adds a post-build event to core tests + COMMAND ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E + # copy_if_different..." + "${keyfile}" # <--this is in-file + "$/") + # <--this is out-file path + endforeach(keyfile) endif(WIN32) - diff --git a/tests/helics/common/CMakeLists.txt b/tests/helics/common/CMakeLists.txt index acc66749d7..10141d54c6 100644 --- a/tests/helics/common/CMakeLists.txt +++ b/tests/helics/common/CMakeLists.txt @@ -1,42 +1,48 @@ -############################################################################## -# Copyright © 2017-2018, -# Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC -#All rights reserved. See LICENSE file and DISCLAIMER for more details. -############################################################################## +# +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore +# National Security, LLC; Alliance for Sustainable Energy, LLC All rights +# reserved. See LICENSE file and DISCLAIMER for more details. +# -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # Common library tests using Boost -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- -set(common_test_headers - -) +set(common_test_headers) set(common_test_sources -common-tests.cpp -MappedVectorTests.cpp -MappedPointerVectorTests.cpp -DualMappedVectorTests.cpp -DualMappedPointerVectorTests.cpp -BlockingQueueTests.cpp -PriorityBlockingQueueTests.cpp -SimpleQueueTests.cpp -AirLockTests.cpp -TimeTests.cpp -) - - -add_executable(common-tests ${common_test_sources} ${common_test_headers} ) + common-tests.cpp + MappedVectorTests.cpp + MappedPointerVectorTests.cpp + DualMappedVectorTests.cpp + DualMappedPointerVectorTests.cpp + BlockingQueueTests.cpp + PriorityBlockingQueueTests.cpp + SimpleQueueTests.cpp + AirLockTests.cpp + TimeTests.cpp) + +add_executable(common-tests ${common_test_sources} ${common_test_headers}) target_link_libraries(common-tests PRIVATE helics-static helics_test_base) -set_target_properties (common-tests PROPERTIES FOLDER tests) +set_target_properties(common-tests PROPERTIES FOLDER tests) -add_test(NAME common-tests COMMAND common-tests --log_level=message --report_level=short) -set_property(TEST common-tests PROPERTY LABELS Common Daily Continuous) +add_test(NAME common-tests + COMMAND common-tests --log_level=message --report_level=short) +set_property(TEST common-tests + PROPERTY LABELS + Common + Daily + Continuous) foreach(keyfile IN LISTS KEY_LIBRARY_FILES) - add_custom_command(TARGET common-tests POST_BUILD # Adds a post-build event to core tests - COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." - "${keyfile}" # <--this is in-file - "$/") # <--this is out-file path + add_custom_command(TARGET + common-tests + POST_BUILD # Adds a post-build event to core tests + COMMAND ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E + # copy_if_different..." + "${keyfile}" # <--this is in-file + "$/") # <--this is + # out-file path endforeach(keyfile) - diff --git a/tests/helics/core/CMakeLists.txt b/tests/helics/core/CMakeLists.txt index b2eaa6ec19..c07143f86d 100644 --- a/tests/helics/core/CMakeLists.txt +++ b/tests/helics/core/CMakeLists.txt @@ -1,65 +1,71 @@ -############################################################################## -# Copyright © 2017-2018, -# Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC -#All rights reserved. See LICENSE file and DISCLAIMER for more details. -############################################################################## +# +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore +# National Security, LLC; Alliance for Sustainable Energy, LLC All rights +# reserved. See LICENSE file and DISCLAIMER for more details. +# -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # Core tests using Boost -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- -set(core_test_headers -testFixtures.h -) +set(core_test_headers testFixtures.h) set(core_test_sources -core-tests.cpp -InfoClass-tests.cpp -FederateState-tests.cpp -ActionMessage-tests.cpp -#CoreBroker-tests.cpp -CoreFactory-tests.cpp -MessageTimerTests.cpp -#CommonCore-tests.cpp -TestCore-tests.cpp -testFixtures.cpp -IPCcore_tests.cpp -data-block-tests.cpp -UdpCore-tests.cpp -ForwardingTimeCoordinatorTests.cpp -TimeCoordinatorTests.cpp -networkInfoTests.cpp -) + core-tests.cpp + InfoClass-tests.cpp + FederateState-tests.cpp + ActionMessage-tests.cpp + # CoreBroker-tests.cpp + CoreFactory-tests.cpp MessageTimerTests.cpp + # CommonCore-tests.cpp + TestCore-tests.cpp + testFixtures.cpp + IPCcore_tests.cpp + data-block-tests.cpp + UdpCore-tests.cpp + ForwardingTimeCoordinatorTests.cpp + TimeCoordinatorTests.cpp + networkInfoTests.cpp) -if (HELICS_HAVE_ZEROMQ) - list(APPEND core_test_sources ZeromqCore-tests.cpp) +if(HELICS_HAVE_ZEROMQ) + list(APPEND core_test_sources ZeromqCore-tests.cpp) endif(HELICS_HAVE_ZEROMQ) -if (NOT DISABLE_TCP_CORE) - list(APPEND core_test_sources TcpCore-tests.cpp) +if(NOT DISABLE_TCP_CORE) + list(APPEND core_test_sources TcpCore-tests.cpp) endif() -if (MPI_ENABLE) - list(APPEND core_test_sources MpiCore-tests.cpp) +if(MPI_ENABLE) + list(APPEND core_test_sources MpiCore-tests.cpp) endif() add_executable(core-tests ${core_test_sources} ${core_test_headers}) target_link_libraries(core-tests helics-static helics_test_base) target_include_directories(core-tests PRIVATE ${PROJECT_SOURCE_DIR}/src) -set_target_properties (core-tests PROPERTIES FOLDER tests) +set_target_properties(core-tests PROPERTIES FOLDER tests) -add_test(NAME core-tests COMMAND core-tests --log_level=message --report_level=short) +add_test(NAME core-tests + COMMAND core-tests --log_level=message --report_level=short) set_property(TEST core-tests PROPERTY LABELS Core Daily) # Tests for Continuous Integration builds -add_test(NAME core-ci-tests COMMAND core-tests --run_test=@ci --log_level=message --report_level=short) +add_test(NAME core-ci-tests + COMMAND core-tests + --run_test=@ci + --log_level=message + --report_level=short) set_property(TEST core-ci-tests PROPERTY LABELS Continuous) foreach(keyfile IN LISTS KEY_LIBRARY_FILES) - add_custom_command(TARGET core-tests POST_BUILD # Adds a post-build event to core tests - COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." - "${keyfile}" # <--this is in-file - "$/") # <--this is out-file path + add_custom_command(TARGET + core-tests + POST_BUILD # Adds a post-build event to core tests + COMMAND ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E + # copy_if_different..." + "${keyfile}" # <--this is in-file + "$/") # <--this is out- + # file path endforeach(keyfile) - diff --git a/tests/helics/shared_library/CMakeLists.txt b/tests/helics/shared_library/CMakeLists.txt index ebd8b0a5be..819d968952 100644 --- a/tests/helics/shared_library/CMakeLists.txt +++ b/tests/helics/shared_library/CMakeLists.txt @@ -1,88 +1,123 @@ -############################################################################## -# Copyright © 2017-2018, -# Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC -#All rights reserved. See LICENSE file and DISCLAIMER for more details. -############################################################################## - -set(c_shared_library_test_sources -ctestFixtures.cpp -shared-library-tests.cpp -#data_viewTests.cpp -test-value-federate1.cpp -test-value-federate2.cpp -#ValueFederateTests2.cpp -FilterTests.cpp - -test-message-federate.cpp -#test-message-federate_cpp.cpp -#FederateTests.cpp -TimingTests.cpp -#iterationTests.cpp -QueryTests.cpp -badInputTests.cpp -) - -set(cpp_shared_library_test_sources -cpptestFixtures.cpp -cppshared-library-tests.cpp -#test-value-federate1_cpp.cpp -test-value-federate2_cpp.cpp -#FilterTests_cpp.cpp -test-message-federate_cpp.cpp -#FederateTests.cpp -#TimingTests.cpp -#iterationTests.cpp -#subPubObjectTests.cpp -#QueryTests.cpp -) - -add_executable(shared-library-tests ${c_shared_library_test_sources} ctestFixtures.hpp) - -add_executable(shared-library-tests-cpp ${cpp_shared_library_test_sources} cpptestFixtures.hpp) - -target_link_libraries(shared-library-tests helicsSharedLib ${Boost_LIBRARIES_core} helics_test_base) -target_link_libraries(shared-library-tests-cpp helicsSharedLib ${Boost_LIBRARIES_core} helics_test_base) - -set_target_properties (shared-library-tests shared-library-tests-cpp PROPERTIES FOLDER tests) - -target_compile_definitions(shared-library-tests PRIVATE "-DHELICS_BROKER_LOCATION=\"${HELICS_BROKER_LOC}\"") -target_compile_definitions(shared-library-tests PRIVATE "-DHELICS_INSTALL_LOCATION=\"${CMAKE_INSTALL_PREFIX}\"") - -target_compile_definitions(shared-library-tests PRIVATE "-DTEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"") - -add_test(NAME shared-library-tests COMMAND shared-library-tests --log_level=message --report_level=short) - -target_compile_definitions(shared-library-tests-cpp PRIVATE "-DHELICS_BROKER_LOCATION=\"${HELICS_BROKER_LOC}\"") -target_compile_definitions(shared-library-tests-cpp PRIVATE "-DHELICS_INSTALL_LOCATION=\"${CMAKE_INSTALL_PREFIX}\"") - -target_compile_definitions(shared-library-tests-cpp PRIVATE "-DTEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"") - -add_test(NAME shared-library-tests-cpp COMMAND shared-library-tests-cpp --log_level=message --report_level=short) +# +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore +# National Security, LLC; Alliance for Sustainable Energy, LLC All rights +# reserved. See LICENSE file and DISCLAIMER for more details. +# + +set(c_shared_library_test_sources ctestFixtures.cpp shared-library-tests.cpp + # data_viewTests.cpp + test-value-federate1.cpp test-value-federate2.cpp + # ValueFederateTests2.cpp + FilterTests.cpp test-message-federate.cpp + # test-message-federate_cpp.cpp + # FederateTests.cpp + TimingTests.cpp + # iterationTests.cpp + QueryTests.cpp badInputTests.cpp) + +set(cpp_shared_library_test_sources cpptestFixtures.cpp + cppshared-library-tests.cpp + # test-value-federate1_cpp.cpp + test-value-federate2_cpp.cpp + # FilterTests_cpp.cpp + test-message-federate_cpp.cpp + # FederateTests.cpp + # TimingTests.cpp + # iterationTests.cpp + # subPubObjectTests.cpp + # QueryTests.cpp + ) + +add_executable(shared-library-tests ${c_shared_library_test_sources} + ctestFixtures.hpp) + +add_executable(shared-library-tests-cpp ${cpp_shared_library_test_sources} + cpptestFixtures.hpp) + +target_link_libraries(shared-library-tests + helicsSharedLib + ${Boost_LIBRARIES_core} + helics_test_base) +target_link_libraries(shared-library-tests-cpp + helicsSharedLib + ${Boost_LIBRARIES_core} + helics_test_base) + +set_target_properties(shared-library-tests shared-library-tests-cpp + PROPERTIES FOLDER tests) + +target_compile_definitions(shared-library-tests PRIVATE + "-DHELICS_BROKER_LOCATION=\"${HELICS_BROKER_LOC}\"") +target_compile_definitions( + shared-library-tests PRIVATE + "-DHELICS_INSTALL_LOCATION=\"${CMAKE_INSTALL_PREFIX}\"") + +target_compile_definitions(shared-library-tests PRIVATE + "-DTEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"") + +add_test(NAME shared-library-tests + COMMAND shared-library-tests --log_level=message --report_level=short) + +target_compile_definitions(shared-library-tests-cpp PRIVATE + "-DHELICS_BROKER_LOCATION=\"${HELICS_BROKER_LOC}\"") +target_compile_definitions( + shared-library-tests-cpp PRIVATE + "-DHELICS_INSTALL_LOCATION=\"${CMAKE_INSTALL_PREFIX}\"") + +target_compile_definitions(shared-library-tests-cpp PRIVATE + "-DTEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"") + +add_test(NAME shared-library-tests-cpp + COMMAND shared-library-tests-cpp + --log_level=message + --report_level=short) set_property(TEST shared-library-tests PROPERTY LABELS SharedLibrary Daily) -# Setting a different label, because the test fixture for the C++ shared library tests doesn't work -# push_back for vector causes a segfault for unknown reasons (Boost UTF related?) -set_property(TEST shared-library-tests-cpp PROPERTY LABELS SharedLibraryCpp Daily) +# Setting a different label, because the test fixture for the C++ shared library +# tests doesn't work push_back for vector causes a segfault for unknown reasons +# (Boost UTF related?) +set_property(TEST shared-library-tests-cpp + PROPERTY LABELS SharedLibraryCpp Daily) # Tests used for Continuous Integration builds -add_test(NAME shared-library-ci-tests COMMAND shared-library-tests --run_test=@ci --log_level=message --report_level=short) -add_test(NAME shared-library-ci-tests-cpp COMMAND shared-library-tests-cpp --run_test=@ci --log_level=message --report_level=short) +add_test(NAME shared-library-ci-tests + COMMAND shared-library-tests + --run_test=@ci + --log_level=message + --report_level=short) +add_test(NAME shared-library-ci-tests-cpp + COMMAND shared-library-tests-cpp + --run_test=@ci + --log_level=message + --report_level=short) set_property(TEST shared-library-ci-tests PROPERTY LABELS Continuous) set_property(TEST shared-library-ci-tests-cpp PROPERTY LABELS Continuous) -if (WIN32) - -foreach(keyfile IN LISTS KEY_LIBRARY_FILES) - add_custom_command(TARGET shared-library-tests POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." - "${keyfile}" # <--this is in-file - "$/") # <--this is out-file path -endforeach(keyfile) - - add_custom_command(TARGET shared-library-tests POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." - "$" # <--this is in-file - "$/") # <--this is out-file path +if(WIN32) + + foreach(keyfile IN LISTS KEY_LIBRARY_FILES) + add_custom_command(TARGET + shared-library-tests + POST_BUILD # Adds a post-build event to api tests + COMMAND ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E + # copy_if_different..." + "${keyfile}" # <--this is in-file + "$/") + # <--this is out-file path + endforeach(keyfile) + + add_custom_command(TARGET + shared-library-tests + POST_BUILD # Adds a post-build event to api tests + COMMAND ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E + # copy_if_different..." + "$" # <--this is in- + # file + "$/") + # <--this is out-file path endif(WIN32) - diff --git a/tests/helics/system_tests/CMakeLists.txt b/tests/helics/system_tests/CMakeLists.txt index a1cb9b34f7..225b0d6082 100644 --- a/tests/helics/system_tests/CMakeLists.txt +++ b/tests/helics/system_tests/CMakeLists.txt @@ -1,44 +1,54 @@ -############################################################################## -# Copyright © 2017-2018, -# Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC -#All rights reserved. See LICENSE file and DISCLAIMER for more details. -############################################################################## - +# +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore +# National Security, LLC; Alliance for Sustainable Energy, LLC All rights +# reserved. See LICENSE file and DISCLAIMER for more details. +# set(system_test_sources -helics_system_tests.cpp -TimingTests.cpp -iterationTests.cpp -ErrorTests.cpp -federateRealTimeTests.cpp -TimingTests2.cpp -QueryTests.cpp -heat-transfer-tests.cpp -../application_api/testFixtures.cpp -../application_api/testFixtures.hpp -) - - -add_executable(system-tests ${system_test_sources} ${system_test_headers} ) + helics_system_tests.cpp + TimingTests.cpp + iterationTests.cpp + ErrorTests.cpp + federateRealTimeTests.cpp + TimingTests2.cpp + QueryTests.cpp + heat-transfer-tests.cpp + ../application_api/testFixtures.cpp + ../application_api/testFixtures.hpp) + +add_executable(system-tests ${system_test_sources} ${system_test_headers}) target_link_libraries(system-tests helics-static helics_test_base) -set_target_properties (system-tests PROPERTIES FOLDER tests) +set_target_properties(system-tests PROPERTIES FOLDER tests) -target_compile_definitions(system-tests PRIVATE "-DHELICS_BROKER_LOCATION=\"${HELICS_BROKER_LOC}\"") -target_compile_definitions(system-tests PRIVATE "-DHELICS_INSTALL_LOCATION=\"${CMAKE_INSTALL_PREFIX}\"") -target_compile_definitions(system-tests PRIVATE "-DTEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"") +target_compile_definitions(system-tests PRIVATE + "-DHELICS_BROKER_LOCATION=\"${HELICS_BROKER_LOC}\"") +target_compile_definitions( + system-tests PRIVATE "-DHELICS_INSTALL_LOCATION=\"${CMAKE_INSTALL_PREFIX}\"") +target_compile_definitions(system-tests PRIVATE + "-DTEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"") -add_test(NAME system-tests COMMAND system-tests --log_level=message --report_level=short) +add_test(NAME system-tests + COMMAND system-tests --log_level=message --report_level=short) set_property(TEST system-tests PROPERTY LABELS System Daily) # Tests for Continuous Integration builds -add_test(NAME system-ci-tests COMMAND system-tests --run_test=@ci --log_level=message --report_level=short) +add_test(NAME system-ci-tests + COMMAND system-tests + --run_test=@ci + --log_level=message + --report_level=short) set_property(TEST system-ci-tests PROPERTY LABELS Continuous) foreach(keyfile IN LISTS KEY_LIBRARY_FILES) -add_custom_command(TARGET system-tests POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." - "${keyfile}" # <--this is in-file - "$/") # <--this is out-file path + add_custom_command(TARGET + system-tests + POST_BUILD # Adds a post-build event to api tests + COMMAND ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E + # copy_if_different..." + "${keyfile}" # <--this is in-file + "$/") # <--this is + # out-file path endforeach(keyfile) - diff --git a/tests/java_helics/CMakeLists.txt b/tests/java_helics/CMakeLists.txt index 5641d64e9b..c27b3b0e12 100644 --- a/tests/java_helics/CMakeLists.txt +++ b/tests/java_helics/CMakeLists.txt @@ -2,77 +2,154 @@ find_package(Java REQUIRED) find_package(JNI REQUIRED) include(UseJava) -set(helicsJar ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar) - -add_custom_target( Java_hello_world ALL - ${Java_JAVAC_EXECUTABLE} -classpath ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar -d ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/HelloWorld.java - DEPENDS JNIhelics ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar - COMMENT "Building HelloWorld.java" - VERBATIM -) - -add_custom_target( Java_Helics_Api ALL - ${Java_JAVAC_EXECUTABLE} -classpath ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar -d ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/JavaHelicsApiTests.java - DEPENDS JNIhelics ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar - COMMENT "Building JavaHelicsApiTests.java" - VERBATIM -) - -add_custom_target( Java_MessageFederate ALL - ${Java_JAVAC_EXECUTABLE} -classpath ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar -d ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/TestMessageFederate.java - DEPENDS JNIhelics ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar - COMMENT "Building MessageFederate.java" - VERBATIM -) - -add_custom_target( Java_MessageFilter ALL - ${Java_JAVAC_EXECUTABLE} -classpath ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar -d ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/TestMessageFilter.java - DEPENDS JNIhelics ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar - COMMENT "Building MessageFilter.java" - VERBATIM -) - -add_custom_target( Java_ValueFederate ALL - ${Java_JAVAC_EXECUTABLE} -classpath ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar -d ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/TestValueFederate.java - DEPENDS JNIhelics ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar - COMMENT "Building ValueFederate.java" - VERBATIM -) +set(helicsJar + ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar) + +add_custom_target( + Java_hello_world + ALL + ${Java_JAVAC_EXECUTABLE} + -classpath + ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar + -d + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/HelloWorld.java + DEPENDS JNIhelics + ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar + COMMENT "Building HelloWorld.java" + VERBATIM) + +add_custom_target( + Java_Helics_Api + ALL + ${Java_JAVAC_EXECUTABLE} + -classpath + ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar + -d + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/JavaHelicsApiTests.java + DEPENDS JNIhelics + ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar + COMMENT "Building JavaHelicsApiTests.java" + VERBATIM) + +add_custom_target( + Java_MessageFederate + ALL + ${Java_JAVAC_EXECUTABLE} + -classpath + ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar + -d + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/TestMessageFederate.java + DEPENDS JNIhelics + ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar + COMMENT "Building MessageFederate.java" + VERBATIM) + +add_custom_target( + Java_MessageFilter + ALL + ${Java_JAVAC_EXECUTABLE} + -classpath + ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar + -d + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/TestMessageFilter.java + DEPENDS JNIhelics + ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar + COMMENT "Building MessageFilter.java" + VERBATIM) + +add_custom_target( + Java_ValueFederate + ALL + ${Java_JAVAC_EXECUTABLE} + -classpath + ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar + -d + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/TestValueFederate.java + DEPENDS JNIhelics + ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar + COMMENT "Building ValueFederate.java" + VERBATIM) # Windows uses a different separator for Java classpaths than other platforms -if (CMAKE_HOST_WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") - set(CMAKE_JAVA_INCLUDE_FLAG_SEP ";") -else () - set(CMAKE_JAVA_INCLUDE_FLAG_SEP ":") +if(CMAKE_HOST_WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") + set(CMAKE_JAVA_INCLUDE_FLAG_SEP ";") +else() + set(CMAKE_JAVA_INCLUDE_FLAG_SEP ":") endif() -set(java_test_classpath "${helicsJar}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_CURRENT_BINARY_DIR}") - -add_test(NAME Java_hello_world_test COMMAND ${Java_JAVA_EXECUTABLE} -Djava.library.path=$ -classpath "${java_test_classpath}" HelloWorld) - -add_test(NAME Java_Helics_Api_tests COMMAND ${Java_JAVA_EXECUTABLE} -Djava.library.path=$ -classpath "${java_test_classpath}" JavaHelicsApiTests) - -add_test(NAME Java_MessageFederate_test COMMAND ${Java_JAVA_EXECUTABLE} -Djava.library.path=$ -classpath "${java_test_classpath}" TestMessageFederate) - -add_test(NAME Java_MessageFilter_test COMMAND ${Java_JAVA_EXECUTABLE} -Djava.library.path=$ -classpath "${java_test_classpath}" TestMessageFilter) - -add_test(NAME Java_ValueFederate_test COMMAND ${Java_JAVA_EXECUTABLE} -Djava.library.path=$ -classpath "${java_test_classpath}" TestValueFederate) - -set_target_properties (Java_hello_world Java_Helics_Api Java_MessageFederate Java_MessageFilter Java_ValueFederate PROPERTIES FOLDER tests) - -set_property(TEST Java_hello_world_test Java_Helics_Api_tests Java_MessageFederate_test Java_MessageFilter_test Java_ValueFederate_test PROPERTY LABELS Java Continuous Daily) - - -if (WIN32) -foreach(keyfile IN LISTS KEY_LIBRARY_FILES) -add_custom_command(TARGET Java_Helics_Api POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." - "${keyfile}" # <--this is in-file - "${CMAKE_CURRENT_BINARY_DIR}/") # <--this is out-file path -endforeach(keyfile) - -add_custom_command(TARGET Java_Helics_Api POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." - "$" # <--this is in-file - "${CMAKE_CURRENT_BINARY_DIR}/") # <--this is out-file path - -endif (WIN32) \ No newline at end of file +set(java_test_classpath + "${helicsJar}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_CURRENT_BINARY_DIR}") + +add_test(NAME Java_hello_world_test + COMMAND ${Java_JAVA_EXECUTABLE} + -Djava.library.path=$ -classpath + "${java_test_classpath}" HelloWorld) + +add_test(NAME Java_Helics_Api_tests + COMMAND ${Java_JAVA_EXECUTABLE} + -Djava.library.path=$ -classpath + "${java_test_classpath}" JavaHelicsApiTests) + +add_test(NAME Java_MessageFederate_test + COMMAND ${Java_JAVA_EXECUTABLE} + -Djava.library.path=$ -classpath + "${java_test_classpath}" TestMessageFederate) + +add_test(NAME Java_MessageFilter_test + COMMAND ${Java_JAVA_EXECUTABLE} + -Djava.library.path=$ -classpath + "${java_test_classpath}" TestMessageFilter) + +add_test(NAME Java_ValueFederate_test + COMMAND ${Java_JAVA_EXECUTABLE} + -Djava.library.path=$ -classpath + "${java_test_classpath}" TestValueFederate) + +set_target_properties(Java_hello_world + Java_Helics_Api + Java_MessageFederate + Java_MessageFilter + Java_ValueFederate + PROPERTIES FOLDER tests) + +set_property(TEST Java_hello_world_test + Java_Helics_Api_tests + Java_MessageFederate_test + Java_MessageFilter_test + Java_ValueFederate_test + PROPERTY LABELS + Java + Continuous + Daily) + +if(WIN32) + foreach(keyfile IN LISTS KEY_LIBRARY_FILES) + add_custom_command(TARGET + Java_Helics_Api + POST_BUILD # Adds a post-build event to api tests + COMMAND ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E + # copy_if_different..." + "${keyfile}" # <--this is in-file + "${CMAKE_CURRENT_BINARY_DIR}/") # <--this is out- + # file path + endforeach(keyfile) + + add_custom_command(TARGET + Java_Helics_Api + POST_BUILD # Adds a post-build event to api tests + COMMAND ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E + # copy_if_different..." + "$" # <--this is in- + # file + "${CMAKE_CURRENT_BINARY_DIR}/") # <--this is out- + # file path + +endif(WIN32) diff --git a/tests/matlab_helics/CMakeLists.txt b/tests/matlab_helics/CMakeLists.txt index 1de4abb28f..3227cd9946 100644 --- a/tests/matlab_helics/CMakeLists.txt +++ b/tests/matlab_helics/CMakeLists.txt @@ -1,5 +1,5 @@ ############################################################################## -#Copyright © 2017-2018, +#Copyright © 2017-2018, #Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC #All rights reserved. See LICENSE file and DISCLAIMER for more details. ############################################################################## @@ -8,11 +8,11 @@ if (WIN32) configure_file(runTestsWIN32.m.in runTests.m) add_test(NAME matlab_tests COMMAND ${Matlab_MAIN_PROGRAM} -nojvm -nosplash -minimize -r "\"run('${CMAKE_CURRENT_BINARY_DIR}/runTests.m');quit;\"" ) - + else() configure_file(runTestsUNIX.m.in runTests.m) add_test(NAME matlab_tests COMMAND ${Matlab_MAIN_PROGRAM} -nojvm -nodisplay -nosplash -r "\"run('${CMAKE_CURRENT_BINARY_DIR}/runTests.m');quit;\"") endif() - + set_property(TEST matlab_tests PROPERTY LABELS Matlab Continuous Daily) diff --git a/tests/python_helics/CMakeLists.txt b/tests/python_helics/CMakeLists.txt index 796580447b..ed73c3c667 100644 --- a/tests/python_helics/CMakeLists.txt +++ b/tests/python_helics/CMakeLists.txt @@ -1,17 +1,36 @@ -if (BUILD_PYTHON_INTERFACE) - SET(Python_ADDITIONAL_VERSIONS 3.4 3.5 3.6 3.7 3.8) - find_package(PythonInterp 3) - find_package(PythonLibs 3 REQUIRED ) +if(BUILD_PYTHON_INTERFACE) + set(Python_ADDITIONAL_VERSIONS 3.4 3.5 3.6 3.7 3.8) + find_package(PythonInterp 3) + find_package(PythonLibs 3 REQUIRED) endif(BUILD_PYTHON_INTERFACE) message(STATUS "Python ${PYTHON_EXECUTABLE}") -add_test(NAME python_basic_test WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/swig/python COMMAND ${PYTHON_EXECUTABLE} -m pytest ${CMAKE_CURRENT_SOURCE_DIR}/test_helics.py) +add_test(NAME python_basic_test + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/swig/python + COMMAND ${PYTHON_EXECUTABLE} -m pytest + ${CMAKE_CURRENT_SOURCE_DIR}/test_helics.py) -add_test(NAME python_message_federate_test WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/swig/python COMMAND ${PYTHON_EXECUTABLE} -m pytest ${CMAKE_CURRENT_SOURCE_DIR}/test_message_federate.py) +add_test(NAME python_message_federate_test + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/swig/python + COMMAND ${PYTHON_EXECUTABLE} -m pytest + ${CMAKE_CURRENT_SOURCE_DIR}/test_message_federate.py) -add_test(NAME python_message_filter_test WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/swig/python COMMAND ${PYTHON_EXECUTABLE} -m pytest ${CMAKE_CURRENT_SOURCE_DIR}/test_message_filter.py) +add_test(NAME python_message_filter_test + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/swig/python + COMMAND ${PYTHON_EXECUTABLE} -m pytest + ${CMAKE_CURRENT_SOURCE_DIR}/test_message_filter.py) -add_test(NAME python_value_federate_test WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/swig/python COMMAND ${PYTHON_EXECUTABLE} -m pytest ${CMAKE_CURRENT_SOURCE_DIR}/test_value_federate.py) +add_test(NAME python_value_federate_test + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/swig/python + COMMAND ${PYTHON_EXECUTABLE} -m pytest + ${CMAKE_CURRENT_SOURCE_DIR}/test_value_federate.py) -set_property(TEST python_basic_test python_message_federate_test python_message_filter_test python_value_federate_test PROPERTY LABELS Python Continuous Daily) +set_property(TEST python_basic_test + python_message_federate_test + python_message_filter_test + python_value_federate_test + PROPERTY LABELS + Python + Continuous + Daily) From 283863612bf77097a5803ea7d4a7a55706491cdc Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Wed, 1 Aug 2018 14:00:03 -0600 Subject: [PATCH 02/16] Make line-width 88 --- CMakeLists.txt | 94 ++++++++------------ ThirdParty/fmt/CMakeLists.txt | 84 +++++++---------- examples/CMakeLists.txt | 10 +-- examples/CppInterface/CMakeLists.txt | 14 ++- examples/comboFederates1/CMakeLists.txt | 19 ++-- src/helics/CMakeLists.txt | 9 +- src/helics/application_api/CMakeLists.txt | 10 +-- src/helics/apps/CMakeLists.txt | 16 ++-- src/helics/common/CMakeLists.txt | 13 ++- src/helics/core/CMakeLists.txt | 43 +++------ src/helics/cpp98/CMakeLists.txt | 16 ++-- src/helics/shared_api_library/CMakeLists.txt | 16 ++-- swig/CMakeLists.txt | 72 ++++++++------- swig/java/CMakeLists.txt | 31 +++---- swig/matlab/CMakeLists.txt | 77 +++++++--------- swig/octave/CMakeLists.txt | 90 ++++++++++--------- swig/python/CMakeLists.txt | 37 +++----- swig/python2/CMakeLists.txt | 29 +++--- tests/CMakeLists.txt | 35 ++++---- tests/helics/CMakeLists.txt | 20 ++--- tests/helics/application_api/CMakeLists.txt | 14 ++- tests/helics/apps/CMakeLists.txt | 14 ++- tests/helics/common/CMakeLists.txt | 10 +-- tests/helics/core/CMakeLists.txt | 13 ++- tests/helics/shared_library/CMakeLists.txt | 38 ++++---- tests/helics/system_tests/CMakeLists.txt | 14 +-- tests/java_helics/CMakeLists.txt | 28 +++--- tests/matlab_helics/CMakeLists.txt | 32 ++++--- 28 files changed, 385 insertions(+), 513 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a3f79d6adc..5503322477 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # -# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore -# National Security, LLC; Alliance for Sustainable Energy, LLC All rights -# reserved. See LICENSE file and DISCLAIMER for more details. +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. # cmake_minimum_required(VERSION 3.4) @@ -19,16 +19,14 @@ set(HELICS_VERSION_UNDERSCORE "${HELICS_VERSION_MAJOR}_${HELICS_VERSION_MINOR}_${HELICS_VERSION_PATCH}") if(HELICS_VERSION_BUILD) set(HELICS_VERSION "${HELICS_VERSION}-${HELICS_VERSION_BUILD}") - set(HELICS_VERSION_UNDERSCORE - "${HELICS_VERSION_UNDERSCORE}-${HELICS_VERSION_BUILD}") + set(HELICS_VERSION_UNDERSCORE "${HELICS_VERSION_UNDERSCORE}-${HELICS_VERSION_BUILD}") endif() set(HELICS_VERSION_STRING "${HELICS_VERSION} (${HELICS_DATE})") # ----------------------------------------------------------------------------- # set the module path and include some common macros # ----------------------------------------------------------------------------- -set( - CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/config/cmake/") +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/config/cmake/") include(extraMacros) include(CMakeDependentOption) # include(BuildType) @@ -140,9 +138,8 @@ if(VERSION_OPTION) if(MSVC) target_compile_options(helics_base_includes INTERFACE ${VERSION_OPTION}) else() - target_compile_options( - helics_base_includes - INTERFACE $<$:${VERSION_OPTION}>) + target_compile_options(helics_base_includes + INTERFACE $<$:${VERSION_OPTION}>) endif(MSVC) endif(VERSION_OPTION) @@ -195,8 +192,8 @@ if(BUILD_HELICS_TESTS) ) else() message( - FATAL_ERROR - "CMAKE_BUILD_TYPE must be set to Coverage for testing code coverage") + FATAL_ERROR "CMAKE_BUILD_TYPE must be set to Coverage for testing code coverage" + ) endif() endif(TEST_CODE_COVERAGE) endif(BUILD_HELICS_TESTS) @@ -221,8 +218,7 @@ if(GENERATE_DOXYGEN_DOC) "${PROJECT_BINARY_DIR}/docs") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) - add_custom_target(doc ${DOXYGEN_EXECUTABLE} - ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile + add_custom_target(doc ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile WORKING_DIRECTORY ${DOXYGET_OUTPUT_DIR} COMMENT "Generating API documentation with Doxygen" VERBATIM) @@ -347,10 +343,9 @@ target_include_directories( $ $) -target_include_directories( - helics_base_includes SYSTEM - INTERFACE $ - $) +target_include_directories(helics_base_includes SYSTEM + INTERFACE $ + $) include(GNUInstallDirs) @@ -360,8 +355,7 @@ include(GNUInstallDirs) # use, i.e. don't skip the full RPATH for the build tree set(CMAKE_SKIP_BUILD_RPATH FALSE) -# when building, don't use the install RPATH already (but later on when -# installing) +# when building, don't use the install RPATH already (but later on when installing) set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) set(CMAKE_MACOSX_RPATH ON) @@ -370,8 +364,8 @@ set( "./;${AUTOBUILD_INSTALL_PATH}/bin;${AUTOBUILD_INSTALL_PATH}/lib;${AUTOBUILD_INSTALL_PATH}/lib64" ) -# add the automatically determined parts of the RPATH which point to directories -# outside the build tree to the install RPATH +# add the automatically determined parts of the RPATH which point to directories outside +# the build tree to the install RPATH set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) # the RPATH to be used when installing, but only if it's not a system directory @@ -385,8 +379,7 @@ endif() list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" isSystemDir) if("${isSystemDir}" STREQUAL "-1") - list(APPEND CMAKE_INSTALL_RPATH - "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + list(APPEND CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") endif() if(NOT Boost_USE_STATIC_LIBS) @@ -407,8 +400,7 @@ if(NOT WIN32) get_filename_component(zmqdir ${zmqlibfile} DIRECTORY) # message(STATUS "zmqdir path =${zmqdir}") if(APPLE) - # TODO: Make sure it works for building ZMQ from source automatically - # using CMake + # TODO: Make sure it works for building ZMQ from source automatically using CMake list(APPEND CMAKE_INSTALL_RPATH ${ZeroMQ_INSTALL_PATH}/lib) list(APPEND CMAKE_BUILD_RPATH ${ZeroMQ_INSTALL_PATH}/lib) endif() @@ -425,8 +417,7 @@ option( file(GLOB KEY_LIBRARY_FILES ${AUTOBUILD_INSTALL_PATH}/bin/*) # message(STATUS "key files ${KEY_LIBRARY_FILES}") -option(DISABLE_LOGGING "disable all normal, debug, and trace logging in HELICS" - OFF) +option(DISABLE_LOGGING "disable all normal, debug, and trace logging in HELICS" OFF) cmake_dependent_option(DISABLE_TRACE_LOGGING "disable trace logging" @@ -501,10 +492,8 @@ endif() # Enable clang analysis and formatting tools # ------------------------------------------------------------- -option( - ENABLE_CLANG_TOOLS - "if clang is found enable some custom targets for clang formatting and tidy" - OFF) +option(ENABLE_CLANG_TOOLS + "if clang is found enable some custom targets for clang formatting and tidy" OFF) mark_as_advanced(ENABLE_CLANG_TOOLS) if(ENABLE_CLANG_TOOLS) include(clang-cxx-dev-tools) @@ -526,9 +515,8 @@ set( "${CMAKE_STATIC_LIBRARY_PREFIX}helics-static${CMAKE_DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" ) if(BUILD_CXX_SHARED_LIB) - set( - helics_cxx_shared_file - "${CMAKE_SHARED_LIBRARY_PREFIX}helics-shared${CMAKE_SHARED_LIBRARY_SUFFIX}") + set(helics_cxx_shared_file + "${CMAKE_SHARED_LIBRARY_PREFIX}helics-shared${CMAKE_SHARED_LIBRARY_SUFFIX}") set( helics_cxx_shared_file_debug "${CMAKE_SHARED_LIBRARY_PREFIX}helics-shared${CMAKE_DEBUG_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}" @@ -539,10 +527,8 @@ else(BUILD_CXX_SHARED_LIB) endif(BUILD_CXX_SHARED_LIB) if(BUILD_C_SHARED_LIB OR INTERFACE_BUILD) - set( - helics_c_shared_file - "${CMAKE_SHARED_LIBRARY_PREFIX}helicsSharedLib${CMAKE_SHARED_LIBRARY_SUFFIX}" - ) + set(helics_c_shared_file + "${CMAKE_SHARED_LIBRARY_PREFIX}helicsSharedLib${CMAKE_SHARED_LIBRARY_SUFFIX}") set( helics_c_shared_file_debug "${CMAKE_SHARED_LIBRARY_PREFIX}helicsSharedLib${CMAKE_DEBUG_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}" @@ -552,8 +538,7 @@ else() set(helics_c_shared_file_debug) endif() -set(HELICS_CMAKECONFIG_INSTALL_DIR - "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" +set(HELICS_CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" CACHE STRING "install path for HELICSConfig.cmake") mark_as_advanced(HELICS_CMAKECONFIG_INSTALL_DIR) @@ -583,11 +568,10 @@ install(DIRECTORY ThirdParty/helics_includes include(CMakePackageConfigHelpers) -configure_package_config_file( - config/${PROJECT_NAME}Config.cmake.in - "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" - INSTALL_DESTINATION - ${HELICS_CMAKECONFIG_INSTALL_DIR}) +configure_package_config_file(config/${PROJECT_NAME}Config.cmake.in + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + INSTALL_DESTINATION + ${HELICS_CMAKECONFIG_INSTALL_DIR}) write_basic_package_version_file( ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake VERSION @@ -610,8 +594,8 @@ install(FILES config/cmake/addMPI.cmake # ------------------------------------------------------------- # CPack # ------------------------------------------------------------- -option(ENABLE_PACKAGE_BUILD - "Add projects for making packages and installers for HELICS" OFF) +option(ENABLE_PACKAGE_BUILD "Add projects for making packages and installers for HELICS" + OFF) if(ENABLE_PACKAGE_BUILD) set(CPACK_PACKAGE_NAME "Helics") @@ -623,15 +607,7 @@ if(ENABLE_PACKAGE_BUILD) set(CPACK_PACKAGE_VERSION_PATCH ${HELICS_VERSION_PATCH}) set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "HELICS") - set(CPACK_COMPONENTS_ALL - applications - headers - libs - runtime - matlab - python - java - octave) + set(CPACK_COMPONENTS_ALL applications headers libs runtime matlab python java octave) if(WIN32) set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}\\\\LICENSE") else(WIN32) @@ -650,8 +626,8 @@ if(ENABLE_PACKAGE_BUILD) set(CPACK_COMPONENT_APPLICATION_DESCRIPTION "Executables and helper applications for HELICS") - set(CPACK_COMPONENT_LIBS_DESCRIPTION - "Libraries for compiling and linking with HELICS") + set( + CPACK_COMPONENT_LIBS_DESCRIPTION "Libraries for compiling and linking with HELICS") set(CPACK_COMPONENT_HEADERS_DESCRIPTION "Headers for linking and compiling with HELICS") set(CPACK_COMPONENT_RUNTIME_DESCRIPTION "Runtime libraries for HELICS") diff --git a/ThirdParty/fmt/CMakeLists.txt b/ThirdParty/fmt/CMakeLists.txt index 506e3d8789..8a4d14a1a7 100644 --- a/ThirdParty/fmt/CMakeLists.txt +++ b/ThirdParty/fmt/CMakeLists.txt @@ -4,8 +4,8 @@ endif() cmake_minimum_required(VERSION 2.8.12) -# Determine if fmt is built as a subproject (using add_subdirectory) or if it is -# the master project. +# Determine if fmt is built as a subproject (using add_subdirectory) or if it is the +# master project. set(MASTER_PROJECT OFF) if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) set(MASTER_PROJECT ON) @@ -20,9 +20,8 @@ function(join result_var) set(${result_var} "${result}" PARENT_SCOPE) endfunction() -# Set the default CMAKE_BUILD_TYPE to Release. This should be done before the -# project command since the latter can set CMAKE_BUILD_TYPE itself (it does so -# for nmake). +# Set the default CMAKE_BUILD_TYPE to Release. This should be done before the project +# command since the latter can set CMAKE_BUILD_TYPE itself (it does so for nmake). if(NOT CMAKE_BUILD_TYPE) join(doc "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or " "CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.") @@ -64,8 +63,7 @@ endif() set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} - "${CMAKE_CURRENT_SOURCE_DIR}/support/cmake") +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/support/cmake") include(cxx14) @@ -74,10 +72,9 @@ if(CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) endif() if(MASTER_PROJECT AND CMAKE_GENERATOR MATCHES "Visual Studio") - # If Microsoft SDK is installed create script run-msbuild.bat that calls - # SetEnv.cmd to set up build environment and runs msbuild. It is useful when - # building Visual Studio projects with the SDK toolchain rather than Visual - # Studio. + # If Microsoft SDK is installed create script run-msbuild.bat that calls SetEnv.cmd to + # set up build environment and runs msbuild. It is useful when building Visual Studio + # projects with the SDK toolchain rather than Visual Studio. include(FindSetEnv) if(WINSDK_SETENV) set(MSBUILD_SETUP "call \"${WINSDK_SETENV}\"") @@ -108,14 +105,7 @@ function(add_headers VAR) endfunction() # Define the fmt library, its includes and the needed defines. -add_headers(FMT_HEADERS - core.h - format.h - format-inl.h - ostream.h - printf.h - time.h - ranges.h) +add_headers(FMT_HEADERS core.h format.h format-inl.h ostream.h printf.h time.h ranges.h) set(FMT_SOURCES src/format.cc) if(HAVE_OPEN) add_headers(FMT_HEADERS posix.h) @@ -125,8 +115,8 @@ endif() add_library(fmt ${FMT_SOURCES} ${FMT_HEADERS} README.rst ChangeLog.rst) add_library(fmt::fmt ALIAS fmt) -# Starting with CMake 3.1 the CXX_STANDARD property can be used instead. Don't -# export -std since it may break projects that use other standards. +# Starting with CMake 3.1 the CXX_STANDARD property can be used instead. Don't export +# -std since it may break projects that use other standards. target_compile_options(fmt PRIVATE ${CPP14_FLAG}) if(FMT_PEDANTIC) target_compile_options(fmt PRIVATE ${PEDANTIC_COMPILE_FLAGS}) @@ -136,10 +126,9 @@ if(MSVC) target_compile_options(fmt PRIVATE /W4) endif() -target_include_directories( - fmt - PUBLIC $ - $) +target_include_directories(fmt + PUBLIC $ + $) set_target_properties(fmt PROPERTIES VERSION @@ -151,8 +140,8 @@ set_target_properties(fmt if(BUILD_SHARED_LIBS) if(UNIX AND NOT APPLE) - # Fix rpmlint warning: unused-direct-shlib-dependency - # /usr/lib/libformat.so.1.1.0 /lib/libm.so.6. + # Fix rpmlint warning: unused-direct-shlib-dependency /usr/lib/libformat.so.1.1.0 + # /lib/libm.so.6. target_link_libraries(fmt -Wl,--as-needed) endif() target_compile_definitions(fmt PRIVATE FMT_EXPORT INTERFACE FMT_SHARED) @@ -165,10 +154,9 @@ if(CMAKE_VERSION VERSION_GREATER 3.1.0 OR CMAKE_VERSION VERSION_EQUAL 3.1.0) target_compile_definitions(fmt-header-only INTERFACE FMT_HEADER_ONLY=1) - target_include_directories( - fmt-header-only - INTERFACE $ - $) + target_include_directories(fmt-header-only + INTERFACE $ + $) endif() # Install targets. @@ -177,9 +165,8 @@ if(FMT_INSTALL) include(CMakePackageConfigHelpers) set( FMT_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/fmt - CACHE - STRING - "Installation directory for cmake files, relative to ${CMAKE_INSTALL_PREFIX}." + CACHE STRING + "Installation directory for cmake files, relative to ${CMAKE_INSTALL_PREFIX}." ) set(version_config ${PROJECT_BINARY_DIR}/fmt-config-version.cmake) set(project_config ${PROJECT_BINARY_DIR}/fmt-config.cmake) @@ -192,17 +179,14 @@ if(FMT_INSTALL) set( FMT_LIB_DIR ${CMAKE_INSTALL_LIBDIR} - CACHE - STRING - "Installation directory for libraries, relative to ${CMAKE_INSTALL_PREFIX}." - ) + CACHE STRING + "Installation directory for libraries, relative to ${CMAKE_INSTALL_PREFIX}.") set( FMT_INC_DIR ${CMAKE_INSTALL_INCLUDEDIR}/fmt CACHE STRING - "Installation directory for include files, relative to ${CMAKE_INSTALL_PREFIX}." - ) + "Installation directory for include files, relative to ${CMAKE_INSTALL_PREFIX}.") # Generate the version, config and target files into the build directory. write_basic_package_version_file(${version_config} @@ -210,23 +194,19 @@ if(FMT_INSTALL) ${FMT_VERSION} COMPATIBILITY AnyNewerVersion) - configure_package_config_file( - ${PROJECT_SOURCE_DIR}/support/cmake/fmt-config.cmake.in - ${project_config} - INSTALL_DESTINATION - ${FMT_CMAKE_DIR}) - # Use a namespace because CMake provides better diagnostics for namespaced - # imported targets. + configure_package_config_file(${PROJECT_SOURCE_DIR}/support/cmake/fmt-config.cmake.in + ${project_config} + INSTALL_DESTINATION + ${FMT_CMAKE_DIR}) + # Use a namespace because CMake provides better diagnostics for namespaced imported + # targets. export(TARGETS ${INSTALL_TARGETS} NAMESPACE fmt:: FILE ${PROJECT_BINARY_DIR}/${targets_export_name}.cmake) # Install version, config and target files. - install(FILES ${project_config} ${version_config} - DESTINATION ${FMT_CMAKE_DIR}) - install(EXPORT ${targets_export_name} - DESTINATION ${FMT_CMAKE_DIR} - NAMESPACE fmt::) + install(FILES ${project_config} ${version_config} DESTINATION ${FMT_CMAKE_DIR}) + install(EXPORT ${targets_export_name} DESTINATION ${FMT_CMAKE_DIR} NAMESPACE fmt::) # Install the library and headers. install(TARGETS ${INSTALL_TARGETS} diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 8a43748a41..b72404989f 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,12 +1,12 @@ # -# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore -# National Security, LLC; Alliance for Sustainable Energy, LLC All rights -# reserved. See LICENSE file and DISCLAIMER for more details. +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. # if(EXAMPLES_WARNINGS_AS_ERROR) - # the examples had better compile without warnings otherwise they should not - # be allowed + # the examples had better compile without warnings otherwise they should not be + # allowed if(WIN32) if(MSVC) add_compile_options(/WX) diff --git a/examples/CppInterface/CMakeLists.txt b/examples/CppInterface/CMakeLists.txt index 414150308e..f16a89a6a8 100644 --- a/examples/CppInterface/CMakeLists.txt +++ b/examples/CppInterface/CMakeLists.txt @@ -1,7 +1,7 @@ # -# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore -# National Security, LLC; Alliance for Sustainable Energy, LLC All rights -# reserved. See LICENSE file and DISCLAIMER for more details. +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. # include_directories("${PROJECT_SOURCE_DIR}/src/helics") @@ -28,8 +28,7 @@ set_target_properties(nonlings_fed2_cpp PROPERTIES FOLDER examples) if(BUILD_HELICS_TESTS AND NOT MSVC) add_test(NAME nonlings_example COMMAND ${PROJECT_SOURCE_DIR}/scripts/test_example.sh 10 - $ - $) + $ $) set_property(TEST nonlings_example PROPERTY LABELS Continuous) endif() @@ -54,6 +53,5 @@ add_custom_command(TARGET copy_if_different # which executes "cmake - E # copy_if_different..." "$" # <--this is in-file - "$/") # <--this is - # out-file - # path + "$/") # <--this is out- + # file path diff --git a/examples/comboFederates1/CMakeLists.txt b/examples/comboFederates1/CMakeLists.txt index d371bdf527..a0ce5ce2ab 100644 --- a/examples/comboFederates1/CMakeLists.txt +++ b/examples/comboFederates1/CMakeLists.txt @@ -1,7 +1,7 @@ # -# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore -# National Security, LLC; Alliance for Sustainable Energy, LLC All rights -# reserved. See LICENSE file and DISCLAIMER for more details. +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. # add_executable(comboFed comboFed.cpp) @@ -10,8 +10,8 @@ target_link_libraries(comboFed helics_apps-static) set_target_properties(comboFed PROPERTIES FOLDER examples) -# configure_file(${CMAKE_CURRENT_SOURCE_DIR}/run.sh -# ${CMAKE_CURRENT_BINARY_DIR}/run.sh COPYONLY) +# configure_file(${CMAKE_CURRENT_SOURCE_DIR}/run.sh ${CMAKE_CURRENT_BINARY_DIR}/run.sh +# COPYONLY) add_custom_command(TARGET comboFed @@ -20,10 +20,8 @@ add_custom_command(TARGET -E copy_if_different # which executes "cmake - E # copy_if_different..." - "${CMAKE_CURRENT_SOURCE_DIR}/run.sh" # <--this is in- - # file - "$/") # <--this is out-file - # path + "${CMAKE_CURRENT_SOURCE_DIR}/run.sh" # <--this is in- file + "$/") # <--this is out-file path foreach(keyfile IN LISTS KEY_LIBRARY_FILES) add_custom_command(TARGET @@ -34,6 +32,5 @@ foreach(keyfile IN LISTS KEY_LIBRARY_FILES) copy_if_different # which executes "cmake - E # copy_if_different..." "${keyfile}" # <--this is in-file - "$/") # <--this is out- - # file path + "$/") # <--this is out- file path endforeach(keyfile) diff --git a/src/helics/CMakeLists.txt b/src/helics/CMakeLists.txt index bc4203da50..65ceaf2753 100644 --- a/src/helics/CMakeLists.txt +++ b/src/helics/CMakeLists.txt @@ -1,7 +1,7 @@ # -# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore -# National Security, LLC; Alliance for Sustainable Energy, LLC All rights -# reserved. See LICENSE file and DISCLAIMER for more details. +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. # add_subdirectory(common) @@ -33,8 +33,7 @@ if(BUILD_CXX_SHARED_LIB) target_link_libraries(helics-shared PRIVATE helics_base) if(WIN32) - set_target_properties(helics-shared - PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) + set_target_properties(helics-shared PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) endif() diff --git a/src/helics/application_api/CMakeLists.txt b/src/helics/application_api/CMakeLists.txt index 4dc7ac0a36..97de3a40de 100644 --- a/src/helics/application_api/CMakeLists.txt +++ b/src/helics/application_api/CMakeLists.txt @@ -1,7 +1,7 @@ # -# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore -# National Security, LLC; Alliance for Sustainable Energy, LLC All rights -# reserved. See LICENSE file and DISCLAIMER for more details. +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. # set(public_application_api_headers CombinationFederate.hpp @@ -56,9 +56,7 @@ target_include_directories( PRIVATE $) target_include_directories( application_api SYSTEM - PRIVATE - $ - ) + PRIVATE $) target_compile_definitions( application_api PRIVATE $) diff --git a/src/helics/apps/CMakeLists.txt b/src/helics/apps/CMakeLists.txt index b95391ac04..5d4ce282cf 100644 --- a/src/helics/apps/CMakeLists.txt +++ b/src/helics/apps/CMakeLists.txt @@ -1,7 +1,7 @@ # -# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore -# National Security, LLC; Alliance for Sustainable Energy, LLC All rights -# reserved. See LICENSE file and DISCLAIMER for more details. +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. # if(BUILD_APPS) @@ -70,9 +70,7 @@ if(BUILD_APPS) add_executable(helics_app appMain.cpp) target_link_libraries(helics_app helics_apps-static) set_target_properties(helics_app PROPERTIES FOLDER apps) - install(TARGETS helics_app - DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT applications) + install(TARGETS helics_app DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT applications) if(WIN32) foreach(keyfile IN LISTS KEY_LIBRARY_FILES) @@ -84,8 +82,7 @@ if(BUILD_APPS) copy_if_different # which executes "cmake - E # copy_if_different..." "${keyfile}" # <--this is in-file - "$/") # <--this is - # out-file + "$/") # <--this is out-file # path endforeach(keyfile) @@ -104,8 +101,7 @@ endif() # if build any app # configure executable app -configure_file(helicsConfigMain.h.in - ${CMAKE_CURRENT_BINARY_DIR}/helicsConfigMain.h) +configure_file(helicsConfigMain.h.in ${CMAKE_CURRENT_BINARY_DIR}/helicsConfigMain.h) add_executable(helics-config helicsConfigMain.cpp ${CMAKE_CURRENT_BINARY_DIR}/helicsConfigMain.h) diff --git a/src/helics/common/CMakeLists.txt b/src/helics/common/CMakeLists.txt index 71bff19871..a64dafb78b 100644 --- a/src/helics/common/CMakeLists.txt +++ b/src/helics/common/CMakeLists.txt @@ -1,7 +1,7 @@ # -# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore -# National Security, LLC; Alliance for Sustainable Energy, LLC All rights -# reserved. See LICENSE file and DISCLAIMER for more details. +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. # set(common_headers @@ -88,9 +88,7 @@ target_include_directories( PRIVATE $) target_include_directories( helics_common SYSTEM - PRIVATE - $ - ) + PRIVATE $) target_compile_definitions( helics_common PRIVATE $) @@ -102,8 +100,7 @@ target_compile_options( if(HELICS_HAVE_ZEROMQ) target_include_directories( helics_common SYSTEM - PRIVATE - $) + PRIVATE $) endif(HELICS_HAVE_ZEROMQ) if(APPLE) diff --git a/src/helics/core/CMakeLists.txt b/src/helics/core/CMakeLists.txt index c2f6b631a8..1270317de8 100644 --- a/src/helics/core/CMakeLists.txt +++ b/src/helics/core/CMakeLists.txt @@ -1,7 +1,7 @@ # -# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore -# National Security, LLC; Alliance for Sustainable Energy, LLC All rights -# reserved. See LICENSE file and DISCLAIMER for more details. +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. # set(SRC_FILES CoreFactory.cpp @@ -101,23 +101,11 @@ set(INCLUDE_FILES set(TESTCORE_HEADER_FILES TestCore.h TestBroker.h) -set(IPC_HEADER_FILES - ipc/IpcCore.h - ipc/IpcBroker.h - ipc/IpcComms.h - ipc/IpcQueueHelper.h) +set(IPC_HEADER_FILES ipc/IpcCore.h ipc/IpcBroker.h ipc/IpcComms.h ipc/IpcQueueHelper.h) -set(ZMQ_HEADER_FILES - zmq/ZmqCore.h - zmq/ZmqBroker.h - zmq/ZmqComms.h - zmq/ZmqRequestSets.h) +set(ZMQ_HEADER_FILES zmq/ZmqCore.h zmq/ZmqBroker.h zmq/ZmqComms.h zmq/ZmqRequestSets.h) -set(MPI_HEADER_FILES - mpi/MpiCore.h - mpi/MpiBroker.h - mpi/MpiComms.h - mpi/MpiService.h) +set(MPI_HEADER_FILES mpi/MpiCore.h mpi/MpiBroker.h mpi/MpiComms.h mpi/MpiService.h) set(UDP_HEADER_FILES udp/UdpCore.h udp/UdpBroker.h udp/UdpComms.h) @@ -151,20 +139,14 @@ if(HELICS_HAVE_MPI) list(APPEND INCLUDE_FILES ${MPI_HEADER_FILES}) endif(HELICS_HAVE_MPI) -add_library(helics_core - OBJECT - ${SRC_FILES} - ${INCLUDE_FILES} - ${PUBLIC_INCLUDE_FILES}) +add_library(helics_core OBJECT ${SRC_FILES} ${INCLUDE_FILES} ${PUBLIC_INCLUDE_FILES}) target_include_directories( helics_core PRIVATE $) target_include_directories( helics_core SYSTEM - PRIVATE - $ - ) + PRIVATE $) target_compile_definitions( helics_core PRIVATE $) @@ -176,8 +158,7 @@ target_include_directories( helics_core SYSTEM PRIVATE $) target_compile_definitions( - helics_core PRIVATE - $) + helics_core PRIVATE $) if(APPLE) target_compile_definitions(helics_core PUBLIC "-DSTX_NO_STD_ANY=1") @@ -190,8 +171,7 @@ endif(HELICS_HAVE_MPI) if(HELICS_HAVE_ZEROMQ) target_include_directories( helics_core SYSTEM - PRIVATE - $) + PRIVATE $) source_group("zmq" FILES ${ZMQ_SOURCE_FILES} ${ZMQ_HEADER_FILES}) endif(HELICS_HAVE_ZEROMQ) @@ -205,8 +185,7 @@ endif() if(HELICS_HAVE_MPI) target_include_directories(helics_core - PRIVATE "${MPI_C_INCLUDE_DIR}" - "${MPI_C_HEADER_DIR}" + PRIVATE "${MPI_C_INCLUDE_DIR}" "${MPI_C_HEADER_DIR}" "${MPI_C_ADDITIONAL_INCLUDE_DIRS}") endif(HELICS_HAVE_MPI) diff --git a/src/helics/cpp98/CMakeLists.txt b/src/helics/cpp98/CMakeLists.txt index 815d393dfc..38254cdacb 100644 --- a/src/helics/cpp98/CMakeLists.txt +++ b/src/helics/cpp98/CMakeLists.txt @@ -1,7 +1,7 @@ # -# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore -# National Security, LLC; Alliance for Sustainable Energy, LLC All rights -# reserved. See LICENSE file and DISCLAIMER for more details. +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. # set(helicsCpp98_headers Broker.hpp @@ -18,18 +18,16 @@ set(helicsCpp98_headers config.hpp) add_library(helicsCpp98 INTERFACE) -target_include_directories(helicsCpp98 - INTERFACE "${PROJECT_SOURCE_DIR}/src/helics") +target_include_directories(helicsCpp98 INTERFACE "${PROJECT_SOURCE_DIR}/src/helics") target_link_libraries(helicsCpp98 INTERFACE helicsSharedLib) add_library(HELICS::helicsCpp98 ALIAS helicsCpp98) -# this is purely so the files show up nicely in an IDE, other ides might use it -# as well but that can be added when/if the need arises +# this is purely so the files show up nicely in an IDE, other ides might use it as well +# but that can be added when/if the need arises if(MSVC) add_library(helicsCpp98_ide STATIC ${helicsCpp98_headers} ../../empty.cpp) - target_include_directories(helicsCpp98_ide - PRIVATE "${PROJECT_SOURCE_DIR}/src/helics") + target_include_directories(helicsCpp98_ide PRIVATE "${PROJECT_SOURCE_DIR}/src/helics") set_target_properties(helicsCpp98_ide PROPERTIES FOLDER interfaces) endif(MSVC) diff --git a/src/helics/shared_api_library/CMakeLists.txt b/src/helics/shared_api_library/CMakeLists.txt index eb4ae33e09..f7f475bf90 100644 --- a/src/helics/shared_api_library/CMakeLists.txt +++ b/src/helics/shared_api_library/CMakeLists.txt @@ -1,7 +1,7 @@ # -# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore -# National Security, LLC; Alliance for Sustainable Energy, LLC All rights -# reserved. See LICENSE file and DISCLAIMER for more details. +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. # set(helicsShared_headers @@ -23,17 +23,13 @@ set(helicsShared_sources include(GenerateExportHeader) -add_library(helicsSharedLib - SHARED - ${helicsShared_sources} - ${helicsShared_headers}) +add_library(helicsSharedLib SHARED ${helicsShared_sources} ${helicsShared_headers}) add_library(HELICS::helicsSharedLib ALIAS helicsSharedLib) generate_export_header(helicsSharedLib BASE_NAME helics) -target_include_directories( - helicsSharedLib - PUBLIC $) +target_include_directories(helicsSharedLib + PUBLIC $) set_target_properties(helicsSharedLib PROPERTIES CXX_VISIBILITY_PRESET diff --git a/swig/CMakeLists.txt b/swig/CMakeLists.txt index feb1a3b027..f133e7ebc4 100644 --- a/swig/CMakeLists.txt +++ b/swig/CMakeLists.txt @@ -1,48 +1,54 @@ -############################################################################## -#Copyright © 2017-2018, -#Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC -#All rights reserved. See LICENSE file and DISCLAIMER for more details. -############################################################################## - -if (NOT DISABLE_SWIG) - if (WIN32 AND NOT MSYS) - if (NOT CMAKE_PROGRAM_PATH) - set(CMAKE_PROGRAM_PATH "C:/local/swigwin-3.0.12" "C:/local/swigwin-3.0.11" "C:/local/swigwin-3.0.10") - else() - set(CMAKE_PROGRAM_PATH "${CMAKE_PROGRAM_PATH}" "C:/local/swigwin-3.0.12" "C:/local/swigwin-3.0.11" "C:/local/swigwin-3.0.10") - endif() - endif() - find_package(SWIG REQUIRED 3.0) - include(${SWIG_USE_FILE}) +# +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. +# + +if(NOT DISABLE_SWIG) + if(WIN32 AND NOT MSYS) + if(NOT CMAKE_PROGRAM_PATH) + set(CMAKE_PROGRAM_PATH + "C:/local/swigwin-3.0.12" + "C:/local/swigwin-3.0.11" + "C:/local/swigwin-3.0.10") + else() + set(CMAKE_PROGRAM_PATH + "${CMAKE_PROGRAM_PATH}" + "C:/local/swigwin-3.0.12" + "C:/local/swigwin-3.0.11" + "C:/local/swigwin-3.0.10") + endif() + endif() + find_package(SWIG REQUIRED 3.0) + include(${SWIG_USE_FILE}) endif() - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) include_directories("${PROJECT_SOURCE_DIR}/src/helics/shared_api_library") include_directories("${PROJECT_BINARY_DIR}/src/helics/shared_api_library") - -if (BUILD_PYTHON_INTERFACE) - add_subdirectory(python) - if( BUILD_PYTHON2_INTERFACE) - message(WARNING "PYTHON2 interface will not be built since python 3 build is active") - endif() -elseif (BUILD_PYTHON2_INTERFACE) - add_subdirectory(python2) +if(BUILD_PYTHON_INTERFACE) + add_subdirectory(python) + if(BUILD_PYTHON2_INTERFACE) + message( + WARNING "PYTHON2 interface will not be built since python 3 build is active") + endif() +elseif(BUILD_PYTHON2_INTERFACE) + add_subdirectory(python2) endif() -if (BUILD_JAVA_INTERFACE) - add_subdirectory(java) -endif () +if(BUILD_JAVA_INTERFACE) + add_subdirectory(java) +endif() if(BUILD_MATLAB_INTERFACE) - add_subdirectory(matlab) + add_subdirectory(matlab) endif() -if (BUILD_OCTAVE_INTERFACE) - add_subdirectory(octave) +if(BUILD_OCTAVE_INTERFACE) + add_subdirectory(octave) endif() -if (BUILD_CSHARP_INTERFACE) - #add_subdirectory(csharp) +if(BUILD_CSHARP_INTERFACE) + # add_subdirectory(csharp) endif() diff --git a/swig/java/CMakeLists.txt b/swig/java/CMakeLists.txt index 20b83e8d9b..5f3452f630 100644 --- a/swig/java/CMakeLists.txt +++ b/swig/java/CMakeLists.txt @@ -1,7 +1,7 @@ # -# Copyright (c) 2017-2018, Battelle Memorial Institute; Lawrence Livermore -# National Security, LLC; Alliance for Sustainable Energy, LLC All rights -# reserved. See LICENSE file and DISCLAIMER for more details. +# Copyright (c) 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. # find_package(Java REQUIRED) @@ -42,17 +42,15 @@ else(DISABLE_SWIG) endif() # DISABLE_SWIG -configure_file(MakeJarCMakeLists.txt.in - ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt @ONLY) +configure_file( + MakeJarCMakeLists.txt.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt @ONLY) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/buildjar/) -# -D -# ADDITIONAL_JAR_FILES=$;$ -add_custom_command( - TARGET "JNIhelics" POST_BUILD - COMMAND ${CMAKE_COMMAND} -D LIBRARY_FILE=$ -P - ${CMAKE_CURRENT_SOURCE_DIR}/addLoadLibraryCommand.cmake) +# -D ADDITIONAL_JAR_FILES=$;$ +add_custom_command(TARGET "JNIhelics" POST_BUILD + COMMAND ${CMAKE_COMMAND} -D LIBRARY_FILE=$ -P + ${CMAKE_CURRENT_SOURCE_DIR}/addLoadLibraryCommand.cmake) add_custom_command(TARGET "JNIhelics" POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS .. @@ -78,8 +76,8 @@ if(WIN32) copy_if_different # which executes "cmake - E # copy_if_different..." "${keyfile}" # <--this is in-file - "$/") # <--this is - # out-file path + "$/") # <--this is out-file + # path endforeach(keyfile) add_custom_command(TARGET @@ -89,10 +87,9 @@ if(WIN32) -E copy_if_different # which executes "cmake - E # copy_if_different..." - "$" # <--this is in- - # file - "$/") # <--this is out- - # file path + "$" # <--this is in- file + "$/") # <--this is out- file + # path endif(WIN32) diff --git a/swig/matlab/CMakeLists.txt b/swig/matlab/CMakeLists.txt index 258f4c33a1..851280b7da 100644 --- a/swig/matlab/CMakeLists.txt +++ b/swig/matlab/CMakeLists.txt @@ -1,7 +1,7 @@ # -# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore -# National Security, LLC; Alliance for Sustainable Energy, LLC All rights -# reserved. See LICENSE file and DISCLAIMER for more details. +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. # # Generate SWIG wrapper for MATLAB @@ -12,13 +12,11 @@ endif() if(NOT DISABLE_SWIG AND SWIG_EXECUTABLE) - execute_process(COMMAND ${SWIG_EXECUTABLE} -help - OUTPUT_VARIABLE SWIG_HELP_OUTPUT) + execute_process(COMMAND ${SWIG_EXECUTABLE} -help OUTPUT_VARIABLE SWIG_HELP_OUTPUT) string(FIND "${SWIG_HELP_OUTPUT}" "-matlab" MATLAB_HELP_FOUND) if(${MATLAB_HELP_FOUND} LESS 0) set(MATLAB_SWIG_NOT_AVAILABLE 1) - message( - warning " SWIG VERSION does not support matlab, reverting to build only") + message(warning " SWIG VERSION does not support matlab, reverting to build only") endif() endif() message(STATUS "Building MATLAB") @@ -40,31 +38,28 @@ if(DISABLE_SWIG OR MATLAB_SWIG_NOT_AVAILABLE) install(FILES ${MATLAB_FILES} DESTINATION matlab COMPONENT matlab) else() - file(GLOB SHARED_LIB_HEADERS - ${CMAKE_SOURCE_DIR}/src/helics/shared_api_library/*.h) + file(GLOB SHARED_LIB_HEADERS ${CMAKE_SOURCE_DIR}/src/helics/shared_api_library/*.h) # custom command for building the wrap file - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp - COMMAND "${SWIG_EXECUTABLE}" "-matlab" "-c++" -o "helicsMEX.cpp" - "-I${CMAKE_SOURCE_DIR}/src/helics/shared_api_library" - ${CMAKE_CURRENT_SOURCE_DIR}/helicsMatlab.i - DEPENDS ${CMAKE_SOURCE_DIR}/swig/helics.i - ${CMAKE_CURRENT_SOURCE_DIR}/helicsMatlab.i - ${SHARED_LIB_HEADERS} - ${CMAKE_CURRENT_SOURCE_DIR}/matlab_maps.i) + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp + COMMAND "${SWIG_EXECUTABLE}" "-matlab" "-c++" -o "helicsMEX.cpp" + "-I${CMAKE_SOURCE_DIR}/src/helics/shared_api_library" + ${CMAKE_CURRENT_SOURCE_DIR}/helicsMatlab.i + DEPENDS ${CMAKE_SOURCE_DIR}/swig/helics.i + ${CMAKE_CURRENT_SOURCE_DIR}/helicsMatlab.i + ${SHARED_LIB_HEADERS} + ${CMAKE_CURRENT_SOURCE_DIR}/matlab_maps.i) if(OVERWRITE_MATLAB_FILES) - add_custom_target( - mfile_overwrite ALL - COMMAND ${CMAKE_COMMAND} -D TARGET_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P - ${CMAKE_CURRENT_SOURCE_DIR}/overwriteMatlabFiles.cmake - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp) + add_custom_target(mfile_overwrite ALL + COMMAND ${CMAKE_COMMAND} -D TARGET_DIR=${CMAKE_CURRENT_SOURCE_DIR} + -P ${CMAKE_CURRENT_SOURCE_DIR}/overwriteMatlabFiles.cmake + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp) endif(OVERWRITE_MATLAB_FILES) # add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp COMMAND - # ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/modifyOctSourceFile.cmake - # DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp ) + # ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/modifyOctSourceFile.cmake DEPENDS + # ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp ) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/+helics DESTINATION matlab @@ -83,14 +78,12 @@ endif() add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mkhelicsMEXFile.m - COMMAND - ${CMAKE_COMMAND} -D LIBRARY_FILE=$ -D - BUILD_FILE=${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp -D - LIBRARY_INCLUDE_LOCATION=${CMAKE_SOURCE_DIR}/src/helics/shared_api_library/ - -D - OTHER_INCLUDE_LOCATION=${PROJECT_BINARY_DIR}/src/helics/shared_api_library/ - -D SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P - ${CMAKE_CURRENT_SOURCE_DIR}/generateMEXcreationScript.cmake + COMMAND ${CMAKE_COMMAND} -D LIBRARY_FILE=$ -D + BUILD_FILE=${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp -D + LIBRARY_INCLUDE_LOCATION=${CMAKE_SOURCE_DIR}/src/helics/shared_api_library/ -D + OTHER_INCLUDE_LOCATION=${PROJECT_BINARY_DIR}/src/helics/shared_api_library/ -D + SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P + ${CMAKE_CURRENT_SOURCE_DIR}/generateMEXcreationScript.cmake DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp) if(WIN32) @@ -117,29 +110,21 @@ if(NOT MATLAB_GENERATE_ONLY) set_target_properties(helicsMEX PROPERTIES FOLDER interfaces) endif(NOT MATLAB_GENERATE_ONLY) -file(GLOB HSHARED_LIB_SOURCES - ${CMAKE_SOURCE_DIR}/src/helics/shared_api_library/*.h) +file(GLOB HSHARED_LIB_SOURCES ${CMAKE_SOURCE_DIR}/src/helics/shared_api_library/*.h) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.${Matlab_MEX_EXTENSION} DESTINATION matlab COMPONENT matlab) -install(FILES $ - DESTINATION matlab - COMPONENT matlab) +install(FILES $ DESTINATION matlab COMPONENT matlab) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp DESTINATION matlab COMPONENT matlab) -install(FILES $ - DESTINATION matlab - COMPONENT matlab) +install(FILES $ DESTINATION matlab COMPONENT matlab) install(FILES ${KEY_LIBRARY_FILES} DESTINATION matlab COMPONENT matlab) -install(FILES ${HSHARED_LIB_SOURCES} +install(FILES ${HSHARED_LIB_SOURCES} DESTINATION matlab/headers COMPONENT matlab) +install(FILES ${PROJECT_BINARY_DIR}/src/helics/shared_api_library/helics_export.h DESTINATION matlab/headers COMPONENT matlab) -install( - FILES ${PROJECT_BINARY_DIR}/src/helics/shared_api_library/helics_export.h - DESTINATION matlab/headers - COMPONENT matlab) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/generatehelicsMEXFile.m DESTINATION matlab COMPONENT matlab) diff --git a/swig/octave/CMakeLists.txt b/swig/octave/CMakeLists.txt index 124f382f5d..b9f021e9b3 100644 --- a/swig/octave/CMakeLists.txt +++ b/swig/octave/CMakeLists.txt @@ -1,66 +1,68 @@ -############################################################################## -#Copyright © 2017-2018, -#Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC -#All rights reserved. See LICENSE file and DISCLAIMER for more details. -############################################################################## +# +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. +# # Generate SWIG wrapper (for Octave) message(STATUS "Building Octave interface") find_package(Octave REQUIRED) -if (NOT MKOCTFILE_EXECUTABLE) - SHOW_VARIABLE(OCTAVE_INSTALL_LOCATION PATH "installation location for Octave" "${OCTAVE_INSTALL_LOCATION}") +if(NOT MKOCTFILE_EXECUTABLE) + show_variable(OCTAVE_INSTALL_LOCATION + PATH + "installation location for Octave" + "${OCTAVE_INSTALL_LOCATION}") endif() -if (DISABLE_SWIG OR NOT SWIG_EXECUTABLE) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/helicsOCTAVE_wrap.cpp ${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cpp COPYONLY) +if(DISABLE_SWIG OR NOT SWIG_EXECUTABLE) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/helicsOCTAVE_wrap.cpp + ${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cpp COPYONLY) else() - # Compile OCT file - #add_custom_target("helicsOCT" ALL) - file(GLOB SHARED_LIB_HEADERS ${CMAKE_SOURCE_DIR}/src/helics/shared_api_library/*.h) + # Compile OCT file add_custom_target("helicsOCT" ALL) + file(GLOB SHARED_LIB_HEADERS ${CMAKE_SOURCE_DIR}/src/helics/shared_api_library/*.h) - #custom command for building the wrap file - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cxx - COMMAND "${SWIG_EXECUTABLE}" - "-octave" "-c++" - -o "helicsOCTAVE_wrap.cxx" - "-I${CMAKE_SOURCE_DIR}/src/helics/shared_api_library" - ${CMAKE_CURRENT_SOURCE_DIR}/helicsOctave.i - DEPENDS ${CMAKE_SOURCE_DIR}/swig/helics.i ${CMAKE_SOURCE_DIR}/swig/octave/helicsOctave.i ${SHARED_LIB_HEADERS} - ) + # custom command for building the wrap file + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cxx + COMMAND "${SWIG_EXECUTABLE}" "-octave" "-c++" -o + "helicsOCTAVE_wrap.cxx" + "-I${CMAKE_SOURCE_DIR}/src/helics/shared_api_library" + ${CMAKE_CURRENT_SOURCE_DIR}/helicsOctave.i + DEPENDS ${CMAKE_SOURCE_DIR}/swig/helics.i + ${CMAKE_SOURCE_DIR}/swig/octave/helicsOctave.i + ${SHARED_LIB_HEADERS}) - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cpp - COMMAND ${CMAKE_COMMAND} -D VOID_SIZE=${CMAKE_SIZEOF_VOID_P} -P ${CMAKE_CURRENT_SOURCE_DIR}/modifyOctSourceFile.cmake - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cxx - ) + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cpp + COMMAND ${CMAKE_COMMAND} -D VOID_SIZE=${CMAKE_SIZEOF_VOID_P} -P + ${CMAKE_CURRENT_SOURCE_DIR}/modifyOctSourceFile.cmake + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cxx) endif() - -add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mkhelicsOCTFile.m - COMMAND ${CMAKE_COMMAND} - -D LIBRARY_FILE=$ - -D BUILD_FILE=${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cpp - -D LIBRARY_INCLUDE_LOCATION=${CMAKE_SOURCE_DIR}/src/helics/shared_api_library/ - -D OTHER_INCLUDE_LOCATION=${PROJECT_BINARY_DIR}/src/helics/shared_api_library/ - -D SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} - -P ${CMAKE_CURRENT_SOURCE_DIR}/generateOCTcreationScript.cmake - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cpp -) +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mkhelicsOCTFile.m + COMMAND ${CMAKE_COMMAND} -D LIBRARY_FILE=$ -D + BUILD_FILE=${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cpp -D + LIBRARY_INCLUDE_LOCATION=${CMAKE_SOURCE_DIR}/src/helics/shared_api_library/ -D + OTHER_INCLUDE_LOCATION=${PROJECT_BINARY_DIR}/src/helics/shared_api_library/ -D + SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P + ${CMAKE_CURRENT_SOURCE_DIR}/generateOCTcreationScript.cmake + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cpp) add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helics.oct - COMMAND ${OCTAVE_EXECUTABLE} "-q" "run(\"${CMAKE_CURRENT_BINARY_DIR}/mkhelicsOCTFile.m\")" - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mkhelicsOCTFile.m helicsSharedLib ${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cpp -) + COMMAND ${OCTAVE_EXECUTABLE} "-q" + "run(\"${CMAKE_CURRENT_BINARY_DIR}/mkhelicsOCTFile.m\")" + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mkhelicsOCTFile.m helicsSharedLib + ${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cpp) -ADD_CUSTOM_TARGET(helicsOCT ALL - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helics.oct -) +add_custom_target(helicsOCT ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helics.oct) -set_target_properties (helicsOCT PROPERTIES FOLDER interfaces) +set_target_properties(helicsOCT PROPERTIES FOLDER interfaces) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/helics.oct DESTINATION octave COMPONENT octave) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/helics.oct + DESTINATION octave + COMPONENT octave) install(FILES $ DESTINATION octave COMPONENT octave) install(FILES ${KEY_LIBRARY_FILES} DESTINATION octave COMPONENT octave) diff --git a/swig/python/CMakeLists.txt b/swig/python/CMakeLists.txt index fbd49fb5d5..5d55ecc54f 100644 --- a/swig/python/CMakeLists.txt +++ b/swig/python/CMakeLists.txt @@ -1,7 +1,7 @@ # -# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore -# National Security, LLC; Alliance for Sustainable Energy, LLC All rights -# reserved. See LICENSE file and DISCLAIMER for more details. +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. # if(BUILD_PYTHON_INTERFACE) @@ -44,8 +44,7 @@ else() # Update if necessary set( CMAKE_C_FLAGS - "${CMAKE_C_FLAGS} -Wno-long-long -Wno-overlength-strings -Wno-ignored-attributes" - ) + "${CMAKE_C_FLAGS} -Wno-long-long -Wno-overlength-strings -Wno-ignored-attributes") endif() include_directories(${PYTHON_INCLUDE_PATH}) @@ -64,18 +63,16 @@ else() swig_link_libraries(helics helicsSharedLib) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - # https://groups.google.com/a/continuum.io/d/msg/anaconda/057P4uNWyCU/Iem6Ot - # jBCQAJ - set_target_properties(_helics - PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") + # https://groups.google.com/a/continuum.io/d/msg/anaconda/057P4uNWyCU/Iem6Ot jBCQAJ + set_target_properties(_helics PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") else() swig_link_libraries(helics ${PYTHON_LIBRARIES}) endif() set_target_properties(_helics PROPERTIES FOLDER interfaces) - # execute_process(COMMAND python -c "from distutils.sysconfig import - # get_python_lib; print get_python_lib()" OUTPUT_VARIABLE PYTHON_SITE_PACKAGES + # execute_process(COMMAND python -c "from distutils.sysconfig import get_python_lib; + # print get_python_lib()" OUTPUT_VARIABLE PYTHON_SITE_PACKAGES # OUTPUT_STRIP_TRAILING_WHITESPACE) install(TARGETS _helics DESTINATION python COMPONENT python) @@ -89,8 +86,8 @@ else() copy_if_different # which executes "cmake - E # copy_if_different..." "${keyfile}" # <--this is in-file - "$/") # <--this is out- - # file path + "$/") # <--this is out- file + # path endforeach(keyfile) add_custom_command(TARGET @@ -100,17 +97,11 @@ else() -E copy_if_different # which executes "cmake - E # copy_if_different..." - "$" # <--this is in- - # file - "$/") # <--this is out- - # file path + "$" # <--this is in- file + "$/") # <--this is out- file path endif() -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/helics.py - DESTINATION python - COMPONENT python) -install(FILES $ - DESTINATION python - COMPONENT python) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/helics.py DESTINATION python COMPONENT python) +install(FILES $ DESTINATION python COMPONENT python) install(FILES ${KEY_LIBRARY_FILES} DESTINATION python COMPONENT python) diff --git a/swig/python2/CMakeLists.txt b/swig/python2/CMakeLists.txt index 1d498682dd..99af3c070e 100644 --- a/swig/python2/CMakeLists.txt +++ b/swig/python2/CMakeLists.txt @@ -1,7 +1,7 @@ # -# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore -# National Security, LLC; Alliance for Sustainable Energy, LLC All rights -# reserved. See LICENSE file and DISCLAIMER for more details. +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. # if(DISABLE_SWIG OR NOT SWIG_EXECUTABLE) @@ -13,10 +13,8 @@ endif() # https://stackoverflow.com/a/3818084/5451769 if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) # Update if necessary - set( - CMAKE_C_FLAGS - "${CMAKE_C_FLAGS} -Wno-long-long -Wno-overlength-strings -Wno-ignored-attributes" - ) + set(CMAKE_C_FLAGS + "${CMAKE_C_FLAGS} -Wno-long-long -Wno-overlength-strings -Wno-ignored-attributes") endif() find_package(PythonLibs 2 REQUIRED) @@ -37,10 +35,8 @@ endif() swig_link_libraries(helics helicsSharedLib) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - # https://groups.google.com/a/continuum.io/d/msg/anaconda/057P4uNWyCU/Iem6OtjB - # CQAJ - set_target_properties(_helics - PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") + # https://groups.google.com/a/continuum.io/d/msg/anaconda/057P4uNWyCU/Iem6OtjB CQAJ + set_target_properties(_helics PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") else() swig_link_libraries(helics ${PYTHON_LIBRARIES}) endif() @@ -58,14 +54,9 @@ foreach(keyfile IN LISTS KEY_LIBRARY_FILES) copy_if_different # which executes "cmake - E # copy_if_different..." "${keyfile}" # <--this is in-file - "$/") # <--this is out- - # file path + "$/") # <--this is out- file path endforeach(keyfile) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/helics.py - DESTINATION python - COMPONENT python) -install(FILES $ - DESTINATION python - COMPONENT python) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/helics.py DESTINATION python COMPONENT python) +install(FILES $ DESTINATION python COMPONENT python) install(FILES ${KEY_LIBRARY_FILES} DESTINATION python COMPONENT python) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b070f891a4..dc7857487f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,27 +1,30 @@ -############################################################################## -#Copyright © 2017-2018, -#Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC -#All rights reserved. See LICENSE file and DISCLAIMER for more details. -############################################################################## +# +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. +# -if (BOOST_VERSION_LEVEL GREATER 0) - add_subdirectory (helics) +if(BOOST_VERSION_LEVEL GREATER 0) + add_subdirectory(helics) else() - message(WARNING "Boost version >=1.61 required for building HELICS tests (Found Boost version ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION})") + message( + WARNING + "Boost version >=1.61 required for building HELICS tests (Found Boost version ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION})" + ) endif() -if (BUILD_PYTHON_INTERFACE) - add_subdirectory(python_helics) +if(BUILD_PYTHON_INTERFACE) + add_subdirectory(python_helics) endif() -if (BUILD_JAVA_INTERFACE) - add_subdirectory(java_helics) +if(BUILD_JAVA_INTERFACE) + add_subdirectory(java_helics) endif() -if (BUILD_MATLAB_INTERFACE) - add_subdirectory(matlab_helics) +if(BUILD_MATLAB_INTERFACE) + add_subdirectory(matlab_helics) endif() -if (BUILD_OCTAVE_INTERFACE) -# add_subdirectory(octave_helics) +if(BUILD_OCTAVE_INTERFACE) + # add_subdirectory(octave_helics) endif() diff --git a/tests/helics/CMakeLists.txt b/tests/helics/CMakeLists.txt index 504d55a889..70ea33a967 100644 --- a/tests/helics/CMakeLists.txt +++ b/tests/helics/CMakeLists.txt @@ -1,23 +1,21 @@ -############################################################################## -#Copyright © 2017-2018, -#Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC -#All rights reserved. See LICENSE file and DISCLAIMER for more details. -############################################################################## +# +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. +# - -#add a baseline library for underlying dependencies and flags for test executables +# add a baseline library for underlying dependencies and flags for test executables add_library(helics_test_base INTERFACE) target_link_libraries(helics_test_base INTERFACE Boostlibs::test) target_link_libraries(helics_test_base INTERFACE helics_base_includes) add_subdirectory(common) -add_subdirectory (core) +add_subdirectory(core) add_subdirectory(application_api) add_subdirectory(system_tests) -if (BUILD_C_SHARED_LIB OR INTERFACE_BUILD) - add_subdirectory(shared_library) +if(BUILD_C_SHARED_LIB OR INTERFACE_BUILD) + add_subdirectory(shared_library) endif() add_subdirectory(apps) - diff --git a/tests/helics/application_api/CMakeLists.txt b/tests/helics/application_api/CMakeLists.txt index 294d0e5a5a..0ae181c7c8 100644 --- a/tests/helics/application_api/CMakeLists.txt +++ b/tests/helics/application_api/CMakeLists.txt @@ -1,11 +1,10 @@ # -# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore -# National Security, LLC; Alliance for Sustainable Energy, LLC All rights -# reserved. See LICENSE file and DISCLAIMER for more details. +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. # -set( - application_api_test_headers testFixtures.hpp ValueFederateTestTemplates.hpp) +set(application_api_test_headers testFixtures.hpp ValueFederateTestTemplates.hpp) set(application_api_test_sources MessageFederateKeyTests.cpp @@ -32,9 +31,8 @@ set_target_properties(application-api-tests PROPERTIES FOLDER tests) target_compile_definitions(application-api-tests PRIVATE "-DHELICS_BROKER_LOCATION=\"${HELICS_BROKER_LOC}\"") -target_compile_definitions( - application-api-tests PRIVATE - "-DHELICS_INSTALL_LOCATION=\"${CMAKE_INSTALL_PREFIX}\"") +target_compile_definitions(application-api-tests PRIVATE + "-DHELICS_INSTALL_LOCATION=\"${CMAKE_INSTALL_PREFIX}\"") target_compile_definitions(application-api-tests PRIVATE "-DTEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"") target_compile_definitions(application-api-tests PRIVATE "-DQUICK_TESTS_ONLY") diff --git a/tests/helics/apps/CMakeLists.txt b/tests/helics/apps/CMakeLists.txt index 8a2c1758d0..4e8216e651 100644 --- a/tests/helics/apps/CMakeLists.txt +++ b/tests/helics/apps/CMakeLists.txt @@ -1,7 +1,7 @@ # -# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore -# National Security, LLC; Alliance for Sustainable Energy, LLC All rights -# reserved. See LICENSE file and DISCLAIMER for more details. +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. # set(helics_apps_test_sources @@ -27,16 +27,14 @@ target_include_directories(helics_apps-tests PRIVATE ${PROJECT_SOURCE_DIR}/src) target_compile_definitions(helics_apps-tests PRIVATE -DTEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\") -target_compile_definitions( - helics_apps-tests PRIVATE - -DHELICS_BUILD_LOC=\"${CMAKE_BINARY_DIR}/src/helics/\") +target_compile_definitions(helics_apps-tests PRIVATE + -DHELICS_BUILD_LOC=\"${CMAKE_BINARY_DIR}/src/helics/\") target_compile_definitions( helics_apps-tests PRIVATE -DHELICS_INSTALL_LOC=\"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}\") if(DISABLE_SYSTEM_CALL_TESTS) - target_compile_definitions(helics_apps-tests PRIVATE - -DDISABLE_SYSTEM_CALL_TESTS=1) + target_compile_definitions(helics_apps-tests PRIVATE -DDISABLE_SYSTEM_CALL_TESTS=1) endif() add_test(NAME helics_apps-tests COMMAND helics_apps-tests --report_level=short) diff --git a/tests/helics/common/CMakeLists.txt b/tests/helics/common/CMakeLists.txt index 10141d54c6..e558276a1e 100644 --- a/tests/helics/common/CMakeLists.txt +++ b/tests/helics/common/CMakeLists.txt @@ -1,7 +1,7 @@ # -# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore -# National Security, LLC; Alliance for Sustainable Energy, LLC All rights -# reserved. See LICENSE file and DISCLAIMER for more details. +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. # # ----------------------------------------------------------------------------- @@ -43,6 +43,6 @@ foreach(keyfile IN LISTS KEY_LIBRARY_FILES) copy_if_different # which executes "cmake - E # copy_if_different..." "${keyfile}" # <--this is in-file - "$/") # <--this is - # out-file path + "$/") # <--this is out-file + # path endforeach(keyfile) diff --git a/tests/helics/core/CMakeLists.txt b/tests/helics/core/CMakeLists.txt index c07143f86d..c66aa02ce6 100644 --- a/tests/helics/core/CMakeLists.txt +++ b/tests/helics/core/CMakeLists.txt @@ -1,7 +1,7 @@ # -# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore -# National Security, LLC; Alliance for Sustainable Energy, LLC All rights -# reserved. See LICENSE file and DISCLAIMER for more details. +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. # # ----------------------------------------------------------------------------- @@ -45,8 +45,7 @@ target_link_libraries(core-tests helics-static helics_test_base) target_include_directories(core-tests PRIVATE ${PROJECT_SOURCE_DIR}/src) set_target_properties(core-tests PROPERTIES FOLDER tests) -add_test(NAME core-tests - COMMAND core-tests --log_level=message --report_level=short) +add_test(NAME core-tests COMMAND core-tests --log_level=message --report_level=short) set_property(TEST core-tests PROPERTY LABELS Core Daily) # Tests for Continuous Integration builds @@ -66,6 +65,6 @@ foreach(keyfile IN LISTS KEY_LIBRARY_FILES) copy_if_different # which executes "cmake - E # copy_if_different..." "${keyfile}" # <--this is in-file - "$/") # <--this is out- - # file path + "$/") # <--this is out- file + # path endforeach(keyfile) diff --git a/tests/helics/shared_library/CMakeLists.txt b/tests/helics/shared_library/CMakeLists.txt index 819d968952..4d1ea6da1f 100644 --- a/tests/helics/shared_library/CMakeLists.txt +++ b/tests/helics/shared_library/CMakeLists.txt @@ -1,7 +1,7 @@ # -# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore -# National Security, LLC; Alliance for Sustainable Energy, LLC All rights -# reserved. See LICENSE file and DISCLAIMER for more details. +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. # set(c_shared_library_test_sources ctestFixtures.cpp shared-library-tests.cpp @@ -15,8 +15,7 @@ set(c_shared_library_test_sources ctestFixtures.cpp shared-library-tests.cpp # iterationTests.cpp QueryTests.cpp badInputTests.cpp) -set(cpp_shared_library_test_sources cpptestFixtures.cpp - cppshared-library-tests.cpp +set(cpp_shared_library_test_sources cpptestFixtures.cpp cppshared-library-tests.cpp # test-value-federate1_cpp.cpp test-value-federate2_cpp.cpp # FilterTests_cpp.cpp @@ -28,8 +27,7 @@ set(cpp_shared_library_test_sources cpptestFixtures.cpp # QueryTests.cpp ) -add_executable(shared-library-tests ${c_shared_library_test_sources} - ctestFixtures.hpp) +add_executable(shared-library-tests ${c_shared_library_test_sources} ctestFixtures.hpp) add_executable(shared-library-tests-cpp ${cpp_shared_library_test_sources} cpptestFixtures.hpp) @@ -48,9 +46,8 @@ set_target_properties(shared-library-tests shared-library-tests-cpp target_compile_definitions(shared-library-tests PRIVATE "-DHELICS_BROKER_LOCATION=\"${HELICS_BROKER_LOC}\"") -target_compile_definitions( - shared-library-tests PRIVATE - "-DHELICS_INSTALL_LOCATION=\"${CMAKE_INSTALL_PREFIX}\"") +target_compile_definitions(shared-library-tests PRIVATE + "-DHELICS_INSTALL_LOCATION=\"${CMAKE_INSTALL_PREFIX}\"") target_compile_definitions(shared-library-tests PRIVATE "-DTEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"") @@ -60,24 +57,20 @@ add_test(NAME shared-library-tests target_compile_definitions(shared-library-tests-cpp PRIVATE "-DHELICS_BROKER_LOCATION=\"${HELICS_BROKER_LOC}\"") -target_compile_definitions( - shared-library-tests-cpp PRIVATE - "-DHELICS_INSTALL_LOCATION=\"${CMAKE_INSTALL_PREFIX}\"") +target_compile_definitions(shared-library-tests-cpp PRIVATE + "-DHELICS_INSTALL_LOCATION=\"${CMAKE_INSTALL_PREFIX}\"") target_compile_definitions(shared-library-tests-cpp PRIVATE "-DTEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"") add_test(NAME shared-library-tests-cpp - COMMAND shared-library-tests-cpp - --log_level=message - --report_level=short) + COMMAND shared-library-tests-cpp --log_level=message --report_level=short) set_property(TEST shared-library-tests PROPERTY LABELS SharedLibrary Daily) -# Setting a different label, because the test fixture for the C++ shared library -# tests doesn't work push_back for vector causes a segfault for unknown reasons -# (Boost UTF related?) -set_property(TEST shared-library-tests-cpp - PROPERTY LABELS SharedLibraryCpp Daily) +# Setting a different label, because the test fixture for the C++ shared library tests +# doesn't work push_back for vector causes a segfault for unknown reasons (Boost UTF +# related?) +set_property(TEST shared-library-tests-cpp PROPERTY LABELS SharedLibraryCpp Daily) # Tests used for Continuous Integration builds add_test(NAME shared-library-ci-tests @@ -116,8 +109,7 @@ if(WIN32) -E copy_if_different # which executes "cmake - E # copy_if_different..." - "$" # <--this is in- - # file + "$" # <--this is in- file "$/") # <--this is out-file path endif(WIN32) diff --git a/tests/helics/system_tests/CMakeLists.txt b/tests/helics/system_tests/CMakeLists.txt index 225b0d6082..cfa6fd250f 100644 --- a/tests/helics/system_tests/CMakeLists.txt +++ b/tests/helics/system_tests/CMakeLists.txt @@ -1,7 +1,7 @@ # -# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore -# National Security, LLC; Alliance for Sustainable Energy, LLC All rights -# reserved. See LICENSE file and DISCLAIMER for more details. +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. # set(system_test_sources @@ -23,8 +23,8 @@ set_target_properties(system-tests PROPERTIES FOLDER tests) target_compile_definitions(system-tests PRIVATE "-DHELICS_BROKER_LOCATION=\"${HELICS_BROKER_LOC}\"") -target_compile_definitions( - system-tests PRIVATE "-DHELICS_INSTALL_LOCATION=\"${CMAKE_INSTALL_PREFIX}\"") +target_compile_definitions(system-tests PRIVATE + "-DHELICS_INSTALL_LOCATION=\"${CMAKE_INSTALL_PREFIX}\"") target_compile_definitions(system-tests PRIVATE "-DTEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"") @@ -49,6 +49,6 @@ foreach(keyfile IN LISTS KEY_LIBRARY_FILES) copy_if_different # which executes "cmake - E # copy_if_different..." "${keyfile}" # <--this is in-file - "$/") # <--this is - # out-file path + "$/") # <--this is out-file + # path endforeach(keyfile) diff --git a/tests/java_helics/CMakeLists.txt b/tests/java_helics/CMakeLists.txt index c27b3b0e12..eb8574c4ef 100644 --- a/tests/java_helics/CMakeLists.txt +++ b/tests/java_helics/CMakeLists.txt @@ -2,8 +2,7 @@ find_package(Java REQUIRED) find_package(JNI REQUIRED) include(UseJava) -set(helicsJar - ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar) +set(helicsJar ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar) add_custom_target( Java_hello_world @@ -14,8 +13,7 @@ add_custom_target( -d ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/HelloWorld.java - DEPENDS JNIhelics - ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar + DEPENDS JNIhelics ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar COMMENT "Building HelloWorld.java" VERBATIM) @@ -28,8 +26,7 @@ add_custom_target( -d ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/JavaHelicsApiTests.java - DEPENDS JNIhelics - ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar + DEPENDS JNIhelics ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar COMMENT "Building JavaHelicsApiTests.java" VERBATIM) @@ -42,8 +39,7 @@ add_custom_target( -d ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/TestMessageFederate.java - DEPENDS JNIhelics - ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar + DEPENDS JNIhelics ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar COMMENT "Building MessageFederate.java" VERBATIM) @@ -56,8 +52,7 @@ add_custom_target( -d ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/TestMessageFilter.java - DEPENDS JNIhelics - ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar + DEPENDS JNIhelics ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar COMMENT "Building MessageFilter.java" VERBATIM) @@ -70,8 +65,7 @@ add_custom_target( -d ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/TestValueFederate.java - DEPENDS JNIhelics - ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar + DEPENDS JNIhelics ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar COMMENT "Building ValueFederate.java" VERBATIM) @@ -136,8 +130,8 @@ if(WIN32) copy_if_different # which executes "cmake - E # copy_if_different..." "${keyfile}" # <--this is in-file - "${CMAKE_CURRENT_BINARY_DIR}/") # <--this is out- - # file path + "${CMAKE_CURRENT_BINARY_DIR}/") # <--this is out- file + # path endforeach(keyfile) add_custom_command(TARGET @@ -147,9 +141,7 @@ if(WIN32) -E copy_if_different # which executes "cmake - E # copy_if_different..." - "$" # <--this is in- - # file - "${CMAKE_CURRENT_BINARY_DIR}/") # <--this is out- - # file path + "$" # <--this is in- file + "${CMAKE_CURRENT_BINARY_DIR}/") # <--this is out- file path endif(WIN32) diff --git a/tests/matlab_helics/CMakeLists.txt b/tests/matlab_helics/CMakeLists.txt index 3227cd9946..385e6f55cc 100644 --- a/tests/matlab_helics/CMakeLists.txt +++ b/tests/matlab_helics/CMakeLists.txt @@ -1,18 +1,24 @@ -############################################################################## -#Copyright © 2017-2018, -#Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC -#All rights reserved. See LICENSE file and DISCLAIMER for more details. -############################################################################## +# +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. +# - -if (WIN32) - configure_file(runTestsWIN32.m.in runTests.m) - add_test(NAME matlab_tests COMMAND ${Matlab_MAIN_PROGRAM} -nojvm -nosplash -minimize -r "\"run('${CMAKE_CURRENT_BINARY_DIR}/runTests.m');quit;\"" ) +if(WIN32) + configure_file(runTestsWIN32.m.in runTests.m) + add_test(NAME matlab_tests + COMMAND ${Matlab_MAIN_PROGRAM} -nojvm -nosplash -minimize -r + "\"run('${CMAKE_CURRENT_BINARY_DIR}/runTests.m');quit;\"") else() - configure_file(runTestsUNIX.m.in runTests.m) - add_test(NAME matlab_tests COMMAND ${Matlab_MAIN_PROGRAM} -nojvm -nodisplay -nosplash -r "\"run('${CMAKE_CURRENT_BINARY_DIR}/runTests.m');quit;\"") + configure_file(runTestsUNIX.m.in runTests.m) + add_test(NAME matlab_tests + COMMAND ${Matlab_MAIN_PROGRAM} -nojvm -nodisplay -nosplash -r + "\"run('${CMAKE_CURRENT_BINARY_DIR}/runTests.m');quit;\"") endif() -set_property(TEST matlab_tests PROPERTY LABELS Matlab Continuous Daily) - +set_property(TEST matlab_tests + PROPERTY LABELS + Matlab + Continuous + Daily) From bbfb9f969d643a7526e962f7a8a40b500e2f081e Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Wed, 1 Aug 2018 14:13:50 -0600 Subject: [PATCH 03/16] Make cmake-format dangle parens --- CMakeLists.txt | 472 +++++++++++-------- ThirdParty/fmt/CMakeLists.txt | 142 +++--- docs/CMakeLists.txt | 30 +- examples/CppInterface/CMakeLists.txt | 50 +- examples/comboFederates1/CMakeLists.txt | 40 +- src/helics/CMakeLists.txt | 80 ++-- src/helics/application_api/CMakeLists.txt | 116 +++-- src/helics/apps/CMakeLists.txt | 140 +++--- src/helics/common/CMakeLists.txt | 158 ++++--- src/helics/core/CMakeLists.txt | 265 ++++++----- src/helics/cpp98/CMakeLists.txt | 36 +- src/helics/shared_api_library/CMakeLists.txt | 128 +++-- swig/CMakeLists.txt | 25 +- swig/java/CMakeLists.txt | 113 +++-- swig/matlab/CMakeLists.txt | 174 ++++--- swig/octave/CMakeLists.txt | 82 ++-- swig/python/CMakeLists.txt | 82 ++-- swig/python2/CMakeLists.txt | 26 +- tests/CMakeLists.txt | 2 +- tests/helics/application_api/CMakeLists.txt | 95 ++-- tests/helics/apps/CMakeLists.txt | 65 +-- tests/helics/common/CMakeLists.txt | 64 +-- tests/helics/core/CMakeLists.txt | 68 +-- tests/helics/shared_library/CMakeLists.txt | 203 ++++---- tests/helics/system_tests/CMakeLists.txt | 79 ++-- tests/java_helics/CMakeLists.txt | 162 ++++--- tests/matlab_helics/CMakeLists.txt | 31 +- tests/python_helics/CMakeLists.txt | 60 ++- 28 files changed, 1741 insertions(+), 1247 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5503322477..4d293599c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,8 +15,10 @@ project(HELICS VERSION 1.3.0) set(HELICS_VERSION_BUILD) set(HELICS_DATE "07-31-18") -set(HELICS_VERSION_UNDERSCORE - "${HELICS_VERSION_MAJOR}_${HELICS_VERSION_MINOR}_${HELICS_VERSION_PATCH}") +set( + HELICS_VERSION_UNDERSCORE + "${HELICS_VERSION_MAJOR}_${HELICS_VERSION_MINOR}_${HELICS_VERSION_PATCH}" +) if(HELICS_VERSION_BUILD) set(HELICS_VERSION "${HELICS_VERSION}-${HELICS_VERSION_BUILD}") set(HELICS_VERSION_UNDERSCORE "${HELICS_VERSION_UNDERSCORE}-${HELICS_VERSION_BUILD}") @@ -36,21 +38,27 @@ include(CMakeDependentOption) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) if(WIN32) if(MSYS) - set(CMAKE_INSTALL_PREFIX "/usr/local/helics_${HELICS_VERSION_UNDERSCORE}/" - CACHE PATH "default install path" - FORCE) + set( + CMAKE_INSTALL_PREFIX "/usr/local/helics_${HELICS_VERSION_UNDERSCORE}/" + CACHE PATH "default install path" + FORCE + ) else(MSYS) - set(CMAKE_INSTALL_PREFIX "C:/local/helics_${HELICS_VERSION_UNDERSCORE}/" - CACHE PATH "default install path" - FORCE) + set( + CMAKE_INSTALL_PREFIX "C:/local/helics_${HELICS_VERSION_UNDERSCORE}/" + CACHE PATH "default install path" + FORCE + ) endif(MSYS) endif(WIN32) endif() -show_variable(AUTOBUILD_INSTALL_PATH - PATH - "location to install the autobuild libraries and Headers" - "${PROJECT_BINARY_DIR}/libs") +show_variable( + AUTOBUILD_INSTALL_PATH + PATH + "location to install the autobuild libraries and Headers" + "${PROJECT_BINARY_DIR}/libs" +) mark_as_advanced(AUTOBUILD_INSTALL_PATH) @@ -70,30 +78,36 @@ option(BUILD_PYTHON_INTERFACE "Build Python extension" OFF) option( BUILD_PYTHON2_INTERFACE "Build Python2.7 extension(Requires swig and will not build if \"PYTHON_INTERFACE\" is active)" - OFF) + OFF +) option(BUILD_MATLAB_INTERFACE "Build Matlab Extension" OFF) option(BUILD_OCTAVE_INTERFACE "Build Octave extension (very experimental)" OFF) option(BUILD_JAVA_INTERFACE "Build Java extension" OFF) -if(BUILD_PYTHON_INTERFACE - OR BUILD_PYTHON2_INTERFACE - OR BUILD_MATLAB_INTERFACE - OR BUILD_JAVA_INTERFACE - OR BUILD_OCTAVE_INTERFACE) +if( + BUILD_PYTHON_INTERFACE + OR BUILD_PYTHON2_INTERFACE + OR BUILD_MATLAB_INTERFACE + OR BUILD_JAVA_INTERFACE + OR BUILD_OCTAVE_INTERFACE +) set(INTERFACE_BUILD ON) else() set(INTERFACE_BUILD OFF) endif() -cmake_dependent_option(BUILD_C_SHARED_LIB - "Build the Shared Libraries with a C interface" - ON - "NOT INTERFACE_BUILD" - ON) +cmake_dependent_option( + BUILD_C_SHARED_LIB + "Build the Shared Libraries with a C interface" + ON + "NOT INTERFACE_BUILD" + ON +) option( DISABLE_SWIG "disable the use of the swig executable to generate interface code and use repository code instead" - OFF) + OFF +) option(BUILD_CXX_SHARED_LIB "Build a Shared Libraries of the CXX interface" OFF) if(INTERFACE_BUILD OR BUILD_C_SHARED_LIB OR BUILD_CXX_SHARED_LIB) @@ -105,7 +119,8 @@ cmake_dependent_option( "Build the libraries with Position independent code Useful if only building the static library and it will be used later in a shared library" OFF "NOT BUILD_SHARED_LIBS" - ON) + ON +) if(BUILD_SHARED_LIBS OR USE_POSITION_INDEPENDENT_CODE) set(CMAKE_POSITION_INDEPENDENT_CODE ON) @@ -129,7 +144,7 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") message( FATAL_ERROR "In-source build is not supported. Please, use an empty directory for building the project." - ) + ) endif() include(compiler_flags) @@ -138,16 +153,20 @@ if(VERSION_OPTION) if(MSVC) target_compile_options(helics_base_includes INTERFACE ${VERSION_OPTION}) else() - target_compile_options(helics_base_includes - INTERFACE $<$:${VERSION_OPTION}>) + target_compile_options( + helics_base_includes + INTERFACE $<$:${VERSION_OPTION}> + ) endif(MSVC) endif(VERSION_OPTION) -cmake_dependent_option(STATIC_STANDARD_LIB - "Link against a static standard lib" - OFF - "NOT USE_LIBCXX" - OFF) +cmake_dependent_option( + STATIC_STANDARD_LIB + "Link against a static standard lib" + OFF + "NOT USE_LIBCXX" + OFF +) include(ucm) mark_as_advanced(STATIC_STANDARD_LIB) if(STATIC_STANDARD_LIB) @@ -169,31 +188,36 @@ endif(MSVC) # add coverage target # ------------------------------------------------------------- if(BUILD_HELICS_TESTS) - cmake_dependent_option(TEST_CODE_COVERAGE - "Build a target for testing code coverage" - OFF - "BUILD_HELICS_TESTS" - OFF) + cmake_dependent_option( + TEST_CODE_COVERAGE + "Build a target for testing code coverage" + OFF + "BUILD_HELICS_TESTS" + OFF + ) if(TEST_CODE_COVERAGE) if(CMAKE_BUILD_TYPE STREQUAL "Coverage") include(CodeCoverage) - set(COVERAGE_EXCLUDES - 'usr/*' - 'dependencies/*' - 'ThirdParty/*' - 'tests/*' - 'swig/*' - 'examples/*') - setup_target_for_coverage(NAME - helics_coverage # New target name - EXECUTABLE - CTest # Executable in PROJECT_BINARY_DIR - ) + set( + COVERAGE_EXCLUDES + 'usr/*' + 'dependencies/*' + 'ThirdParty/*' + 'tests/*' + 'swig/*' + 'examples/*' + ) + setup_target_for_coverage( + NAME + helics_coverage # New target name + EXECUTABLE + CTest # Executable in PROJECT_BINARY_DIR + ) else() message( FATAL_ERROR "CMAKE_BUILD_TYPE must be set to Coverage for testing code coverage" - ) + ) endif() endif(TEST_CODE_COVERAGE) endif(BUILD_HELICS_TESTS) @@ -212,30 +236,38 @@ if(GENERATE_DOXYGEN_DOC) find_package(Doxygen) if(DOXYGEN_FOUND) - show_variable(DOXYGEN_OUTPUT_DIR - PATH - "location to put Doxygen docs" - "${PROJECT_BINARY_DIR}/docs") - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config/Doxyfile.in - ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) - add_custom_target(doc ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile - WORKING_DIRECTORY ${DOXYGET_OUTPUT_DIR} - COMMENT "Generating API documentation with Doxygen" - VERBATIM) + show_variable( + DOXYGEN_OUTPUT_DIR + PATH + "location to put Doxygen docs" + "${PROJECT_BINARY_DIR}/docs" + ) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/config/Doxyfile.in + ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY + ) + add_custom_target( + doc ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile + WORKING_DIRECTORY ${DOXYGET_OUTPUT_DIR} + COMMENT "Generating API documentation with Doxygen" + VERBATIM + ) endif(DOXYGEN_FOUND) endif(GENERATE_DOXYGEN_DOC) # ------------------------------------------------------------- # BOOST find the boost libraries # ------------------------------------------------------------- -set(BOOST_REQUIRED_LIBRARIES - program_options - unit_test_framework - filesystem - system - date_time - timer - chrono) +set( + BOOST_REQUIRED_LIBRARIES + program_options + unit_test_framework + filesystem + system + date_time + timer + chrono +) include(addBoost) target_link_libraries(helics_base INTERFACE Boostlibs::core) @@ -304,7 +336,7 @@ if(BUILD_DEBUG_ONLY AND BUILD_RELEASE_ONLY) message( fatal "BOTH BUILD_DEBUG_ONLY AND BUILD_RELEASE_ONLY cannot be specified together otherwise nothing works" - ) + ) endif() option(ZeroMQ_ENABLE "Enable ZeroMQ networking library" ON) @@ -339,13 +371,18 @@ endif(ZeroMQ_ENABLE) # ------------------------------------------------------------- target_include_directories( helics_base_includes - INTERFACE $ - $ - $) + INTERFACE + $ + $ + $ +) -target_include_directories(helics_base_includes SYSTEM - INTERFACE $ - $) +target_include_directories( + helics_base_includes SYSTEM + INTERFACE + $ + $ +) include(GNUInstallDirs) @@ -362,22 +399,31 @@ set(CMAKE_MACOSX_RPATH ON) set( CMAKE_BUILD_RPATH "./;${AUTOBUILD_INSTALL_PATH}/bin;${AUTOBUILD_INSTALL_PATH}/lib;${AUTOBUILD_INSTALL_PATH}/lib64" - ) +) # add the automatically determined parts of the RPATH which point to directories outside # the build tree to the install RPATH set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) # the RPATH to be used when installing, but only if it's not a system directory -list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES - "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}" isSystemDir) +list( + FIND + CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}" isSystemDir +) if("${isSystemDir}" STREQUAL "-1") - list(APPEND CMAKE_INSTALL_RPATH CMAKE_INSTALL_RPATH - "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") + list( + APPEND + CMAKE_INSTALL_RPATH CMAKE_INSTALL_RPATH + "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}" + ) endif() -list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES - "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" isSystemDir) +list( + FIND + CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" isSystemDir +) if("${isSystemDir}" STREQUAL "-1") list(APPEND CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") endif() @@ -412,23 +458,28 @@ endif() option( BUILD_APPS "Build helics applications to run various apps, including broker, player, recorder, and helics_apps" - ON) + ON +) file(GLOB KEY_LIBRARY_FILES ${AUTOBUILD_INSTALL_PATH}/bin/*) # message(STATUS "key files ${KEY_LIBRARY_FILES}") option(DISABLE_LOGGING "disable all normal, debug, and trace logging in HELICS" OFF) -cmake_dependent_option(DISABLE_TRACE_LOGGING - "disable trace logging" - OFF - "NOT DISABLE_LOGGING" - OFF) -cmake_dependent_option(DISABLE_DEBUG_LOGGING - "disable debug logging" - OFF - "NOT DISABLE_LOGGING" - OFF) +cmake_dependent_option( + DISABLE_TRACE_LOGGING + "disable trace logging" + OFF + "NOT DISABLE_LOGGING" + OFF +) +cmake_dependent_option( + DISABLE_DEBUG_LOGGING + "disable debug logging" + OFF + "NOT DISABLE_LOGGING" + OFF +) mark_as_advanced(DISABLE_TRACE_LOGGING) mark_as_advanced(DISABLE_DEBUG_LOGGING) @@ -468,23 +519,31 @@ if(BUILD_HELICS_EXAMPLES) add_subdirectory(examples) endif(BUILD_HELICS_EXAMPLES) -install(FILES ${KEY_LIBRARY_FILES} - DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT - runtime) - -install(DIRECTORY ${AUTOBUILD_INSTALL_PATH}/lib/ - DESTINATION ${CMAKE_INSTALL_LIBDIR}/ - OPTIONAL) -install(DIRECTORY ${AUTOBUILD_INSTALL_PATH}/lib64/ - DESTINATION ${CMAKE_INSTALL_LIBDIR}/ - OPTIONAL) +install( + FILES ${KEY_LIBRARY_FILES} + DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT + runtime +) + +install( + DIRECTORY ${AUTOBUILD_INSTALL_PATH}/lib/ + DESTINATION ${CMAKE_INSTALL_LIBDIR}/ + OPTIONAL +) +install( + DIRECTORY ${AUTOBUILD_INSTALL_PATH}/lib64/ + DESTINATION ${CMAKE_INSTALL_LIBDIR}/ + OPTIONAL +) if(HELICS_HAVE_ZEROMQ) if(WIN32 AND NOT MSYS) - install(FILES $ - DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT libs) + install( + FILES $ + DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT libs + ) endif() endif() @@ -492,8 +551,10 @@ endif() # Enable clang analysis and formatting tools # ------------------------------------------------------------- -option(ENABLE_CLANG_TOOLS - "if clang is found enable some custom targets for clang formatting and tidy" OFF) +option( + ENABLE_CLANG_TOOLS + "if clang is found enable some custom targets for clang formatting and tidy" OFF +) mark_as_advanced(ENABLE_CLANG_TOOLS) if(ENABLE_CLANG_TOOLS) include(clang-cxx-dev-tools) @@ -508,94 +569,123 @@ add_subdirectory(docs) install(TARGETS helics_base EXPORT helics-targets) install(TARGETS helics_base_includes EXPORT helics-targets) -set(helics_static_file - "${CMAKE_STATIC_LIBRARY_PREFIX}helics-static${CMAKE_STATIC_LIBRARY_SUFFIX}") +set( + helics_static_file + "${CMAKE_STATIC_LIBRARY_PREFIX}helics-static${CMAKE_STATIC_LIBRARY_SUFFIX}" +) set( helics_static_file_debug "${CMAKE_STATIC_LIBRARY_PREFIX}helics-static${CMAKE_DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) +) if(BUILD_CXX_SHARED_LIB) - set(helics_cxx_shared_file - "${CMAKE_SHARED_LIBRARY_PREFIX}helics-shared${CMAKE_SHARED_LIBRARY_SUFFIX}") + set( + helics_cxx_shared_file + "${CMAKE_SHARED_LIBRARY_PREFIX}helics-shared${CMAKE_SHARED_LIBRARY_SUFFIX}" + ) set( helics_cxx_shared_file_debug "${CMAKE_SHARED_LIBRARY_PREFIX}helics-shared${CMAKE_DEBUG_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}" - ) + ) else(BUILD_CXX_SHARED_LIB) set(helics_cxx_shared_file) set(helics_cxx_shared_file_debug) endif(BUILD_CXX_SHARED_LIB) if(BUILD_C_SHARED_LIB OR INTERFACE_BUILD) - set(helics_c_shared_file - "${CMAKE_SHARED_LIBRARY_PREFIX}helicsSharedLib${CMAKE_SHARED_LIBRARY_SUFFIX}") + set( + helics_c_shared_file + "${CMAKE_SHARED_LIBRARY_PREFIX}helicsSharedLib${CMAKE_SHARED_LIBRARY_SUFFIX}" + ) set( helics_c_shared_file_debug "${CMAKE_SHARED_LIBRARY_PREFIX}helicsSharedLib${CMAKE_DEBUG_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}" - ) + ) else() set(helics_c_shared_file) set(helics_c_shared_file_debug) endif() -set(HELICS_CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" - CACHE STRING "install path for HELICSConfig.cmake") +set( + HELICS_CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" + CACHE STRING "install path for HELICSConfig.cmake" +) mark_as_advanced(HELICS_CMAKECONFIG_INSTALL_DIR) -install(EXPORT helics-targets - NAMESPACE HELICS:: - DESTINATION ${HELICS_CMAKECONFIG_INSTALL_DIR} - COMPONENT libs) +install( + EXPORT helics-targets + NAMESPACE HELICS:: + DESTINATION ${HELICS_CMAKECONFIG_INSTALL_DIR} + COMPONENT libs +) # ----------------------------------------------------------------------------- # Setup configure.h file for accessing configure options # ----------------------------------------------------------------------------- -configure_file("config/helics-config.h.in" - "${AUTOBUILD_INSTALL_PATH}/include/helics/helics-config.h") -install(FILES ${AUTOBUILD_INSTALL_PATH}/include/helics/helics-config.h - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics - COMPONENT headers) -install(FILES ${AUTOBUILD_INSTALL_PATH}/include/helics/compiler-config.h - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics - COMPONENT headers) -install(DIRECTORY ThirdParty/cereal - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - COMPONENT headers) - -install(DIRECTORY ThirdParty/helics_includes - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - COMPONENT headers) +configure_file( + "config/helics-config.h.in" "${AUTOBUILD_INSTALL_PATH}/include/helics/helics-config.h" +) +install( + FILES ${AUTOBUILD_INSTALL_PATH}/include/helics/helics-config.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics + COMPONENT headers +) +install( + FILES ${AUTOBUILD_INSTALL_PATH}/include/helics/compiler-config.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics + COMPONENT headers +) +install( + DIRECTORY ThirdParty/cereal + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + COMPONENT headers +) + +install( + DIRECTORY ThirdParty/helics_includes + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + COMPONENT headers +) include(CMakePackageConfigHelpers) -configure_package_config_file(config/${PROJECT_NAME}Config.cmake.in - "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" - INSTALL_DESTINATION - ${HELICS_CMAKECONFIG_INSTALL_DIR}) +configure_package_config_file( + config/${PROJECT_NAME}Config.cmake.in + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + INSTALL_DESTINATION + ${HELICS_CMAKECONFIG_INSTALL_DIR} +) write_basic_package_version_file( ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake VERSION ${HELICS_VERSION} COMPATIBILITY - SameMajorVersion) - -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake - ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake - DESTINATION ${HELICS_CMAKECONFIG_INSTALL_DIR} - COMPONENT libs) + SameMajorVersion +) + +install( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake + DESTINATION ${HELICS_CMAKECONFIG_INSTALL_DIR} + COMPONENT libs +) # install required additional cmake files -install(FILES config/cmake/addMPI.cmake - config/cmake/FindZeroMQ.cmake - config/cmake/addBoost.cmake - config/cmake/extraMacros.cmake - DESTINATION ${HELICS_CMAKECONFIG_INSTALL_DIR} - COMPONENT libs) +install( + FILES + config/cmake/addMPI.cmake + config/cmake/FindZeroMQ.cmake + config/cmake/addBoost.cmake + config/cmake/extraMacros.cmake + DESTINATION ${HELICS_CMAKECONFIG_INSTALL_DIR} + COMPONENT libs +) # ------------------------------------------------------------- # CPack # ------------------------------------------------------------- -option(ENABLE_PACKAGE_BUILD "Add projects for making packages and installers for HELICS" - OFF) +option( + ENABLE_PACKAGE_BUILD "Add projects for making packages and installers for HELICS" OFF +) if(ENABLE_PACKAGE_BUILD) set(CPACK_PACKAGE_NAME "Helics") @@ -624,29 +714,37 @@ if(ENABLE_PACKAGE_BUILD) set(CPACK_COMPONENT_OCTAVE_GROUP interfaces) set(CPACK_COMPONENT_PYTHON_GROUP interfaces) - set(CPACK_COMPONENT_APPLICATION_DESCRIPTION - "Executables and helper applications for HELICS") set( - CPACK_COMPONENT_LIBS_DESCRIPTION "Libraries for compiling and linking with HELICS") - set(CPACK_COMPONENT_HEADERS_DESCRIPTION - "Headers for linking and compiling with HELICS") + CPACK_COMPONENT_APPLICATION_DESCRIPTION + "Executables and helper applications for HELICS" + ) + set( + CPACK_COMPONENT_LIBS_DESCRIPTION "Libraries for compiling and linking with HELICS" + ) + set( + CPACK_COMPONENT_HEADERS_DESCRIPTION "Headers for linking and compiling with HELICS" + ) set(CPACK_COMPONENT_RUNTIME_DESCRIPTION "Runtime libraries for HELICS") - set(CPACK_COMPONENT_GROUP_INTERFACES_DESCRIPTION - "additional language interfaces for HELICS") + set( + CPACK_COMPONENT_GROUP_INTERFACES_DESCRIPTION + "additional language interfaces for HELICS" + ) set(CPACK_COMPONENT_LIBS_DEPENDS headers) set(CPACK_COMPONENT_RUNTIME_REQUIRED ON) - set(CPACK_PACKAGE_EXECUTABLES - "helics_broker" - "Helics Broker" - "helics_app" - "Helics app executable" - "helics_recorder" - "Helics recorder" - "helics_player" - "Helics Player") + set( + CPACK_PACKAGE_EXECUTABLES + "helics_broker" + "Helics Broker" + "helics_app" + "Helics app executable" + "helics_recorder" + "Helics recorder" + "helics_player" + "Helics Player" + ) if(WIN32) set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}\\\\docs\\\\img\\\\HELICS.ico") set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/docs/img/HELICS.ico") @@ -657,23 +755,27 @@ if(ENABLE_PACKAGE_BUILD) set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) set(CPACK_NSIS_MODIFY_PATH ON) set(CPACK_NSIS_EXECUTABLES_DIRECTORY ${CMAKE_INSTALL_BINDIR}) - set(CPACK_NSIS_MENU_LINKS - "https://www.github.com/GMLC-TDC/Helics-src" - "HELICS Github" - "https://gmlc-tdc.github.io/HELICS-src/" - "Helics Documentation" - "https://www.helics.org" - "Helics Web page" - "https://www.youtube.com/channel/UCPa81c4BVXEYXt2EShTzbcg" - "TDC YouTube channel") + set( + CPACK_NSIS_MENU_LINKS + "https://www.github.com/GMLC-TDC/Helics-src" + "HELICS Github" + "https://gmlc-tdc.github.io/HELICS-src/" + "Helics Documentation" + "https://www.helics.org" + "Helics Web page" + "https://www.youtube.com/channel/UCPa81c4BVXEYXt2EShTzbcg" + "TDC YouTube channel" + ) else(WIN32) set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/docs/img/HELICS.ico") endif(WIN32) if(APPLE) set(CPACK_BUNDLE_NAME "libhelics") - configure_file("${PROJECT_SOURCE_DIR}/config/Info.plist.in" - "${CMAKE_CURRENT_BINARY_DIR}/Info.plist" @ONLY) + configure_file( + "${PROJECT_SOURCE_DIR}/config/Info.plist.in" + "${CMAKE_CURRENT_BINARY_DIR}/Info.plist" @ONLY + ) set(CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_BINARY_DIR}/Info.plist") set(CPACK_BUNDLE_ICON "${PROJECT_SOURCE_DIR}/docs/img/HELICS.ico") endif(APPLE) diff --git a/ThirdParty/fmt/CMakeLists.txt b/ThirdParty/fmt/CMakeLists.txt index 8a4d14a1a7..ebf5c5fa00 100644 --- a/ThirdParty/fmt/CMakeLists.txt +++ b/ThirdParty/fmt/CMakeLists.txt @@ -23,8 +23,10 @@ endfunction() # Set the default CMAKE_BUILD_TYPE to Release. This should be done before the project # command since the latter can set CMAKE_BUILD_TYPE itself (it does so for nmake). if(NOT CMAKE_BUILD_TYPE) - join(doc "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or " - "CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.") + join( + doc "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or " + "CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." + ) set(CMAKE_BUILD_TYPE Release CACHE STRING ${doc}) endif() @@ -45,8 +47,10 @@ endif() math(EXPR CPACK_PACKAGE_VERSION_MAJOR ${CMAKE_MATCH_1}) math(EXPR CPACK_PACKAGE_VERSION_MINOR ${CMAKE_MATCH_2}) math(EXPR CPACK_PACKAGE_VERSION_PATCH ${CMAKE_MATCH_3}) -join(FMT_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}. - ${CPACK_PACKAGE_VERSION_PATCH}) +join( + FMT_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}. + ${CPACK_PACKAGE_VERSION_PATCH} +) if(NOT FMT_SILENT) message(STATUS "Version: ${FMT_VERSION}") @@ -83,7 +87,7 @@ if(MASTER_PROJECT AND CMAKE_GENERATOR MATCHES "Visual Studio") set( netfxpath "C:\\Program Files\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0" - ) + ) file(WRITE run-msbuild.bat " ${MSBUILD_SETUP} ${CMAKE_MAKE_PROGRAM} -p:FrameworkPathOverride=\"${netfxpath}\" %*") @@ -126,17 +130,21 @@ if(MSVC) target_compile_options(fmt PRIVATE /W4) endif() -target_include_directories(fmt - PUBLIC $ - $) - -set_target_properties(fmt - PROPERTIES VERSION - ${FMT_VERSION} - SOVERSION - ${CPACK_PACKAGE_VERSION_MAJOR} - DEBUG_POSTFIX - d) +target_include_directories( + fmt + PUBLIC $ $ +) + +set_target_properties( + fmt + PROPERTIES + VERSION + ${FMT_VERSION} + SOVERSION + ${CPACK_PACKAGE_VERSION_MAJOR} + DEBUG_POSTFIX + d +) if(BUILD_SHARED_LIBS) if(UNIX AND NOT APPLE) @@ -154,9 +162,11 @@ if(CMAKE_VERSION VERSION_GREATER 3.1.0 OR CMAKE_VERSION VERSION_EQUAL 3.1.0) target_compile_definitions(fmt-header-only INTERFACE FMT_HEADER_ONLY=1) - target_include_directories(fmt-header-only - INTERFACE $ - $) + target_include_directories( + fmt-header-only + INTERFACE + $ $ + ) endif() # Install targets. @@ -165,9 +175,10 @@ if(FMT_INSTALL) include(CMakePackageConfigHelpers) set( FMT_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/fmt - CACHE STRING - "Installation directory for cmake files, relative to ${CMAKE_INSTALL_PREFIX}." - ) + CACHE + STRING + "Installation directory for cmake files, relative to ${CMAKE_INSTALL_PREFIX}." + ) set(version_config ${PROJECT_BINARY_DIR}/fmt-config-version.cmake) set(project_config ${PROJECT_BINARY_DIR}/fmt-config.cmake) set(targets_export_name fmt-targets) @@ -179,39 +190,50 @@ if(FMT_INSTALL) set( FMT_LIB_DIR ${CMAKE_INSTALL_LIBDIR} - CACHE STRING - "Installation directory for libraries, relative to ${CMAKE_INSTALL_PREFIX}.") + CACHE + STRING + "Installation directory for libraries, relative to ${CMAKE_INSTALL_PREFIX}." + ) set( FMT_INC_DIR ${CMAKE_INSTALL_INCLUDEDIR}/fmt CACHE STRING - "Installation directory for include files, relative to ${CMAKE_INSTALL_PREFIX}.") + "Installation directory for include files, relative to ${CMAKE_INSTALL_PREFIX}." + ) # Generate the version, config and target files into the build directory. - write_basic_package_version_file(${version_config} - VERSION - ${FMT_VERSION} - COMPATIBILITY - AnyNewerVersion) - configure_package_config_file(${PROJECT_SOURCE_DIR}/support/cmake/fmt-config.cmake.in - ${project_config} - INSTALL_DESTINATION - ${FMT_CMAKE_DIR}) + write_basic_package_version_file( + ${version_config} + VERSION + ${FMT_VERSION} + COMPATIBILITY + AnyNewerVersion + ) + configure_package_config_file( + ${PROJECT_SOURCE_DIR}/support/cmake/fmt-config.cmake.in + ${project_config} + INSTALL_DESTINATION + ${FMT_CMAKE_DIR} + ) # Use a namespace because CMake provides better diagnostics for namespaced imported # targets. - export(TARGETS ${INSTALL_TARGETS} - NAMESPACE fmt:: - FILE ${PROJECT_BINARY_DIR}/${targets_export_name}.cmake) + export( + TARGETS ${INSTALL_TARGETS} + NAMESPACE fmt:: + FILE ${PROJECT_BINARY_DIR}/${targets_export_name}.cmake + ) # Install version, config and target files. install(FILES ${project_config} ${version_config} DESTINATION ${FMT_CMAKE_DIR}) install(EXPORT ${targets_export_name} DESTINATION ${FMT_CMAKE_DIR} NAMESPACE fmt::) # Install the library and headers. - install(TARGETS ${INSTALL_TARGETS} - EXPORT ${targets_export_name} - DESTINATION ${FMT_LIB_DIR}) + install( + TARGETS ${INSTALL_TARGETS} + EXPORT ${targets_export_name} + DESTINATION ${FMT_LIB_DIR} + ) install(FILES ${FMT_HEADERS} DESTINATION ${FMT_INC_DIR}) endif() @@ -230,24 +252,32 @@ if(MASTER_PROJECT AND EXISTS ${gitignore}) file(STRINGS ${gitignore} lines) list(REMOVE_ITEM lines /doc/html) foreach(line ${lines}) - string(REPLACE "." - "[.]" - line - "${line}") - string(REPLACE "*" - ".*" - line - "${line}") + string( + REPLACE + "." + "[.]" + line + "${line}" + ) + string( + REPLACE + "*" + ".*" + line + "${line}" + ) set(ignored_files ${ignored_files} "${line}$" "${line}/") endforeach() - set(ignored_files - ${ignored_files} - /.git - /breathe - /format-benchmark - sphinx/ - .buildinfo - .doctrees) + set( + ignored_files + ${ignored_files} + /.git + /breathe + /format-benchmark + sphinx/ + .buildinfo + .doctrees + ) set(CPACK_SOURCE_GENERATOR ZIP) set(CPACK_SOURCE_IGNORE_FILES ${ignored_files}) diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 2ca6729a9a..306f8fff93 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -1,19 +1,21 @@ if(MSVC) - set(doc_sources - apps/Echo.md - apps/Broker.md - apps/App.md - apps/Player.md - apps/index.md - apps/Source.md - configuration/CoreTypes.md - configuration/Federate.md - configuration/index.md - configuration/Timing.md - configuration/Filters.md - configuration/MessageFederate.md - configuration/ValueFederate.md) + set( + doc_sources + apps/Echo.md + apps/Broker.md + apps/App.md + apps/Player.md + apps/index.md + apps/Source.md + configuration/CoreTypes.md + configuration/Federate.md + configuration/index.md + configuration/Timing.md + configuration/Filters.md + configuration/MessageFederate.md + configuration/ValueFederate.md + ) add_custom_target(helics_docs SOURCES ${doc_sources}) diff --git a/examples/CppInterface/CMakeLists.txt b/examples/CppInterface/CMakeLists.txt index f16a89a6a8..1895595d1a 100644 --- a/examples/CppInterface/CMakeLists.txt +++ b/examples/CppInterface/CMakeLists.txt @@ -26,32 +26,38 @@ set_target_properties(nonlings_fed1_cpp PROPERTIES FOLDER examples) set_target_properties(nonlings_fed2_cpp PROPERTIES FOLDER examples) if(BUILD_HELICS_TESTS AND NOT MSVC) - add_test(NAME nonlings_example - COMMAND ${PROJECT_SOURCE_DIR}/scripts/test_example.sh 10 - $ $) + add_test( + NAME nonlings_example + COMMAND + ${PROJECT_SOURCE_DIR}/scripts/test_example.sh 10 $ + $ + ) set_property(TEST nonlings_example PROPERTY LABELS Continuous) endif() foreach(keyfile IN LISTS KEY_LIBRARY_FILES) - add_custom_command(TARGET - nonlings_fed1_cpp - POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} - -E - copy_if_different # which executes "cmake - E - # copy_if_different..." - "${keyfile}" # <--this is in-file - "$/") + add_custom_command( + TARGET + nonlings_fed1_cpp + POST_BUILD # Adds a post-build event to api tests + COMMAND + ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E copy_if_different..." + "${keyfile}" # <--this is in-file + "$/" + ) # <--this is out-file path endforeach(keyfile) -add_custom_command(TARGET - nonlings_fed1_cpp - POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} - -E - copy_if_different # which executes "cmake - E - # copy_if_different..." - "$" # <--this is in-file - "$/") # <--this is out- - # file path +add_custom_command( + TARGET + nonlings_fed1_cpp + POST_BUILD # Adds a post-build event to api tests + COMMAND + ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E copy_if_different..." + "$" # <--this is in-file + "$/" +) # <--this is out- file path diff --git a/examples/comboFederates1/CMakeLists.txt b/examples/comboFederates1/CMakeLists.txt index a0ce5ce2ab..04b6232186 100644 --- a/examples/comboFederates1/CMakeLists.txt +++ b/examples/comboFederates1/CMakeLists.txt @@ -13,24 +13,28 @@ set_target_properties(comboFed PROPERTIES FOLDER examples) # configure_file(${CMAKE_CURRENT_SOURCE_DIR}/run.sh ${CMAKE_CURRENT_BINARY_DIR}/run.sh # COPYONLY) -add_custom_command(TARGET - comboFed - POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} - -E - copy_if_different # which executes "cmake - E - # copy_if_different..." - "${CMAKE_CURRENT_SOURCE_DIR}/run.sh" # <--this is in- file - "$/") # <--this is out-file path +add_custom_command( + TARGET + comboFed + POST_BUILD # Adds a post-build event to api tests + COMMAND + ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E copy_if_different..." + "${CMAKE_CURRENT_SOURCE_DIR}/run.sh" # <--this is in- file + "$/" +) # <--this is out-file path foreach(keyfile IN LISTS KEY_LIBRARY_FILES) - add_custom_command(TARGET - comboFed - POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} - -E - copy_if_different # which executes "cmake - E - # copy_if_different..." - "${keyfile}" # <--this is in-file - "$/") # <--this is out- file path + add_custom_command( + TARGET + comboFed + POST_BUILD # Adds a post-build event to api tests + COMMAND + ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E copy_if_different..." + "${keyfile}" # <--this is in-file + "$/" + ) # <--this is out- file path endforeach(keyfile) diff --git a/src/helics/CMakeLists.txt b/src/helics/CMakeLists.txt index 65ceaf2753..1f346a2a7f 100644 --- a/src/helics/CMakeLists.txt +++ b/src/helics/CMakeLists.txt @@ -12,22 +12,26 @@ add_subdirectory(application_api) # Add the main HELICS library # ------------------------------------------------------------- -add_library(helics-static - STATIC - $ - $ - $) +add_library( + helics-static + STATIC + $ + $ + $ +) target_link_libraries(helics-static PUBLIC helics_base) # add and alias library to match the find_package add_library(HELICS::helics-static ALIAS helics-static) if(BUILD_CXX_SHARED_LIB) - add_library(helics-shared - SHARED - ../empty.cpp - $ - $ - $) + add_library( + helics-shared + SHARED + ../empty.cpp + $ + $ + $ + ) add_library(HELICS::helics-shared ALIAS helics-shared) target_link_libraries(helics-shared PRIVATE helics_base) @@ -39,28 +43,38 @@ if(BUILD_CXX_SHARED_LIB) endif() -install(FILES flag-definitions.h helics.hpp - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics - COMPONENT headers) +install( + FILES flag-definitions.h helics.hpp + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics + COMPONENT headers +) -install(TARGETS helics-static - EXPORT helics-targets - DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT libs) +install( + TARGETS helics-static + EXPORT helics-targets + DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT libs +) if(BUILD_CXX_SHARED_LIB) - install(TARGETS helics-shared - EXPORT helics-targets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install( + TARGETS helics-shared + EXPORT helics-targets + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) - install(FILES $ - DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT libs) - install(FILES $ - DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT libs) + install( + FILES $ + DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT libs + ) + install( + FILES $ + DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT libs + ) endif(BUILD_CXX_SHARED_LIB) @@ -69,7 +83,9 @@ add_subdirectory(apps) if(BUILD_C_SHARED_LIB OR INTERFACE_BUILD) add_subdirectory(shared_api_library) add_subdirectory(cpp98) - install(FILES chelics.h - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics - COMPONENT headers) + install( + FILES chelics.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics + COMPONENT headers + ) endif() diff --git a/src/helics/application_api/CMakeLists.txt b/src/helics/application_api/CMakeLists.txt index 97de3a40de..a502562af0 100644 --- a/src/helics/application_api/CMakeLists.txt +++ b/src/helics/application_api/CMakeLists.txt @@ -3,67 +3,81 @@ # Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE # file and DISCLAIMER for more details. # -set(public_application_api_headers - CombinationFederate.hpp - Publications.hpp - Subscriptions.hpp - Endpoints.hpp - Filters.hpp - Federate.hpp - helicsTypes.hpp - data_view.hpp - MessageFederate.hpp - MessageOperators.hpp - ValueConverter.hpp - ValueConverter_impl.hpp - ValueFederate.hpp - HelicsPrimaryTypes.hpp - queryFunctions.hpp) +set( + public_application_api_headers + CombinationFederate.hpp + Publications.hpp + Subscriptions.hpp + Endpoints.hpp + Filters.hpp + Federate.hpp + helicsTypes.hpp + data_view.hpp + MessageFederate.hpp + MessageOperators.hpp + ValueConverter.hpp + ValueConverter_impl.hpp + ValueFederate.hpp + HelicsPrimaryTypes.hpp + queryFunctions.hpp +) -set(private_application_api_headers - MessageFederateManager.hpp - ValueFederateManager.hpp - AsyncFedCallInfo.hpp - FilterOperations.hpp) +set( + private_application_api_headers + MessageFederateManager.hpp + ValueFederateManager.hpp + AsyncFedCallInfo.hpp + FilterOperations.hpp +) -set(application_api_sources - CombinationFederate.cpp - Federate.cpp - MessageFederate.cpp - MessageFederateManager.cpp - MessageOperators.cpp - ValueFederate.cpp - ValueConverter.cpp - ValueFederateManager.cpp - helicsPrimaryTypes.cpp - Subscriptions.cpp - Publications.cpp - Filters.cpp - FilterOperations.cpp - Endpoints.cpp - helicsTypes.cpp - queryFunctions.cpp - FederateInfo.cpp) +set( + application_api_sources + CombinationFederate.cpp + Federate.cpp + MessageFederate.cpp + MessageFederateManager.cpp + MessageOperators.cpp + ValueFederate.cpp + ValueConverter.cpp + ValueFederateManager.cpp + helicsPrimaryTypes.cpp + Subscriptions.cpp + Publications.cpp + Filters.cpp + FilterOperations.cpp + Endpoints.cpp + helicsTypes.cpp + queryFunctions.cpp + FederateInfo.cpp +) -add_library(application_api - OBJECT - ${application_api_sources} - ${public_application_api_headers} - ${private_application_api_headers}) +add_library( + application_api + OBJECT + ${application_api_sources} + ${public_application_api_headers} + ${private_application_api_headers} +) target_include_directories( application_api - PRIVATE $) + PRIVATE $ +) target_include_directories( application_api SYSTEM - PRIVATE $) + PRIVATE $ +) target_compile_definitions( application_api PRIVATE - $) + $ +) target_compile_options( application_api - PRIVATE $) + PRIVATE $ +) -install(FILES ${public_application_api_headers} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics/application_api - COMPONENT headers) +install( + FILES ${public_application_api_headers} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics/application_api + COMPONENT headers +) diff --git a/src/helics/apps/CMakeLists.txt b/src/helics/apps/CMakeLists.txt index 5d4ce282cf..c5cd020d64 100644 --- a/src/helics/apps/CMakeLists.txt +++ b/src/helics/apps/CMakeLists.txt @@ -6,66 +6,82 @@ if(BUILD_APPS) - set(helics_apps_public_headers - Player.hpp - Recorder.hpp - Echo.hpp - Source.hpp - Tracer.hpp - helicsApp.hpp - BrokerApp.hpp) + set( + helics_apps_public_headers + Player.hpp + Recorder.hpp + Echo.hpp + Source.hpp + Tracer.hpp + helicsApp.hpp + BrokerApp.hpp + ) set(helics_apps_private_headers PrecHelper.hpp SignalGenerators.hpp) - set(helics_apps_library_files - Player.cpp - Recorder.cpp - PrecHelper.cpp - SignalGenerators.cpp - Echo.cpp - Source.cpp - Tracer.cpp - helicsApp.cpp - BrokerApp.cpp) - - add_library(helics_apps-static - STATIC - ${helics_apps_library_files} - ${helics_apps_public_headers} - ${helics_apps_private_headers}) + set( + helics_apps_library_files + Player.cpp + Recorder.cpp + PrecHelper.cpp + SignalGenerators.cpp + Echo.cpp + Source.cpp + Tracer.cpp + helicsApp.cpp + BrokerApp.cpp + ) + + add_library( + helics_apps-static + STATIC + ${helics_apps_library_files} + ${helics_apps_public_headers} + ${helics_apps_private_headers} + ) target_link_libraries(helics_apps-static PUBLIC helics-static) target_include_directories( helics_apps-static SYSTEM - PRIVATE $) + PRIVATE $ + ) target_compile_definitions( helics_apps-static PRIVATE - $) + $ + ) # add and alias library to match the find_package add_library(HELICS::helics_apps-static ALIAS helics_apps-static) add_executable(helics_player playerMain.cpp) target_link_libraries(helics_player helics_apps-static) set_target_properties(helics_player PROPERTIES FOLDER apps) - install(TARGETS helics_player - DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT applications) + install( + TARGETS helics_player + DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT applications + ) add_executable(helics_recorder recorderMain.cpp) target_link_libraries(helics_recorder helics_apps-static) set_target_properties(helics_recorder PROPERTIES FOLDER apps) - install(TARGETS helics_recorder - DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT applications) + install( + TARGETS helics_recorder + DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT applications + ) add_executable(helics_broker helics-broker.cpp) target_link_libraries(helics_broker helics_apps-static) set_target_properties(helics_broker PROPERTIES FOLDER apps) - set(HELICS_BROKER_LOC ${CMAKE_CURRENT_BINARY_DIR} - CACHE INTERNAL "build folder location of the broker") - install(TARGETS helics_broker - DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT applications) + set( + HELICS_BROKER_LOC ${CMAKE_CURRENT_BINARY_DIR} + CACHE INTERNAL "build folder location of the broker" + ) + install( + TARGETS helics_broker + DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT applications + ) add_executable(helics_app appMain.cpp) target_link_libraries(helics_app helics_apps-static) @@ -74,36 +90,42 @@ if(BUILD_APPS) if(WIN32) foreach(keyfile IN LISTS KEY_LIBRARY_FILES) - add_custom_command(TARGET - helics_app - POST_BUILD # Adds a post-build event to core tests - COMMAND ${CMAKE_COMMAND} - -E - copy_if_different # which executes "cmake - E - # copy_if_different..." - "${keyfile}" # <--this is in-file - "$/") # <--this is out-file - # path + add_custom_command( + TARGET + helics_app + POST_BUILD # Adds a post-build event to core tests + COMMAND + ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E copy_if_different..." + "${keyfile}" # <--this is in-file + "$/" + ) # <--this is out-file path endforeach(keyfile) endif() - install(TARGETS helics_apps-static - EXPORT helics-targets - DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT libs) + install( + TARGETS helics_apps-static + EXPORT helics-targets + DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT libs + ) - install(FILES ${helics_apps_public_headers} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics/apps - COMPONENT headers) + install( + FILES ${helics_apps_public_headers} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics/apps + COMPONENT headers + ) endif() # if build any app # configure executable app configure_file(helicsConfigMain.h.in ${CMAKE_CURRENT_BINARY_DIR}/helicsConfigMain.h) -add_executable(helics-config helicsConfigMain.cpp - ${CMAKE_CURRENT_BINARY_DIR}/helicsConfigMain.h) +add_executable( + helics-config helicsConfigMain.cpp ${CMAKE_CURRENT_BINARY_DIR}/helicsConfigMain.h +) target_include_directories(helics-config PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) set_target_properties(helics-config PROPERTIES FOLDER apps) @@ -111,5 +133,7 @@ set_target_properties(helics-config PROPERTIES FOLDER apps) target_link_libraries(helics-config PUBLIC Boostlibs::core) target_include_directories(helics-config SYSTEM PRIVATE ${Boost_INCLUDE_DIR}) -install(TARGETS helics-config - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs) +install( + TARGETS helics-config + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs +) diff --git a/src/helics/common/CMakeLists.txt b/src/helics/common/CMakeLists.txt index a64dafb78b..a232b3ede3 100644 --- a/src/helics/common/CMakeLists.txt +++ b/src/helics/common/CMakeLists.txt @@ -4,74 +4,83 @@ # file and DISCLAIMER for more details. # -set(common_headers - AirLock.hpp - simpleQueue.hpp - BlockingQueue.hpp - BlockingPriorityQueue.hpp - timeRepresentation.hpp - delayedDestructor.hpp - DelayedObjects.hpp - searchableObjectHolder.hpp - argParser.h - JsonProcessingFunctions.hpp - TomlProcessingFunctions.hpp - stringToCmdLine.h - AsioServiceManager.h - logger.h - stringOps.h - MapTraits.hpp - GuardedTypes.hpp - generic_string_ops.hpp - charMapper.h - base64.h - MappedVector.hpp - DualMappedVector.hpp - MappedPointerVector.hpp - DualMappedPointerVector.hpp - TripWire.hpp - fmt_format.h - fmt_ostream.h) +set( + common_headers + AirLock.hpp + simpleQueue.hpp + BlockingQueue.hpp + BlockingPriorityQueue.hpp + timeRepresentation.hpp + delayedDestructor.hpp + DelayedObjects.hpp + searchableObjectHolder.hpp + argParser.h + JsonProcessingFunctions.hpp + TomlProcessingFunctions.hpp + stringToCmdLine.h + AsioServiceManager.h + logger.h + stringOps.h + MapTraits.hpp + GuardedTypes.hpp + generic_string_ops.hpp + charMapper.h + base64.h + MappedVector.hpp + DualMappedVector.hpp + MappedPointerVector.hpp + DualMappedPointerVector.hpp + TripWire.hpp + fmt_format.h + fmt_ostream.h +) -set(common_sources - stringToCmdLine.cpp - AsioServiceManager.cpp - JsonProcessingFunctions.cpp - TomlProcessingFunctions.cpp - logger.cpp - stringOps.cpp - charMapper.cpp - base64.cpp - argParser.cpp - TripWire.cpp) +set( + common_sources + stringToCmdLine.cpp + AsioServiceManager.cpp + JsonProcessingFunctions.cpp + TomlProcessingFunctions.cpp + logger.cpp + stringOps.cpp + charMapper.cpp + base64.cpp + argParser.cpp + TripWire.cpp +) -set(zmq_headers - # zmqReactor.h - zmqContextManager.h zmqHelper.h - # zmqSocketDescriptor.h - # zmqProxyHub.h - cppzmq/zmq.hpp cppzmq/zmq_addon.hpp) +set( + zmq_headers + # zmqReactor.h + zmqContextManager.h zmqHelper.h + # zmqSocketDescriptor.h + # zmqProxyHub.h + cppzmq/zmq.hpp cppzmq/zmq_addon.hpp +) -set(zmq_sources - # zmqReactor.cpp - zmqContextManager.cpp - # zmqSocketDescriptor.cpp - zmqHelper.cpp - # zmqProxyHub.cpp - ) +set( + zmq_sources + # zmqReactor.cpp + zmqContextManager.cpp + # zmqSocketDescriptor.cpp + zmqHelper.cpp + # zmqProxyHub.cpp +) # headers that are part of the public interface -set(helics_public_common - timeRepresentation.hpp - argParser.h - JsonProcessingFunctions.hpp - stringToCmdLine.h - AsioServiceManager.h - logger.h - stringOps.h - MapTraits.hpp - GuardedTypes.hpp - generic_string_ops.hpp) +set( + helics_public_common + timeRepresentation.hpp + argParser.h + JsonProcessingFunctions.hpp + stringToCmdLine.h + AsioServiceManager.h + logger.h + stringOps.h + MapTraits.hpp + GuardedTypes.hpp + generic_string_ops.hpp +) if(HELICS_HAVE_ZEROMQ) list(APPEND common_headers ${zmq_headers}) @@ -85,28 +94,35 @@ set_target_properties(helics_common PROPERTIES LINKER_LANGUAGE CXX) target_include_directories( helics_common - PRIVATE $) + PRIVATE $ +) target_include_directories( helics_common SYSTEM - PRIVATE $) + PRIVATE $ +) target_compile_definitions( helics_common PRIVATE - $) + $ +) target_compile_options( helics_common - PRIVATE $) + PRIVATE $ +) if(HELICS_HAVE_ZEROMQ) target_include_directories( helics_common SYSTEM - PRIVATE $) + PRIVATE $ + ) endif(HELICS_HAVE_ZEROMQ) if(APPLE) target_compile_definitions(helics_common PUBLIC "-DSTX_NO_STD_ANY=1") endif(APPLE) -install(FILES ${helics_public_common} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics/common - COMPONENT headers) +install( + FILES ${helics_public_common} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics/common + COMPONENT headers +) diff --git a/src/helics/core/CMakeLists.txt b/src/helics/core/CMakeLists.txt index 1270317de8..a027afa631 100644 --- a/src/helics/core/CMakeLists.txt +++ b/src/helics/core/CMakeLists.txt @@ -3,101 +3,115 @@ # Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE # file and DISCLAIMER for more details. # -set(SRC_FILES - CoreFactory.cpp - BrokerFactory.cpp - BrokerBase.cpp - CommonCore.cpp - FederateState.cpp - SubscriptionInfo.cpp - PublicationInfo.cpp - InterfaceInfo.cpp - # FilterInfo.cpp - EndpointInfo.cpp - ActionMessage.cpp - CoreBroker.cpp - core-types.cpp - core-data.cpp - TimeCoordinator.cpp - ForwardingTimeCoordinator.cpp - TimeDependencies.cpp - CommsInterface.cpp - CommsBroker.cpp - NetworkBrokerData.cpp - helics-time.cpp - HandleManager.cpp - HandlePointerManager.cpp - MessageTimer.cpp - JsonMapBuilder.cpp) +set( + SRC_FILES + CoreFactory.cpp + BrokerFactory.cpp + BrokerBase.cpp + CommonCore.cpp + FederateState.cpp + SubscriptionInfo.cpp + PublicationInfo.cpp + InterfaceInfo.cpp + # FilterInfo.cpp + EndpointInfo.cpp + ActionMessage.cpp + CoreBroker.cpp + core-types.cpp + core-data.cpp + TimeCoordinator.cpp + ForwardingTimeCoordinator.cpp + TimeDependencies.cpp + CommsInterface.cpp + CommsBroker.cpp + NetworkBrokerData.cpp + helics-time.cpp + HandleManager.cpp + HandlePointerManager.cpp + MessageTimer.cpp + JsonMapBuilder.cpp +) set(TESTCORE_SOURCE_FILES TestBroker.cpp TestCore.cpp) -set(IPC_SOURCE_FILES - ipc/IpcCore.cpp - ipc/IpcBroker.cpp - ipc/IpcComms.cpp - ipc/IpcQueueHelper.cpp) - -set(MPI_SOURCE_FILES - mpi/MpiCore.cpp - mpi/MpiBroker.cpp - mpi/MpiComms.cpp - mpi/MpiService.cpp) - -set(ZMQ_SOURCE_FILES - zmq/ZmqCore.cpp - zmq/ZmqBroker.cpp - zmq/ZmqComms.cpp - zmq/ZmqRequestSets.cpp) +set( + IPC_SOURCE_FILES + ipc/IpcCore.cpp + ipc/IpcBroker.cpp + ipc/IpcComms.cpp + ipc/IpcQueueHelper.cpp +) + +set( + MPI_SOURCE_FILES + mpi/MpiCore.cpp + mpi/MpiBroker.cpp + mpi/MpiComms.cpp + mpi/MpiService.cpp +) + +set( + ZMQ_SOURCE_FILES + zmq/ZmqCore.cpp + zmq/ZmqBroker.cpp + zmq/ZmqComms.cpp + zmq/ZmqRequestSets.cpp +) set(UDP_SOURCE_FILES udp/UdpCore.cpp udp/UdpBroker.cpp udp/UdpComms.cpp) -set(TCP_SOURCE_FILES - tcp/TcpCore.cpp - tcp/TcpBroker.cpp - tcp/TcpComms.cpp - tcp/TcpHelperClasses.cpp) - -set(PUBLIC_INCLUDE_FILES - Core.hpp - Broker.hpp - CoreFactory.hpp - BrokerFactory.hpp - core-exceptions.hpp - core-types.hpp - core-data.hpp - helics-time.hpp - CoreFederateInfo.hpp - helicsVersion.hpp - ../flag-definitions.h) - -set(INCLUDE_FILES - BrokerBase.hpp - TimeDependencies.hpp - TimeCoordinator.hpp - ForwardingTimeCoordinator.hpp - loggingHelper.hpp - CommsBroker.hpp - CommsBroker_impl.hpp - CoreBroker.hpp - InterfaceInfo.hpp - ActionMessageDefintions.hpp - ActionMessage.hpp - CommonCore.hpp - CommsInterface.hpp - FederateState.hpp - SubscriptionInfo.hpp - PublicationInfo.hpp - EndpointInfo.hpp - FilterInfo.hpp - BasicHandleInfo.hpp - FilterFunctions.hpp - NetworkBrokerData.hpp - HandleManager.hpp - HandlePointerManager.hpp - queryHelpers.hpp - MessageTimer.hpp - JsonMapBuilder.hpp) +set( + TCP_SOURCE_FILES + tcp/TcpCore.cpp + tcp/TcpBroker.cpp + tcp/TcpComms.cpp + tcp/TcpHelperClasses.cpp +) + +set( + PUBLIC_INCLUDE_FILES + Core.hpp + Broker.hpp + CoreFactory.hpp + BrokerFactory.hpp + core-exceptions.hpp + core-types.hpp + core-data.hpp + helics-time.hpp + CoreFederateInfo.hpp + helicsVersion.hpp + ../flag-definitions.h +) + +set( + INCLUDE_FILES + BrokerBase.hpp + TimeDependencies.hpp + TimeCoordinator.hpp + ForwardingTimeCoordinator.hpp + loggingHelper.hpp + CommsBroker.hpp + CommsBroker_impl.hpp + CoreBroker.hpp + InterfaceInfo.hpp + ActionMessageDefintions.hpp + ActionMessage.hpp + CommonCore.hpp + CommsInterface.hpp + FederateState.hpp + SubscriptionInfo.hpp + PublicationInfo.hpp + EndpointInfo.hpp + FilterInfo.hpp + BasicHandleInfo.hpp + FilterFunctions.hpp + NetworkBrokerData.hpp + HandleManager.hpp + HandlePointerManager.hpp + queryHelpers.hpp + MessageTimer.hpp + JsonMapBuilder.hpp +) set(TESTCORE_HEADER_FILES TestCore.h TestBroker.h) @@ -109,20 +123,28 @@ set(MPI_HEADER_FILES mpi/MpiCore.h mpi/MpiBroker.h mpi/MpiComms.h mpi/MpiService set(UDP_HEADER_FILES udp/UdpCore.h udp/UdpBroker.h udp/UdpComms.h) -set(TCP_HEADER_FILES - tcp/TcpCore.h - tcp/TcpBroker.h - tcp/TcpComms.h - tcp/TcpHelperClasses.h) - -list(APPEND SRC_FILES - ${TESTCORE_SOURCE_FILES} - ${UDP_SOURCE_FILES} - ${IPC_SOURCE_FILES}) -list(APPEND INCLUDE_FILES - ${TESTCORE_HEADER_FILES} - ${UDP_HEADER_FILES} - ${IPC_HEADER_FILES}) +set( + TCP_HEADER_FILES + tcp/TcpCore.h + tcp/TcpBroker.h + tcp/TcpComms.h + tcp/TcpHelperClasses.h +) + +list( + APPEND + SRC_FILES + ${TESTCORE_SOURCE_FILES} + ${UDP_SOURCE_FILES} + ${IPC_SOURCE_FILES} +) +list( + APPEND + INCLUDE_FILES + ${TESTCORE_HEADER_FILES} + ${UDP_HEADER_FILES} + ${IPC_HEADER_FILES} +) if(NOT DISABLE_TCP_CORE) list(APPEND SRC_FILES ${TCP_SOURCE_FILES}) @@ -143,22 +165,28 @@ add_library(helics_core OBJECT ${SRC_FILES} ${INCLUDE_FILES} ${PUBLIC_INCLUDE_FI target_include_directories( helics_core - PRIVATE $) + PRIVATE $ +) target_include_directories( helics_core SYSTEM - PRIVATE $) + PRIVATE $ +) target_compile_definitions( helics_core PRIVATE - $) + $ +) target_compile_options( helics_core - PRIVATE $) + PRIVATE $ +) target_include_directories( helics_core SYSTEM - PRIVATE $) + PRIVATE $ +) target_compile_definitions( - helics_core PRIVATE $) + helics_core PRIVATE $ +) if(APPLE) target_compile_definitions(helics_core PUBLIC "-DSTX_NO_STD_ANY=1") @@ -171,7 +199,8 @@ endif(HELICS_HAVE_MPI) if(HELICS_HAVE_ZEROMQ) target_include_directories( helics_core SYSTEM - PRIVATE $) + PRIVATE $ + ) source_group("zmq" FILES ${ZMQ_SOURCE_FILES} ${ZMQ_HEADER_FILES}) endif(HELICS_HAVE_ZEROMQ) @@ -184,11 +213,15 @@ if(NOT DISABLE_TCP_CORE) endif() if(HELICS_HAVE_MPI) - target_include_directories(helics_core - PRIVATE "${MPI_C_INCLUDE_DIR}" "${MPI_C_HEADER_DIR}" - "${MPI_C_ADDITIONAL_INCLUDE_DIRS}") + target_include_directories( + helics_core + PRIVATE + "${MPI_C_INCLUDE_DIR}" "${MPI_C_HEADER_DIR}" "${MPI_C_ADDITIONAL_INCLUDE_DIRS}" + ) endif(HELICS_HAVE_MPI) -install(FILES ${PUBLIC_INCLUDE_FILES} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics/core - COMPONENT headers) +install( + FILES ${PUBLIC_INCLUDE_FILES} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics/core + COMPONENT headers +) diff --git a/src/helics/cpp98/CMakeLists.txt b/src/helics/cpp98/CMakeLists.txt index 38254cdacb..d8a9b4a2b2 100644 --- a/src/helics/cpp98/CMakeLists.txt +++ b/src/helics/cpp98/CMakeLists.txt @@ -3,19 +3,21 @@ # Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE # file and DISCLAIMER for more details. # -set(helicsCpp98_headers - Broker.hpp - Core.hpp - CombinationFederate.hpp - Federate.hpp - MessageFederate.hpp - ValueFederate.hpp - helics.hpp - Publication.hpp - Subscription.hpp - Endpoint.hpp - Filter.hpp - config.hpp) +set( + helicsCpp98_headers + Broker.hpp + Core.hpp + CombinationFederate.hpp + Federate.hpp + MessageFederate.hpp + ValueFederate.hpp + helics.hpp + Publication.hpp + Subscription.hpp + Endpoint.hpp + Filter.hpp + config.hpp +) add_library(helicsCpp98 INTERFACE) target_include_directories(helicsCpp98 INTERFACE "${PROJECT_SOURCE_DIR}/src/helics") @@ -31,6 +33,8 @@ if(MSVC) set_target_properties(helicsCpp98_ide PROPERTIES FOLDER interfaces) endif(MSVC) -install(FILES ${helicsCpp98_headers} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cpp98 - COMPONENT headers) +install( + FILES ${helicsCpp98_headers} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cpp98 + COMPONENT headers +) diff --git a/src/helics/shared_api_library/CMakeLists.txt b/src/helics/shared_api_library/CMakeLists.txt index f7f475bf90..b011fda8d9 100644 --- a/src/helics/shared_api_library/CMakeLists.txt +++ b/src/helics/shared_api_library/CMakeLists.txt @@ -4,22 +4,26 @@ # file and DISCLAIMER for more details. # -set(helicsShared_headers - helics.h - api-data.h - ValueFederate.h - MessageFederate.h - MessageFilters.h - helicsCallbacks.h) +set( + helicsShared_headers + helics.h + api-data.h + ValueFederate.h + MessageFederate.h + MessageFilters.h + helicsCallbacks.h +) -set(helicsShared_sources - helicsExport.cpp - FederateExport.cpp - ValueFederateExport.cpp - MessageFederateExport.cpp - MessageFiltersExport.cpp - helicsCallbacks.cpp - internal/api_objects.h) +set( + helicsShared_sources + helicsExport.cpp + FederateExport.cpp + ValueFederateExport.cpp + MessageFederateExport.cpp + MessageFiltersExport.cpp + helicsCallbacks.cpp + internal/api_objects.h +) include(GenerateExportHeader) @@ -28,58 +32,80 @@ add_library(helicsSharedLib SHARED ${helicsShared_sources} ${helicsShared_header add_library(HELICS::helicsSharedLib ALIAS helicsSharedLib) generate_export_header(helicsSharedLib BASE_NAME helics) -target_include_directories(helicsSharedLib - PUBLIC $) +target_include_directories( + helicsSharedLib + PUBLIC $ +) -set_target_properties(helicsSharedLib - PROPERTIES CXX_VISIBILITY_PRESET - hidden - C_VISIBILITY_PRESET - hidden) +set_target_properties( + helicsSharedLib + PROPERTIES + CXX_VISIBILITY_PRESET + hidden + C_VISIBILITY_PRESET + hidden +) target_link_libraries(helicsSharedLib PRIVATE helics-static) if(UNIX OR MINGW) if(NOT APPLE) target_link_libraries( helicsSharedLib - PRIVATE -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.txt) + PRIVATE -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.txt + ) endif(NOT APPLE) endif() set_target_properties(helicsSharedLib PROPERTIES FOLDER interfaces) -install(TARGETS helicsSharedLib - EXPORT helics-targets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install( + TARGETS helicsSharedLib + EXPORT helics-targets + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 3.6) - install(FILES $ - DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT libs EXCLUDE_FROM_ALL) - install(FILES $ - DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT - runtime EXCLUDE_FROM_ALL) + install( + FILES $ + DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT libs EXCLUDE_FROM_ALL + ) + install( + FILES $ + DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT + runtime EXCLUDE_FROM_ALL + ) else() - install(FILES $ - DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT libs) - install(FILES $ - DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT - runtime) + install( + FILES $ + DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT libs + ) + install( + FILES $ + DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT + runtime + ) endif() -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/helics_export.h - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics/shared_api_library - COMPONENT headers) +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/helics_export.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics/shared_api_library + COMPONENT headers +) if(MSVC AND NOT EMBEDDED_DEBUG_INFO) - install(FILES $ - DESTINATION ${CMAKE_INSTALL_BINDIR} - OPTIONAL COMPONENT libs) + install( + FILES $ + DESTINATION ${CMAKE_INSTALL_BINDIR} + OPTIONAL COMPONENT libs + ) endif() -install(FILES ${helicsShared_headers} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics/shared_api_library - COMPONENT headers) +install( + FILES ${helicsShared_headers} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/helics/shared_api_library + COMPONENT headers +) diff --git a/swig/CMakeLists.txt b/swig/CMakeLists.txt index f133e7ebc4..9d217b30c5 100644 --- a/swig/CMakeLists.txt +++ b/swig/CMakeLists.txt @@ -7,16 +7,20 @@ if(NOT DISABLE_SWIG) if(WIN32 AND NOT MSYS) if(NOT CMAKE_PROGRAM_PATH) - set(CMAKE_PROGRAM_PATH - "C:/local/swigwin-3.0.12" - "C:/local/swigwin-3.0.11" - "C:/local/swigwin-3.0.10") + set( + CMAKE_PROGRAM_PATH + "C:/local/swigwin-3.0.12" + "C:/local/swigwin-3.0.11" + "C:/local/swigwin-3.0.10" + ) else() - set(CMAKE_PROGRAM_PATH - "${CMAKE_PROGRAM_PATH}" - "C:/local/swigwin-3.0.12" - "C:/local/swigwin-3.0.11" - "C:/local/swigwin-3.0.10") + set( + CMAKE_PROGRAM_PATH + "${CMAKE_PROGRAM_PATH}" + "C:/local/swigwin-3.0.12" + "C:/local/swigwin-3.0.11" + "C:/local/swigwin-3.0.10" + ) endif() endif() find_package(SWIG REQUIRED 3.0) @@ -31,7 +35,8 @@ if(BUILD_PYTHON_INTERFACE) add_subdirectory(python) if(BUILD_PYTHON2_INTERFACE) message( - WARNING "PYTHON2 interface will not be built since python 3 build is active") + WARNING "PYTHON2 interface will not be built since python 3 build is active" + ) endif() elseif(BUILD_PYTHON2_INTERFACE) add_subdirectory(python2) diff --git a/swig/java/CMakeLists.txt b/swig/java/CMakeLists.txt index 5f3452f630..293390306d 100644 --- a/swig/java/CMakeLists.txt +++ b/swig/java/CMakeLists.txt @@ -12,10 +12,12 @@ include_directories(${JAVA_INCLUDE_PATH}) include_directories(${JNI_INCLUDE_DIRS}) if(DISABLE_SWIG OR NOT SWIG_EXECUTABLE) - file(COPY - ${CMAKE_CURRENT_SOURCE_DIR}/interface/ - DESTINATION - ${CMAKE_CURRENT_BINARY_DIR}) + file( + COPY + ${CMAKE_CURRENT_SOURCE_DIR}/interface/ + DESTINATION + ${CMAKE_CURRENT_BINARY_DIR} + ) if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) # Update if necessary set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long") @@ -43,62 +45,77 @@ else(DISABLE_SWIG) endif() # DISABLE_SWIG configure_file( - MakeJarCMakeLists.txt.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt @ONLY) + MakeJarCMakeLists.txt.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt @ONLY +) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/buildjar/) # -D ADDITIONAL_JAR_FILES=$;$ -add_custom_command(TARGET "JNIhelics" POST_BUILD - COMMAND ${CMAKE_COMMAND} -D LIBRARY_FILE=$ -P - ${CMAKE_CURRENT_SOURCE_DIR}/addLoadLibraryCommand.cmake) - -add_custom_command(TARGET "JNIhelics" POST_BUILD - COMMAND ${CMAKE_COMMAND} ARGS .. - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/buildjar" - VERBATIM) - -add_custom_command(TARGET "JNIhelics" POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS - --build . - --target helics - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/buildjar/" - COMMENT "Building jar file" - VERBATIM) +add_custom_command( + TARGET "JNIhelics" POST_BUILD + COMMAND + ${CMAKE_COMMAND} -D LIBRARY_FILE=$ -P + ${CMAKE_CURRENT_SOURCE_DIR}/addLoadLibraryCommand.cmake +) + +add_custom_command( + TARGET "JNIhelics" POST_BUILD + COMMAND ${CMAKE_COMMAND} ARGS .. + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/buildjar" + VERBATIM +) + +add_custom_command( + TARGET "JNIhelics" POST_BUILD + COMMAND + ${CMAKE_COMMAND} + ARGS + --build . + --target helics + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/buildjar/" + COMMENT "Building jar file" + VERBATIM +) if(WIN32) foreach(keyfile IN LISTS KEY_LIBRARY_FILES) - add_custom_command(TARGET - JNIhelics - POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} - -E - copy_if_different # which executes "cmake - E - # copy_if_different..." - "${keyfile}" # <--this is in-file - "$/") # <--this is out-file - # path + add_custom_command( + TARGET + JNIhelics + POST_BUILD # Adds a post-build event to api tests + COMMAND + ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E copy_if_different..." + "${keyfile}" # <--this is in-file + "$/" + ) # <--this is out-file path endforeach(keyfile) - add_custom_command(TARGET - JNIhelics - POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} - -E - copy_if_different # which executes "cmake - E - # copy_if_different..." - "$" # <--this is in- file - "$/") # <--this is out- file - # path + add_custom_command( + TARGET + JNIhelics + POST_BUILD # Adds a post-build event to api tests + COMMAND + ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E copy_if_different..." + "$" # <--this is in- file + "$/" + ) # <--this is out- file path endif(WIN32) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/buildjar/helics-${HELICS_VERSION}.jar - DESTINATION java - COMPONENT java) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/buildjar/helics.jar - DESTINATION java - COMPONENT java OPTIONAL) +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/buildjar/helics-${HELICS_VERSION}.jar + DESTINATION java + COMPONENT java +) +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/buildjar/helics.jar + DESTINATION java + COMPONENT java OPTIONAL +) install(FILES $ DESTINATION java COMPONENT java) install(TARGETS JNIhelics DESTINATION java COMPONENT java) install(FILES ${KEY_LIBRARY_FILES} DESTINATION java COMPONENT java) diff --git a/swig/matlab/CMakeLists.txt b/swig/matlab/CMakeLists.txt index 851280b7da..07356a9cdc 100644 --- a/swig/matlab/CMakeLists.txt +++ b/swig/matlab/CMakeLists.txt @@ -22,112 +22,150 @@ endif() message(STATUS "Building MATLAB") if(DISABLE_SWIG OR MATLAB_SWIG_NOT_AVAILABLE) - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp - COMMAND "${CMAKE_COMMAND}" -E copy - ${CMAKE_CURRENT_SOURCE_DIR}/helicsMEX.cpp - ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/helicsMEX.cpp) - install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/+helics - DESTINATION matlab - COMPONENT matlab) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp + COMMAND + "${CMAKE_COMMAND}" -E copy ${CMAKE_CURRENT_SOURCE_DIR}/helicsMEX.cpp + ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/helicsMEX.cpp + ) + install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/+helics + DESTINATION matlab + COMPONENT matlab + ) file(GLOB MATLAB_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.m) - install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/+helics - DESTINATION matlab - COMPONENT matlab) + install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/+helics + DESTINATION matlab + COMPONENT matlab + ) install(FILES ${MATLAB_FILES} DESTINATION matlab COMPONENT matlab) else() file(GLOB SHARED_LIB_HEADERS ${CMAKE_SOURCE_DIR}/src/helics/shared_api_library/*.h) # custom command for building the wrap file - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp - COMMAND "${SWIG_EXECUTABLE}" "-matlab" "-c++" -o "helicsMEX.cpp" - "-I${CMAKE_SOURCE_DIR}/src/helics/shared_api_library" - ${CMAKE_CURRENT_SOURCE_DIR}/helicsMatlab.i - DEPENDS ${CMAKE_SOURCE_DIR}/swig/helics.i - ${CMAKE_CURRENT_SOURCE_DIR}/helicsMatlab.i - ${SHARED_LIB_HEADERS} - ${CMAKE_CURRENT_SOURCE_DIR}/matlab_maps.i) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp + COMMAND + "${SWIG_EXECUTABLE}" "-matlab" "-c++" -o "helicsMEX.cpp" + "-I${CMAKE_SOURCE_DIR}/src/helics/shared_api_library" + ${CMAKE_CURRENT_SOURCE_DIR}/helicsMatlab.i + DEPENDS + ${CMAKE_SOURCE_DIR}/swig/helics.i + ${CMAKE_CURRENT_SOURCE_DIR}/helicsMatlab.i + ${SHARED_LIB_HEADERS} + ${CMAKE_CURRENT_SOURCE_DIR}/matlab_maps.i + ) if(OVERWRITE_MATLAB_FILES) - add_custom_target(mfile_overwrite ALL - COMMAND ${CMAKE_COMMAND} -D TARGET_DIR=${CMAKE_CURRENT_SOURCE_DIR} - -P ${CMAKE_CURRENT_SOURCE_DIR}/overwriteMatlabFiles.cmake - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp) + add_custom_target( + mfile_overwrite ALL + COMMAND + ${CMAKE_COMMAND} -D TARGET_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P + ${CMAKE_CURRENT_SOURCE_DIR}/overwriteMatlabFiles.cmake + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp + ) endif(OVERWRITE_MATLAB_FILES) # add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp COMMAND # ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/modifyOctSourceFile.cmake DEPENDS # ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp ) - install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/+helics - DESTINATION matlab - COMPONENT matlab) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/SwigGet.m - ${CMAKE_CURRENT_BINARY_DIR}/SwigMem.m - ${CMAKE_CURRENT_BINARY_DIR}/SwigRef.m - DESTINATION matlab - COMPONENT matlab) - install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pisender.m - ${CMAKE_CURRENT_SOURCE_DIR}/pireceiver.m - ${CMAKE_CURRENT_SOURCE_DIR}/GetFullPath.m - DESTINATION matlab - COMPONENT matlab) + install( + DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/+helics + DESTINATION matlab + COMPONENT matlab + ) + install( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/SwigGet.m ${CMAKE_CURRENT_BINARY_DIR}/SwigMem.m + ${CMAKE_CURRENT_BINARY_DIR}/SwigRef.m + DESTINATION matlab + COMPONENT matlab + ) + install( + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/pisender.m ${CMAKE_CURRENT_SOURCE_DIR}/pireceiver.m + ${CMAKE_CURRENT_SOURCE_DIR}/GetFullPath.m + DESTINATION matlab + COMPONENT matlab + ) endif() add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mkhelicsMEXFile.m - COMMAND ${CMAKE_COMMAND} -D LIBRARY_FILE=$ -D - BUILD_FILE=${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp -D - LIBRARY_INCLUDE_LOCATION=${CMAKE_SOURCE_DIR}/src/helics/shared_api_library/ -D - OTHER_INCLUDE_LOCATION=${PROJECT_BINARY_DIR}/src/helics/shared_api_library/ -D - SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P - ${CMAKE_CURRENT_SOURCE_DIR}/generateMEXcreationScript.cmake - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp) + COMMAND + ${CMAKE_COMMAND} -D LIBRARY_FILE=$ -D + BUILD_FILE=${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp -D + LIBRARY_INCLUDE_LOCATION=${CMAKE_SOURCE_DIR}/src/helics/shared_api_library/ -D + OTHER_INCLUDE_LOCATION=${PROJECT_BINARY_DIR}/src/helics/shared_api_library/ -D + SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P + ${CMAKE_CURRENT_SOURCE_DIR}/generateMEXcreationScript.cmake + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp +) if(WIN32) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.${Matlab_MEX_EXTENSION} - COMMAND ${Matlab_MAIN_PROGRAM} -nojvm -nosplash -minimize -r - "\"run('${CMAKE_CURRENT_BINARY_DIR}/mkhelicsMEXFile.m');quit;\"" - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mkhelicsMEXFile.m helicsSharedLib - ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp) + COMMAND + ${Matlab_MAIN_PROGRAM} -nojvm -nosplash -minimize -r + "\"run('${CMAKE_CURRENT_BINARY_DIR}/mkhelicsMEXFile.m');quit;\"" + DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/mkhelicsMEXFile.m helicsSharedLib + ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp + ) else() add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.${Matlab_MEX_EXTENSION} - COMMAND ${Matlab_MAIN_PROGRAM} -nojvm -nodisplay -nosplash -r - "\"run('${CMAKE_CURRENT_BINARY_DIR}/mkhelicsMEXFile.m');quit;\"" - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mkhelicsMEXFile.m helicsSharedLib - ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp) + COMMAND + ${Matlab_MAIN_PROGRAM} -nojvm -nodisplay -nosplash -r + "\"run('${CMAKE_CURRENT_BINARY_DIR}/mkhelicsMEXFile.m');quit;\"" + DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/mkhelicsMEXFile.m helicsSharedLib + ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp + ) endif() if(NOT MATLAB_GENERATE_ONLY) add_custom_target( helicsMEX ALL - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.${Matlab_MEX_EXTENSION} - helicsSharedLib) + DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.${Matlab_MEX_EXTENSION} helicsSharedLib + ) set_target_properties(helicsMEX PROPERTIES FOLDER interfaces) endif(NOT MATLAB_GENERATE_ONLY) file(GLOB HSHARED_LIB_SOURCES ${CMAKE_SOURCE_DIR}/src/helics/shared_api_library/*.h) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.${Matlab_MEX_EXTENSION} - DESTINATION matlab - COMPONENT matlab) +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.${Matlab_MEX_EXTENSION} + DESTINATION matlab + COMPONENT matlab +) install(FILES $ DESTINATION matlab COMPONENT matlab) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp - DESTINATION matlab - COMPONENT matlab) +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/helicsMEX.cpp + DESTINATION matlab + COMPONENT matlab +) install(FILES $ DESTINATION matlab COMPONENT matlab) install(FILES ${KEY_LIBRARY_FILES} DESTINATION matlab COMPONENT matlab) install(FILES ${HSHARED_LIB_SOURCES} DESTINATION matlab/headers COMPONENT matlab) -install(FILES ${PROJECT_BINARY_DIR}/src/helics/shared_api_library/helics_export.h - DESTINATION matlab/headers - COMPONENT matlab) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/generatehelicsMEXFile.m - DESTINATION matlab - COMPONENT matlab) -install(FILES helicsSharedLib.h libhelicsSharedLib.h - DESTINATION matlab - COMPONENT matlab) +install( + FILES ${PROJECT_BINARY_DIR}/src/helics/shared_api_library/helics_export.h + DESTINATION matlab/headers + COMPONENT matlab +) +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/generatehelicsMEXFile.m + DESTINATION matlab + COMPONENT matlab +) +install( + FILES helicsSharedLib.h libhelicsSharedLib.h + DESTINATION matlab + COMPONENT matlab +) diff --git a/swig/octave/CMakeLists.txt b/swig/octave/CMakeLists.txt index b9f021e9b3..2ea5dd35f0 100644 --- a/swig/octave/CMakeLists.txt +++ b/swig/octave/CMakeLists.txt @@ -9,15 +9,19 @@ message(STATUS "Building Octave interface") find_package(Octave REQUIRED) if(NOT MKOCTFILE_EXECUTABLE) - show_variable(OCTAVE_INSTALL_LOCATION - PATH - "installation location for Octave" - "${OCTAVE_INSTALL_LOCATION}") + show_variable( + OCTAVE_INSTALL_LOCATION + PATH + "installation location for Octave" + "${OCTAVE_INSTALL_LOCATION}" + ) endif() if(DISABLE_SWIG OR NOT SWIG_EXECUTABLE) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/helicsOCTAVE_wrap.cpp - ${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cpp COPYONLY) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/helicsOCTAVE_wrap.cpp + ${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cpp COPYONLY + ) else() @@ -25,44 +29,56 @@ else() file(GLOB SHARED_LIB_HEADERS ${CMAKE_SOURCE_DIR}/src/helics/shared_api_library/*.h) # custom command for building the wrap file - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cxx - COMMAND "${SWIG_EXECUTABLE}" "-octave" "-c++" -o - "helicsOCTAVE_wrap.cxx" - "-I${CMAKE_SOURCE_DIR}/src/helics/shared_api_library" - ${CMAKE_CURRENT_SOURCE_DIR}/helicsOctave.i - DEPENDS ${CMAKE_SOURCE_DIR}/swig/helics.i - ${CMAKE_SOURCE_DIR}/swig/octave/helicsOctave.i - ${SHARED_LIB_HEADERS}) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cxx + COMMAND + "${SWIG_EXECUTABLE}" "-octave" "-c++" -o "helicsOCTAVE_wrap.cxx" + "-I${CMAKE_SOURCE_DIR}/src/helics/shared_api_library" + ${CMAKE_CURRENT_SOURCE_DIR}/helicsOctave.i + DEPENDS + ${CMAKE_SOURCE_DIR}/swig/helics.i ${CMAKE_SOURCE_DIR}/swig/octave/helicsOctave.i + ${SHARED_LIB_HEADERS} + ) - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cpp - COMMAND ${CMAKE_COMMAND} -D VOID_SIZE=${CMAKE_SIZEOF_VOID_P} -P - ${CMAKE_CURRENT_SOURCE_DIR}/modifyOctSourceFile.cmake - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cxx) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cpp + COMMAND + ${CMAKE_COMMAND} -D VOID_SIZE=${CMAKE_SIZEOF_VOID_P} -P + ${CMAKE_CURRENT_SOURCE_DIR}/modifyOctSourceFile.cmake + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cxx + ) endif() add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mkhelicsOCTFile.m - COMMAND ${CMAKE_COMMAND} -D LIBRARY_FILE=$ -D - BUILD_FILE=${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cpp -D - LIBRARY_INCLUDE_LOCATION=${CMAKE_SOURCE_DIR}/src/helics/shared_api_library/ -D - OTHER_INCLUDE_LOCATION=${PROJECT_BINARY_DIR}/src/helics/shared_api_library/ -D - SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P - ${CMAKE_CURRENT_SOURCE_DIR}/generateOCTcreationScript.cmake - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cpp) + COMMAND + ${CMAKE_COMMAND} -D LIBRARY_FILE=$ -D + BUILD_FILE=${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cpp -D + LIBRARY_INCLUDE_LOCATION=${CMAKE_SOURCE_DIR}/src/helics/shared_api_library/ -D + OTHER_INCLUDE_LOCATION=${PROJECT_BINARY_DIR}/src/helics/shared_api_library/ -D + SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P + ${CMAKE_CURRENT_SOURCE_DIR}/generateOCTcreationScript.cmake + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cpp +) -add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helics.oct - COMMAND ${OCTAVE_EXECUTABLE} "-q" - "run(\"${CMAKE_CURRENT_BINARY_DIR}/mkhelicsOCTFile.m\")" - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mkhelicsOCTFile.m helicsSharedLib - ${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cpp) +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/helics.oct + COMMAND + ${OCTAVE_EXECUTABLE} "-q" "run(\"${CMAKE_CURRENT_BINARY_DIR}/mkhelicsOCTFile.m\")" + DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/mkhelicsOCTFile.m helicsSharedLib + ${CMAKE_CURRENT_BINARY_DIR}/helicsOCTAVE_wrap.cpp +) add_custom_target(helicsOCT ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/helics.oct) set_target_properties(helicsOCT PROPERTIES FOLDER interfaces) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/helics.oct - DESTINATION octave - COMPONENT octave) +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/helics.oct + DESTINATION octave + COMPONENT octave +) install(FILES $ DESTINATION octave COMPONENT octave) install(FILES ${KEY_LIBRARY_FILES} DESTINATION octave COMPONENT octave) diff --git a/swig/python/CMakeLists.txt b/swig/python/CMakeLists.txt index 5d55ecc54f..fab8599668 100644 --- a/swig/python/CMakeLists.txt +++ b/swig/python/CMakeLists.txt @@ -20,31 +20,40 @@ if(DISABLE_SWIG OR NOT SWIG_EXECUTABLE) set(ZMQ_INCLUDE_DIR ${ZeroMQ_INCLUDE_DIR}) get_filename_component(ZMQ_LIB_DIR ${ZeroMQ_LIBRARY} DIRECTORY) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in - ${CMAKE_CURRENT_BINARY_DIR}/setup.py) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/helics_wrap.c - ${CMAKE_CURRENT_BINARY_DIR}/helics_wrap.c COPYONLY) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/helics.py - ${CMAKE_CURRENT_BINARY_DIR}/helics.py COPYONLY) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in ${CMAKE_CURRENT_BINARY_DIR}/setup.py + ) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/helics_wrap.c ${CMAKE_CURRENT_BINARY_DIR}/helics_wrap.c + COPYONLY + ) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/helics.py ${CMAKE_CURRENT_BINARY_DIR}/helics.py COPYONLY + ) add_custom_target("helicsPYTHONEXT" ALL DEPENDS helicsSharedLib helicsPYTHON) - add_custom_command(TARGET "helicsPYTHONEXT" POST_BUILD - COMMAND ${PYTHON_EXECUTABLE} - ARGS "-m" - "pip" - "install" - "-e" - "." - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" - COMMENT "Building Python extension") + add_custom_command( + TARGET "helicsPYTHONEXT" POST_BUILD + COMMAND + ${PYTHON_EXECUTABLE} + ARGS + "-m" + "pip" + "install" + "-e" + "." + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + COMMENT "Building Python extension" + ) else() # https://stackoverflow.com/a/3818084/5451769 if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) # Update if necessary set( CMAKE_C_FLAGS - "${CMAKE_C_FLAGS} -Wno-long-long -Wno-overlength-strings -Wno-ignored-attributes") + "${CMAKE_C_FLAGS} -Wno-long-long -Wno-overlength-strings -Wno-ignored-attributes" + ) endif() include_directories(${PYTHON_INCLUDE_PATH}) @@ -78,27 +87,30 @@ else() install(TARGETS _helics DESTINATION python COMPONENT python) foreach(keyfile IN LISTS KEY_LIBRARY_FILES) - add_custom_command(TARGET - _helics - POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} - -E - copy_if_different # which executes "cmake - E - # copy_if_different..." - "${keyfile}" # <--this is in-file - "$/") # <--this is out- file - # path + add_custom_command( + TARGET + _helics + POST_BUILD # Adds a post-build event to api tests + COMMAND + ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E copy_if_different..." + "${keyfile}" # <--this is in-file + "$/" + ) # <--this is out- file path endforeach(keyfile) - add_custom_command(TARGET - _helics - POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} - -E - copy_if_different # which executes "cmake - E - # copy_if_different..." - "$" # <--this is in- file - "$/") # <--this is out- file path + add_custom_command( + TARGET + _helics + POST_BUILD # Adds a post-build event to api tests + COMMAND + ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E copy_if_different..." + "$" # <--this is in- file + "$/" + ) # <--this is out- file path endif() diff --git a/swig/python2/CMakeLists.txt b/swig/python2/CMakeLists.txt index 99af3c070e..30dc17907a 100644 --- a/swig/python2/CMakeLists.txt +++ b/swig/python2/CMakeLists.txt @@ -13,8 +13,10 @@ endif() # https://stackoverflow.com/a/3818084/5451769 if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) # Update if necessary - set(CMAKE_C_FLAGS - "${CMAKE_C_FLAGS} -Wno-long-long -Wno-overlength-strings -Wno-ignored-attributes") + set( + CMAKE_C_FLAGS + "${CMAKE_C_FLAGS} -Wno-long-long -Wno-overlength-strings -Wno-ignored-attributes" + ) endif() find_package(PythonLibs 2 REQUIRED) @@ -46,15 +48,17 @@ set_target_properties(_helics PROPERTIES FOLDER interfaces) install(TARGETS _helics DESTINATION python COMPONENT python) foreach(keyfile IN LISTS KEY_LIBRARY_FILES) - add_custom_command(TARGET - _helics - POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} - -E - copy_if_different # which executes "cmake - E - # copy_if_different..." - "${keyfile}" # <--this is in-file - "$/") # <--this is out- file path + add_custom_command( + TARGET + _helics + POST_BUILD # Adds a post-build event to api tests + COMMAND + ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E copy_if_different..." + "${keyfile}" # <--this is in-file + "$/" + ) # <--this is out- file path endforeach(keyfile) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/helics.py DESTINATION python COMPONENT python) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index dc7857487f..744c3ce32c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -10,7 +10,7 @@ else() message( WARNING "Boost version >=1.61 required for building HELICS tests (Found Boost version ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION})" - ) + ) endif() if(BUILD_PYTHON_INTERFACE) diff --git a/tests/helics/application_api/CMakeLists.txt b/tests/helics/application_api/CMakeLists.txt index 0ae181c7c8..68443db223 100644 --- a/tests/helics/application_api/CMakeLists.txt +++ b/tests/helics/application_api/CMakeLists.txt @@ -6,58 +6,71 @@ set(application_api_test_headers testFixtures.hpp ValueFederateTestTemplates.hpp) -set(application_api_test_sources - MessageFederateKeyTests.cpp - ValueFederateKeyTests.cpp - FilterTests.cpp - testFixtures.cpp - PrimaryTypeConversionTests.cpp - FilterAdditionalTests.cpp - ValueConverterTests.cpp - application-api-tests.cpp - data_viewTests.cpp - MessageFederateAdditionalTests.cpp - FederateTests.cpp - subPubObjectTests.cpp - ValueFederateAdditionalTests.cpp - CombinationFederateTests.cpp - ValueFederateExtendedTests.cpp) - -add_executable(application-api-tests ${application_api_test_sources} - ${application_api_test_headers}) +set( + application_api_test_sources + MessageFederateKeyTests.cpp + ValueFederateKeyTests.cpp + FilterTests.cpp + testFixtures.cpp + PrimaryTypeConversionTests.cpp + FilterAdditionalTests.cpp + ValueConverterTests.cpp + application-api-tests.cpp + data_viewTests.cpp + MessageFederateAdditionalTests.cpp + FederateTests.cpp + subPubObjectTests.cpp + ValueFederateAdditionalTests.cpp + CombinationFederateTests.cpp + ValueFederateExtendedTests.cpp +) + +add_executable( + application-api-tests ${application_api_test_sources} ${application_api_test_headers} +) target_link_libraries(application-api-tests helics-static helics_test_base) set_target_properties(application-api-tests PROPERTIES FOLDER tests) -target_compile_definitions(application-api-tests PRIVATE - "-DHELICS_BROKER_LOCATION=\"${HELICS_BROKER_LOC}\"") -target_compile_definitions(application-api-tests PRIVATE - "-DHELICS_INSTALL_LOCATION=\"${CMAKE_INSTALL_PREFIX}\"") -target_compile_definitions(application-api-tests PRIVATE - "-DTEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"") +target_compile_definitions( + application-api-tests PRIVATE "-DHELICS_BROKER_LOCATION=\"${HELICS_BROKER_LOC}\"" +) +target_compile_definitions( + application-api-tests PRIVATE "-DHELICS_INSTALL_LOCATION=\"${CMAKE_INSTALL_PREFIX}\"" +) +target_compile_definitions( + application-api-tests PRIVATE "-DTEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"" +) target_compile_definitions(application-api-tests PRIVATE "-DQUICK_TESTS_ONLY") -add_test(NAME application-api-tests - COMMAND application-api-tests --log_level=message --report_level=short) +add_test( + NAME application-api-tests + COMMAND application-api-tests --log_level=message --report_level=short +) set_property(TEST application-api-tests PROPERTY LABELS ApplicationApi Daily) # Tests for Continuous Integration builds -add_test(NAME application-api-ci-tests - COMMAND application-api-tests - --run_test=@ci - --log_level=message - --report_level=short) +add_test( + NAME application-api-ci-tests + COMMAND + application-api-tests + --run_test=@ci + --log_level=message + --report_level=short +) set_property(TEST application-api-ci-tests PROPERTY LABELS Continuous) foreach(keyfile IN LISTS KEY_LIBRARY_FILES) - add_custom_command(TARGET - application-api-tests - POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} - -E - copy_if_different # which executes "cmake - E - # copy_if_different..." - "${keyfile}" # <--this is in-file - "$/") + add_custom_command( + TARGET + application-api-tests + POST_BUILD # Adds a post-build event to api tests + COMMAND + ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E copy_if_different..." + "${keyfile}" # <--this is in-file + "$/" + ) # <--this is out-file path endforeach(keyfile) diff --git a/tests/helics/apps/CMakeLists.txt b/tests/helics/apps/CMakeLists.txt index 4e8216e651..70dca6e9dd 100644 --- a/tests/helics/apps/CMakeLists.txt +++ b/tests/helics/apps/CMakeLists.txt @@ -4,18 +4,20 @@ # file and DISCLAIMER for more details. # -set(helics_apps_test_sources - helics_apps_tests.cpp - multi_player_tests.cpp - multi_tests.cpp - PlayerTests.cpp - RecorderTests.cpp - exeTestHelper.cpp - combo_tests.cpp - EchoTests.cpp - TracerTests.cpp - SourceTests.cpp - exeTestHelper.h) +set( + helics_apps_test_sources + helics_apps_tests.cpp + multi_player_tests.cpp + multi_tests.cpp + PlayerTests.cpp + RecorderTests.cpp + exeTestHelper.cpp + combo_tests.cpp + EchoTests.cpp + TracerTests.cpp + SourceTests.cpp + exeTestHelper.h +) add_executable(helics_apps-tests ${helics_apps_test_sources}) @@ -25,13 +27,16 @@ target_link_libraries(helics_apps-tests helics_apps-static helics_test_base) target_include_directories(helics_apps-tests PRIVATE ${PROJECT_SOURCE_DIR}/src) -target_compile_definitions(helics_apps-tests PRIVATE - -DTEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\") -target_compile_definitions(helics_apps-tests PRIVATE - -DHELICS_BUILD_LOC=\"${CMAKE_BINARY_DIR}/src/helics/\") +target_compile_definitions( + helics_apps-tests PRIVATE -DTEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\" +) +target_compile_definitions( + helics_apps-tests PRIVATE -DHELICS_BUILD_LOC=\"${CMAKE_BINARY_DIR}/src/helics/\" +) target_compile_definitions( helics_apps-tests PRIVATE - -DHELICS_INSTALL_LOC=\"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}\") + -DHELICS_INSTALL_LOC=\"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}\" +) if(DISABLE_SYSTEM_CALL_TESTS) target_compile_definitions(helics_apps-tests PRIVATE -DDISABLE_SYSTEM_CALL_TESTS=1) @@ -41,21 +46,25 @@ add_test(NAME helics_apps-tests COMMAND helics_apps-tests --report_level=short) set_property(TEST helics_apps-tests PROPERTY LABELS HelicsApps Daily) # Tests for Continous Integration builds -add_test(NAME helics_apps-ci-tests - COMMAND helics_apps-tests --run_test=@ci --report_level=short) +add_test( + NAME helics_apps-ci-tests + COMMAND helics_apps-tests --run_test=@ci --report_level=short +) set_property(TEST helics_apps-ci-tests PROPERTY LABELS Continuous) if(WIN32) foreach(keyfile IN LISTS KEY_LIBRARY_FILES) - add_custom_command(TARGET - helics_apps-tests - POST_BUILD # Adds a post-build event to core tests - COMMAND ${CMAKE_COMMAND} - -E - copy_if_different # which executes "cmake - E - # copy_if_different..." - "${keyfile}" # <--this is in-file - "$/") + add_custom_command( + TARGET + helics_apps-tests + POST_BUILD # Adds a post-build event to core tests + COMMAND + ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E copy_if_different..." + "${keyfile}" # <--this is in-file + "$/" + ) # <--this is out-file path endforeach(keyfile) endif(WIN32) diff --git a/tests/helics/common/CMakeLists.txt b/tests/helics/common/CMakeLists.txt index e558276a1e..287bdff62f 100644 --- a/tests/helics/common/CMakeLists.txt +++ b/tests/helics/common/CMakeLists.txt @@ -10,39 +10,47 @@ set(common_test_headers) -set(common_test_sources - common-tests.cpp - MappedVectorTests.cpp - MappedPointerVectorTests.cpp - DualMappedVectorTests.cpp - DualMappedPointerVectorTests.cpp - BlockingQueueTests.cpp - PriorityBlockingQueueTests.cpp - SimpleQueueTests.cpp - AirLockTests.cpp - TimeTests.cpp) +set( + common_test_sources + common-tests.cpp + MappedVectorTests.cpp + MappedPointerVectorTests.cpp + DualMappedVectorTests.cpp + DualMappedPointerVectorTests.cpp + BlockingQueueTests.cpp + PriorityBlockingQueueTests.cpp + SimpleQueueTests.cpp + AirLockTests.cpp + TimeTests.cpp +) add_executable(common-tests ${common_test_sources} ${common_test_headers}) target_link_libraries(common-tests PRIVATE helics-static helics_test_base) set_target_properties(common-tests PROPERTIES FOLDER tests) -add_test(NAME common-tests - COMMAND common-tests --log_level=message --report_level=short) -set_property(TEST common-tests - PROPERTY LABELS - Common - Daily - Continuous) +add_test( + NAME common-tests + COMMAND common-tests --log_level=message --report_level=short +) +set_property( + TEST common-tests + PROPERTY + LABELS + Common + Daily + Continuous +) foreach(keyfile IN LISTS KEY_LIBRARY_FILES) - add_custom_command(TARGET - common-tests - POST_BUILD # Adds a post-build event to core tests - COMMAND ${CMAKE_COMMAND} - -E - copy_if_different # which executes "cmake - E - # copy_if_different..." - "${keyfile}" # <--this is in-file - "$/") # <--this is out-file - # path + add_custom_command( + TARGET + common-tests + POST_BUILD # Adds a post-build event to core tests + COMMAND + ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E copy_if_different..." + "${keyfile}" # <--this is in-file + "$/" + ) # <--this is out-file path endforeach(keyfile) diff --git a/tests/helics/core/CMakeLists.txt b/tests/helics/core/CMakeLists.txt index c66aa02ce6..f6231896ba 100644 --- a/tests/helics/core/CMakeLists.txt +++ b/tests/helics/core/CMakeLists.txt @@ -10,22 +10,24 @@ set(core_test_headers testFixtures.h) -set(core_test_sources - core-tests.cpp - InfoClass-tests.cpp - FederateState-tests.cpp - ActionMessage-tests.cpp - # CoreBroker-tests.cpp - CoreFactory-tests.cpp MessageTimerTests.cpp - # CommonCore-tests.cpp - TestCore-tests.cpp - testFixtures.cpp - IPCcore_tests.cpp - data-block-tests.cpp - UdpCore-tests.cpp - ForwardingTimeCoordinatorTests.cpp - TimeCoordinatorTests.cpp - networkInfoTests.cpp) +set( + core_test_sources + core-tests.cpp + InfoClass-tests.cpp + FederateState-tests.cpp + ActionMessage-tests.cpp + # CoreBroker-tests.cpp + CoreFactory-tests.cpp MessageTimerTests.cpp + # CommonCore-tests.cpp + TestCore-tests.cpp + testFixtures.cpp + IPCcore_tests.cpp + data-block-tests.cpp + UdpCore-tests.cpp + ForwardingTimeCoordinatorTests.cpp + TimeCoordinatorTests.cpp + networkInfoTests.cpp +) if(HELICS_HAVE_ZEROMQ) list(APPEND core_test_sources ZeromqCore-tests.cpp) @@ -49,22 +51,26 @@ add_test(NAME core-tests COMMAND core-tests --log_level=message --report_level=s set_property(TEST core-tests PROPERTY LABELS Core Daily) # Tests for Continuous Integration builds -add_test(NAME core-ci-tests - COMMAND core-tests - --run_test=@ci - --log_level=message - --report_level=short) +add_test( + NAME core-ci-tests + COMMAND + core-tests + --run_test=@ci + --log_level=message + --report_level=short +) set_property(TEST core-ci-tests PROPERTY LABELS Continuous) foreach(keyfile IN LISTS KEY_LIBRARY_FILES) - add_custom_command(TARGET - core-tests - POST_BUILD # Adds a post-build event to core tests - COMMAND ${CMAKE_COMMAND} - -E - copy_if_different # which executes "cmake - E - # copy_if_different..." - "${keyfile}" # <--this is in-file - "$/") # <--this is out- file - # path + add_custom_command( + TARGET + core-tests + POST_BUILD # Adds a post-build event to core tests + COMMAND + ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E copy_if_different..." + "${keyfile}" # <--this is in-file + "$/" + ) # <--this is out- file path endforeach(keyfile) diff --git a/tests/helics/shared_library/CMakeLists.txt b/tests/helics/shared_library/CMakeLists.txt index 4d1ea6da1f..a0fb6205a2 100644 --- a/tests/helics/shared_library/CMakeLists.txt +++ b/tests/helics/shared_library/CMakeLists.txt @@ -4,67 +4,88 @@ # file and DISCLAIMER for more details. # -set(c_shared_library_test_sources ctestFixtures.cpp shared-library-tests.cpp - # data_viewTests.cpp - test-value-federate1.cpp test-value-federate2.cpp - # ValueFederateTests2.cpp - FilterTests.cpp test-message-federate.cpp - # test-message-federate_cpp.cpp - # FederateTests.cpp - TimingTests.cpp - # iterationTests.cpp - QueryTests.cpp badInputTests.cpp) - -set(cpp_shared_library_test_sources cpptestFixtures.cpp cppshared-library-tests.cpp - # test-value-federate1_cpp.cpp - test-value-federate2_cpp.cpp - # FilterTests_cpp.cpp - test-message-federate_cpp.cpp - # FederateTests.cpp - # TimingTests.cpp - # iterationTests.cpp - # subPubObjectTests.cpp - # QueryTests.cpp - ) +set( + c_shared_library_test_sources ctestFixtures.cpp shared-library-tests.cpp + # data_viewTests.cpp + test-value-federate1.cpp test-value-federate2.cpp + # ValueFederateTests2.cpp + FilterTests.cpp test-message-federate.cpp + # test-message-federate_cpp.cpp + # FederateTests.cpp + TimingTests.cpp + # iterationTests.cpp + QueryTests.cpp badInputTests.cpp +) + +set( + cpp_shared_library_test_sources cpptestFixtures.cpp cppshared-library-tests.cpp + # test-value-federate1_cpp.cpp + test-value-federate2_cpp.cpp + # FilterTests_cpp.cpp + test-message-federate_cpp.cpp + # FederateTests.cpp + # TimingTests.cpp + # iterationTests.cpp + # subPubObjectTests.cpp + # QueryTests.cpp +) add_executable(shared-library-tests ${c_shared_library_test_sources} ctestFixtures.hpp) -add_executable(shared-library-tests-cpp ${cpp_shared_library_test_sources} - cpptestFixtures.hpp) - -target_link_libraries(shared-library-tests - helicsSharedLib - ${Boost_LIBRARIES_core} - helics_test_base) -target_link_libraries(shared-library-tests-cpp - helicsSharedLib - ${Boost_LIBRARIES_core} - helics_test_base) - -set_target_properties(shared-library-tests shared-library-tests-cpp - PROPERTIES FOLDER tests) - -target_compile_definitions(shared-library-tests PRIVATE - "-DHELICS_BROKER_LOCATION=\"${HELICS_BROKER_LOC}\"") -target_compile_definitions(shared-library-tests PRIVATE - "-DHELICS_INSTALL_LOCATION=\"${CMAKE_INSTALL_PREFIX}\"") - -target_compile_definitions(shared-library-tests PRIVATE - "-DTEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"") - -add_test(NAME shared-library-tests - COMMAND shared-library-tests --log_level=message --report_level=short) - -target_compile_definitions(shared-library-tests-cpp PRIVATE - "-DHELICS_BROKER_LOCATION=\"${HELICS_BROKER_LOC}\"") -target_compile_definitions(shared-library-tests-cpp PRIVATE - "-DHELICS_INSTALL_LOCATION=\"${CMAKE_INSTALL_PREFIX}\"") - -target_compile_definitions(shared-library-tests-cpp PRIVATE - "-DTEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"") - -add_test(NAME shared-library-tests-cpp - COMMAND shared-library-tests-cpp --log_level=message --report_level=short) +add_executable( + shared-library-tests-cpp ${cpp_shared_library_test_sources} cpptestFixtures.hpp +) + +target_link_libraries( + shared-library-tests + helicsSharedLib + ${Boost_LIBRARIES_core} + helics_test_base +) +target_link_libraries( + shared-library-tests-cpp + helicsSharedLib + ${Boost_LIBRARIES_core} + helics_test_base +) + +set_target_properties( + shared-library-tests shared-library-tests-cpp + PROPERTIES FOLDER tests +) + +target_compile_definitions( + shared-library-tests PRIVATE "-DHELICS_BROKER_LOCATION=\"${HELICS_BROKER_LOC}\"" +) +target_compile_definitions( + shared-library-tests PRIVATE "-DHELICS_INSTALL_LOCATION=\"${CMAKE_INSTALL_PREFIX}\"" +) + +target_compile_definitions( + shared-library-tests PRIVATE "-DTEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"" +) + +add_test( + NAME shared-library-tests + COMMAND shared-library-tests --log_level=message --report_level=short +) + +target_compile_definitions( + shared-library-tests-cpp PRIVATE "-DHELICS_BROKER_LOCATION=\"${HELICS_BROKER_LOC}\"" +) +target_compile_definitions( + shared-library-tests-cpp PRIVATE + "-DHELICS_INSTALL_LOCATION=\"${CMAKE_INSTALL_PREFIX}\"" +) + +target_compile_definitions( + shared-library-tests-cpp PRIVATE "-DTEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"" +) + +add_test( + NAME shared-library-tests-cpp + COMMAND shared-library-tests-cpp --log_level=message --report_level=short +) set_property(TEST shared-library-tests PROPERTY LABELS SharedLibrary Daily) # Setting a different label, because the test fixture for the C++ shared library tests @@ -73,16 +94,22 @@ set_property(TEST shared-library-tests PROPERTY LABELS SharedLibrary Daily) set_property(TEST shared-library-tests-cpp PROPERTY LABELS SharedLibraryCpp Daily) # Tests used for Continuous Integration builds -add_test(NAME shared-library-ci-tests - COMMAND shared-library-tests - --run_test=@ci - --log_level=message - --report_level=short) -add_test(NAME shared-library-ci-tests-cpp - COMMAND shared-library-tests-cpp - --run_test=@ci - --log_level=message - --report_level=short) +add_test( + NAME shared-library-ci-tests + COMMAND + shared-library-tests + --run_test=@ci + --log_level=message + --report_level=short +) +add_test( + NAME shared-library-ci-tests-cpp + COMMAND + shared-library-tests-cpp + --run_test=@ci + --log_level=message + --report_level=short +) set_property(TEST shared-library-ci-tests PROPERTY LABELS Continuous) set_property(TEST shared-library-ci-tests-cpp PROPERTY LABELS Continuous) @@ -90,26 +117,30 @@ set_property(TEST shared-library-ci-tests-cpp PROPERTY LABELS Continuous) if(WIN32) foreach(keyfile IN LISTS KEY_LIBRARY_FILES) - add_custom_command(TARGET - shared-library-tests - POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} - -E - copy_if_different # which executes "cmake - E - # copy_if_different..." - "${keyfile}" # <--this is in-file - "$/") + add_custom_command( + TARGET + shared-library-tests + POST_BUILD # Adds a post-build event to api tests + COMMAND + ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E copy_if_different..." + "${keyfile}" # <--this is in-file + "$/" + ) # <--this is out-file path endforeach(keyfile) - add_custom_command(TARGET - shared-library-tests - POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} - -E - copy_if_different # which executes "cmake - E - # copy_if_different..." - "$" # <--this is in- file - "$/") + add_custom_command( + TARGET + shared-library-tests + POST_BUILD # Adds a post-build event to api tests + COMMAND + ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E copy_if_different..." + "$" # <--this is in- file + "$/" + ) # <--this is out-file path endif(WIN32) diff --git a/tests/helics/system_tests/CMakeLists.txt b/tests/helics/system_tests/CMakeLists.txt index cfa6fd250f..be42718aa6 100644 --- a/tests/helics/system_tests/CMakeLists.txt +++ b/tests/helics/system_tests/CMakeLists.txt @@ -4,51 +4,62 @@ # file and DISCLAIMER for more details. # -set(system_test_sources - helics_system_tests.cpp - TimingTests.cpp - iterationTests.cpp - ErrorTests.cpp - federateRealTimeTests.cpp - TimingTests2.cpp - QueryTests.cpp - heat-transfer-tests.cpp - ../application_api/testFixtures.cpp - ../application_api/testFixtures.hpp) +set( + system_test_sources + helics_system_tests.cpp + TimingTests.cpp + iterationTests.cpp + ErrorTests.cpp + federateRealTimeTests.cpp + TimingTests2.cpp + QueryTests.cpp + heat-transfer-tests.cpp + ../application_api/testFixtures.cpp + ../application_api/testFixtures.hpp +) add_executable(system-tests ${system_test_sources} ${system_test_headers}) target_link_libraries(system-tests helics-static helics_test_base) set_target_properties(system-tests PROPERTIES FOLDER tests) -target_compile_definitions(system-tests PRIVATE - "-DHELICS_BROKER_LOCATION=\"${HELICS_BROKER_LOC}\"") -target_compile_definitions(system-tests PRIVATE - "-DHELICS_INSTALL_LOCATION=\"${CMAKE_INSTALL_PREFIX}\"") -target_compile_definitions(system-tests PRIVATE - "-DTEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"") +target_compile_definitions( + system-tests PRIVATE "-DHELICS_BROKER_LOCATION=\"${HELICS_BROKER_LOC}\"" +) +target_compile_definitions( + system-tests PRIVATE "-DHELICS_INSTALL_LOCATION=\"${CMAKE_INSTALL_PREFIX}\"" +) +target_compile_definitions( + system-tests PRIVATE "-DTEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"" +) -add_test(NAME system-tests - COMMAND system-tests --log_level=message --report_level=short) +add_test( + NAME system-tests + COMMAND system-tests --log_level=message --report_level=short +) set_property(TEST system-tests PROPERTY LABELS System Daily) # Tests for Continuous Integration builds -add_test(NAME system-ci-tests - COMMAND system-tests - --run_test=@ci - --log_level=message - --report_level=short) +add_test( + NAME system-ci-tests + COMMAND + system-tests + --run_test=@ci + --log_level=message + --report_level=short +) set_property(TEST system-ci-tests PROPERTY LABELS Continuous) foreach(keyfile IN LISTS KEY_LIBRARY_FILES) - add_custom_command(TARGET - system-tests - POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} - -E - copy_if_different # which executes "cmake - E - # copy_if_different..." - "${keyfile}" # <--this is in-file - "$/") # <--this is out-file - # path + add_custom_command( + TARGET + system-tests + POST_BUILD # Adds a post-build event to api tests + COMMAND + ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E copy_if_different..." + "${keyfile}" # <--this is in-file + "$/" + ) # <--this is out-file path endforeach(keyfile) diff --git a/tests/java_helics/CMakeLists.txt b/tests/java_helics/CMakeLists.txt index eb8574c4ef..10bc3a5823 100644 --- a/tests/java_helics/CMakeLists.txt +++ b/tests/java_helics/CMakeLists.txt @@ -15,7 +15,8 @@ add_custom_target( ${CMAKE_CURRENT_SOURCE_DIR}/HelloWorld.java DEPENDS JNIhelics ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar COMMENT "Building HelloWorld.java" - VERBATIM) + VERBATIM +) add_custom_target( Java_Helics_Api @@ -28,7 +29,8 @@ add_custom_target( ${CMAKE_CURRENT_SOURCE_DIR}/JavaHelicsApiTests.java DEPENDS JNIhelics ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar COMMENT "Building JavaHelicsApiTests.java" - VERBATIM) + VERBATIM +) add_custom_target( Java_MessageFederate @@ -41,7 +43,8 @@ add_custom_target( ${CMAKE_CURRENT_SOURCE_DIR}/TestMessageFederate.java DEPENDS JNIhelics ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar COMMENT "Building MessageFederate.java" - VERBATIM) + VERBATIM +) add_custom_target( Java_MessageFilter @@ -54,7 +57,8 @@ add_custom_target( ${CMAKE_CURRENT_SOURCE_DIR}/TestMessageFilter.java DEPENDS JNIhelics ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar COMMENT "Building MessageFilter.java" - VERBATIM) + VERBATIM +) add_custom_target( Java_ValueFederate @@ -67,7 +71,8 @@ add_custom_target( ${CMAKE_CURRENT_SOURCE_DIR}/TestValueFederate.java DEPENDS JNIhelics ${CMAKE_BINARY_DIR}/swig/java/buildjar/helics-${HELICS_VERSION}.jar COMMENT "Building ValueFederate.java" - VERBATIM) + VERBATIM +) # Windows uses a different separator for Java classpaths than other platforms if(CMAKE_HOST_WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") @@ -75,73 +80,94 @@ if(CMAKE_HOST_WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") else() set(CMAKE_JAVA_INCLUDE_FLAG_SEP ":") endif() -set(java_test_classpath - "${helicsJar}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_CURRENT_BINARY_DIR}") - -add_test(NAME Java_hello_world_test - COMMAND ${Java_JAVA_EXECUTABLE} - -Djava.library.path=$ -classpath - "${java_test_classpath}" HelloWorld) - -add_test(NAME Java_Helics_Api_tests - COMMAND ${Java_JAVA_EXECUTABLE} - -Djava.library.path=$ -classpath - "${java_test_classpath}" JavaHelicsApiTests) - -add_test(NAME Java_MessageFederate_test - COMMAND ${Java_JAVA_EXECUTABLE} - -Djava.library.path=$ -classpath - "${java_test_classpath}" TestMessageFederate) - -add_test(NAME Java_MessageFilter_test - COMMAND ${Java_JAVA_EXECUTABLE} - -Djava.library.path=$ -classpath - "${java_test_classpath}" TestMessageFilter) - -add_test(NAME Java_ValueFederate_test - COMMAND ${Java_JAVA_EXECUTABLE} - -Djava.library.path=$ -classpath - "${java_test_classpath}" TestValueFederate) - -set_target_properties(Java_hello_world - Java_Helics_Api - Java_MessageFederate - Java_MessageFilter - Java_ValueFederate - PROPERTIES FOLDER tests) - -set_property(TEST Java_hello_world_test - Java_Helics_Api_tests - Java_MessageFederate_test - Java_MessageFilter_test - Java_ValueFederate_test - PROPERTY LABELS - Java - Continuous - Daily) +set( + java_test_classpath + "${helicsJar}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_CURRENT_BINARY_DIR}" +) + +add_test( + NAME Java_hello_world_test + COMMAND + ${Java_JAVA_EXECUTABLE} -Djava.library.path=$ -classpath + "${java_test_classpath}" HelloWorld +) + +add_test( + NAME Java_Helics_Api_tests + COMMAND + ${Java_JAVA_EXECUTABLE} -Djava.library.path=$ -classpath + "${java_test_classpath}" JavaHelicsApiTests +) + +add_test( + NAME Java_MessageFederate_test + COMMAND + ${Java_JAVA_EXECUTABLE} -Djava.library.path=$ -classpath + "${java_test_classpath}" TestMessageFederate +) + +add_test( + NAME Java_MessageFilter_test + COMMAND + ${Java_JAVA_EXECUTABLE} -Djava.library.path=$ -classpath + "${java_test_classpath}" TestMessageFilter +) + +add_test( + NAME Java_ValueFederate_test + COMMAND + ${Java_JAVA_EXECUTABLE} -Djava.library.path=$ -classpath + "${java_test_classpath}" TestValueFederate +) + +set_target_properties( + Java_hello_world + Java_Helics_Api + Java_MessageFederate + Java_MessageFilter + Java_ValueFederate + PROPERTIES FOLDER tests +) + +set_property( + TEST + Java_hello_world_test + Java_Helics_Api_tests + Java_MessageFederate_test + Java_MessageFilter_test + Java_ValueFederate_test + PROPERTY + LABELS + Java + Continuous + Daily +) if(WIN32) foreach(keyfile IN LISTS KEY_LIBRARY_FILES) - add_custom_command(TARGET - Java_Helics_Api - POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} - -E - copy_if_different # which executes "cmake - E - # copy_if_different..." - "${keyfile}" # <--this is in-file - "${CMAKE_CURRENT_BINARY_DIR}/") # <--this is out- file - # path + add_custom_command( + TARGET + Java_Helics_Api + POST_BUILD # Adds a post-build event to api tests + COMMAND + ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E copy_if_different..." + "${keyfile}" # <--this is in-file + "${CMAKE_CURRENT_BINARY_DIR}/" + ) # <--this is out- file path endforeach(keyfile) - add_custom_command(TARGET - Java_Helics_Api - POST_BUILD # Adds a post-build event to api tests - COMMAND ${CMAKE_COMMAND} - -E - copy_if_different # which executes "cmake - E - # copy_if_different..." - "$" # <--this is in- file - "${CMAKE_CURRENT_BINARY_DIR}/") # <--this is out- file path + add_custom_command( + TARGET + Java_Helics_Api + POST_BUILD # Adds a post-build event to api tests + COMMAND + ${CMAKE_COMMAND} + -E + copy_if_different # which executes "cmake - E copy_if_different..." + "$" # <--this is in- file + "${CMAKE_CURRENT_BINARY_DIR}/" + ) # <--this is out- file path endif(WIN32) diff --git a/tests/matlab_helics/CMakeLists.txt b/tests/matlab_helics/CMakeLists.txt index 385e6f55cc..098de12acc 100644 --- a/tests/matlab_helics/CMakeLists.txt +++ b/tests/matlab_helics/CMakeLists.txt @@ -6,19 +6,28 @@ if(WIN32) configure_file(runTestsWIN32.m.in runTests.m) - add_test(NAME matlab_tests - COMMAND ${Matlab_MAIN_PROGRAM} -nojvm -nosplash -minimize -r - "\"run('${CMAKE_CURRENT_BINARY_DIR}/runTests.m');quit;\"") + add_test( + NAME matlab_tests + COMMAND + ${Matlab_MAIN_PROGRAM} -nojvm -nosplash -minimize -r + "\"run('${CMAKE_CURRENT_BINARY_DIR}/runTests.m');quit;\"" + ) else() configure_file(runTestsUNIX.m.in runTests.m) - add_test(NAME matlab_tests - COMMAND ${Matlab_MAIN_PROGRAM} -nojvm -nodisplay -nosplash -r - "\"run('${CMAKE_CURRENT_BINARY_DIR}/runTests.m');quit;\"") + add_test( + NAME matlab_tests + COMMAND + ${Matlab_MAIN_PROGRAM} -nojvm -nodisplay -nosplash -r + "\"run('${CMAKE_CURRENT_BINARY_DIR}/runTests.m');quit;\"" + ) endif() -set_property(TEST matlab_tests - PROPERTY LABELS - Matlab - Continuous - Daily) +set_property( + TEST matlab_tests + PROPERTY + LABELS + Matlab + Continuous + Daily +) diff --git a/tests/python_helics/CMakeLists.txt b/tests/python_helics/CMakeLists.txt index ed73c3c667..d41f594d88 100644 --- a/tests/python_helics/CMakeLists.txt +++ b/tests/python_helics/CMakeLists.txt @@ -6,31 +6,43 @@ endif(BUILD_PYTHON_INTERFACE) message(STATUS "Python ${PYTHON_EXECUTABLE}") -add_test(NAME python_basic_test - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/swig/python - COMMAND ${PYTHON_EXECUTABLE} -m pytest - ${CMAKE_CURRENT_SOURCE_DIR}/test_helics.py) +add_test( + NAME python_basic_test + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/swig/python + COMMAND + ${PYTHON_EXECUTABLE} -m pytest ${CMAKE_CURRENT_SOURCE_DIR}/test_helics.py +) -add_test(NAME python_message_federate_test - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/swig/python - COMMAND ${PYTHON_EXECUTABLE} -m pytest - ${CMAKE_CURRENT_SOURCE_DIR}/test_message_federate.py) +add_test( + NAME python_message_federate_test + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/swig/python + COMMAND + ${PYTHON_EXECUTABLE} -m pytest ${CMAKE_CURRENT_SOURCE_DIR}/test_message_federate.py +) -add_test(NAME python_message_filter_test - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/swig/python - COMMAND ${PYTHON_EXECUTABLE} -m pytest - ${CMAKE_CURRENT_SOURCE_DIR}/test_message_filter.py) +add_test( + NAME python_message_filter_test + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/swig/python + COMMAND + ${PYTHON_EXECUTABLE} -m pytest ${CMAKE_CURRENT_SOURCE_DIR}/test_message_filter.py +) -add_test(NAME python_value_federate_test - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/swig/python - COMMAND ${PYTHON_EXECUTABLE} -m pytest - ${CMAKE_CURRENT_SOURCE_DIR}/test_value_federate.py) +add_test( + NAME python_value_federate_test + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/swig/python + COMMAND + ${PYTHON_EXECUTABLE} -m pytest ${CMAKE_CURRENT_SOURCE_DIR}/test_value_federate.py +) -set_property(TEST python_basic_test - python_message_federate_test - python_message_filter_test - python_value_federate_test - PROPERTY LABELS - Python - Continuous - Daily) +set_property( + TEST + python_basic_test + python_message_federate_test + python_message_filter_test + python_value_federate_test + PROPERTY + LABELS + Python + Continuous + Daily +) From 4983deb128f80cd890baef0e4499048976deab2e Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Wed, 1 Aug 2018 14:21:55 -0600 Subject: [PATCH 04/16] Add cmake-format helper script --- scripts/cmake-format-helper.py | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 scripts/cmake-format-helper.py diff --git a/scripts/cmake-format-helper.py b/scripts/cmake-format-helper.py new file mode 100755 index 0000000000..adbb443fe7 --- /dev/null +++ b/scripts/cmake-format-helper.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 + +import os +import subprocess +import shlex + +CURRENT_DIRECTORY = os.path.realpath(os.path.dirname(__file__)) + + +def format_file(filename): + """ Format cmake files """ + + cmd = f"cmake-format -i {filename} --line-width=88 --dangle-parens=True" + print(f"Formatting {filename}") + p = subprocess.Popen(shlex.split(cmd)) + p.__filename = filename + return p + + +def main(): + """ cmake-format helper script """ + + processes = [] + + for r, _, files in os.walk(os.path.join(CURRENT_DIRECTORY, "..")): + for filename in files: + if filename == "CMakeLists.txt": + processes.append(format_file(os.path.abspath(os.path.join(r, filename)))) + + for p in processes: + p.wait() + if p.returncode != 0: + print(p.__filename) + + +if __name__ == "__main__": + + main() From 42cb175c4f9aeb9a55021d453627fe4d6512647f Mon Sep 17 00:00:00 2001 From: Philip Top Date: Thu, 2 Aug 2018 21:10:05 -0700 Subject: [PATCH 05/16] Test fixes (#424) * update version numbers changelog and roadmap * update appveyor.yml * update changelog * update timeout, fix incorrect field detection in Toml reader for filters, try fix on tcp_comms test * revert tcpcore test changes, fix additional issues with the toml reader and json readers resulting from actually fixing the previous bug. * update some flags, to clear up gcc 8 warnings. Make attributes dependent on using c++17 instead of a compiler check which wasn't working very well. and remove the associated compiler check code. * try a repeated check on the tcp_core test --- .travis.yml | 2 +- CHANGELOG.md | 4 + CMakeLists.txt | 4 +- README.md | 4 +- config/cmake/compiler_flags.cmake | 6 +- config/cmake/configGenerator.cmake | 6 +- .../test_compiler_cxx/check_constexpr_if.cpp | 9 --- .../test_compiler_cxx/check_fallthrough.cpp | 17 ---- .../cmake/test_compiler_cxx/check_unused.cpp | 9 --- examples/example_files/example_combo_fed.toml | 61 +++++++++++++++ examples/example_files/example_filters.toml | 78 +++++++++++++++++++ .../example_files/example_message_fed.toml | 37 +++++++++ examples/example_files/example_value_fed.toml | 50 ++++++++++++ src/helics/application_api/Federate.cpp | 42 +++------- tests/helics/application_api/CMakeLists.txt | 2 +- tests/helics/core/TcpCore-tests.cpp | 14 ++-- tests/helics/shared_library/CMakeLists.txt | 4 +- 17 files changed, 266 insertions(+), 83 deletions(-) delete mode 100644 config/cmake/test_compiler_cxx/check_constexpr_if.cpp delete mode 100644 config/cmake/test_compiler_cxx/check_fallthrough.cpp delete mode 100644 config/cmake/test_compiler_cxx/check_unused.cpp create mode 100644 examples/example_files/example_combo_fed.toml create mode 100644 examples/example_files/example_filters.toml create mode 100644 examples/example_files/example_message_fed.toml create mode 100644 examples/example_files/example_value_fed.toml diff --git a/.travis.yml b/.travis.yml index 7535d73a37..e6c04d07bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -202,7 +202,7 @@ script: - if [[ "TRAVIS_OS_NAME" == "osx" ]] ; then python ../scripts/fix_install_names.py ; fi - if [[ "TRAVIS_OS_NAME" == "osx" ]] ; then make ${MAKEFLAGS} install ; fi - - ctest --output-on-failure --timeout 180 -L Continuous + - ctest --output-on-failure --timeout 220 -L Continuous # Gather coverage results - if [[ "$BUILD_TYPE" == "Coverage" ]]; then pushd .. && scripts/lcov-helper.sh gather-coverage-info --gcov ${GCOV_TOOL} --codecov && popd ; fi diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c89b13790..fd2780b1bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed - some CMake options have been removed (BUILD_BROKER) - major changes to the build of the CTest testing Framework + - moved most examples to new [HELICS-Examples](https://github.com/GMLC-TDC/HELICS-Examples) Repo ### Fixed - potential segmentation fault in C shared library when calling free with invalid object. @@ -29,6 +30,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Environment variables are recognized in CMAKE find options - split API tests from system wide tests - added options on MSVC to build with embedded system libraries and embedded debug info. + +### Removed + - Most examples are now located in [HELICS-Examples](https://github.com/GMLC-TDC/HELICS-Examples) ## [1.2.1] - 2018-06-30 ### Fixed diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d293599c0..4335ce40c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,13 +7,13 @@ cmake_minimum_required(VERSION 3.4) cmake_policy(VERSION 3.4) -project(HELICS VERSION 1.3.0) +project (HELICS VERSION 1.3.0) # ----------------------------------------------------------------------------- # HELICS Version number # ----------------------------------------------------------------------------- set(HELICS_VERSION_BUILD) -set(HELICS_DATE "07-31-18") +set (HELICS_DATE "07-31-18") set( HELICS_VERSION_UNDERSCORE diff --git a/README.md b/README.md index 614e4f6085..ad8ca1ea50 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Welcome to the repository for the Hierarchical Engine for Large-scale Infrastruc **Motivation:** Energy systems and their associated information and communication technology systems are becoming increasingly intertwined. As a result, effectively designing, analyzing, and implementing modern energy systems increasingly relies on advanced modeling that simultaneously captures both the cyber and physical domains in combined simulations. It is designed to increase scalability and portability in modeling advanced features of highly integrated power system and cyber-physical energy systems. -# Install Instructions +# Installation Instructions [Windows](https://gmlc-tdc.github.io/HELICS-src/installation/windows.html) @@ -29,6 +29,8 @@ We've created a series of roughly 10-minute mini-tutorial videos that discuss va The [Introduction to the HELICS documentation](https://gmlc-tdc.github.io/HELICS-src/introduction/index.html) steps through a series of examples that step through the basic usage and concepts of HELICS. +Several Examples of HELICS federates and projects are located in [HELICS-Examples](https://github.com/GMLC-TDC/HELICS-Examples). This repo provides a number of examples using the different libraries and interfaces. + The [HELICS-Tutorial repository](https://github.com/GMLC-TDC/HELICS-Tutorial) provides a series of tutorials using HELICS to build a co-simulation using domain-specific external modeling tools that is built around an electric power system use case with integrated transmission-distribution-market-communication quasi-steady-state-timeseries (QSTS) simulation. The [HELICS-Use-Cases repository](https://github.com/GMLC-TDC/HELICS-Use-Cases) includes examples for a growing range of research use cases for inspiration. diff --git a/config/cmake/compiler_flags.cmake b/config/cmake/compiler_flags.cmake index eb784367fe..3b66d805d1 100644 --- a/config/cmake/compiler_flags.cmake +++ b/config/cmake/compiler_flags.cmake @@ -31,7 +31,8 @@ if(UNIX) #add_compile_options($<$:-Wredundant-decls>) add_compile_options($<$:-Wundef>) if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") - add_compile_options($<$:-Wstrict-overflow=5>) + #this produces a lot of noise on newer compilers + #add_compile_options($<$:-Wstrict-overflow=5>) add_compile_options($<$:-Wcast-align>) endif() #this options produces lots of warning but is useful for checking every once in a while with Clang, GCC warning notices with this aren't as useful @@ -47,6 +48,9 @@ if(UNIX) endif() if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0) add_compile_options($<$:-Wimplicit-fallthrough=2>) + endif() + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.9) + add_compile_options($<$:-Wclass-memaccess>) endif() endif() endif(ENABLE_EXTRA_COMPILER_WARNINGS) diff --git a/config/cmake/configGenerator.cmake b/config/cmake/configGenerator.cmake index 9cb75dff34..fbef56b88a 100644 --- a/config/cmake/configGenerator.cmake +++ b/config/cmake/configGenerator.cmake @@ -27,11 +27,11 @@ try_compile(STRING_VIEW_AVAILABLE ${CMAKE_BINARY_DIR} ${TEST_CXX_DIRECTORY}/chec #try_compile(CLAMP_AVAILABLE ${CMAKE_BINARY_DIR} ${TEST_CXX_DIRECTORY}/check_clamp.cpp COMPILE_DEFINITIONS ${VERSION_OPTION}) #try_compile(HYPOT3_AVAILABLE ${CMAKE_BINARY_DIR} ${TEST_CXX_DIRECTORY}/check_hypot3.cpp COMPILE_DEFINITIONS ${VERSION_OPTION}) -try_compile(IFCONSTEXPR_AVAILABLE ${CMAKE_BINARY_DIR} ${TEST_CXX_DIRECTORY}/check_constexpr_if.cpp COMPILE_DEFINITIONS ${WERROR_FLAG} ) +set(IFCONSTEXPR_AVAILABLE TRUE) -try_compile(FALLTHROUGH_AVAILABLE ${CMAKE_BINARY_DIR} ${TEST_CXX_DIRECTORY}/check_fallthrough.cpp COMPILE_DEFINITIONS ${WERROR_FLAG} ${VERSION_OPTION}) +set(FALLTHROUGH_AVAILABLE TRUE) -try_compile(UNUSED_AVAILABLE ${CMAKE_BINARY_DIR} ${TEST_CXX_DIRECTORY}/check_unused.cpp COMPILE_DEFINITIONS ${WERROR_FLAG} ${VERSION_OPTION}) +set(UNUSED_AVAILABLE TRUE) endif(ENABLE_CXX_17) diff --git a/config/cmake/test_compiler_cxx/check_constexpr_if.cpp b/config/cmake/test_compiler_cxx/check_constexpr_if.cpp deleted file mode 100644 index a4263171ae..0000000000 --- a/config/cmake/test_compiler_cxx/check_constexpr_if.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#define CX 1 -int main() -{ - if constexpr (CX == 1) - return 1; - else - return 0; -} - diff --git a/config/cmake/test_compiler_cxx/check_fallthrough.cpp b/config/cmake/test_compiler_cxx/check_fallthrough.cpp deleted file mode 100644 index be501b8089..0000000000 --- a/config/cmake/test_compiler_cxx/check_fallthrough.cpp +++ /dev/null @@ -1,17 +0,0 @@ - -int main(int argc, char * /*argv*/[]) -{ - int count = 0; - switch (argc) - { - case 1: - count = 1; - [[fallthrough]]; - case 2: - count = 2; - break; - case 3: - count = 3; - } -} - diff --git a/config/cmake/test_compiler_cxx/check_unused.cpp b/config/cmake/test_compiler_cxx/check_unused.cpp deleted file mode 100644 index 853c73c9e7..0000000000 --- a/config/cmake/test_compiler_cxx/check_unused.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -#include -int main(int argc, char * /*argv*/[]) -{ - [[maybe_unused]] bool b = (argc>3); - assert(b); // in release mode, assert is compiled out, and b is unused - // no warning because it is declared [[maybe_unused]] -} - diff --git a/examples/example_files/example_combo_fed.toml b/examples/example_files/example_combo_fed.toml new file mode 100644 index 0000000000..0f7bb8b169 --- /dev/null +++ b/examples/example_files/example_combo_fed.toml @@ -0,0 +1,61 @@ +#this should be a valid json file (except comments are not recognized in standard JSON) +#example json configuration file for a message federate all arguments are optional +name="comboFed" # the name of the federate +#possible flags +observer=false # indicator that the federate does not send anything +rollback= false # indicator that the federate can use rollback -NOTE= not used at present +only_update_on_change=false #indicator that the federate should only indicate updated values on change +only_transmit_on_change=false #indicator that the federate should only publish if the value changed +source_only=false #indicator that the federate is only a source and is not expected to receive anything +uninterruptible=false #indicator that the federate should only return requested times +coreType="test" #the type of the core "test","zmq","udp","icp","tcp","mpi" +coreName="the name of the core" #this matters most for icp and test cores, can be empty +coreInit="1" # the initialization string for the core in the form of a command line arguments +maxIterations=10 #the maximum number of iterations for a time step +period= 1.0 #the period with which federate may return time +offset= 0.0 # the offset shift in the period +timeDelta=0.0 # the minimum time between subsequent return times +outputDelay=0 #the propagation delay for federates to send data +inputDelay=0 #the input delay for external data to propagate to federates + +#endpoints used in the federate +[[endpoints]] + +name="ept1" # the name of the publication + type="genmessage" # the type assocaited with a endpoint endpoint types have limited usefullness at present (optional) + global=true #set to true to make the key global (default is false in which case the publication is prepended with the federate name) +[[endpoints]] +name="ept2" # the name of the publication + type="message2" # the type assocaited with a endpoint (optional) + #the fact that there is no global value creates a local endpoint with global name comboFed/ept2 + + knownDestinations="ept1" #this value can be an array of strings or just a single one it names key paths + #knownDestinations can be used to optimize the communication pathways inside of HELICS + subscriptions="pub1" #subscribe an endpoint to a particular publication this means that an endpoint will get a message whenever anything is published to that particular key + #the message will be raw data so it would have to be translated to be useful. this can also be a json array to subscribe to multiple publications + +#Publications used in the federate +[[publications]] + +"key"="pub1" # the name of the publication + "type"="double" # the type assocaited with a publication (optional) + "unit"="m" # the units associated with a publication (optional) + "global"=true #set to true to make the key global (default is false in which case the publication is prepended with the federate name) + +[[publications]] +name="pub2" # the name of the publication (can be key or name) + type="double" # the type assocaited with a publication (optional) + #no global=true implies this will have the federate name prepended like comboFed/pub2 + +#subscriptions used in the federate +[[subscriptions]] + +key="pub1" # the key of the publication + type="double" # the type assocaited with a publication (optional) + required=true #set to true to make helics issue a warning if the publication is not found + +[[subscriptions]] +key="comboFed/pub2" # the name of the publication to subscribe to +shortcut="pubshortcut" #a naming shortcut for the publication for later retrieval + + diff --git a/examples/example_files/example_filters.toml b/examples/example_files/example_filters.toml new file mode 100644 index 0000000000..af8a84a963 --- /dev/null +++ b/examples/example_files/example_filters.toml @@ -0,0 +1,78 @@ +#example toml configuration file for a message federate that also creates some filters +name="filterFed" # the name of the federate + +#possible flags +observer=false # indicator that the federate does not send anything +rollback= false # indicator that the federate can use rollback -NOTE= not used at present +only_update_on_change=false #indicator that the federate should only indicate updated values on change +only_transmit_on_change=false #indicator that the federate should only publish if the value changed +source_only=false #indicator that the federate is only a source and is not expected to receive anything +uninterruptible=false #indicator that the federate should only return requested times +coreType="test" #the type of the core "test","zmq","udp","icp","tcp","mpi" +coreName="the name of the core" #this matters most for icp and test cores, can be empty +coreInit="1" # the initialization string for the core in the form of a command line arguments +maxIterations=10 #the maximum number of iterations for a time step +period= 1.0 #the period with which federate may return time +offset= 0.0 # the offset shift in the period +timeDelta=0.0 # the minimum time between subsequent return times +outputDelay=0 #the propagation delay for federates to send data +inputDelay=0 #the input delay for external data to propagate to federates +separator=":" # set the character separator for local interfaces + +#endpoints used in the federate not really necessary to define endpoints for a filer +[[endpoints]] +name="ept1" # the name of the endpoint + type="genmessage" # the type assocaited with a endpoint endpoint types have limited usefullness at present (optional) + global=true #set to true to make the key global (default is false in which case the endpoint is prepended with the federate name) + + +[[endpoints]] +name="clonedest" # the name of the endpoint + global=true #set to true to make the key global (default is false in which case the endpoint is prepended with the federate name) + + +[[endpoints]] +name="ept2" # the name of the endpoint + type="message2" # the type assocaited with a endpoint (optional) + + #the fact that there is no global value creates a local endpoint with global name messageFed/ept2 + knownDestinations="ept1" #this value can be an array of strings or just a single one it names key paths + + #knownDestinations can be used to optimize the communication pathways inside of HELICS + subscriptions="fed2/sub1" #subscribe an endpoint to a particular publication this means that an endpoint will get a message whenever anything is published to that particular key + #the message will be raw data so it would have to be translated to be useful. this can also be a json array to subscribe to multiple publications + +[[filters]] + name="filtername" #filters can have names (optional) + target="ept1" #this is a key field specifying the target endpoint + #inputType="genmessage" #can trigger some warnings if there is mismatches for custom filters only used if operation is "custom" + #outputType="genmessage" #this could be useful if the filter actually translates the data and can be used to automatically order filters + mode="source" #source is the default but can be "source","destination","clone","cloning" + operation="delay" #currently valid operations are "delay","clone","cloning","timedelay","randomdelay","randomdrop","reroute","redirect","custom" + #additional properties for filters are specified in a property array or object if there is just a single one + #A delay filter just has a single property + properties= {name="delay", value=0.2} #times default to seconds though units can also be specified "200 ms" or similar + +[[filters]] + name="filtername2" #filters can have names (optional) + target="filterFed/ept2" #this is a key field specifying the target endpoint + mode="source" #source is the default but can be "source","destination","clone","cloning" + operation="reroute" #currently valid operations are "delay","clone","cloning","timedelay","randomdelay","randomdrop","reroute","redirect","custom" + #additional properties for filters are specified in a property array or object if there is just a single one + #A reroute filter takes a new destination + #the value here is the endpoint that should be the new destination + properties= {name="newdestination", value="ept1"} +[[filters]] + name="filterClone" #filters can have names (optional) + target="ept2" #for cloning filters the target is the delivery address + mode="clone" #specify that this is cloning filter + #operation="clone" #cloning filters don't really need an operation since clone is all they do if one is specified it must be "clone" or "cloning" + [[filters.properties]] #additional properties for filters are specified in a property array or object if there is just a single one + name="destination" #destination adds a cloning filter for all messages delivered to a particular + value="ept1" #the value here the endpoint that will have its messages cloned + [[filters.properties]] + name="source" #source adds a cloning filter for all messages send from a particular endpoint + value="ept1" #the value here the endpoint that will have its messages cloned + #this pair of properties clone all messages to or from "ept1" this could also be done in one property with "endpoint" but this seemed more instructive in this file + + diff --git a/examples/example_files/example_message_fed.toml b/examples/example_files/example_message_fed.toml new file mode 100644 index 0000000000..2a7bd535a0 --- /dev/null +++ b/examples/example_files/example_message_fed.toml @@ -0,0 +1,37 @@ +#example toml configuration file for a message federate all arguments are optional +name="messageFed" # the name of the federate +#possible flags +observer=false # indicator that the federate does not send anything +rollback= false # indicator that the federate can use rollback -NOTE= not used at present +only_update_on_change=false #indicator that the federate should only indicate updated values on change +only_transmit_on_change=false #indicator that the federate should only publish if the value changed +source_only=false #indicator that the federate is only a source and is not expected to receive anything +uninterruptible=false #indicator that the federate should only return requested times +coreType="test" #the type of the core "test","zmq","udp","icp","tcp","mpi" +coreName="the name of the core" #this matters most for icp and test cores, can be empty +coreInit="1" # the initialization string for the core in the form of a command line arguments +maxIterations=10 #the maximum number of iterations for a time step +period= 1.0 #the period with which federate may return time +offset= 0.0 # the offset shift in the period +timeDelta=0.0 # the minimum time between subsequent return times +outputDelay=0 #the propagation delay for federates to send data +inputDelay=0 #the input delay for external data to propagate to federates + +#endpoints used in the federate +[[endpoints]] + +name="ept1" # the name of the publication + type="genmessage" # the type assocaited with a endpoint endpoint types have limited usefullness at present (optional) + global=true #set to true to make the key global (default is false in which case the publication is prepended with the federate name) + +[[endpoints]] +name="ept2" # the name of the publication + type="message2" # the type assocaited with a endpoint (optional) + #the fact that there is no global value creates a local endpoint with global name messageFed/ept2 + knownDestinations="ept1" #this value can be an array of strings or just a single one it names key paths + #knownDestinations can be used to optimize the communication pathways inside of HELICS + subscriptions="fed2/sub1" #subscribe an endpoint to a particular publication this means that an endpoint will get a message whenever anything is published to that particular key + #the message will be raw data so it would have to be translated to be useful. this can also be a json array to subscribe to multiple publications + + + diff --git a/examples/example_files/example_value_fed.toml b/examples/example_files/example_value_fed.toml new file mode 100644 index 0000000000..ec692f63c6 --- /dev/null +++ b/examples/example_files/example_value_fed.toml @@ -0,0 +1,50 @@ +#this is a toml configuration file for HELICS value federate +#example toml configuration file for a value federate all arguments are optional + +name="valueFed" # the name of the federate + +#possible flags + +# observer is an indicator that the federate does not send anything +observer=false + +rollback= false # indicator that the federate can use rollback -NOTE= not used at present +only_update_on_change=false #indicator that the federate should only indicate updated values on change +only_transmit_on_change=false #indicator that the federate should only publish if the value changed +source_only=false #indicator that the federate is only a source and is not expected to receive anything +uninterruptible=false #indicator that the federate should only return requested times +coreType="test" #the type of the core "test","zmq","udp","icp","tcp","mpi" +coreName="the name of the core" #this matters most for icp and test cores, can be empty +coreInit="1" # the initialization string for the core in the form of a command line arguments +maxIterations=10 #the maximum number of iterations for a time step +period= 1.0 #the period with which federate may return time +offset= 0.0 # the offset shift in the period +timeDelta=0.0 # the minimum time between subsequent return times +outputDelay=0 #the propagation delay for federates to send data +inputDelay=0 #the input delay for external data to propagate to federates + +#subscriptions used in the federate (also example of inline table +#set required to true to make helics issue a warning if the publication is not found +#example of inline tables (be careful it falls under the most recent [section] or [[table]] +subscriptions=[ +{key="pub1", type="double",required=true}, + # shortcut is a naming shortcut for the publication for later retrieval +{key="fedName:pub2", shortcut="pubshortcut"} +] + +#Publications used in the federate +[[publications]] +key="pub1" # the name of the publication + type="double" # the type assocaited with a publication (optional) + unit="m" # the units associated with a publication (optional) + global=true #set to true to make the key global (default is false in which case the publication is prepended with the federate name) + +[[publications]] +key="pub2" # the name of the publication + type="double" # the type assocaited with a publication (optional) + #no global=true implies this will have the federate name prepended like valueFed/pub2 + + + + + diff --git a/src/helics/application_api/Federate.cpp b/src/helics/application_api/Federate.cpp index 2772ca2cee..370ccc3074 100644 --- a/src/helics/application_api/Federate.cpp +++ b/src/helics/application_api/Federate.cpp @@ -681,35 +681,15 @@ void Federate::registerFilterInterfacesJson (const std::string &jsonString) { for (const auto &filt : doc["filters"]) { - std::string name; - bool useTypes = false; - if (filt.isMember ("name")) - { - name = filt["name"].asString (); - } - std::string target; - if (filt.isMember ("target")) - { - target = filt["target"].asString (); - } - std::string inputType; - if (filt.isMember ("inputType")) - { - inputType = filt["inputType"].asString (); - useTypes = true; - } - std::string outputType; - if (filt.isMember ("outputType")) - { - outputType = filt["outputType"].asString (); - useTypes = true; - } - std::string mode = "source"; - if (filt.isMember ("mode")) - { - mode = filt["mode"].asString (); - } + + std::string name = jsonGetOrDefault(filt, "name", std::string()); + std::string target = jsonGetOrDefault(filt, "target", std::string()); + std::string inputType = jsonGetOrDefault(filt, "inputType", std::string()); + std::string outputType = jsonGetOrDefault(filt, "outputType", std::string()); + bool useTypes = !((inputType.empty()) && (outputType.empty())); + std::string mode = jsonGetOrDefault(filt, "mode", "source"); + std::string operation ("custom"); if (filt.isMember ("operation")) { @@ -837,9 +817,9 @@ void Federate::registerFilterInterfacesToml (const std::string &tomlString) { std::string name = tomlGetOrDefault (filt, "name", std::string ()); std::string target = tomlGetOrDefault (filt, "target", std::string ()); - std::string inputType = tomlGetOrDefault (filt, "target", std::string ()); - std::string outputType = tomlGetOrDefault (filt, "target", std::string ()); - bool useTypes = ((inputType.empty ()) && (outputType.empty ())); + std::string inputType = tomlGetOrDefault (filt, "inputType", std::string ()); + std::string outputType = tomlGetOrDefault (filt, "outputType", std::string ()); + bool useTypes = !((inputType.empty()) && (outputType.empty())); std::string mode =tomlGetOrDefault (filt, "mode", std::string ("source")); diff --git a/tests/helics/application_api/CMakeLists.txt b/tests/helics/application_api/CMakeLists.txt index 68443db223..1fafdb217e 100644 --- a/tests/helics/application_api/CMakeLists.txt +++ b/tests/helics/application_api/CMakeLists.txt @@ -55,7 +55,7 @@ add_test( COMMAND application-api-tests --run_test=@ci - --log_level=message + --log_level=test_suite --report_level=short ) set_property(TEST application-api-ci-tests PROPERTY LABELS Continuous) diff --git a/tests/helics/core/TcpCore-tests.cpp b/tests/helics/core/TcpCore-tests.cpp index 8b3a561755..d92a60a27c 100644 --- a/tests/helics/core/TcpCore-tests.cpp +++ b/tests/helics/core/TcpCore-tests.cpp @@ -296,14 +296,16 @@ BOOST_AUTO_TEST_CASE (tcpComm_transmit_through) }); // need to launch the connection commands at the same time since they depend on each other in this case auto connected_fut = std::async (std::launch::async, [&comm] { return comm.connect (); }); - - bool connected = comm2.connect (); - BOOST_REQUIRE (connected); - connected = connected_fut.get (); - BOOST_REQUIRE (connected); + bool connected1 = comm2.connect(); + BOOST_REQUIRE(connected1); + bool connected2 = connected_fut.get (); + if (!connected2) + { //lets just try again if it is not connected + connected2 = comm.connect(); + } + BOOST_REQUIRE (connected2); comm.transmit (0, helics::CMD_ACK); - BOOST_CHECK (connected); std::this_thread::sleep_for (std::chrono::milliseconds (250)); if (counter2 != 1) { diff --git a/tests/helics/shared_library/CMakeLists.txt b/tests/helics/shared_library/CMakeLists.txt index a0fb6205a2..fdc05f3e47 100644 --- a/tests/helics/shared_library/CMakeLists.txt +++ b/tests/helics/shared_library/CMakeLists.txt @@ -99,7 +99,7 @@ add_test( COMMAND shared-library-tests --run_test=@ci - --log_level=message + --log_level=test_suite --report_level=short ) add_test( @@ -107,7 +107,7 @@ add_test( COMMAND shared-library-tests-cpp --run_test=@ci - --log_level=message + --log_level=test_suite --report_level=short ) From b5fd8e32dc916331d039b09c40e586e315d10fc6 Mon Sep 17 00:00:00 2001 From: Bryan Palmintier Date: Thu, 9 Aug 2018 14:01:32 -0700 Subject: [PATCH 06/16] Matlab example update (#429) * matlab fixes: clean and comment pireceiver, fix typo in startup * Clean & comment MATLAB pisender/receiver * streamline .gitignore * (MATLAB) Rename helicsEndFederate to helicsDestroyFederate * [MATLAB] Further cleanup of example --- .gitignore | 2 + swig/matlab/helicsDestroyFederate.m | 41 ++++++++ swig/matlab/helicsStartup.m | 40 +++++--- swig/matlab/pireceiver.m | 93 +++++++++++------- swig/matlab/pisender.m | 141 +++++++++++++++++++--------- 5 files changed, 223 insertions(+), 94 deletions(-) create mode 100644 swig/matlab/helicsDestroyFederate.m diff --git a/.gitignore b/.gitignore index edec17bb93..2c32f5f4a5 100644 --- a/.gitignore +++ b/.gitignore @@ -249,3 +249,5 @@ tags # End of https://www.gitignore.io/api/c++,c,python /build/Download/libzmq +### MATLAB ### +*.mex* diff --git a/swig/matlab/helicsDestroyFederate.m b/swig/matlab/helicsDestroyFederate.m new file mode 100644 index 0000000000..a3f93ed3a0 --- /dev/null +++ b/swig/matlab/helicsDestroyFederate.m @@ -0,0 +1,41 @@ +function helicsDestroyFederate(fed_info, close_library) +% helicsDestroyFederate helper function to abstract steps to close a HELICS federate +% +% helicsDestroyFederate(fed_info) Gets rid of all HELICS data and C +% objects associated with the federate described by fed_info. This +% includes "closing" the HELICS library so a new federate can be created +% in the same MATLAB session. +% +% helicsDestroyFederate(fed_info, false) Ends the federate, but does not +% close the HELICS library. This option is used when a single MATLAB +% session/program is managing multiple HELICS objects, such as multiple +% federates. In the multi-object case, the library should only be closed +% when destroying the last object. +% +% TODO: mauy eventually become part of the C library and called via SWIG mex + +if nargin <2 || isempty(close_library) + close_library = true; +end + +if nargin <1 || isempty(fed_info) + if close_library + warning('Empty fed_info, will not finalize or free HELICS federate. Will still close library') + else + warning('Nothing to do: Empty fed_info, not closing library') + end +else + status = helics.helicsFederateFinalize(fed_info); + if status ~= 0 + warning('Non-zero status (%d) returned in call to helicsFederateFinalize. Ignoring.', status) + end + + + helics.helicsFederateFree(fed_info); +end + +if close_library + %Note: helicsCloseLibrary is unrelated to the MATLAB library loading (from + %helicsStartup) + helics.helicsCloseLibrary(); +end \ No newline at end of file diff --git a/swig/matlab/helicsStartup.m b/swig/matlab/helicsStartup.m index 1bac065d4d..1dc24400b9 100644 --- a/swig/matlab/helicsStartup.m +++ b/swig/matlab/helicsStartup.m @@ -1,43 +1,53 @@ -disp('Loading HELICS ...') -if (exists('helicsLibPath','var')==1) - directory=helicsLibPath; -else - directory = fileparts(mfilename('fullpath')); +function success = helicsStartup(helicsLibPath) +% HELICSSTARTUP configures MATLAB for HELICS use + +if nargin < 1 + %If not specified use our location, which should have required lib once + %compiled/installed + helicsLibPath = fileparts(mfilename('fullpath')); end +fprintf('Loading HELICS (from %s)...\n', helicsLibPath) -listing = dir(fullfile(directory, '*helicsSharedLib.*')); +%% Extract HELICS library name in a cross-platform way +listing = dir(fullfile(helicsLibPath, '*helicsSharedLib.*')); libraryName = ''; +%TODO: vectorize (make MATLAB-esque) for i=1:numel(listing) - if ( endsWith(listing(i).name, '.h') == 1 ) + if endsWith(listing(i).name, '.h') continue; end - if ( endsWith(listing(i).name, '.lib') == 1 ) + if endsWith(listing(i).name, '.lib') continue; end - librarynName = listing(i).name; + libraryName = listing(i).name; end -if isempty(librarynName) +%% Try some backups if not found +if isempty(libraryName) %if we are empty try for a debug version listing = dir(fullfile(directory, '*helicsSharedLibd.*')); for i=1:numel(listing) - if ( endsWith(listing(i).name, '.h') == 1 ) + if endsWith(listing(i).name, '.h') continue; end - if ( endsWith(listing(i).name, '.lib') == 1 ) + if endsWith(listing(i).name, '.lib') continue; end - librarynName = listing(i).name; + libraryName = listing(i).name; end end if (~isempty(libraryName)) - loadlibrary(GetFullPath(fullfile(directory, librarynName))); + loadlibrary(GetFullPath(fullfile(helicsLibPath, libraryName))); else - disp('Unable to find library for helics') + disp('Unable to find library for HELICS') +end + +if nargout >1 + success = ~isempty(libraryName); end diff --git a/swig/matlab/pireceiver.m b/swig/matlab/pireceiver.m index 36874d1ce9..6fd8958d93 100644 --- a/swig/matlab/pireceiver.m +++ b/swig/matlab/pireceiver.m @@ -1,74 +1,97 @@ -%loadlibrary(GetFullPath('~/local/helics-develop/lib/libhelicsSharedLib.dylib')); - -fedinitstring = '--federates=1'; -deltat = 0.01; - +% PIRECEIVER script demonstrating MATLAB-HELICS interface +% +% See pisender for usage information +% +% This example attempts to request the next time equal to its +% sim_stop_time, but the corresponding pisender will request intermediate +% times such that the pireceiver will be granted times earlier than +% requested +% +% Note to non-programmers: if unfamiliar, the assert functions simply check +% if the condition is true and if so continues. If false, execution stops. + +%% Initialize HELICS library in MATLAB +helicsStartup() + +%% Configuration +deltat = 0.01; %Base time interval (seconds) +sim_stop_time = 20; + +% HELICS options +helics_core_type = 'zmq'; +fedinitstring = '--federates=1'; % required with current C interface when using separate processes for each federate + +%% Provide summary information helicsversion = helics.helicsGetVersion(); -display(strcat('PI RECEIVER: Helics version = ', helicsversion)); +fprintf('PI RECEIVER: Helics version = %s\n', helicsversion) -% Create Federate Info object that describes the federate properties +%% Create Federate Info object that describes the federate properties fedinfo = helics.helicsFederateInfoCreate(); +assert(not(isempty(fedinfo))) % Set Federate name -status = helics.helicsFederateInfoSetFederateName(fedinfo, 'TestB Federate'); +status = helics.helicsFederateInfoSetFederateName(fedinfo, 'MATLAB Pi Receiver Federate'); +assert(status==0) % Set core type from string -status = helics.helicsFederateInfoSetCoreTypeFromString(fedinfo, 'zmq'); +status = helics.helicsFederateInfoSetCoreTypeFromString(fedinfo, helics_core_type); +assert(status==0) % Federate init string status = helics.helicsFederateInfoSetCoreInitString(fedinfo, fedinitstring); +assert(status==0) -% Set the message interval (timedelta) for federate. Note that +%% Set the message interval (timedelta) for federate. +% Note: % HELICS minimum message time interval is 1 ns and by default % it uses a time delta of 1 second. What is provided to the -% setTimedelta routine is a multiplier for the default timedelta. +% setTimedelta routine is a multiplier for the default timedelta +% (default unit = seconds). -% Set one second message interval +% Set one message interval status = helics.helicsFederateInfoSetTimeDelta(fedinfo, deltat); +assert(status==0) status = helics.helicsFederateInfoSetLoggingLevel(fedinfo, 1); +assert(status==0) -% Create value federate +%% Actually create value federate vfed = helics.helicsCreateValueFederate(fedinfo); -display('PI RECEIVER: Value federate created'); +disp('PI RECEIVER: Value federate created'); -% Subscribe to PI SENDER's publication +% Subscribe to PI SENDER's publication (note: published as global) sub = helics.helicsFederateRegisterSubscription(vfed, 'testA', 'double', ''); -display('PI RECEIVER: Subscription registered'); +disp('PI RECEIVER: Subscription registered (testA)'); +%% Start execution status = helics.helicsFederateEnterExecutionMode(vfed); -display('PI RECEIVER: Entering execution mode'); - -value = 0.0; -prevtime = 0; - -currenttime = helics.helicsFederateRequestTime(vfed, 20); - -isupdated = helics.helicsSubscriptionIsUpdated(sub); - -if (isupdated == 1) - [result, value] = helics.helicsSubscriptionGetDouble(sub); - display(['PI RECEIVER: Received value = ', '', num2str(value), '', ' at time ', '', num2str(currenttime), ' from PI SENDER']); +if status == 0 + disp('PI RECEIVER: Entering execution mode'); +else + error('PI RECEIVER: Failed to enter execution mode (status = %d)\n Try running pisender.m first. (or start the broker seperately)', status); end +%% Execution Loop +granted_time =- 1; %Force at least one run -while currenttime <= 20 +%% Continue execution until end of requested simulation time +while granted_time <= sim_stop_time - [status, currenttime] = helics.helicsFederateRequestTime(vfed, 20); + [status, granted_time] = helics.helicsFederateRequestTime(vfed, sim_stop_time); + assert(status==0) isupdated = helics.helicsSubscriptionIsUpdated(sub); if (isupdated == 1) [result, value] = helics.helicsSubscriptionGetDouble(sub); - display(['PI RECEIVER: Received value = ', '', num2str(value), '', ' at time ', '', num2str(currenttime), ' from PI SENDER']); + fprintf('PI RECEIVER: Received value = %g at time %4.1f from PI SENDER\n', value, granted_time); end end -status = helics.helicsFederateFinalize(vfed); +%% Shutdown +helicsDestroyFederate(vfed); -helics.helicsFederateFree(vfed); -helics.helicsCloseLibrary(); +disp('PI RECEIVER: Federate finalized'); -display('PI RECEIVER: Federate finalized'); diff --git a/swig/matlab/pisender.m b/swig/matlab/pisender.m index 001b7e5afd..d78cd0fd89 100644 --- a/swig/matlab/pisender.m +++ b/swig/matlab/pisender.m @@ -1,85 +1,138 @@ - -%loadlibrary(GetFullPath('~/local/helics-develop/lib/libhelicsSharedLib.dylib')); - -initstring = '2 --name=mainbroker'; -fedinitstring = '--broker=mainbroker --federates=1'; -deltat = 0.01; - +% PISENDER script demonstrating MATLAB-HELICS interface +% +% Usage: +% 1. Start two separate MATLAB terminals +% 2. In the first: +% >> pisender +% 3. In the second: +% >> pireciever + + +%% Initialize HELICS library in MATLAB +helicsStartup() + +%% Configuration +deltat = 1; %Base time interval (seconds) +numsteps = 20; + +% HELICS options +% Note: these configure this matlab process to host the main broker and 1 +% federate +pisend_start_broker = true; +helics_core_type = 'zmq'; +broker_initstring = '2 --name=mainbroker'; +fed_initstring = '--broker=mainbroker --federates=1'; + +%% Provide summary information helicsversion = helics.helicsGetVersion(); -display(strcat('PI SENDER: Helics version = ', helicsversion)); +fprintf('PI SENDER (with main broker): Helics version = %s\n', helicsversion) -% Create broker -display('Creating Broker'); -broker = helics.helicsCreateBroker('zmq', '', initstring); -display('Created Broker'); +%% Create broker (if desired) +if pisend_start_broker + disp('Creating Broker'); + broker = helics.helicsCreateBroker(helics_core_type, '', broker_initstring); + disp('Created Broker'); -display('Checking if Broker is connected'); -isconnected = helics.helicsBrokerIsConnected(broker); -display('Checked if Broker is connected'); + fprintf('Checking if Broker is connected...'); + isconnected = helics.helicsBrokerIsConnected(broker); -if isconnected == 1; - display('Broker created and connected'); -end; + if isconnected == 1 + fprintf('SUCCESS, Broker created and connected\n'); + else + fprintf('\n') + error('NOT CONNECTED (helicsBrokerIsConnected return = %d)', isconnected) + end +end -% Create Federate Info object that describes the federate properties +%% Create Federate Info object that describes the federate properties fedinfo = helics.helicsFederateInfoCreate(); +assert(not(isempty(fedinfo))) % Set Federate name -status = helics.helicsFederateInfoSetFederateName(fedinfo, 'TestA Federate'); +status = helics.helicsFederateInfoSetFederateName(fedinfo, 'MATLAB Pi SENDER Federate'); +assert(status==0) % Set core type from string -status = helics.helicsFederateInfoSetCoreTypeFromString(fedinfo, 'zmq'); +status = helics.helicsFederateInfoSetCoreTypeFromString(fedinfo, helics_core_type); +assert(status==0) % Federate init string -status = helics.helicsFederateInfoSetCoreInitString(fedinfo, fedinitstring); +status = helics.helicsFederateInfoSetCoreInitString(fedinfo, fed_initstring); +assert(status==0) + -% Set the message interval (timedelta) for federate. Note th# +% Note: % HELICS minimum message time interval is 1 ns and by default % it uses a time delta of 1 second. What is provided to the -% setTimedelta routine is a multiplier for the default timedelta. +% setTimedelta routine is a multiplier for the default timedelta +% (default unit = seconds). -% Set one second message interval +% Set one message interval status = helics.helicsFederateInfoSetTimeDelta(fedinfo, deltat); +assert(status==0) status = helics.helicsFederateInfoSetLoggingLevel(fedinfo, 1); +assert(status==0) -% Create value federate +%% Actually create value federate vfed = helics.helicsCreateValueFederate(fedinfo); -display('PI SENDER: Value federate created'); +disp('PI SENDER: Value federate created'); -% Register the publication +%% Register our value to publish pub = helics.helicsFederateRegisterGlobalPublication(vfed, 'testA', 'double', ''); -display('PI SENDER: Publication registered'); +disp('PI SENDER: Publication registered (testA)'); -% Enter execution mode +%% Start execution status = helics.helicsFederateEnterExecutionMode(vfed); -display('PI SENDER: Entering execution mode'); +if status == 0 + disp('PI SENDER: Entering execution mode'); +else + error('PI SENDER: Failed to enter execution mode (status = %d)\n Try running pisender.m first. (or start the broker seperately)', status); +end +%% Execution Loop % This federate will be publishing deltat*pi for numsteps steps this_time = 0.0; value = pi; -for i = 1:20 +for i = 1:numsteps val = value; - currenttime = helics.helicsFederateRequestTime(vfed, i); + [status, granted_time] = helics.helicsFederateRequestTime(vfed, i); + assert(status==0) - display(['PI SENDER: Sending value pi = ', '', num2str(val), ' at time ', '', num2str(this_time + (deltat * i)),' to PI RECEIVER']); +% fprintf('PI SENDER: Sending value pi = %g at time %f to PI RECEIVER\n', val, this_time + (deltat * i)); + fprintf('PI SENDER: Publishing value pi = %g at time %4.1f... ', val, granted_time); status = helics.helicsPublicationPublishDouble(pub, val); + fprintf('DONE (status=%d)\n', status); end -status = helics.helicsFederateFinalize(vfed); -display('PI SENDER: Federate finalized'); - - -while helics.helicsBrokerIsConnected(broker) - pause(1); +%% Shutdown + +if pisend_start_broker + % If we started the broker in this thread, we have to be careful + % sequencing the shutdown in hopes of doing so cleanly + status = helics.helicsFederateFinalize(vfed); + disp('PI SENDER: Federate finalized'); + + %Make sure the broker is gone in case we have a lingering low-level + %reference (to avoid memory leaks) + for foo = 1:60 + if not(helics.helicsBrokerIsConnected(broker)) + break + end + pause(1); + end + disp('PI SENDER: Broker disconnected'); + + helics.helicsFederateFree(vfed); + helics.helicsCloseLibrary(); +else + %But if we just setup the federate, we can simply call endFederate + helicsDestroyFederate(vfed); %#ok + disp('PI SENDER: Federate finalized'); end -helics.helicsFederateFree(vfed); -helics.helicsCloseLibrary(); - -display('PI SENDER: Broker disconnected'); From c3d6f46ebfb023026d0998f8c116abb2b5880c1b Mon Sep 17 00:00:00 2001 From: Philip Top Date: Wed, 15 Aug 2018 11:43:37 -0700 Subject: [PATCH 07/16] just to get a sample for package building on msys2 --- config/packaging/mingw-w64-helics/PKGBUILD | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 config/packaging/mingw-w64-helics/PKGBUILD diff --git a/config/packaging/mingw-w64-helics/PKGBUILD b/config/packaging/mingw-w64-helics/PKGBUILD new file mode 100644 index 0000000000..fd1bdf790b --- /dev/null +++ b/config/packaging/mingw-w64-helics/PKGBUILD @@ -0,0 +1,55 @@ +# Maintainer: Philip Top + +_realname=helics +pkgbase=mingw-w64-${_realname} +pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}" +pkgver=2.0.0 +pkgrel=1 +pkgdesc="A C++ library for co-simulation" +arch=('any') +url="https://github.com/GMLC-TDC/HELICS-src" +license=('BSD') +makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" + "${MINGW_PACKAGE_PREFIX}-cmake" + "${MINGW_PACKAGE_PREFIX}-boost" + "${MINGW_PACKAGE_PREFIX}-zeromq" + "${MINGW_PACKAGE_PREFIX}-swig" + "${MINGW_PACKAGE_PREFIX}-python3") + +source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/GMLC-TDC/HELICS-src/archive/v${pkgver}.tar.gz" + 001-library-name.patch) +#sha256sums=('c49deac9e0933bcb7044f08516861a2d560988540b23de2ac1ad443b219afdb6' + # 'db74c4fb0e5b98a8365a99060166cfff36a7eda97f552cd838b8a7bb9799428a') + +prepare() { + cd ${_realname}-v${pkgver} +} + +build() { + declare -a extra_config + if check_option "debug" "n"; then + extra_config+=("-DCMAKE_BUILD_TYPE=Release") + else + extra_config+=("-DCMAKE_BUILD_TYPE=Debug") + fi + + [[ -d ${srcdir}/build-${MINGW_CHOST} ]] && rm -rf ${srcdir}/build-${MINGW_CHOST} + mkdir "${srcdir}/build-${MINGW_CHOST}" && cd "${srcdir}/build-${MINGW_CHOST}" + + MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \ + ${MINGW_PREFIX}/bin/cmake \ + -G"MSYS Makefiles" \ + -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \ + -DBUILD_SHARED_LIBS=ON \ + -DBUILD_STATIC_LIBS=ON \ + -DBUILD_TESTS=OFF \ + ${extra_config} \ + ../${_realname}-v${pkgver} + + make +} + +package() { + cd "${srcdir}/build-${MINGW_CHOST}" + make DESTDIR=${pkgdir} install +} \ No newline at end of file From 33cd11d049cf9c06cafd2d65fe917c2215ca7068 Mon Sep 17 00:00:00 2001 From: Bryan Palmintier Date: Wed, 22 Aug 2018 10:31:58 -0600 Subject: [PATCH 08/16] Relocating matlab examples to HELICS-Examples --- swig/matlab/pireceiver.m | 97 --------------------------- swig/matlab/pisender.m | 138 --------------------------------------- 2 files changed, 235 deletions(-) delete mode 100644 swig/matlab/pireceiver.m delete mode 100644 swig/matlab/pisender.m diff --git a/swig/matlab/pireceiver.m b/swig/matlab/pireceiver.m deleted file mode 100644 index 6fd8958d93..0000000000 --- a/swig/matlab/pireceiver.m +++ /dev/null @@ -1,97 +0,0 @@ -% PIRECEIVER script demonstrating MATLAB-HELICS interface -% -% See pisender for usage information -% -% This example attempts to request the next time equal to its -% sim_stop_time, but the corresponding pisender will request intermediate -% times such that the pireceiver will be granted times earlier than -% requested -% -% Note to non-programmers: if unfamiliar, the assert functions simply check -% if the condition is true and if so continues. If false, execution stops. - -%% Initialize HELICS library in MATLAB -helicsStartup() - -%% Configuration -deltat = 0.01; %Base time interval (seconds) -sim_stop_time = 20; - -% HELICS options -helics_core_type = 'zmq'; -fedinitstring = '--federates=1'; % required with current C interface when using separate processes for each federate - -%% Provide summary information -helicsversion = helics.helicsGetVersion(); - -fprintf('PI RECEIVER: Helics version = %s\n', helicsversion) - -%% Create Federate Info object that describes the federate properties -fedinfo = helics.helicsFederateInfoCreate(); -assert(not(isempty(fedinfo))) - -% Set Federate name -status = helics.helicsFederateInfoSetFederateName(fedinfo, 'MATLAB Pi Receiver Federate'); -assert(status==0) - -% Set core type from string -status = helics.helicsFederateInfoSetCoreTypeFromString(fedinfo, helics_core_type); -assert(status==0) - -% Federate init string -status = helics.helicsFederateInfoSetCoreInitString(fedinfo, fedinitstring); -assert(status==0) - -%% Set the message interval (timedelta) for federate. -% Note: -% HELICS minimum message time interval is 1 ns and by default -% it uses a time delta of 1 second. What is provided to the -% setTimedelta routine is a multiplier for the default timedelta -% (default unit = seconds). - -% Set one message interval -status = helics.helicsFederateInfoSetTimeDelta(fedinfo, deltat); -assert(status==0) - -status = helics.helicsFederateInfoSetLoggingLevel(fedinfo, 1); -assert(status==0) - -%% Actually create value federate -vfed = helics.helicsCreateValueFederate(fedinfo); -disp('PI RECEIVER: Value federate created'); - -% Subscribe to PI SENDER's publication (note: published as global) -sub = helics.helicsFederateRegisterSubscription(vfed, 'testA', 'double', ''); - -disp('PI RECEIVER: Subscription registered (testA)'); - -%% Start execution -status = helics.helicsFederateEnterExecutionMode(vfed); -if status == 0 - disp('PI RECEIVER: Entering execution mode'); -else - error('PI RECEIVER: Failed to enter execution mode (status = %d)\n Try running pisender.m first. (or start the broker seperately)', status); -end - -%% Execution Loop -granted_time =- 1; %Force at least one run - -%% Continue execution until end of requested simulation time -while granted_time <= sim_stop_time - - [status, granted_time] = helics.helicsFederateRequestTime(vfed, sim_stop_time); - assert(status==0) - - isupdated = helics.helicsSubscriptionIsUpdated(sub); - - if (isupdated == 1) - [result, value] = helics.helicsSubscriptionGetDouble(sub); - fprintf('PI RECEIVER: Received value = %g at time %4.1f from PI SENDER\n', value, granted_time); - end -end - -%% Shutdown -helicsDestroyFederate(vfed); - -disp('PI RECEIVER: Federate finalized'); - diff --git a/swig/matlab/pisender.m b/swig/matlab/pisender.m deleted file mode 100644 index d78cd0fd89..0000000000 --- a/swig/matlab/pisender.m +++ /dev/null @@ -1,138 +0,0 @@ -% PISENDER script demonstrating MATLAB-HELICS interface -% -% Usage: -% 1. Start two separate MATLAB terminals -% 2. In the first: -% >> pisender -% 3. In the second: -% >> pireciever - - -%% Initialize HELICS library in MATLAB -helicsStartup() - -%% Configuration -deltat = 1; %Base time interval (seconds) -numsteps = 20; - -% HELICS options -% Note: these configure this matlab process to host the main broker and 1 -% federate -pisend_start_broker = true; -helics_core_type = 'zmq'; -broker_initstring = '2 --name=mainbroker'; -fed_initstring = '--broker=mainbroker --federates=1'; - -%% Provide summary information -helicsversion = helics.helicsGetVersion(); - -fprintf('PI SENDER (with main broker): Helics version = %s\n', helicsversion) - -%% Create broker (if desired) -if pisend_start_broker - disp('Creating Broker'); - broker = helics.helicsCreateBroker(helics_core_type, '', broker_initstring); - disp('Created Broker'); - - fprintf('Checking if Broker is connected...'); - isconnected = helics.helicsBrokerIsConnected(broker); - - if isconnected == 1 - fprintf('SUCCESS, Broker created and connected\n'); - else - fprintf('\n') - error('NOT CONNECTED (helicsBrokerIsConnected return = %d)', isconnected) - end -end - -%% Create Federate Info object that describes the federate properties -fedinfo = helics.helicsFederateInfoCreate(); -assert(not(isempty(fedinfo))) - -% Set Federate name -status = helics.helicsFederateInfoSetFederateName(fedinfo, 'MATLAB Pi SENDER Federate'); -assert(status==0) - -% Set core type from string -status = helics.helicsFederateInfoSetCoreTypeFromString(fedinfo, helics_core_type); -assert(status==0) - -% Federate init string -status = helics.helicsFederateInfoSetCoreInitString(fedinfo, fed_initstring); -assert(status==0) - - -% Note: -% HELICS minimum message time interval is 1 ns and by default -% it uses a time delta of 1 second. What is provided to the -% setTimedelta routine is a multiplier for the default timedelta -% (default unit = seconds). - -% Set one message interval -status = helics.helicsFederateInfoSetTimeDelta(fedinfo, deltat); -assert(status==0) - -status = helics.helicsFederateInfoSetLoggingLevel(fedinfo, 1); -assert(status==0) - -%% Actually create value federate -vfed = helics.helicsCreateValueFederate(fedinfo); -disp('PI SENDER: Value federate created'); - -%% Register our value to publish -pub = helics.helicsFederateRegisterGlobalPublication(vfed, 'testA', 'double', ''); -disp('PI SENDER: Publication registered (testA)'); - -%% Start execution -status = helics.helicsFederateEnterExecutionMode(vfed); -if status == 0 - disp('PI SENDER: Entering execution mode'); -else - error('PI SENDER: Failed to enter execution mode (status = %d)\n Try running pisender.m first. (or start the broker seperately)', status); -end - -%% Execution Loop -% This federate will be publishing deltat*pi for numsteps steps -this_time = 0.0; -value = pi; - -for i = 1:numsteps - val = value; - - [status, granted_time] = helics.helicsFederateRequestTime(vfed, i); - assert(status==0) - -% fprintf('PI SENDER: Sending value pi = %g at time %f to PI RECEIVER\n', val, this_time + (deltat * i)); - fprintf('PI SENDER: Publishing value pi = %g at time %4.1f... ', val, granted_time); - status = helics.helicsPublicationPublishDouble(pub, val); - fprintf('DONE (status=%d)\n', status); -end - -%% Shutdown - -if pisend_start_broker - % If we started the broker in this thread, we have to be careful - % sequencing the shutdown in hopes of doing so cleanly - status = helics.helicsFederateFinalize(vfed); - disp('PI SENDER: Federate finalized'); - - %Make sure the broker is gone in case we have a lingering low-level - %reference (to avoid memory leaks) - for foo = 1:60 - if not(helics.helicsBrokerIsConnected(broker)) - break - end - pause(1); - end - disp('PI SENDER: Broker disconnected'); - - helics.helicsFederateFree(vfed); - helics.helicsCloseLibrary(); -else - %But if we just setup the federate, we can simply call endFederate - helicsDestroyFederate(vfed); %#ok - disp('PI SENDER: Federate finalized'); -end - - - From cc77268c829f03fa61c8c7adf7d8952be852ef8a Mon Sep 17 00:00:00 2001 From: Ryan Mast Date: Fri, 7 Sep 2018 12:48:11 -0700 Subject: [PATCH 09/16] Travis thread sanitizer and test execution changes (#436) * Initial CMake caches for sanitizers * Run tests using a script for a full set of coverage tests and thread sanitizer build * Make test running script executable * Use Coverage label for tests to run for code coverage * Name Travis jobs * Tweak syntax for job name to include quotes * Cache build/libs folder on Travis * Switch to using static ZeroMQ library for Travis builds * Create build directory using -p, now that a subdirectory is cached it could already exist * Remove Java, Matlab, and Python tests from Code Coverage build * Re-add code for installing ZMQ dependency, but only for non-Travis builds * Build and use static Boost on Travis * Set CMake variable for using static Boost library to ON in Travis * Compile static Boost with -fPIC * Add -fPIC to linkflags when building Boost * Another test with boost static and -fPIC * Make install dependency script generate option flags only when needed for -fPIC * Show full log for Boost building * Ditch user specified cxxflags for building Boost, can't get bash script to handle multiple flags in a variable working * Handle multiple cxx/link flags and sanitizer flag when building Boost * Build Boost with thread sanitizer flag for tsan builds on Travis * Reduce verbosity of Boost build process * Run system CI tests with Valgrind * Add linker flags for sanitizers * Remove XCode 9.4 build (to be readded when 6.4 is removed) --- .travis.yml | 65 +++++++++--- config/cmake/buildlibZMQ.cmake | 2 + scripts/asan-cache.cmake | 4 + scripts/install-ci-dependencies.sh | 8 +- scripts/install-dependency.sh | 43 ++++++-- scripts/msan-cache.cmake | 4 + scripts/run-ci-tests.sh | 110 ++++++++++++++++++++ scripts/tsan-cache.cmake | 4 + scripts/ubsan-cache.cmake | 4 + tests/helics/application_api/CMakeLists.txt | 2 +- tests/helics/apps/CMakeLists.txt | 2 +- tests/helics/common/CMakeLists.txt | 1 + tests/helics/core/CMakeLists.txt | 2 +- tests/helics/shared_library/CMakeLists.txt | 4 +- tests/helics/system_tests/CMakeLists.txt | 4 +- 15 files changed, 225 insertions(+), 34 deletions(-) create mode 100644 scripts/asan-cache.cmake create mode 100644 scripts/msan-cache.cmake create mode 100755 scripts/run-ci-tests.sh create mode 100644 scripts/tsan-cache.cmake create mode 100644 scripts/ubsan-cache.cmake diff --git a/.travis.yml b/.travis.yml index e6c04d07bb..3e64f2ece3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ cache: ccache: true directories: - dependencies + - build/libs before_cache: - ${TRAVIS_BUILD_DIR}/scripts/cleanup-cmake.sh @@ -49,6 +50,7 @@ jobs: include: # XCode 6.4, OS X 10.10 - <<: *osx_base + name: "XCode 6.4 macOS 10.10" env: - MATRIX_EVAL="COMPILER=clang && BUILD_TYPE=Release && TRAVIS_XCODE_VERSION=64" - HOMEBREW_NO_AUTO_UPDATE=1 @@ -56,22 +58,14 @@ jobs: osx_image: xcode6.4 # XCode 7.3, OS X 10.11 - <<: *osx_base + name: "XCode 7.3 macOS 10.11" env: - MATRIX_EVAL="COMPILER=clang && BUILD_TYPE=Release && TRAVIS_XCODE_VERSION=73" - HOMEBREW_NO_AUTO_UPDATE=1 osx_image: xcode7.3 - - <<: *osx_base - env: - - MATRIX_EVAL="COMPILER=clang && BUILD_TYPE=Release && TRAVIS_XCODE_VERSION=73" - - HOMEBREW_NO_AUTO_UPDATE=1 - # Built without errors on my clone from one of the changes made - # Possibly local dependencies, or removing Linux-only commands fixed it - # XCode 8.3, OS X 10.12 - #- env: COMPILER=clang++ BUILD_TYPE=Debug - # osx_image: xcode8.3 - - <<: *linux_base + name: "GCC 6" addons: apt: sources: @@ -84,6 +78,7 @@ jobs: - USE_MPI=mpich - <<: *linux_base + name: "GCC 4.9 (No SWIG)" addons: apt: sources: @@ -96,6 +91,7 @@ jobs: - CI_BOOST_VERSION=1.61.0 - <<: *linux_base + name: "Clang 3.6" compiler: clang addons: apt: @@ -112,20 +108,27 @@ jobs: # ------------------------------------------------ # Jobs for daily valgrind and code coverage tests # ------------------------------------------------ + # Valgrind build - <<: *daily_linux + name: "GCC 6 Valgrind" env: - MATRIX_EVAL="COMPILER=gcc && CC=gcc-6 && CXX=g++-6" - USE_SWIG=true - RUN_VALGRIND=true - BUILD_TYPE=RelWithDebInfo + # Code coverage build - <<: *daily_linux + name: "GCC 6 Code Coverage" env: - MATRIX_EVAL="COMPILER=gcc && CC=gcc-6 && CXX=g++-6" - - USE_SWIG=true + - USE_SWIG=true + - TEST_TYPE=Coverage - BUILD_TYPE=Coverage - GCOV_TOOL=gcov-6 - USE_MPI=mpich + # GCC 5 build - <<: *daily_linux + name: "GCC 5" addons: apt: sources: @@ -134,7 +137,9 @@ jobs: - g++-5 env: - MATRIX_EVAL="COMPILER=gcc && CC='gcc-5' && CXX='g++-5'" + # Clang 5 build - <<: *daily_linux + name: "Clang 5" compiler: clang addons: apt: @@ -149,8 +154,27 @@ jobs: - CCACHE_CPP2=yes - USE_SWIG=true - CXX_STANDARD=17 + # TSAN build + - <<: *daily_linux + name: "Clang 4 Thread Sanitizer" + compiler: clang + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - llvm-toolchain-trusty-4.0 + packages: + - libstdc++-6-dev + - clang-4.0 + env: + - MATRIX_EVAL="COMPILER=clang && CC='clang-4.0' && CXX='clang++-4.0'" + - CCACHE_CPP2=yes + - RUN_TSAN=true + - USE_MPI=mpich + - JOB_OPTION_FLAGS="-C../scripts/tsan-cache.cmake" # XCode 8gm, OS X 10.11 - <<: *daily_osx + name: "XCode 8gm macOS 10.11" env: - MATRIX_EVAL="COMPILER=clang && BUILD_TYPE=Release && TRAVIS_XCODE_VERSION=8gm" - HOMEBREW_NO_AUTO_UPDATE=1 @@ -165,11 +189,13 @@ before_install: - $CXX --version install: + - export BOOST_USE_STATIC=true - source scripts/install-ci-dependencies.sh - OPTION_FLAGS_ARR=() - OPTION_FLAGS_ARR+=("-DBUILD_C_SHARED_LIB=ON" "-DBUILD_CXX_SHARED_LIB=ON" "-DBUILD_PYTHON_INTERFACE=ON" "-DBUILD_JAVA_INTERFACE=ON" "-DEXAMPLES_WARNINGS_AS_ERROR=ON") - OPTION_FLAGS_ARR+=("-DPYTHON_LIBRARY=${PYTHON_LIB_PATH}" "-DPYTHON_INCLUDE_DIR=${PYTHON_INCLUDE_PATH}") + - OPTION_FLAGS_ARR+=("-DZMQ_USE_STATIC_LIBRARY=ON -DUSE_BOOST_STATIC_LIBS=ON") - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then OPTION_FLAGS_ARR+=("-DDISABLE_SYSTEM_CALL_TESTS=ON") ; fi @@ -181,20 +207,21 @@ install: - if [[ "$USE_MPI" ]]; then CC=${CI_DEPENDENCY_DIR}/mpi/bin/mpicc ; CXX=${CI_DEPENDENCY_DIR}/mpi/bin/mpic++ ; fi - export HELICS_OPTION_FLAGS=${OPTION_FLAGS_ARR[@]} - - TEST_FLAGS_ARR=() - - if [[ "$RUN_VALGRIND" ]]; then TEST_FLAGS_ARR+=("--valgrind") ; fi + - TEST_FLAGS_ARR=("$TEST_TYPE") + - if [[ "$RUN_VALGRIND" ]]; then TEST_FLAGS_ARR+=("--valgrind" "--disable-unit-tests") ; fi - if [[ "$RUN_CACHEGRIND" ]]; then TEST_FLAGS_ARR+=("--cachegrind") ; fi - if [[ "$RUN_ASAN" ]]; then TEST_FLAGS_ARR+=("--asan") ; fi - if [[ "$RUN_MSAN" ]]; then TEST_FLAGS_ARR+=("--msan") ; fi + - if [[ "$RUN_TSAN" ]]; then TEST_FLAGS_ARR+=("--tsan") ; fi - if [[ "$RUN_UBSAN" ]]; then TEST_FLAGS_ARR+=("--ubsan") ; fi - if [[ "$NO_CTEST" ]]; then TEST_FLAGS_ARR+=("--no-ctest") ; fi - if [[ "$DISABLE_CI_TESTS" ]]; then TEST_FLAGS_ARR+=("--disable-unit-tests") ; fi - export CI_TEST_FLAGS=${TEST_FLAGS_ARR[@]} script: - - mkdir build && cd build - - HELICS_DEPENDENCY_FLAGS+="-DZeroMQ_INSTALL_PATH=${CI_DEPENDENCY_DIR}/zmq -DBOOST_INSTALL_PATH=${CI_DEPENDENCY_DIR}/boost" - - cmake .. ${HELICS_DEPENDENCY_FLAGS} ${HELICS_OPTION_FLAGS} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + - mkdir -p build && cd build + - HELICS_DEPENDENCY_FLAGS+="-DBOOST_INSTALL_PATH=${CI_DEPENDENCY_DIR}/boost" + - cmake .. ${JOB_OPTION_FLAGS} ${HELICS_DEPENDENCY_FLAGS} ${HELICS_OPTION_FLAGS} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - make ${MAKEFLAGS} # Setup counters for coverage @@ -202,7 +229,11 @@ script: - if [[ "TRAVIS_OS_NAME" == "osx" ]] ; then python ../scripts/fix_install_names.py ; fi - if [[ "TRAVIS_OS_NAME" == "osx" ]] ; then make ${MAKEFLAGS} install ; fi - - ctest --output-on-failure --timeout 220 -L Continuous + + # Run CI tests + - export CTEST_OPTIONS="--output-on-failure" + - ../scripts/run-ci-tests.sh ${CI_TEST_FLAGS} + # Gather coverage results - if [[ "$BUILD_TYPE" == "Coverage" ]]; then pushd .. && scripts/lcov-helper.sh gather-coverage-info --gcov ${GCOV_TOOL} --codecov && popd ; fi diff --git a/config/cmake/buildlibZMQ.cmake b/config/cmake/buildlibZMQ.cmake index 45653e07e1..78909a9a90 100644 --- a/config/cmake/buildlibZMQ.cmake +++ b/config/cmake/buildlibZMQ.cmake @@ -80,6 +80,8 @@ ExternalProject_Add(libzmq -DBUILD_SHARED=${zmq_shared_build} \"-DCMAKE_CXX_FLAGS=${extra_cxx_flags}\" \"-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}\" + \"-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS}\" + \"-DCMAKE_MODULE_LINKER_FLAGS=${CMAKE_MODULE_LINKER_FLAGS}\" -DENABLE_CPACK=OFF -DLIBZMQ_PEDANTIC=OFF -DWITH_PERF_TOOL=OFF diff --git a/scripts/asan-cache.cmake b/scripts/asan-cache.cmake new file mode 100644 index 0000000000..170e797061 --- /dev/null +++ b/scripts/asan-cache.cmake @@ -0,0 +1,4 @@ +set(CMAKE_C_FLAGS "-fsanitize=address -fno-omit-frame-pointer -g -O1" CACHE STRING "Flags used by the compiler during all build types.") +set(CMAKE_CXX_FLAGS "-fsanitize=address -fno-omit-frame-pointer -g -O1" CACHE STRING "Flags used by the compiler during all build types.") +set(CMAKE_EXE_LINKER_FLAGS "-fsanitize=address" CACHE STRING "Flags used by the linker during all build types.") +set(CMAKE_MODULE_LINKER_FLAGS "-fsanitize=address" CACHE STRING "Flags used by the linker during all build types.") diff --git a/scripts/install-ci-dependencies.sh b/scripts/install-ci-dependencies.sh index 6d383cfca4..506ca491bd 100755 --- a/scripts/install-ci-dependencies.sh +++ b/scripts/install-ci-dependencies.sh @@ -117,7 +117,7 @@ export PATH="${swig_install_path}/bin:${PATH}" echo "*** built swig successfully {$PATH}" # Install ZeroMQ -if [[ ! -d "${zmq_install_path}" ]]; then +if [[ "$TRAVIS" != "true" && ! -d "${zmq_install_path}" ]]; then echo "*** build libzmq" ./scripts/install-dependency.sh zmq ${zmq_version} ${zmq_install_path} echo "*** built zmq successfully" @@ -136,7 +136,11 @@ fi # Install Boost if [[ ! -d "${boost_install_path}" ]]; then echo "*** build boost" - ${WAIT_COMMAND} ./scripts/install-dependency.sh boost ${boost_version} ${boost_install_path} + local boost_sanitizer="" + if [[ "$RUN_TSAN" ]]; then + boost_sanitizer="BOOST_SANITIZER=thread" + fi + ${BOOST_SANITIZER} ${WAIT_COMMAND} ./scripts/install-dependency.sh boost ${boost_version} ${boost_install_path} echo "*** built boost successfully" fi diff --git a/scripts/install-dependency.sh b/scripts/install-dependency.sh index a3af9eca5c..9b24615f8f 100755 --- a/scripts/install-dependency.sh +++ b/scripts/install-dependency.sh @@ -120,26 +120,53 @@ install_boost () { local boost_toolset=$3 local b2_extra_options="" - if [[ "${BOOST_CXX_FLAGS}" ]]; then - b2_extra_options="cxxflags=${BOOST_CXX_FLAGS} ${b2_extra_options}" + local cxxflags_var="" + local cxxflags_arr=() + if [[ "${BOOST_CXXFLAGS}" ]]; then + cxxflags_arr+=("${BOOST_CXXFLAGS}") + fi + + local linkflags_var="" + local linkflags_arr=() + if [[ "${BOOST_LINKFLAGS}" ]]; then + linkflags_arr+=("${BOOST_LINKFLAGS}") fi local b2_link_type=shared if [[ "${BOOST_USE_STATIC}" ]]; then b2_link_type=static + cxxflags_arr+=("-fPIC") + fi + + if [[ "${BOOST_SANITIZER}" ]]; then + cxxflags_arr+=("-fsanitize=${BOOST_SANITIZER}") + linkflags_arr+=("-fsanitize=${BOOST_SANITIZER}") + fi + + if [[ "${cxxflags_arr[@]}" ]]; then + cxxflags_var="cxxflags=${cxxflags_arr[@]}" fi + if [[ "${linkflags_arr[@]}" ]]; then + linkflags_var="linkflags=${linkflags_arr[@]}" + fi + + echo Boost link type: $b2_link_type + + echo Boost b2 extra options ${b2_extra_options} + fetch_and_untar ${boost_version_str}.tar.gz \ http://sourceforge.net/projects/boost/files/boost/${boost_version}/${boost_version_str}.tar.gz/download cd ${boost_version_str}/; - ./bootstrap.sh --with-libraries=date_time,filesystem,program_options,system,chrono,timer,test; - ./b2 -j2 \ + ./bootstrap.sh --with-libraries=date_time,filesystem,program_options,system,chrono,timer,test --with-toolset=${boost_toolset}; + ./b2 install -j2 --prefix=${install_path} \ + variant=release \ link=${b2_link_type} \ threading=multi \ - variant=release \ toolset=${boost_toolset} \ - ${b2_extra_options} > /dev/null; - ./b2 install --prefix=${install_path} > /dev/null; + "${cxxflags_var}" \ + "${linkflags_var}" \ + ${b2_extra_options} >/dev/null; } install_cmake () { @@ -169,7 +196,7 @@ else fi compiler_toolset=$4 -if [[ -z ${compiler_toolset+x} ]]; then +if [[ -z ${compiler_toolset} ]]; then case $COMPILER in gcc*) compiler_toolset=gcc diff --git a/scripts/msan-cache.cmake b/scripts/msan-cache.cmake new file mode 100644 index 0000000000..113addf694 --- /dev/null +++ b/scripts/msan-cache.cmake @@ -0,0 +1,4 @@ +set(CMAKE_C_FLAGS "-fsanitize=memory -fno-omit-frame-pointer -g -O1" CACHE STRING "Flags used by the compiler during all build types.") +set(CMAKE_CXX_FLAGS "-fsanitize=memory -fno-omit-frame-pointer -g -O1" CACHE STRING "Flags used by the compiler during all build types.") +set(CMAKE_EXE_LINKER_FLAGS "-fsanitize=memory" CACHE STRING "Flags used by the linker during all build types.") +set(CMAKE_MODULE_LINKER_FLAGS "-fsanitize=memory" CACHE STRING "Flags used by the linker during all build types.") diff --git a/scripts/run-ci-tests.sh b/scripts/run-ci-tests.sh new file mode 100755 index 0000000000..faf0863af8 --- /dev/null +++ b/scripts/run-ci-tests.sh @@ -0,0 +1,110 @@ +#!/bin/bash + +for i in "$@" +do + case $i in + --valgrind) + echo "Running Valgrind tests" + RUN_VALGRIND=true + ;; + --cachegrind) + echo "Running cachegrind tests" + RUN_CACHEGRIND=true + ;; + --asan) + echo "Tests using address sanitizer" + export ASAN_OPTIONS=detect_leaks=0 + export LSAN_OPTIONS=verbosity=1:log_threads=1 + ;; + --msan) + echo "Tests using memory sanitizer" + ;; + --tsan) + echo "Tests using thread sanitizer" + CTEST_OPTIONS+=" --verbose" + ;; + --ubsan) + echo "Tests using undefined behavior sanitizer" + export UBSAN_OPTIONS=print_stacktrace=1 + CTEST_OPTIONS+=" --verbose" + ;; + --no-ctest) + echo "Disable tests using ctest as a runner" + NO_CTEST=true + ;; + --disable-unit-tests) + DISABLE_UNIT_TESTS=true + ;; + --ctest-xml-output) + CTEST_OPTIONS+=" -T Test" + ;; + *) + TEST_CONFIG=$i + TEST_CONFIG_GIVEN=true + ;; + esac +done + +#if [[ "$RUN_CACHEGRIND" == "true" ]]; then + #valgrind --track-origins=yes --tool=cachegrind +#fi + +if [[ "$NO_CTEST" == "true" ]]; then + echo "CTest disabled, full set of CI tests may not run" + if [[ "$RUN_VALGRIND" == "true" ]]; then + echo "-- Valgrind will not run" + fi + + # LSan doesn't like being run under CTest; running a single test case instead of hardcoding commands for all unit tests + # ASAN_OPTIONS=detect_leaks=0 LSAN_OPTIONS=verbosity=1:log_threads=1 +else + # Include releasetest or coveragetest in the branch name to run a longer set of tests + export CTEST_OUTPUT_ON_FAILURE=true + + if [[ "$TEST_CONFIG_GIVEN" == "true" ]]; then + test_label=$(tr '[:upper:]' '[:lower:]' <<< $TEST_CONFIG) + case "${test_label}" in + *daily*) + TEST_CONFIG="Daily" + ;; + *coverage*) + TEST_CONFIG="Coverage" + ;; + *) + TEST_CONFIG="Continuous" + CTEST_OPTIONS+=" --timeout 220" + ;; + esac + + # If no argument was given, but we are running in Travis, check the branch name for tests to run + elif [[ "$TRAVIS" == "true" ]]; then + case "${TRAVIS_BRANCH}" in + *coveragetest*) + TEST_CONFIG="Coverage" + ;; + *dailytest*) + TEST_CONFIG="Daily" + ;; + *) + TEST_CONFIG="Continuous" + CTEST_OPTIONS+=" --timeout 220" + ;; + esac + fi + + if [[ "$RUN_VALGRIND" == "true" ]]; then + echo "Running Valgrind tests" + ctest -T memcheck -L Valgrind && cat Testing/Temporary/MemoryChecker*.log + fi + + # Run the CI tests last so that the execution status is used for the pass/fail status shown + if [[ "$DISABLE_UNIT_TESTS" != "true" ]]; then + if [[ -n "${TEST_CONFIG}" ]]; then + echo "Running ${TEST_CONFIG} tests" + ctest -L ${TEST_CONFIG} ${CTEST_OPTIONS} + else + echo "Running all tests" + ctest ${CTEST_OPTIONS} + fi + fi +fi diff --git a/scripts/tsan-cache.cmake b/scripts/tsan-cache.cmake new file mode 100644 index 0000000000..59437957f5 --- /dev/null +++ b/scripts/tsan-cache.cmake @@ -0,0 +1,4 @@ +set(CMAKE_C_FLAGS "-fsanitize=thread -g -O1" CACHE STRING "Flags used by the compiler during all build types.") +set(CMAKE_CXX_FLAGS "-fsanitize=thread -g -O1" CACHE STRING "Flags used by the compiler during all build types.") +set(CMAKE_EXE_LINKER_FLAGS "-fsanitize=thread" CACHE STRING "Flags used by the linker during all build types.") +set(CMAKE_MODULE_LINKER_FLAGS "-fsanitize=thread" CACHE STRING "Flags used by the linker during all build types.") diff --git a/scripts/ubsan-cache.cmake b/scripts/ubsan-cache.cmake new file mode 100644 index 0000000000..a471aa5fe2 --- /dev/null +++ b/scripts/ubsan-cache.cmake @@ -0,0 +1,4 @@ +set(CMAKE_C_FLAGS "-fsanitize=undefined -g" CACHE STRING "Flags used by the compiler during all build types.") +set(CMAKE_CXX_FLAGS "-fsanitize=undefined -g" CACHE STRING "Flags used by the compiler during all build types.") +set(CMAKE_EXE_LINKER_FLAGS "-fsanitize=undefined" CACHE STRING "Flags used by the linker during all build types.") +set(CMAKE_MODULE_LINKER_FLAGS "-fsanitize=undefined" CACHE STRING "Flags used by the linker during all build types.") diff --git a/tests/helics/application_api/CMakeLists.txt b/tests/helics/application_api/CMakeLists.txt index 1fafdb217e..88e50dad2d 100644 --- a/tests/helics/application_api/CMakeLists.txt +++ b/tests/helics/application_api/CMakeLists.txt @@ -47,7 +47,7 @@ add_test( NAME application-api-tests COMMAND application-api-tests --log_level=message --report_level=short ) -set_property(TEST application-api-tests PROPERTY LABELS ApplicationApi Daily) +set_property(TEST application-api-tests PROPERTY LABELS ApplicationApi Coverage Daily) # Tests for Continuous Integration builds add_test( diff --git a/tests/helics/apps/CMakeLists.txt b/tests/helics/apps/CMakeLists.txt index 70dca6e9dd..cd6cb5593d 100644 --- a/tests/helics/apps/CMakeLists.txt +++ b/tests/helics/apps/CMakeLists.txt @@ -43,7 +43,7 @@ if(DISABLE_SYSTEM_CALL_TESTS) endif() add_test(NAME helics_apps-tests COMMAND helics_apps-tests --report_level=short) -set_property(TEST helics_apps-tests PROPERTY LABELS HelicsApps Daily) +set_property(TEST helics_apps-tests PROPERTY LABELS HelicsApps Coverage Daily) # Tests for Continous Integration builds add_test( diff --git a/tests/helics/common/CMakeLists.txt b/tests/helics/common/CMakeLists.txt index 287bdff62f..e713d4f74b 100644 --- a/tests/helics/common/CMakeLists.txt +++ b/tests/helics/common/CMakeLists.txt @@ -38,6 +38,7 @@ set_property( LABELS Common Daily + Coverage Continuous ) diff --git a/tests/helics/core/CMakeLists.txt b/tests/helics/core/CMakeLists.txt index f6231896ba..9ab8e211cc 100644 --- a/tests/helics/core/CMakeLists.txt +++ b/tests/helics/core/CMakeLists.txt @@ -48,7 +48,7 @@ target_include_directories(core-tests PRIVATE ${PROJECT_SOURCE_DIR}/src) set_target_properties(core-tests PROPERTIES FOLDER tests) add_test(NAME core-tests COMMAND core-tests --log_level=message --report_level=short) -set_property(TEST core-tests PROPERTY LABELS Core Daily) +set_property(TEST core-tests PROPERTY LABELS Core Coverage Daily) # Tests for Continuous Integration builds add_test( diff --git a/tests/helics/shared_library/CMakeLists.txt b/tests/helics/shared_library/CMakeLists.txt index fdc05f3e47..f9c23e8577 100644 --- a/tests/helics/shared_library/CMakeLists.txt +++ b/tests/helics/shared_library/CMakeLists.txt @@ -87,11 +87,11 @@ add_test( COMMAND shared-library-tests-cpp --log_level=message --report_level=short ) -set_property(TEST shared-library-tests PROPERTY LABELS SharedLibrary Daily) +set_property(TEST shared-library-tests PROPERTY LABELS SharedLibrary Coverage Daily) # Setting a different label, because the test fixture for the C++ shared library tests # doesn't work push_back for vector causes a segfault for unknown reasons (Boost UTF # related?) -set_property(TEST shared-library-tests-cpp PROPERTY LABELS SharedLibraryCpp Daily) +set_property(TEST shared-library-tests-cpp PROPERTY LABELS SharedLibraryCpp Coverage Daily) # Tests used for Continuous Integration builds add_test( diff --git a/tests/helics/system_tests/CMakeLists.txt b/tests/helics/system_tests/CMakeLists.txt index be42718aa6..3ead9f938f 100644 --- a/tests/helics/system_tests/CMakeLists.txt +++ b/tests/helics/system_tests/CMakeLists.txt @@ -37,7 +37,7 @@ add_test( NAME system-tests COMMAND system-tests --log_level=message --report_level=short ) -set_property(TEST system-tests PROPERTY LABELS System Daily) +set_property(TEST system-tests PROPERTY LABELS System Coverage Daily) # Tests for Continuous Integration builds add_test( @@ -48,7 +48,7 @@ add_test( --log_level=message --report_level=short ) -set_property(TEST system-ci-tests PROPERTY LABELS Continuous) +set_property(TEST system-ci-tests PROPERTY LABELS Continuous Valgrind) foreach(keyfile IN LISTS KEY_LIBRARY_FILES) add_custom_command( From 25b8516520dfe0e885bc0f327567c08d98615009 Mon Sep 17 00:00:00 2001 From: Philip Top Date: Fri, 7 Sep 2018 16:18:23 -0700 Subject: [PATCH 10/16] Server timeouts (#444) * Add ISSUE_TEMPLATE.md * add destroy functions to C-api * add timeouts and checks to unable to connect errors for the network servers. Add generic interface specifications to TcpComms. * server reconnection and timeout update, mainly on the tcp comms * use endpoint iterators instead of c++14 functions (only available on newer boost) * fix delete method * more on TcpConnections * update to TCP servers and acceptors * make sure the async operations in acceptors have completed * minor updates to tests and closeout * more some of the initialization around a little to prevent possible missed initialization * change error handling in Tcp comms * add connection info to error message * add destructor to server * add disconnection timeouts to brokers * update matlab library * try a different method of closing the tcp port * add retry on broker * try using a mutex to prevent some potential race conditions. * add adaptive port number for autoport numbering * change condition for broker disconnect * more work on server timeout, fixing some latent bugs in the way cores were getting closed out, some other issue have cropped up due to that now * add cascading termination * fix erroneous capitalization * more json capitalization problems * more file name changes * add close to connection. * add a sleep at critical juncture to remove to allow time for the disconnect to process. * tweak the linger timeouts on the tcp cores * tweak the options and add error capture * update closeout sequence for tcp core to only shutdown if the socket is open * try a few other things on the acceptors * adding print out for force broker disconnect * change some timings and shift some locks around * add extra check for halting * don't hold lock during close operation * adding timeout on acceptor close * add error string in tcp connections * add Trigger Variable and integrate into the tcphelper functions * merge updates and make cTestFixture match testFixtures * add waitForDisconnect to broker and the shared library * add port rotation on the comms for automatically allocated ports * move to a trigger for connection and disconnection notification * fix MPIcore and extra warning * add shutdown linger to tcp socket * change close-out procedure for tcp socket connections * add delay on tcp broker disconnection * add extra delay for tcp tests on shared_library tests * add error traps in the close classes * fix error in comms interface closeout. * turn off reuse_false in tcp connections * add reuse_address option to tcp core and specify its use for the application and shared_library test suites. * update to cpptest fixtures for cpp shared_library tests to match the other test fixtures --- .github/ISSUE_TEMPLATE.md | 41 + .travis.yml | 1 - docs/apps/App.md | 2 +- docs/configuration/MessageFederate.md | 8 +- docs/configuration/ValueFederate.md | 4 +- src/helics/application_api/Federate.cpp | 10 +- src/helics/application_api/Federate.hpp | 13 +- .../application_api/MessageFederate.hpp | 8 +- .../MessageFederateManager.cpp | 24 +- src/helics/application_api/ValueFederate.hpp | 8 +- src/helics/apps/Echo.hpp | 2 +- src/helics/apps/Source.hpp | 2 +- src/helics/common/BlockingPriorityQueue.hpp | 5 +- src/helics/common/CMakeLists.txt | 2 + src/helics/common/DualMappedVector.hpp | 2 + src/helics/common/GuardedTypes.hpp | 3 +- src/helics/common/JsonProcessingFunctions.cpp | 28 +- src/helics/common/JsonProcessingFunctions.hpp | 19 +- src/helics/common/TomlProcessingFunctions.hpp | 20 +- src/helics/common/TriggerVariable.cpp | 94 ++ src/helics/common/TriggerVariable.hpp | 45 + src/helics/common/TripWire.cpp | 2 +- src/helics/common/base64.cpp | 3 +- src/helics/core/ActionMessageDefintions.hpp | 4 + src/helics/core/Broker.hpp | 2 +- src/helics/core/BrokerBase.cpp | 19 + src/helics/core/BrokerBase.hpp | 1 + src/helics/core/BrokerFactory.cpp | 30 +- src/helics/core/CommonCore.cpp | 118 ++- src/helics/core/CommonCore.hpp | 34 +- src/helics/core/CommsInterface.cpp | 101 ++- src/helics/core/CommsInterface.hpp | 21 +- src/helics/core/CoreBroker.cpp | 127 ++- src/helics/core/CoreBroker.hpp | 39 +- src/helics/core/FederateState.cpp | 17 +- src/helics/core/FederateState.hpp | 10 +- src/helics/core/ForwardingTimeCoordinator.cpp | 38 +- src/helics/core/ForwardingTimeCoordinator.hpp | 2 + src/helics/core/NetworkBrokerData.cpp | 5 + src/helics/core/NetworkBrokerData.hpp | 1 + src/helics/core/TimeCoordinator.cpp | 53 +- src/helics/core/TimeDependencies.cpp | 15 +- src/helics/core/ipc/IpcBroker.cpp | 3 +- src/helics/core/ipc/IpcComms.cpp | 39 +- src/helics/core/ipc/IpcCore.cpp | 3 +- src/helics/core/mpi/MpiComms.cpp | 10 +- src/helics/core/tcp/TcpBroker.cpp | 4 +- src/helics/core/tcp/TcpComms.cpp | 86 +- src/helics/core/tcp/TcpComms.h | 18 +- src/helics/core/tcp/TcpCore.cpp | 4 +- src/helics/core/tcp/TcpHelperClasses.cpp | 630 ++++++++++++-- src/helics/core/tcp/TcpHelperClasses.h | 182 +++- src/helics/core/udp/UdpBroker.cpp | 4 +- src/helics/core/udp/UdpComms.cpp | 88 +- src/helics/core/udp/UdpComms.h | 1 + src/helics/core/udp/UdpCore.cpp | 4 +- src/helics/core/zmq/ZmqBroker.cpp | 4 +- src/helics/core/zmq/ZmqComms.cpp | 152 ++-- src/helics/core/zmq/ZmqComms.h | 1 + src/helics/core/zmq/ZmqCore.cpp | 4 +- src/helics/cpp98/Broker.hpp | 62 +- src/helics/cpp98/Core.hpp | 2 +- src/helics/cpp98/Federate.hpp | 2 +- src/helics/cpp98/ValueFederate.hpp | 2 +- .../shared_api_library/FederateExport.cpp | 12 +- src/helics/shared_api_library/helics.h | 21 +- .../shared_api_library/helicsExport.cpp | 74 +- swig/java/interface/helics.java | 28 +- swig/java/interface/helicsJNI.java | 8 +- swig/java/interface/helicsJavaJAVA_wrap.c | 46 + .../matlab/+helics/HELICS_CORE_TYPE_DEFAULT.m | 2 +- .../+helics/HELICS_CORE_TYPE_INTERPROCESS.m | 2 +- swig/matlab/+helics/HELICS_CORE_TYPE_IPC.m | 2 +- swig/matlab/+helics/HELICS_CORE_TYPE_MPI.m | 2 +- swig/matlab/+helics/HELICS_CORE_TYPE_TCP.m | 2 +- swig/matlab/+helics/HELICS_CORE_TYPE_TEST.m | 2 +- swig/matlab/+helics/HELICS_CORE_TYPE_UDP.m | 2 +- swig/matlab/+helics/HELICS_CORE_TYPE_ZMQ.m | 2 +- .../matlab/+helics/HELICS_DATA_TYPE_BOOLEAN.m | 2 +- .../matlab/+helics/HELICS_DATA_TYPE_COMPLEX.m | 2 +- swig/matlab/+helics/HELICS_DATA_TYPE_DOUBLE.m | 2 +- swig/matlab/+helics/HELICS_DATA_TYPE_INT.m | 2 +- .../+helics/HELICS_DATA_TYPE_NAMEDPOINT.m | 2 +- swig/matlab/+helics/HELICS_DATA_TYPE_RAW.m | 2 +- swig/matlab/+helics/HELICS_DATA_TYPE_STRING.m | 2 +- swig/matlab/+helics/HELICS_DATA_TYPE_VECTOR.m | 2 +- swig/matlab/+helics/force_iteration.m | 2 +- swig/matlab/+helics/helicsBrokerDisconnect.m | 2 +- swig/matlab/+helics/helicsBrokerFree.m | 2 +- swig/matlab/+helics/helicsBrokerGetAddress.m | 2 +- .../+helics/helicsBrokerGetIdentifier.m | 2 +- .../+helics/helicsBrokerWaitForDisconnect.m | 3 + .../+helics/helicsCleanupHelicsLibrary.m | 2 +- swig/matlab/+helics/helicsCloseLibrary.m | 2 +- swig/matlab/+helics/helicsCoreDisconnect.m | 2 +- swig/matlab/+helics/helicsCoreFree.m | 2 +- swig/matlab/+helics/helicsCoreGetIdentifier.m | 2 +- swig/matlab/+helics/helicsCoreIsConnected.m | 2 +- .../+helics/helicsCoreRegisterCloningFilter.m | 2 +- .../helicsCoreRegisterDestinationFilter.m | 2 +- .../+helics/helicsCoreRegisterSourceFilter.m | 2 +- .../matlab/+helics/helicsCoreSetReadyToInit.m | 2 +- .../+helics/helicsCreateCombinationFederate.m | 2 +- .../helicsCreateCombinationFederateFromJson.m | 2 +- .../+helics/helicsCreateMessageFederate.m | 2 +- .../helicsCreateMessageFederateFromJson.m | 2 +- swig/matlab/+helics/helicsCreateQuery.m | 2 +- .../+helics/helicsCreateValueFederate.m | 2 +- .../helicsCreateValueFederateFromJson.m | 2 +- swig/matlab/+helics/helicsDestroyBroker.m | 3 + swig/matlab/+helics/helicsDestroyCore.m | 3 + swig/matlab/+helics/helicsDestroyFederate.m | 3 + .../matlab/+helics/helicsEndpointGetMessage.m | 2 +- swig/matlab/+helics/helicsEndpointGetName.m | 2 +- swig/matlab/+helics/helicsEndpointGetType.m | 2 +- .../matlab/+helics/helicsEndpointHasMessage.m | 2 +- .../+helics/helicsEndpointReceiveCount.m | 2 +- .../+helics/helicsEndpointSendEventRaw.m | 2 +- .../+helics/helicsEndpointSendMessage.m | 2 +- .../+helics/helicsEndpointSendMessageRaw.m | 2 +- .../helicsEndpointSetDefaultDestination.m | 2 +- swig/matlab/+helics/helicsEndpointSubscribe.m | 2 +- swig/matlab/+helics/helicsFederateClone.m | 2 +- .../helicsFederateEnterExecutionMode.m | 2 +- .../helicsFederateEnterExecutionModeAsync.m | 2 +- ...helicsFederateEnterExecutionModeComplete.m | 2 +- ...elicsFederateEnterExecutionModeIterative.m | 2 +- ...FederateEnterExecutionModeIterativeAsync.m | 2 +- ...erateEnterExecutionModeIterativeComplete.m | 2 +- .../helicsFederateEnterInitializationMode.m | 2 +- ...licsFederateEnterInitializationModeAsync.m | 2 +- ...sFederateEnterInitializationModeComplete.m | 2 +- swig/matlab/+helics/helicsFederateFinalize.m | 2 +- swig/matlab/+helics/helicsFederateFree.m | 2 +- .../+helics/helicsFederateGetCoreObject.m | 2 +- .../+helics/helicsFederateGetCurrentTime.m | 2 +- .../+helics/helicsFederateGetEndpointCount.m | 2 +- .../matlab/+helics/helicsFederateGetMessage.m | 2 +- swig/matlab/+helics/helicsFederateGetName.m | 2 +- .../helicsFederateGetPublicationCount.m | 2 +- swig/matlab/+helics/helicsFederateGetState.m | 2 +- .../helicsFederateGetSubscriptionCount.m | 2 +- .../matlab/+helics/helicsFederateHasMessage.m | 2 +- .../matlab/+helics/helicsFederateInfoCreate.m | 2 +- swig/matlab/+helics/helicsFederateInfoFree.m | 2 +- .../+helics/helicsFederateInfoLoadFromArgs.m | 2 +- .../helicsFederateInfoSetCoreInitString.m | 2 +- .../+helics/helicsFederateInfoSetCoreName.m | 2 +- .../+helics/helicsFederateInfoSetCoreType.m | 2 +- .../helicsFederateInfoSetCoreTypeFromString.m | 2 +- .../helicsFederateInfoSetFederateName.m | 2 +- .../+helics/helicsFederateInfoSetFlag.m | 2 +- .../+helics/helicsFederateInfoSetInputDelay.m | 2 +- .../helicsFederateInfoSetLoggingLevel.m | 2 +- .../helicsFederateInfoSetMaxIterations.m | 2 +- .../helicsFederateInfoSetOutputDelay.m | 2 +- .../+helics/helicsFederateInfoSetPeriod.m | 2 +- .../+helics/helicsFederateInfoSetSeparator.m | 2 +- .../+helics/helicsFederateInfoSetTimeDelta.m | 2 +- .../+helics/helicsFederateInfoSetTimeOffset.m | 2 +- .../helicsFederateIsAsyncOperationCompleted.m | 2 +- .../+helics/helicsFederateReceiveCount.m | 2 +- .../helicsFederateRegisterCloningFilter.m | 2 +- .../helicsFederateRegisterDestinationFilter.m | 2 +- .../+helics/helicsFederateRegisterEndpoint.m | 2 +- .../helicsFederateRegisterGlobalEndpoint.m | 2 +- .../helicsFederateRegisterGlobalPublication.m | 2 +- ...icsFederateRegisterGlobalTypePublication.m | 2 +- ...licsFederateRegisterOptionalSubscription.m | 2 +- ...FederateRegisterOptionalTypeSubscription.m | 2 +- .../helicsFederateRegisterPublication.m | 2 +- .../helicsFederateRegisterSourceFilter.m | 2 +- .../helicsFederateRegisterSubscription.m | 2 +- .../helicsFederateRegisterTypePublication.m | 2 +- .../helicsFederateRegisterTypeSubscription.m | 2 +- .../+helics/helicsFederateRequestTime.m | 2 +- .../+helics/helicsFederateRequestTimeAsync.m | 2 +- .../helicsFederateRequestTimeComplete.m | 2 +- .../helicsFederateRequestTimeIterative.m | 2 +- .../helicsFederateRequestTimeIterativeAsync.m | 2 +- ...licsFederateRequestTimeIterativeComplete.m | 2 +- swig/matlab/+helics/helicsFederateSetFlag.m | 2 +- .../+helics/helicsFederateSetInputDelay.m | 2 +- .../+helics/helicsFederateSetLoggingLevel.m | 2 +- .../+helics/helicsFederateSetMaxIterations.m | 2 +- .../+helics/helicsFederateSetOutputDelay.m | 2 +- swig/matlab/+helics/helicsFederateSetPeriod.m | 2 +- .../+helics/helicsFederateSetSeparator.m | 2 +- .../+helics/helicsFederateSetTimeDelta.m | 2 +- .../+helics/helicsFilterAddDeliveryEndpoint.m | 2 +- .../helicsFilterAddDestinationTarget.m | 2 +- .../+helics/helicsFilterAddSourceTarget.m | 2 +- swig/matlab/+helics/helicsFilterGetName.m | 2 +- swig/matlab/+helics/helicsFilterGetTarget.m | 2 +- .../helicsFilterRemoveDeliveryEndpoint.m | 2 +- .../helicsFilterRemoveDestinationTarget.m | 2 +- .../+helics/helicsFilterRemoveSourceTarget.m | 2 +- swig/matlab/+helics/helicsFilterSet.m | 2 +- swig/matlab/+helics/helicsFilterSetString.m | 2 +- swig/matlab/+helics/helicsGetFederateByName.m | 2 +- swig/matlab/+helics/helicsPublicationGetKey.m | 2 +- .../matlab/+helics/helicsPublicationGetType.m | 2 +- .../+helics/helicsPublicationGetUnits.m | 2 +- .../+helics/helicsPublicationPublishBoolean.m | 2 +- .../+helics/helicsPublicationPublishComplex.m | 2 +- .../+helics/helicsPublicationPublishDouble.m | 2 +- .../+helics/helicsPublicationPublishInteger.m | 2 +- .../helicsPublicationPublishNamedPoint.m | 2 +- .../+helics/helicsPublicationPublishRaw.m | 2 +- .../+helics/helicsPublicationPublishString.m | 2 +- .../+helics/helicsPublicationPublishVector.m | 2 +- .../matlab/+helics/helicsQueryBrokerExecute.m | 2 +- swig/matlab/+helics/helicsQueryCoreExecute.m | 2 +- swig/matlab/+helics/helicsQueryExecute.m | 2 +- swig/matlab/+helics/helicsQueryExecuteAsync.m | 2 +- .../+helics/helicsQueryExecuteComplete.m | 2 +- swig/matlab/+helics/helicsQueryFree.m | 2 +- swig/matlab/+helics/helicsQueryIsCompleted.m | 2 +- .../+helics/helicsSubscriptionGetBoolean.m | 2 +- .../+helics/helicsSubscriptionGetComplex.m | 2 +- .../+helics/helicsSubscriptionGetDouble.m | 2 +- .../+helics/helicsSubscriptionGetInteger.m | 2 +- .../matlab/+helics/helicsSubscriptionGetKey.m | 2 +- .../+helics/helicsSubscriptionGetNamedPoint.m | 2 +- .../+helics/helicsSubscriptionGetRawValue.m | 2 +- .../+helics/helicsSubscriptionGetString.m | 2 +- .../+helics/helicsSubscriptionGetStringSize.m | 2 +- .../+helics/helicsSubscriptionGetType.m | 2 +- .../+helics/helicsSubscriptionGetUnits.m | 2 +- .../+helics/helicsSubscriptionGetValueSize.m | 2 +- .../+helics/helicsSubscriptionGetVector.m | 2 +- .../+helics/helicsSubscriptionGetVectorSize.m | 2 +- .../+helics/helicsSubscriptionIsUpdated.m | 2 +- .../helicsSubscriptionLastUpdateTime.m | 2 +- .../helicsSubscriptionSetDefaultBoolean.m | 2 +- .../helicsSubscriptionSetDefaultComplex.m | 2 +- .../helicsSubscriptionSetDefaultDouble.m | 2 +- .../helicsSubscriptionSetDefaultInteger.m | 2 +- .../helicsSubscriptionSetDefaultNamedPoint.m | 2 +- .../+helics/helicsSubscriptionSetDefaultRaw.m | 2 +- .../helicsSubscriptionSetDefaultString.m | 2 +- .../helicsSubscriptionSetDefaultVector.m | 2 +- swig/matlab/+helics/helics_clone_filter.m | 2 +- swig/matlab/+helics/helics_custom_filter.m | 2 +- swig/matlab/+helics/helics_delay_filter.m | 2 +- swig/matlab/+helics/helics_discard.m | 2 +- swig/matlab/+helics/helics_error.m | 2 +- swig/matlab/+helics/helics_error_state.m | 2 +- swig/matlab/+helics/helics_execution_state.m | 2 +- swig/matlab/+helics/helics_finalize_state.m | 2 +- .../+helics/helics_initialization_state.m | 2 +- swig/matlab/+helics/helics_invalid_argument.m | 2 +- .../+helics/helics_invalid_function_call.m | 2 +- swig/matlab/+helics/helics_invalid_object.m | 2 +- .../+helics/helics_invalid_state_transition.m | 2 +- swig/matlab/+helics/helics_ok.m | 2 +- .../+helics/helics_pending_exec_state.m | 2 +- .../+helics/helics_pending_init_state.m | 2 +- .../helics_pending_iterative_time_state.m | 2 +- .../+helics/helics_pending_time_state.m | 2 +- .../+helics/helics_randomDelay_filter.m | 2 +- .../matlab/+helics/helics_randomDrop_filter.m | 2 +- .../+helics/helics_registration_failure.m | 2 +- swig/matlab/+helics/helics_reroute_filter.m | 2 +- swig/matlab/+helics/helics_startup_state.m | 2 +- swig/matlab/+helics/helics_terminated.m | 2 +- swig/matlab/+helics/helics_warning.m | 2 +- swig/matlab/+helics/iterate_if_needed.m | 2 +- swig/matlab/+helics/iterating.m | 2 +- swig/matlab/+helics/iteration_error.m | 2 +- swig/matlab/+helics/iteration_halted.m | 2 +- swig/matlab/+helics/next_step.m | 2 +- swig/matlab/+helics/no_iteration.m | 2 +- swig/matlab/helicsMEX.cpp | 801 ++++++++++-------- swig/python/helics.py | 28 +- swig/python/helics_wrap.c | 90 ++ .../helics/application_api/FederateTests.cpp | 6 +- tests/helics/application_api/FilterTests.cpp | 85 +- .../MessageFederateAdditionalTests.cpp | 12 +- .../application_api/ValueFederateKeyTests.cpp | 1 + tests/helics/application_api/testFixtures.cpp | 56 +- tests/helics/application_api/testFixtures.hpp | 91 +- tests/helics/core/TcpCore-tests.cpp | 41 +- tests/helics/core/UdpCore-tests.cpp | 2 +- tests/helics/core/ZeromqCore-tests.cpp | 20 +- .../helics/shared_library/cpptestFixtures.cpp | 35 +- .../helics/shared_library/cpptestFixtures.hpp | 14 +- tests/helics/shared_library/ctestFixtures.cpp | 35 +- tests/helics/shared_library/ctestFixtures.hpp | 5 +- .../shared_library/test-value-federate2.cpp | 2 +- .../test-value-federate2_cpp.cpp | 2 +- tests/helics/system_tests/ErrorTests.cpp | 43 + 292 files changed, 3011 insertions(+), 1245 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 src/helics/common/TriggerVariable.cpp create mode 100644 src/helics/common/TriggerVariable.hpp create mode 100644 swig/matlab/+helics/helicsBrokerWaitForDisconnect.m create mode 100644 swig/matlab/+helics/helicsDestroyBroker.m create mode 100644 swig/matlab/+helics/helicsDestroyCore.m create mode 100644 swig/matlab/+helics/helicsDestroyFederate.m diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000000..d2bfc7e74b --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,41 @@ + + +* **I'm submitting a ...** + - [ ] bug + - [ ] feature request + - [ ] support question + + +### Feature Request / Support Question + + + +### Bug + + + +* **What is the current behavior?** + + + +* **What is the expected behavior? What is the motivation / use case for changing the behavior?** + + +* **What are the steps to reproduce this bug? Please provide a minimal working example of the bug if possible.** + + + +* **Please tell us about your environment:** + + - HELICS version: + +``` +$ helics_app --version +``` + + + - Operating System: [all | Windows | Mac | Linux] + - Language Extension: [all | Python | MATLAB | Java] + + +* **Other information** (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc) diff --git a/.travis.yml b/.travis.yml index 3e64f2ece3..e4fa3bb8f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -234,7 +234,6 @@ script: - export CTEST_OPTIONS="--output-on-failure" - ../scripts/run-ci-tests.sh ${CI_TEST_FLAGS} - # Gather coverage results - if [[ "$BUILD_TYPE" == "Coverage" ]]; then pushd .. && scripts/lcov-helper.sh gather-coverage-info --gcov ${GCOV_TOOL} --codecov && popd ; fi diff --git a/docs/apps/App.md b/docs/apps/App.md index 0861be26d5..11abc59513 100644 --- a/docs/apps/App.md +++ b/docs/apps/App.md @@ -20,7 +20,7 @@ The [player](Player.md) app will generate signals through specified interfaces f This is used for generating test signals into a federate #### Recorder -The [Recorder](Recorder.md) app captures signals and data on specified interfaces and can record then to various file formats including text files and json files +The [Recorder](Recorder.md) app captures signals and data on specified interfaces and can record then to various file formats including text files and JSON files The files saved can then be used by the Player app at a later time #### Tracer diff --git a/docs/configuration/MessageFederate.md b/docs/configuration/MessageFederate.md index c6c278778b..66018d2299 100644 --- a/docs/configuration/MessageFederate.md +++ b/docs/configuration/MessageFederate.md @@ -14,11 +14,11 @@ TODO:: add links to other generated documents ### file configuration -File based configuration looks primarily at an "endpoints" json array +File based configuration looks primarily at an "endpoints" JSON array ``` -//this should be a valid json file (except comments are not recognized in standard JSON) -{ //example json configuration file for a message federate all arguments are optional +//this should be a valid JSON file (except comments are not recognized in standard JSON) +{ //example JSON configuration file for a message federate all arguments are optional "name":"messageFed", // the name of the federate //possible flags "observer":false, // indicator that the federate does not send anything @@ -51,7 +51,7 @@ File based configuration looks primarily at an "endpoints" json array "knownDestinations":"ept1", //this value can be an array of strings or just a single one it names key paths //knownDestinations can be used to optimize the communication pathways inside of HELICS "subscriptions":"fed2/sub1" //subscribe an endpoint to a particular publication this means that an endpoint will get a message whenever anything is published to that particular key - //the message will be raw data so it would have to be translated to be useful. this can also be a json array to subscribe to multiple publications + //the message will be raw data so it would have to be translated to be useful. this can also be a JSON array to subscribe to multiple publications } ] } diff --git a/docs/configuration/ValueFederate.md b/docs/configuration/ValueFederate.md index e468479eea..2440302efe 100644 --- a/docs/configuration/ValueFederate.md +++ b/docs/configuration/ValueFederate.md @@ -17,8 +17,8 @@ TODO:: add links to other generated documents File based configuration looks primarily at an "publications" or "subscriptions" JSON array ``` -//this should be a valid json file (except comments are not recognized in standard JSON) -{ //example json configuration file for a value federate all arguments are optional +//this should be a valid JSON file (except comments are not recognized in standard JSON) +{ //example JSON configuration file for a value federate all arguments are optional "name":"valueFed", // the name of the federate //possible flags "observer":false, // indicator that the federate does not send anything diff --git a/src/helics/application_api/Federate.cpp b/src/helics/application_api/Federate.cpp index 370ccc3074..5479b6b862 100644 --- a/src/helics/application_api/Federate.cpp +++ b/src/helics/application_api/Federate.cpp @@ -23,8 +23,9 @@ namespace helics { void cleanupHelicsLibrary () { - BrokerFactory::cleanUpBrokers (200); + BrokerFactory::cleanUpBrokers (100); CoreFactory::cleanUpCores (200); + BrokerFactory::cleanUpBrokers (100); } Federate::Federate (const FederateInfo &fi) : Federate (fi.name, fi) {} @@ -501,11 +502,16 @@ Time Federate::requestTime (Time nextInternalTimeStep) updateTime (newTime, oldTime); return newTime; } - catch (FunctionExecutionFailure &fee) + catch (const FunctionExecutionFailure &fee) { state = op_states::error; throw; } + catch (const HelicsTerminated &ht) + { + state = op_states::finalize; + throw; + } } else { diff --git a/src/helics/application_api/Federate.hpp b/src/helics/application_api/Federate.hpp index 483c968170..667bb7ebfe 100644 --- a/src/helics/application_api/Federate.hpp +++ b/src/helics/application_api/Federate.hpp @@ -67,11 +67,11 @@ class FederateInfo : public CoreFederateInfo void loadInfoFromArgs (int argc, const char *const *argv); }; -/** generate a FederateInfo object from a config file (json, toml) +/** generate a FederateInfo object from a config file (JSON, toml) */ FederateInfo loadFederateInfo (const std::string &configString); -/** generate a FederateInfo object from a config file (json, toml) +/** generate a FederateInfo object from a config file (JSON, toml) */ FederateInfo loadFederateInfo (const std::string &name, const std::string &configString); @@ -132,7 +132,8 @@ class Federate explicit Federate (const std::string &configString); /**constructor taking a file with the required information and the name of the federate @param[in] name the name of the federate - @param[in] configString can be either a JSON file or a string containing JSON code or a toml file with extension (.TOML, .toml) + @param[in] configString can be either a JSON file or a string containing JSON code or a toml file with + extension (.TOML, .toml) */ Federate (const std::string &name, const std::string &configString); /**default constructor*/ @@ -283,7 +284,7 @@ class Federate a federate, core, or broker @param queryStr a string with the query see other documentation for specific properties to query, can be defined by the federate - @return a string with the value requested. this is either going to be a vector of strings value or a json + @return a string with the value requested. this is either going to be a vector of strings value or a JSON string stored in the first element of the vector. The string "#invalid" is returned if the query was not valid */ std::string query (const std::string &target, const std::string &queryStr); @@ -293,7 +294,7 @@ class Federate the federation and the specific string being queried @param queryStr a string with the query see other documentation for specific properties to query, can be defined by the federate if the local federate does not recognize the query it sends it on to the federation - @return a string with the value requested. this is either going to be a vector of strings value or a json + @return a string with the value requested. this is either going to be a vector of strings value or a JSON string stored in the first element of the vector. The string "#invalid" is returned if the query was not valid */ std::string query (const std::string &queryStr); @@ -324,7 +325,7 @@ class Federate @param queryIndex the int value returned from the queryAsync call @return a string with the value requested. the format of the string will be either a single string a string - vector like "[string1; string2]" or json The string "#invalid" is returned if the query was not valid + vector like "[string1; string2]" or JSON The string "#invalid" is returned if the query was not valid */ std::string queryComplete (query_id_t queryIndex); diff --git a/src/helics/application_api/MessageFederate.hpp b/src/helics/application_api/MessageFederate.hpp index ee360da337..8de68fd29a 100644 --- a/src/helics/application_api/MessageFederate.hpp +++ b/src/helics/application_api/MessageFederate.hpp @@ -26,12 +26,12 @@ class MessageFederate : public virtual Federate // using virtual inheritance to */ MessageFederate (const std::shared_ptr &core, const FederateInfo &fi); /**constructor taking a string with the required information - @param[in] configString can be either a json file, toml file or a string containing json code + @param[in] configString can be either a JSON file, toml file or a string containing JSON code */ explicit MessageFederate (const std::string &configString); /**constructor taking a string with the required information @param[in] name the name of the federate - @param[in] configString can be either a json file, toml file or a string containing json code + @param[in] configString can be either a JSON file, toml file or a string containing JSON code */ MessageFederate (const std::string &name, const std::string &configString); /** move constructor*/ @@ -70,14 +70,14 @@ class MessageFederate : public virtual Federate // using virtual inheritance to /** register a set Message interfaces @details call is only valid in startup mode it is a protected call to add an - @param[in] configString the location of the file or json String to load to generate the interfaces + @param[in] configString the location of the file or JSON String to load to generate the interfaces */ void registerMessageInterfaces (const std::string &configString); private: /** register a set Message interfaces @details call is only valid in startup mode it is a protected call to add an - @param[in] configString the location of the file or json String to load to generate the interfaces + @param[in] configString the location of the file or JSON String to load to generate the interfaces */ void registerMessageInterfacesJson (const std::string &jsonString); diff --git a/src/helics/application_api/MessageFederateManager.cpp b/src/helics/application_api/MessageFederateManager.cpp index 308461d48f..d436f48eac 100644 --- a/src/helics/application_api/MessageFederateManager.cpp +++ b/src/helics/application_api/MessageFederateManager.cpp @@ -298,9 +298,12 @@ void MessageFederateManager::registerCallback (endpoint_id_t id, if (id.value () < endpointCount) { auto eplock = local_endpoints.lock (); - assert (eplock); - (*eplock)[id.value ()]->callbackIndex = static_cast (callbacks.size ()); - callbacks.push_back (callback); + if (eplock) + { + (*eplock)[id.value ()]->callbackIndex = static_cast (callbacks.size ()); + callbacks.push_back (callback); + } + } else { @@ -315,14 +318,17 @@ void MessageFederateManager::registerCallback (const std::vector callbacks.push_back (callback); auto cnt = endpointCount.load (); auto eptLock = local_endpoints.lock (); - assert (eptLock); - for (auto id : ids) - { - if (id.value () < cnt) + if (eptLock) + { + for (auto id : ids) { - (*eptLock)[id.value ()]->callbackIndex = ind; + if (id.value () < cnt) + { + (*eptLock)[id.value ()]->callbackIndex = ind; + } } - } + } + } void MessageFederateManager::removeOrderedMessage (unsigned int index) diff --git a/src/helics/application_api/ValueFederate.hpp b/src/helics/application_api/ValueFederate.hpp index fa07aed8eb..17ccab3beb 100644 --- a/src/helics/application_api/ValueFederate.hpp +++ b/src/helics/application_api/ValueFederate.hpp @@ -29,11 +29,11 @@ class ValueFederate : public virtual Federate // using virtual inheritance to a */ ValueFederate (const std::shared_ptr &core, const FederateInfo &fi); /**constructor taking a string with the required information - @param[in] configString can be either a json file a toml file (with extension toml) or a string containing json code + @param[in] configString can be either a JSON file a toml file (with extension toml) or a string containing JSON code */ explicit ValueFederate (const std::string &configString); /**constructor taking a string with the required information - @param[in] configString can be either a json file a toml file (with extension toml) or a string containing json code + @param[in] configString can be either a JSON file a toml file (with extension toml) or a string containing JSON code */ ValueFederate (const std::string &name, const std::string &configString); @@ -271,13 +271,13 @@ class ValueFederate : public virtual Federate // using virtual inheritance to a } /** register a set of interfaces defined in a file @details call is only valid in startup mode to add an toml files must have extension .toml or .TOML - @param[in] configString the location of the file(json or toml) or json String to load to generate the interfaces + @param[in] configString the location of the file(JSON or toml) or JSON String to load to generate the interfaces */ virtual void registerInterfaces (const std::string &configString) override; /** register a set of value interfaces (publications and subscriptions) @details call is only valid in startup mode it is a protected call to add an toml files must have extension .toml or .TOML - @param[in] configString the location of the file(json or toml) or json String to load to generate the interfaces + @param[in] configString the location of the file(JSON or toml) or JSON String to load to generate the interfaces */ void registerValueInterfaces (const std::string &configString); diff --git a/src/helics/apps/Echo.hpp b/src/helics/apps/Echo.hpp index bacf15059b..b627a6b6ba 100644 --- a/src/helics/apps/Echo.hpp +++ b/src/helics/apps/Echo.hpp @@ -40,7 +40,7 @@ class Echo:public App */ Echo (const std::shared_ptr &core, const FederateInfo &fi); /**constructor taking a file with the required information - @param[in] jsonString file or json string defining the federate information and other configuration + @param[in] jsonString file or JSON string defining the federate information and other configuration */ Echo (const std::string &name, const std::string &jsonString); diff --git a/src/helics/apps/Source.hpp b/src/helics/apps/Source.hpp index 8128ff22ca..8718485089 100644 --- a/src/helics/apps/Source.hpp +++ b/src/helics/apps/Source.hpp @@ -132,7 +132,7 @@ class Source:public App private: int loadArguments (boost::program_options::variables_map &vm_map); /** load from a jsonString - @param either a json filename or a string containing json + @param either a JSON filename or a string containing JSON */ virtual void loadJsonFile(const std::string &jsonString) override; /** execute a source object and update its time return the next execution time*/ diff --git a/src/helics/common/BlockingPriorityQueue.hpp b/src/helics/common/BlockingPriorityQueue.hpp index dc57d1807e..00f67862e9 100644 --- a/src/helics/common/BlockingPriorityQueue.hpp +++ b/src/helics/common/BlockingPriorityQueue.hpp @@ -1,11 +1,9 @@ /* - Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE file and DISCLAIMER for more details. */ -#ifndef HELICS_BLOCKING_PRIORITY_QUEUE_HPP_ -#define HELICS_BLOCKING_PRIORITY_QUEUE_HPP_ +#pragma once #include "helics_includes/optional.hpp" #include @@ -421,4 +419,3 @@ bool BlockingPriorityQueue::empty () const { return queueEmptyFlag; } -#endif /*HELICS_BLOCKING_PRIORITY_QUEUE_HPP_*/ diff --git a/src/helics/common/CMakeLists.txt b/src/helics/common/CMakeLists.txt index a232b3ede3..715abdd8c6 100644 --- a/src/helics/common/CMakeLists.txt +++ b/src/helics/common/CMakeLists.txt @@ -30,6 +30,7 @@ set( DualMappedVector.hpp MappedPointerVector.hpp DualMappedPointerVector.hpp + TriggerVariable.hpp TripWire.hpp fmt_format.h fmt_ostream.h @@ -47,6 +48,7 @@ set( base64.cpp argParser.cpp TripWire.cpp + TriggerVariable.cpp ) set( diff --git a/src/helics/common/DualMappedVector.hpp b/src/helics/common/DualMappedVector.hpp index da652a051d..92b5d502dd 100644 --- a/src/helics/common/DualMappedVector.hpp +++ b/src/helics/common/DualMappedVector.hpp @@ -340,6 +340,8 @@ class DualMappedVector { std::transform (dataStorage.begin (), dataStorage.end (), dataStorage.begin (), F); } + auto begin () { return dataStorage.begin (); } + auto end (){ return dataStorage.end (); } auto begin () const { return dataStorage.cbegin (); } auto end () const { return dataStorage.cend (); } diff --git a/src/helics/common/GuardedTypes.hpp b/src/helics/common/GuardedTypes.hpp index 0f5dcb12a7..c23049bc9b 100644 --- a/src/helics/common/GuardedTypes.hpp +++ b/src/helics/common/GuardedTypes.hpp @@ -8,7 +8,7 @@ All rights reserved. See LICENSE file and DISCLAIMER for more details. #include "helics/compiler-config.h" #ifndef HAVE_SHARED_TIMED_MUTEX #ifndef HAVE_SHARED_MUTEX - #define LIBGUARDED_NO_DEFAULT 1 +#define LIBGUARDED_NO_DEFAULT 1 #endif #endif #include @@ -17,7 +17,6 @@ All rights reserved. See LICENSE file and DISCLAIMER for more details. #include //#include - template using guarded = libguarded::guarded; diff --git a/src/helics/common/JsonProcessingFunctions.cpp b/src/helics/common/JsonProcessingFunctions.cpp index bb0a41a2af..fdab53ca64 100644 --- a/src/helics/common/JsonProcessingFunctions.cpp +++ b/src/helics/common/JsonProcessingFunctions.cpp @@ -9,19 +9,18 @@ All rights reserved. See LICENSE file and DISCLAIMER for more details. Json_helics::Value loadJson (const std::string &jsonString) { - if (jsonString.size() > 128) + if (jsonString.size () > 128) { try { - return loadJsonStr(jsonString); + return loadJsonStr (jsonString); } catch (const std::invalid_argument &) { - //this was an assumption lets try a file now, the same error will be generated again later as well + // this was an assumption lets try a file now, the same error will be generated again later as well } } std::ifstream file (jsonString); - if (file.is_open ()) { @@ -35,19 +34,19 @@ Json_helics::Value loadJson (const std::string &jsonString) } return doc; } - return loadJsonStr(jsonString); + return loadJsonStr (jsonString); } -Json_helics::Value loadJsonStr(const std::string &jsonString) +Json_helics::Value loadJsonStr (const std::string &jsonString) { Json_helics::Value doc; Json_helics::CharReaderBuilder rbuilder; std::string errs; - std::istringstream jstring(jsonString); - bool ok = Json_helics::parseFromStream(rbuilder, jstring, &doc, &errs); + std::istringstream jstring (jsonString); + bool ok = Json_helics::parseFromStream (rbuilder, jstring, &doc, &errs); if (!ok) { - throw (std::invalid_argument(errs.c_str())); + throw (std::invalid_argument (errs.c_str ())); } return doc; } @@ -92,14 +91,13 @@ std::string getKey (const Json_helics::Value &element) ((element.isMember ("name")) ? element["name"].asString () : std::string ()); } - -std::string generateJsonString(const Json_helics::Value &block) +std::string generateJsonString (const Json_helics::Value &block) { Json_helics::StreamWriterBuilder builder; builder["commentStyle"] = "None"; builder["indentation"] = " "; // or whatever you like - auto writer(builder.newStreamWriter()); + auto writer (builder.newStreamWriter ()); std::stringstream sstr; - writer->write(block, &sstr); - return sstr.str(); -} \ No newline at end of file + writer->write (block, &sstr); + return sstr.str (); +} diff --git a/src/helics/common/JsonProcessingFunctions.hpp b/src/helics/common/JsonProcessingFunctions.hpp index 96c412678e..8709a8e42d 100644 --- a/src/helics/common/JsonProcessingFunctions.hpp +++ b/src/helics/common/JsonProcessingFunctions.hpp @@ -14,13 +14,13 @@ using the jsoncpp library #include "../core/helics-time.hpp" /** load a JSON string or filename that points to a JSON file and return a -json::Value to the root object +JSON::Value to the root object */ Json_helics::Value loadJson (const std::string &jsonString); /** load a JSON object in a string -*/ -Json_helics::Value loadJsonStr(const std::string &jsonString); + */ +Json_helics::Value loadJsonStr (const std::string &jsonString); /** read a time from a JSON value element*/ helics::Time loadJsonTime (const Json_helics::Value &timeElement, timeUnits defaultUnits = timeUnits::sec); @@ -28,14 +28,13 @@ helics::Time loadJsonTime (const Json_helics::Value &timeElement, timeUnits defa /** get a name or key from the element*/ std::string getKey (const Json_helics::Value &element); - -inline std::string jsonGetOrDefault (const Json_helics::Value &element, const std::string &key, const std::string &defVal) +inline std::string +jsonGetOrDefault (const Json_helics::Value &element, const std::string &key, const std::string &defVal) { return (element.isMember (key)) ? element[key].asString () : defVal; } -inline double -jsonGetOrDefault (const Json_helics::Value &element, const std::string &key, double defVal) +inline double jsonGetOrDefault (const Json_helics::Value &element, const std::string &key, double defVal) { return (element.isMember (key)) ? element[key].asDouble () : defVal; } @@ -47,7 +46,7 @@ inline int64_t jsonGetOrDefault (const Json_helics::Value &element, const std::s inline void jsonReplaceIfMember (const Json_helics::Value &element, const std::string &key, helics::Time &timeVal) { - if (element.isMember(key)) + if (element.isMember (key)) { timeVal = loadJsonTime (element[key]); } @@ -57,7 +56,7 @@ inline void jsonReplaceIfMember (const Json_helics::Value &element, const std::s { if (element.isMember (key)) { - sval= element[key].asString(); + sval = element[key].asString (); } } @@ -70,4 +69,4 @@ inline void jsonReplaceIfMember (const Json_helics::Value &element, const std::s } /** generate a Json String*/ -std::string generateJsonString(const Json_helics::Value &block); \ No newline at end of file +std::string generateJsonString (const Json_helics::Value &block); diff --git a/src/helics/common/TomlProcessingFunctions.hpp b/src/helics/common/TomlProcessingFunctions.hpp index 40162ea592..55fa7d6bf2 100644 --- a/src/helics/common/TomlProcessingFunctions.hpp +++ b/src/helics/common/TomlProcessingFunctions.hpp @@ -14,13 +14,13 @@ using the toml library #include "../core/helics-time.hpp" /** load a Toml string or filename that points to a TOML file and return a -json::Value to the root object +JSON::Value to the root object */ toml::Value loadToml (const std::string &tomlString); bool hasTomlExtension (const std::string &tomlString); - /** load a JSON object in a string -*/ +/** load a JSON object in a string + */ toml::Value loadTomlStr (const std::string &tomlString); /** read a time from a JSON value element*/ @@ -29,8 +29,8 @@ helics::Time loadTomlTime (const toml::Value &timeElement, timeUnits defaultUnit /** get a name or key from the element*/ std::string getKey (const toml::Value &element); -template -inline X tomlGetOrDefault(const toml::Value &element, const std::string &key, const X &defVal) +template +inline X tomlGetOrDefault (const toml::Value &element, const std::string &key, const X &defVal) { auto val = element.find (key); return (val != nullptr) ? val->as () : defVal; @@ -41,7 +41,7 @@ inline void tomlReplaceIfMember (const toml::Value &element, const std::string & auto val = element.find (key); if (val != nullptr) { - timeVal = loadTomlTime(*val); + timeVal = loadTomlTime (*val); } } @@ -49,13 +49,13 @@ template inline void tomlReplaceIfMember (const toml::Value &element, const std::string &key, X &loc) { auto val = element.find (key); - if (val != nullptr) - { + if (val != nullptr) + { loc = val->as (); - } + } } inline bool isMember (const toml::Value &element, const std::string &key) { return (element.find (key) != nullptr); -} \ No newline at end of file +} diff --git a/src/helics/common/TriggerVariable.cpp b/src/helics/common/TriggerVariable.cpp new file mode 100644 index 0000000000..333fab5040 --- /dev/null +++ b/src/helics/common/TriggerVariable.cpp @@ -0,0 +1,94 @@ +/* +Copyright © 2017-2018, +Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC +All rights reserved. See LICENSE file and DISCLAIMER for more details. +*/ + +#include "TriggerVariable.hpp" + +bool TriggerVariable::activate () +{ + std::unique_lock lock (stateLock); + if (activated) + { + // we are already activated so this function did nothing so return false + return false; + } + activated = true; + lock.unlock (); + cv_active.notify_all (); + return true; +} + +bool TriggerVariable::trigger () +{ + std::unique_lock lock (stateLock); + if (activated) + { + triggered.store (true); + lock.unlock (); + cv_trigger.notify_all (); + return true; + } + + return false; +} + +void TriggerVariable::wait () const +{ + std::unique_lock lk (stateLock); + if (activated && (!triggered.load ())) + { + cv_trigger.wait (lk, [this] { return triggered.load (); }); + } +} + +bool TriggerVariable::wait_for (const std::chrono::milliseconds &duration) const +{ + std::unique_lock lk (stateLock); + if (activated && (!triggered.load ())) + { + return cv_trigger.wait_for (lk, duration, [this] { return triggered.load (); }); + } + return true; +} + +void TriggerVariable::waitActivation () const +{ + std::unique_lock lk (stateLock); + if (!activated) + { + cv_active.wait (lk, [this] { return activated; }); + } +} + +bool TriggerVariable::wait_forActivation (const std::chrono::milliseconds &duration) const +{ + std::unique_lock lk (stateLock); + if (!activated) + { + return cv_active.wait_for (lk, duration, [this] { return activated; }); + } + return true; +} + +void TriggerVariable::reset () +{ + std::unique_lock lk (stateLock); + if (activated) + { + while (!triggered.load ()) + { + lk.unlock (); + trigger (); + lk.lock (); + } + } + activated = false; +} + +bool TriggerVariable::isActive () const +{ + std::lock_guard lock (stateLock); + return activated; +} diff --git a/src/helics/common/TriggerVariable.hpp b/src/helics/common/TriggerVariable.hpp new file mode 100644 index 0000000000..ac46dba0a3 --- /dev/null +++ b/src/helics/common/TriggerVariable.hpp @@ -0,0 +1,45 @@ +/* +Copyright © 2017-2018, +Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC +All rights reserved. See LICENSE file and DISCLAIMER for more details. +*/ +#pragma once +#include + +#include +#include +#include + +class TriggerVariable +{ + public: + explicit TriggerVariable (bool active = false) : triggered (false), activated (active){}; + /** activate the trigger to the ready state + @return true if the Trigger was activated false if it was already active + */ + bool activate (); + /** trigger the variable + @return true if the trigger was successful, false if the trigger has not been activated yet*/ + bool trigger (); + /** check if the variable has been triggered*/ + bool isTriggered () const { return triggered.load (); } + /** wait for the variable to trigger*/ + void wait () const; + /** wait for a period of time for the value to trigger*/ + bool wait_for (const std::chrono::milliseconds &duration) const; + /** wait on the Trigger becoming active*/ + void waitActivation () const; + /** wait for a period of time for the value to trigger*/ + bool wait_forActivation (const std::chrono::milliseconds &duration) const; + /** reset the trigger Variable to the inactive state*/ + void reset (); + /** check if the variable is active*/ + bool isActive () const; + + private: + std::atomic triggered; //!< the state of the trigger + bool activated; //!< variable controlling if the trigger has been activated + mutable std::mutex stateLock; //!< mutex protecting the trigger + mutable std::condition_variable cv_trigger; //!< semaphore for the trigger + mutable std::condition_variable cv_active; //!< semaphore for the activation +}; diff --git a/src/helics/common/TripWire.cpp b/src/helics/common/TripWire.cpp index 0b66085d8b..98d78a7b97 100644 --- a/src/helics/common/TripWire.cpp +++ b/src/helics/common/TripWire.cpp @@ -19,4 +19,4 @@ bool TripWireDetector::isTripped () const { return lineDetector->load (); } TripWireTrigger::TripWireTrigger () : lineTrigger (TripWire::getline ()) {} TripWireTrigger::~TripWireTrigger () { lineTrigger->store (true); } -} +} // namespace tripwire diff --git a/src/helics/common/base64.cpp b/src/helics/common/base64.cpp index 515239e90e..5a3f721e88 100644 --- a/src/helics/common/base64.cpp +++ b/src/helics/common/base64.cpp @@ -203,7 +203,8 @@ size_t base64_decode (std::string const &encoded_string, void *data, size_t max_ auto in_len = encoded_string.size (); int i = 0; int in_ = 0; - unsigned char char_array_4[4], char_array_3[3]; + unsigned char char_array_4[4] = {'\0', '\0', '\0', '\0'}; + unsigned char char_array_3[3] = {'\0', '\0', '\0'}; unsigned char *outData = reinterpret_cast (data); size_t dataIndex = 0; while (((in_len--) != 0u) && (encoded_string[in_] != '=') && is_base64 (encoded_string[in_])) diff --git a/src/helics/core/ActionMessageDefintions.hpp b/src/helics/core/ActionMessageDefintions.hpp index 8cf8df86ac..6e921e6807 100644 --- a/src/helics/core/ActionMessageDefintions.hpp +++ b/src/helics/core/ActionMessageDefintions.hpp @@ -56,8 +56,10 @@ enum class action_t : int32_t cmd_ignore = 0, //!< null command cmd_tick = 1, //!< command for a timer tick + cmd_user_disconnect = 2, //!< command specifying that a user has issued a disconnect signal cmd_disconnect = 3, //!< disconnect command cmd_disconnect_name = 4, //!< disconnect a broker or core by name vs id + cmd_disconnect_check = 5, //!< check for a disconnect cmd_ping = 6, //!< request for an Echo response cmd_ping_reply = 7, //!< response to a ping request @@ -141,8 +143,10 @@ enum class action_t : int32_t #define CMD_TICK action_message_def::action_t::cmd_tick #define CMD_REG_BROKER action_message_def::action_t::cmd_reg_broker #define CMD_PRIORITY_DISCONNECT action_message_def::action_t::cmd_priority_disconnect +#define CMD_USER_DISCONNECT action_message_def::action_t::cmd_user_disconnect #define CMD_DISCONNECT action_message_def::action_t::cmd_disconnect #define CMD_DISCONNECT_NAME action_message_def::action_t::cmd_disconnect_name +#define CMD_DISCONNECT_CHECK action_message_def::action_t::cmd_disconnect_check #define CMD_PING action_message_def::action_t::cmd_ping #define CMD_PING_REPLY action_message_def::action_t::cmd_ping_reply diff --git a/src/helics/core/Broker.hpp b/src/helics/core/Broker.hpp index 7c20b7863d..dcffbab470 100644 --- a/src/helics/core/Broker.hpp +++ b/src/helics/core/Broker.hpp @@ -60,7 +60,7 @@ class Broker /** waits in the current thread until the broker is disconnected */ - virtual void waitForDisconnect () const= 0; + virtual void waitForDisconnect (int msToWait=-1) const= 0; /** make a query for information from the co-simulation @details the format is somewhat unspecified target is the name of an object typically one of "federation", "broker", or the name of a specific object diff --git a/src/helics/core/BrokerBase.cpp b/src/helics/core/BrokerBase.cpp index 9c7180af30..b9f785c59b 100644 --- a/src/helics/core/BrokerBase.cpp +++ b/src/helics/core/BrokerBase.cpp @@ -84,9 +84,12 @@ static const ArgDescriptors extraArgs{ "secondary actions are taken (can also be entered as a time like '10s' or '45ms')"}, {"dumplog", ArgDescriptor::arg_type_t::flag_type, "capture a record of all messages and dump a complete log to file or console on termination"}, + {"networktimeout", + "milliseconds to wait to establish a network (can also be entered as a time like '500ms' or '2s') "}, {"timeout", "milliseconds to wait for a broker connection (can also be entered as a time like '10s' or '45ms') "}}; + void BrokerBase::displayHelp () { std::cout << " Global options for all Brokers:\n"; @@ -148,11 +151,24 @@ void BrokerBase::initializeFromCmdArgs (int argc, const char *const *argv) { logFile = vm["logfile"].as (); } + if (vm.count ("networktimeout") > 0) + { + auto network_to = loadTimeFromString (vm["timeout"].as (), timeUnits::ms); + networkTimeout = network_to.toCount (timeUnits::ms); + } if (vm.count ("timeout") > 0) { auto time_out = loadTimeFromString (vm["timeout"].as (), timeUnits::ms); timeout = time_out.toCount (timeUnits::ms); + if (networkTimeout < 0) + { + networkTimeout = timeout; + } } + if (networkTimeout < 0) + { + networkTimeout = 4000; + } if (vm.count ("tick") > 0) { auto time_tick = loadTimeFromString (vm["tick"].as (), timeUnits::ms); @@ -322,6 +338,7 @@ static void timerTickHandler (BrokerBase *bbase, activeProtector &active, const bool BrokerBase::tryReconnect () { return false; } +//#define DISABLE_TICK void BrokerBase::queueProcessingLoop () { std::vector dumpMessages; @@ -366,8 +383,10 @@ void BrokerBase::queueProcessingLoop () } if (messagesSinceLastTick == 0) { +#ifndef DISABLE_TICK // std::cout << "sending tick " << std::endl; processCommand (std::move (command)); +#endif } messagesSinceLastTick = 0; // reschedule the timer diff --git a/src/helics/core/BrokerBase.hpp b/src/helics/core/BrokerBase.hpp index 8bfc4cdab0..ba06eac5e2 100644 --- a/src/helics/core/BrokerBase.hpp +++ b/src/helics/core/BrokerBase.hpp @@ -38,6 +38,7 @@ class BrokerBase int32_t tickTimer = 4000; //!< counter for the length of a keep alive tick in milliseconds int32_t timeout = 30000; //!< timeout to wait to establish a broker connection before giving up in milliseconds + int32_t networkTimeout = -1; //!< timeout to establish a socket connection before giving up std::string identifier; //!< an identifier for the broker std::unique_ptr diff --git a/src/helics/core/BrokerFactory.cpp b/src/helics/core/BrokerFactory.cpp index 87a7044c4a..73d96d6c30 100644 --- a/src/helics/core/BrokerFactory.cpp +++ b/src/helics/core/BrokerFactory.cpp @@ -4,10 +4,10 @@ Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE file and DISCLAIMER for more details. */ -#include "BrokerFactory.hpp" #include "../common/TripWire.hpp" #include "../common/delayedDestructor.hpp" #include "../common/searchableObjectHolder.hpp" +#include "BrokerFactory.hpp" #include "core-exceptions.hpp" #include "core-types.hpp" #include "helics/helics-config.h" @@ -136,7 +136,11 @@ std::shared_ptr create (core_type type, const std::string &initializatio { auto broker = makeBroker (type, std::string ()); broker->initialize (initializationString); - registerBroker (broker); + bool reg=registerBroker (broker); + if (!reg) + { + throw (helics::RegistrationFailure ("unable to register broker")); + } broker->connect (); return broker; } @@ -149,7 +153,7 @@ create (core_type type, const std::string &broker_name, const std::string &initi bool reg = registerBroker (broker); if (!reg) { - // TODO:: do some automatic renaming? + throw (helics::RegistrationFailure ("unable to register broker")); } broker->connect (); return broker; @@ -159,7 +163,11 @@ std::shared_ptr create (core_type type, int argc, const char *const *arg { auto broker = makeBroker (type, ""); broker->initializeFromArgs (argc, argv); - registerBroker (broker); + bool reg=registerBroker (broker); + if (!reg) + { + throw (helics::RegistrationFailure ("unable to register broker")); + } broker->connect (); return broker; } @@ -171,6 +179,7 @@ std::shared_ptr create (core_type type, const std::string &broker_name, bool reg = registerBroker (broker); if (!reg) { + throw (helics::RegistrationFailure ("unable to register broker")); } broker->connect (); return broker; @@ -204,19 +213,24 @@ std::shared_ptr findBroker (const std::string &brokerName) bool registerBroker (const std::shared_ptr &broker) { - bool res = false; + bool registered = false; auto tbroker = std::dynamic_pointer_cast (broker); if (tbroker) { - res = searchableObjects.addObject (tbroker->getIdentifier (), tbroker); + registered = searchableObjects.addObject (tbroker->getIdentifier (), tbroker); } cleanUpBrokers (); - if (res) + if (!registered) + { + std::this_thread::sleep_for (std::chrono::milliseconds (200)); + registered = searchableObjects.addObject (tbroker->getIdentifier (), tbroker); + } + if (registered) { delayedDestroyer.addObjectsToBeDestroyed (tbroker); } - return res; + return registered; } size_t cleanUpBrokers () { return delayedDestroyer.destroyObjects (); } diff --git a/src/helics/core/CommonCore.cpp b/src/helics/core/CommonCore.cpp index f225a45771..c8ee1a6b02 100644 --- a/src/helics/core/CommonCore.cpp +++ b/src/helics/core/CommonCore.cpp @@ -110,6 +110,7 @@ void CommonCore::processDisconnect (bool skipUnregister) if (brokerState < broker_state_t::terminating) { brokerState = broker_state_t::terminating; + timeCoord->disconnect (); if (global_broker_id != 0) { ActionMessage dis (CMD_DISCONNECT); @@ -311,7 +312,15 @@ bool CommonCore::allDisconnected () const auto state = fed->getState (); return (HELICS_FINISHED == state) || (HELICS_ERROR == state); }; - return std::all_of (loopFederates.begin (), loopFederates.end (), pred); + auto afed = std::all_of (loopFederates.begin (), loopFederates.end (), pred); + if ((hasTimeDependency) || (hasFilters)) + { + return (afed) && (!timeCoord->hasActiveTimeDependencies ()); + } + else + { + return (afed); + } } void CommonCore::setCoreReadyToInit () @@ -505,11 +514,15 @@ Time CommonCore::timeRequest (federate_id_t federateID, Time next) if (HELICS_EXECUTING == fed->getState ()) { auto ret = fed->requestTime (next, iteration_request::no_iterations); - if (ret.state != iteration_result::error) + switch (ret.state) { + case iteration_result::error: + throw (FunctionExecutionFailure (fed->lastErrorString ())); + case iteration_result::halted: + throw (HelicsTerminated ("federate has terminated")); + default: return ret.grantedTime; } - throw (FunctionExecutionFailure ("federate has an error")); } throw (InvalidFunctionCall ("time request may only be called in execution state")); } @@ -2020,7 +2033,7 @@ std::string CommonCore::query (const std::string &target, const std::string &que ActiveQueries.finishedWithValue (index); return ret; } - //default into a federate query + // default into a federate query auto fed = (target != "federate") ? getFederate (target) : getFederateAt (0); if (fed != nullptr) { @@ -2120,14 +2133,7 @@ void CommonCore::processPriorityCommand (ActionMessage &&command) addRoute (command.dest_handle, command.payload); break; case CMD_PRIORITY_DISCONNECT: - if (allDisconnected ()) - { - brokerState = broker_state_t::terminating; - ActionMessage dis (CMD_DISCONNECT); - dis.source_id = global_broker_id; - transmit (0, dis); - addActionMessage (CMD_STOP); - } + checkDisconnect (); break; case CMD_BROKER_QUERY: if (command.dest_id == global_broker_id) @@ -2304,10 +2310,13 @@ void CommonCore::processCommand (ActionMessage &&command) } break; case CMD_STOP: + if (isConnected ()) { - if (!allDisconnected ()) + if (brokerState < broker_state_t::terminating) { // only send a disconnect message if we haven't done so already + brokerState = broker_state_t::terminating; + timeCoord->disconnect (); ActionMessage m (CMD_DISCONNECT); m.source_id = global_broker_id; transmit (0, m); @@ -2374,20 +2383,16 @@ void CommonCore::processCommand (ActionMessage &&command) case CMD_DISCONNECT: if (command.dest_id == 0) { - if (allDisconnected ()) - { - brokerState = broker_state_t::terminated; - ActionMessage dis (CMD_DISCONNECT); - dis.source_id = global_broker_id; - transmit (0, dis); - addActionMessage (CMD_STOP); - } + checkDisconnect (); } else { routeMessage (command); } + break; + case CMD_DISCONNECT_CHECK: + checkDisconnect (); break; case CMD_SEARCH_DEPENDENCY: { @@ -2466,7 +2471,14 @@ void CommonCore::processCommand (ActionMessage &&command) case CMD_ERROR: if (command.dest_id == global_broker_id) { - sendToLogger (0, 0, getFederateNameNoThrow (command.source_id), command.payload); + if (command.source_id == higher_broker_id) + { + sendErrorToFederates (command.counter); + } + else + { + sendToLogger (0, 0, getFederateNameNoThrow (command.source_id), command.payload); + } } else { @@ -2854,12 +2866,13 @@ void CommonCore::checkDependencies () } } - // if we have filters we need to be a timeCoordinator + // if the core has filters we need to be a timeCoordinator if (hasFilters) { return; } - // if there is more than 2 dependents(higher broker + 2 or more federates then we need to be a timeCoordinator + // if there is more than 2 dependents or dependencies (higher broker + 2 or more federates) then we need to be + // a timeCoordinator if (timeCoord->getDependents ().size () > 2) { return; @@ -2890,19 +2903,9 @@ void CommonCore::checkDependencies () // check to make sure the dependencies match for (auto &dep : timeCoord->getDependencies ()) { - if (isLocal (dep)) - { - if (dep != fedid) - { - return; - } - } - else + if (!((dep == fedid) || (dep == brkid))) { - if (brkid != dep) - { - return; - } + return; } } // remove the core from the time dependency chain since it is just adding to the communication noise in this @@ -2911,7 +2914,7 @@ void CommonCore::checkDependencies () timeCoord->removeDependency (fedid); timeCoord->removeDependent (brkid); timeCoord->removeDependent (fedid); - + hasTimeDependency = false; ActionMessage rmdep (CMD_REMOVE_INTERDEPENDENCY); rmdep.source_id = global_broker_id; @@ -3110,14 +3113,32 @@ void CommonCore::processCommandsForCore (const ActionMessage &cmd) } if (cmd.action () == CMD_DISCONNECT) { - if (allDisconnected ()) + if (cmd.source_id == higher_broker_id) { - brokerState = broker_state_t::terminated; - ActionMessage dis (CMD_DISCONNECT); - dis.source_id = global_broker_id; - transmit (0, dis); + brokerState = broker_state_t::terminating; + if (hasTimeDependency || hasFilters) + { + timeCoord->disconnect (); + } + ActionMessage bye (CMD_DISCONNECT); + for (auto &fed : loopFederates) + { + auto state = fed->getState (); + if ((HELICS_FINISHED == state) || (HELICS_ERROR == state)) + { + continue; + } + bye.source_id = fed->global_id; + bye.dest_id = fed->global_id; + fed->addAction (bye); + } + addActionMessage (CMD_STOP); } + else + { + checkDisconnect (); + } } } else if (isDependencyCommand (cmd)) @@ -3130,6 +3151,19 @@ void CommonCore::processCommandsForCore (const ActionMessage &cmd) } } +void CommonCore::checkDisconnect () +{ + if (allDisconnected ()) + { + brokerState = broker_state_t::terminating; + timeCoord->disconnect (); + ActionMessage dis (CMD_DISCONNECT); + dis.source_id = global_broker_id; + transmit (0, dis); + addActionMessage (CMD_STOP); + } +} + bool CommonCore::checkForLocalPublication (ActionMessage &cmd) { auto handlelock = handles.lock_shared (); diff --git a/src/helics/core/CommonCore.hpp b/src/helics/core/CommonCore.hpp index 4bf5e20c33..9773aa061d 100644 --- a/src/helics/core/CommonCore.hpp +++ b/src/helics/core/CommonCore.hpp @@ -3,7 +3,6 @@ Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE file and DISCLAIMER for more details. */ - #pragma once #include "../common/simpleQueue.hpp" @@ -13,19 +12,19 @@ All rights reserved. See LICENSE file and DISCLAIMER for more details. #include "helics-time.hpp" #include "helics/helics-config.h" +#include "../common/AirLock.hpp" +#include "../common/DelayedObjects.hpp" #include "../common/DualMappedPointerVector.hpp" #include "../common/DualMappedVector.hpp" #include "../common/GuardedTypes.hpp" #include "../common/MappedPointerVector.hpp" -#include "../common/AirLock.hpp" -#include "../common/DelayedObjects.hpp" -#include "helics_includes/any.hpp" #include "HandlePointerManager.hpp" +#include "helics_includes/any.hpp" +#include #include #include #include #include -#include namespace helics { @@ -272,7 +271,7 @@ class CommonCore : public Core, public BrokerBase const std::string &target, const std::string &type_in, const std::string &type_out, - bool cloning); + bool cloning); /** check if we can remove some dependencies*/ void checkDependencies (); @@ -280,14 +279,15 @@ class CommonCore : public Core, public BrokerBase /** handle command with the core itself as a destination at the core*/ void processCommandsForCore (const ActionMessage &cmd); /** process configure commands for the core*/ - void processCoreConfigureCommands(ActionMessage &cmd); + void processCoreConfigureCommands (ActionMessage &cmd); /** check if a newly registered subscription has a local publication if it does return true*/ bool checkForLocalPublication (ActionMessage &cmd); /** get an index for an airlock*/ - uint16_t getNextAirlockIndex(); + uint16_t getNextAirlockIndex (); /** generate results for core queries*/ - std::string coreQuery(const std::string &queryStr) const; + std::string coreQuery (const std::string &queryStr) const; + private: int32_t _global_federation_size = 0; //!< total size of the federation std::atomic delayInitCounter{ @@ -308,16 +308,18 @@ class CommonCore : public Core, public BrokerBase std::map> delayedTimingMessages; //!< delayedTimingMessages from ongoing Filter actions - std::atomic queryCounter{1}; //counter for queries start at 1 so the default value isn't used - DelayedObjects ActiveQueries; //holder for active queries + std::atomic queryCounter{1}; // counter for queries start at 1 so the default value isn't used + DelayedObjects ActiveQueries; // holder for active queries std::map> filterCoord; //!< map of all local filters using fed_handle_pair = std::pair; - shared_guarded> filters; //!< storage for all the filters + shared_guarded> + filters; //!< storage for all the filters - std::atomic nextAirLock{ 0 }; //!< the index of the next airlock to use - std::array, 4> dataAirlocks; //!< airlocks for updating the filter operators + std::atomic nextAirLock{0}; //!< the index of the next airlock to use + std::array, 4> dataAirlocks; //!< airlocks for updating filter operators and other functions protected: /** deliver a message to the appropriate location*/ @@ -373,6 +375,8 @@ class CommonCore : public Core, public BrokerBase /** send an error code to all the federates*/ void sendErrorToFederates (int error_code); + /** check for a disconnect and take actions if the object can disconnect*/ + void checkDisconnect (); }; } // namespace helics diff --git a/src/helics/core/CommsInterface.cpp b/src/helics/core/CommsInterface.cpp index 447f6dbf15..13f1f7ab1f 100644 --- a/src/helics/core/CommsInterface.cpp +++ b/src/helics/core/CommsInterface.cpp @@ -54,6 +54,76 @@ void CommsInterface::addRoute (int route_id, const std::string &routeInfo) transmit (-1, rt); } +void CommsInterface::setTxStatus(connection_status txStatus) +{ + if (tx_status == txStatus) + { + return; + } + switch (txStatus) + { + case connection_status::connected: + if (tx_status == connection_status::startup) + { + tx_status = txStatus; + txTrigger.activate (); + } + break; + case connection_status::terminated: + case connection_status::error: + if (tx_status == connection_status::startup) + { + tx_status = txStatus; + txTrigger.activate (); + txTrigger.trigger (); + } + else + { + tx_status = txStatus; + txTrigger.trigger (); + } + break; + default: + tx_status = txStatus; + } + +} + +void CommsInterface::setRxStatus(connection_status rxStatus) +{ + if (rx_status == rxStatus) + { + return; + } + switch (rxStatus) + { + case connection_status::connected: + if (rx_status == connection_status::startup) + { + rx_status = rxStatus; + rxTrigger.activate (); + } + break; + case connection_status::terminated: + case connection_status::error: + if (rx_status == connection_status::startup) + { + rx_status = rxStatus; + rxTrigger.activate (); + rxTrigger.trigger (); + } + else + { + rx_status = rxStatus; + rxTrigger.trigger (); + } + + break; + default: + rx_status = rxStatus; + } +} + bool CommsInterface::connect () { if (isConnected ()) @@ -85,15 +155,8 @@ bool CommsInterface::connect () } queue_watcher = std::thread ([this] { queue_rx_function (); }); queue_transmitter = std::thread ([this] { queue_tx_function (); }); - std::this_thread::sleep_for (std::chrono::milliseconds (50)); - while (rx_status == connection_status::startup) - { - std::this_thread::sleep_for (std::chrono::milliseconds (100)); - } - while (tx_status == connection_status::startup) - { - std::this_thread::sleep_for (std::chrono::milliseconds (100)); - } + txTrigger.waitActivation (); + rxTrigger.waitActivation (); if (rx_status != connection_status::connected) { // std::cerr << "receiver connection failure" << std::endl; @@ -146,14 +209,17 @@ void CommsInterface::disconnect () int cnt = 0; while (rx_status.load () <= connection_status::connected) { - std::this_thread::sleep_for (std::chrono::milliseconds (50)); + if (rxTrigger.wait_for(std::chrono::milliseconds(800))) + { + continue; + } ++cnt; - if ((cnt & 31) == 0) // call this every 32*50 milliseconds + if ((cnt & 3) == 0) // call this every 2400 milliseconds { // try calling closeReceiver again closeReceiver (); } - if (cnt == 400) // Eventually give up + if (cnt == 14) // Eventually give up { std::cerr << "unable to terminate connection\n"; break; @@ -169,14 +235,17 @@ void CommsInterface::disconnect () cnt = 0; while (tx_status.load () <= connection_status::connected) { - std::this_thread::sleep_for (std::chrono::milliseconds (50)); + if (txTrigger.wait_for (std::chrono::milliseconds (800))) + { + continue; + } ++cnt; - if ((cnt & 31) == 0) + if ((cnt & 3) == 0) // call this every 2400 milliseconds { - // try calling closeTransmitter again + // try calling closeReceiver again closeTransmitter (); } - if (cnt == 400) + if (cnt == 14) // Eventually give up { std::cerr << "unable to terminate connection\n"; break; diff --git a/src/helics/core/CommsInterface.hpp b/src/helics/core/CommsInterface.hpp index 901358a488..e5b7ef1a96 100644 --- a/src/helics/core/CommsInterface.hpp +++ b/src/helics/core/CommsInterface.hpp @@ -11,6 +11,8 @@ All rights reserved. See LICENSE file and DISCLAIMER for more details. #include "ActionMessage.hpp" #include #include +#include "../common/TriggerVariable.hpp" + namespace helics { enum class interface_networks :char; @@ -76,14 +78,23 @@ class CommsInterface error = 4, //!< some error occurred on the connection }; + + private: std::atomic rx_status{connection_status::startup}; //!< the status of the receiver thread + protected: + TriggerVariable rxTrigger; + std::string name; //!< the name of the object std::string localTarget_; //!< the base for the receive address std::string brokerTarget_; //!< the base for the broker address std::string brokerName_; //!< the identifier for the broker + private: std::atomic tx_status{ connection_status::startup}; //!< the status of the transmitter thread - int connectionTimeout = 4000; // timeout for the initial connection to a broker + TriggerVariable txTrigger; + + protected: + int connectionTimeout = 4000; // timeout for the initial connection to a broker or to bind a broker port(in ms) int maxMessageSize_ = 16 * 1024; //!< the maximum message size for the queues (if needed) int maxMessageCount_ = 512; //!< the maximum number of message to buffer (if needed) @@ -94,6 +105,7 @@ class CommsInterface std::atomic disconnecting{ false}; //!< flag indicating that the comm system is in the process of disconnecting interface_networks interfaceNetwork; + private: std::thread queue_transmitter; //!< single thread for sending data std::thread queue_watcher; //!< thread monitoring the receive queue @@ -104,7 +116,12 @@ class CommsInterface virtual void closeReceiver () = 0; //!< function to instruct the receiver loop to close virtual void reconnectTransmitter (); //!< function to reconnect the transmitter virtual void reconnectReceiver (); //!< function to reconnect the receiver - + protected: + void setTxStatus (connection_status txStatus); + void setRxStatus (connection_status rxStatus); + connection_status getRxStatus () const { return rx_status.load (); } + connection_status getTxStatus () const { return tx_status.load (); } + private: tripwire::TripWireDetector tripDetector; //!< try to detect if everything is shutting down }; diff --git a/src/helics/core/CoreBroker.cpp b/src/helics/core/CoreBroker.cpp index 3635e27b48..a54dd40aa9 100644 --- a/src/helics/core/CoreBroker.cpp +++ b/src/helics/core/CoreBroker.cpp @@ -364,6 +364,42 @@ void CoreBroker::transmitDelayedMessages () } } +void CoreBroker::sendDisconnect () +{ + ActionMessage bye (CMD_DISCONNECT); + bye.source_id = global_broker_id; + for (auto &brk : _brokers) + { + if (!brk._nonLocal) + { + routeMessage (bye, brk.global_id); + brk._disconnected = true; + } + if (hasTimeDependency) + { + timeCoord->removeDependency (brk.global_id); + timeCoord->removeDependent (brk.global_id); + } + } + if (hasTimeDependency) + { + timeCoord->disconnect (); + } +} + +void CoreBroker::sendErrorToImmediateBrokers (int error_code) +{ + ActionMessage errorCom (CMD_ERROR); + errorCom.counter = static_cast (error_code); + for (auto &brk : _brokers) + { + if (!brk._nonLocal) + { + routeMessage (errorCom, brk.global_id); + } + } +} + void CoreBroker::processCommand (ActionMessage &&command) { LOG_TRACE (global_broker_id, getIdentifier (), @@ -373,6 +409,7 @@ void CoreBroker::processCommand (ActionMessage &&command) case CMD_IGNORE: case CMD_PROTOCOL: break; + case CMD_TICK: if (!_isRoot) { @@ -380,6 +417,11 @@ void CoreBroker::processCommand (ActionMessage &&command) { // try to reset the connection to the broker // brokerReconnect() + LOG_ERROR (global_broker_id, getIdentifier (), "lost connection with server"); + sendErrorToImmediateBrokers (-5); + disconnect (); + brokerState = broker_state_t::errored; + addActionMessage (CMD_STOP); } else { @@ -497,7 +539,7 @@ void CoreBroker::processCommand (ActionMessage &&command) auto brk = _brokers.find (command.payload); if (brk != _brokers.end ()) { - brk->_disconnected = true; + command.source_id = brk->global_id; } } FALLTHROUGH @@ -506,13 +548,44 @@ void CoreBroker::processCommand (ActionMessage &&command) { if ((command.dest_id == 0) || (command.dest_id == global_broker_id)) { + if (!isRoot ()) + { + if (command.source_id == higher_broker_id) + { + sendDisconnect (); + addActionMessage (CMD_STOP); + return; + } + } + auto brk = getBrokerById (command.source_id); if (brk != nullptr) { brk->_disconnected = true; } + if (hasTimeDependency) + { + if (!enteredExecutionMode) + { + timeCoord->processTimeMessage (command); + auto res = timeCoord->checkExecEntry (); + if (res == message_processing_result::next_step) + { + enteredExecutionMode = true; + } + } + else + { + if (timeCoord->processTimeMessage (command)) + { + timeCoord->updateTimeFactors (); + } + } + } + if (allDisconnected ()) { + timeCoord->disconnect (); if (!_isRoot) { ActionMessage dis (CMD_DISCONNECT); @@ -528,12 +601,20 @@ void CoreBroker::processCommand (ActionMessage &&command) } } break; + case CMD_USER_DISCONNECT: + sendDisconnect (); + addActionMessage (CMD_STOP); + break; case CMD_STOP: - if ((!allDisconnected ()) && (!_isRoot)) + if (!allDisconnected ()) { // only send a disconnect message if we haven't done so already - ActionMessage m (CMD_DISCONNECT); - m.source_id = global_broker_id; - transmit (0, m); + timeCoord->disconnect (); + if (!_isRoot) + { + ActionMessage m (CMD_DISCONNECT); + m.source_id = global_broker_id; + transmit (0, m); + } } break; case CMD_EXEC_REQUEST: @@ -681,6 +762,10 @@ void CoreBroker::processCommand (ActionMessage &&command) else { timeCoord->processDependencyUpdateMessage (command); + if (!hasTimeDependency) + { + hasTimeDependency = true; + } } break; default: @@ -923,6 +1008,7 @@ bool CoreBroker::connect () { timeCoord->source_id = global_broker_id; } + disconnection.activate (); brokerState = broker_state_t::connected; } else @@ -944,21 +1030,15 @@ bool CoreBroker::connect () bool CoreBroker::isConnected () const { return ((brokerState == operating) || (brokerState == connected)); } -void CoreBroker::waitForDisconnect () const +void CoreBroker::waitForDisconnect (int msToWait) const { - // TODO:: this should really be a future that gets triggered when isConnected changes - bool sleep_toggle = false; - while (isConnected ()) + if (msToWait <= 0) { - if (!sleep_toggle) - { - std::this_thread::yield (); - } - else - { - std::this_thread::sleep_for (std::chrono::milliseconds (200)); - } - sleep_toggle = !sleep_toggle; + disconnection.wait (); + } + else + { + disconnection.wait_for (std::chrono::milliseconds (msToWait)); } } @@ -976,6 +1056,7 @@ void CoreBroker::processDisconnect (bool skipUnregister) { unregister (); } + disconnection.trigger (); } void CoreBroker::unregister () @@ -999,7 +1080,12 @@ void CoreBroker::unregister () } } -void CoreBroker::disconnect () { processDisconnect (); } +void CoreBroker::disconnect () +{ + ActionMessage udisconnect (CMD_USER_DISCONNECT); + addActionMessage (udisconnect); + waitForDisconnect (); +} void CoreBroker::routeMessage (ActionMessage &cmd, Core::federate_id_t dest) { @@ -1806,7 +1892,8 @@ bool CoreBroker::allInitReady () const bool CoreBroker::allDisconnected () const { - return std::all_of (_brokers.begin (), _brokers.end (), [](const auto &brk) { return brk._disconnected; }); + return std::all_of (_brokers.begin (), _brokers.end (), + [](const auto &brk) { return ((brk._nonLocal) || (brk._disconnected)); }); } } // namespace helics diff --git a/src/helics/core/CoreBroker.hpp b/src/helics/core/CoreBroker.hpp index 17f185adc0..81d953314c 100644 --- a/src/helics/core/CoreBroker.hpp +++ b/src/helics/core/CoreBroker.hpp @@ -12,17 +12,18 @@ All rights reserved. See LICENSE file and DISCLAIMER for more details. #include #include +#include "../common/DelayedObjects.hpp" #include "../common/DualMappedVector.hpp" #include "../common/simpleQueue.hpp" -#include "../common/DelayedObjects.hpp" #include "ActionMessage.hpp" #include "BasicHandleInfo.hpp" #include "Broker.hpp" #include "BrokerBase.hpp" #include "HandleManager.hpp" -#include "TimeDependencies.hpp" #include "JsonMapBuilder.hpp" +#include "TimeDependencies.hpp" +#include "../common/TriggerVariable.hpp" namespace helics { @@ -91,13 +92,13 @@ class CoreBroker : public Broker, public BrokerBase std::unordered_map knownExternalEndpoints; //!< external map for all known external endpoints with names and route std::mutex name_mutex_; //!< mutex lock for name and identifier - std::atomic queryCounter{ 1 }; //counter for active queries going to the local API - DelayedObjects ActiveQueries; //!< holder for - JsonMapBuilder fedMap; //!< builder for the federate_map - std::vector fedMapRequestors; //!< list of requesters for the active federate map - JsonMapBuilder depMap; //!< builder for the dependency graph - std::vector depMapRequestors; //!< list of requesters for the dependency graph - + std::atomic queryCounter{1}; // counter for active queries going to the local API + DelayedObjects ActiveQueries; //!< holder for + JsonMapBuilder fedMap; //!< builder for the federate_map + std::vector fedMapRequestors; //!< list of requesters for the active federate map + JsonMapBuilder depMap; //!< builder for the dependency graph + std::vector depMapRequestors; //!< list of requesters for the dependency graph + TriggerVariable disconnection; //!< controller for the disconection process private: /** function that processes all the messages @param[in] command -- the message to process @@ -155,7 +156,7 @@ class CoreBroker : public Broker, public BrokerBase virtual void setLoggingCallback ( const std::function &logFunction) override final; - virtual void waitForDisconnect () const override final; + virtual void waitForDisconnect (int msToWait = -1) const override final; private: /** implementation details of the connection process @@ -204,7 +205,8 @@ class CoreBroker : public Broker, public BrokerBase void setIdentifier (const std::string &name); /** get the local identification for the broker*/ virtual const std::string &getIdentifier () const override final { return identifier; } - virtual std::string query(const std::string &target, const std::string &queryStr) override final; + virtual std::string query (const std::string &target, const std::string &queryStr) override final; + private: /** check if we can remove some dependencies*/ void checkDependencies (); @@ -222,7 +224,7 @@ class CoreBroker : public Broker, public BrokerBase /** answer a query or route the message the appropriate location*/ void processQuery (const ActionMessage &m); /** answer a query or route the message the appropriate location*/ - void processQueryResponse(const ActionMessage &m); + void processQueryResponse (const ActionMessage &m); /** generate an answer to a local query*/ void processLocalQuery (const ActionMessage &m); /** generate an actual response string to a query*/ @@ -239,11 +241,16 @@ class CoreBroker : public Broker, public BrokerBase void addEndpoint (ActionMessage &m); void addDestFilter (ActionMessage &m); void addSourceFilter (ActionMessage &m); - // bool updateSourceFilterOperator (ActionMessage &m); - /** generate a json string containing the federate/broker/Core Map*/ + // bool updateSourceFilterOperator (ActionMessage &m); + /** generate a JSON string containing the federate/broker/Core Map*/ void initializeFederateMap (); - /** generate a json string containing the dependency information for all federation object*/ - void initializeDependencyGraph(); + /** generate a JSON string containing the dependency information for all federation object*/ + void initializeDependencyGraph (); + + /** send an error code to all direct cores*/ + void sendErrorToImmediateBrokers (int error_code); + /** send a disconnect message to time dependencies and child brokers*/ + void sendDisconnect (); }; } // namespace helics diff --git a/src/helics/core/FederateState.cpp b/src/helics/core/FederateState.cpp index bac5bb482c..1b8157ba2c 100644 --- a/src/helics/core/FederateState.cpp +++ b/src/helics/core/FederateState.cpp @@ -856,13 +856,16 @@ message_processing_result FederateState::processActionMessage (ActionMessage &cm case CMD_DISCONNECT: if (cmd.source_id == global_id) { - setState (HELICS_FINISHED); - timeCoord->disconnect (); - cmd.dest_id = 0; - if (parent_ != nullptr) - { - parent_->addActionMessage (cmd); - } + if (state != HELICS_FINISHED) + { + setState (HELICS_FINISHED); + timeCoord->disconnect (); + cmd.dest_id = 0; + if (parent_ != nullptr) + { + parent_->addActionMessage (cmd); + } + } return message_processing_result::halted; } else diff --git a/src/helics/core/FederateState.hpp b/src/helics/core/FederateState.hpp index 7fb3f483d4..5a12e556d7 100644 --- a/src/helics/core/FederateState.hpp +++ b/src/helics/core/FederateState.hpp @@ -66,7 +66,8 @@ class FederateState int errorCode = 0; //!< storage for an error code CommonCore *parent_ = nullptr; //!< pointer to the higher level; std::string errorString; //!< storage for an error string populated on an error - decltype (std::chrono::steady_clock::now ()) start_clock_time; //!< time the initialization mode started for real time capture + decltype (std::chrono::steady_clock::now ()) + start_clock_time; //!< time the initialization mode started for real time capture Time rt_lag = timeZero; //!< max lag for the rt control Time rt_lead = timeZero; //!< min lag for the realtime control int32_t realTimeTimerIndex = -1; //!< the timer index for the real time timer; @@ -85,7 +86,8 @@ class FederateState std::shared_ptr mTimer; //!< message timer object for real time operations and timeouts BlockingQueue queue; //!< processing queue for messages incoming to a federate - std::map> delayQueues; //!< queue for delaying processing of messages for a time + std::map> + delayQueues; //!< queue for delaying processing of messages for a time std::vector events; //!< list of value events to process std::vector delayedFederates; //!< list of federates to delay messages from @@ -204,8 +206,8 @@ class FederateState */ const std::vector &getEvents () const; /** get a vector of the federates this one depends on - */ - std::vector getDependencies() const; + */ + std::vector getDependencies () const; /** get a vector to the global ids of dependent federates */ std::vector getDependents () const; diff --git a/src/helics/core/ForwardingTimeCoordinator.cpp b/src/helics/core/ForwardingTimeCoordinator.cpp index ac55d18abe..47bd5000b8 100644 --- a/src/helics/core/ForwardingTimeCoordinator.cpp +++ b/src/helics/core/ForwardingTimeCoordinator.cpp @@ -8,7 +8,7 @@ All rights reserved. See LICENSE file and DISCLAIMER for more details. #include "../flag-definitions.h" #include #include "../common/fmt_format.h" - +#include namespace helics { void ForwardingTimeCoordinator::enteringExecMode () @@ -23,6 +23,38 @@ void ForwardingTimeCoordinator::enteringExecMode () transmitTimingMessage (execreq); } +void ForwardingTimeCoordinator::disconnect () +{ + if (sendMessageFunction) + { + ActionMessage bye (CMD_DISCONNECT); + bye.source_id = source_id; + std::set connections (dependents.begin (), dependents.end ()); + for (auto dep : dependencies) + { + if (dep.Tnext < Time::maxVal()) + { + connections.insert (dep.fedID); + } + + } + for (auto fed : connections) + { + bye.dest_id = fed; + if (fed == source_id) + { + processTimeMessage (bye); + } + else + { + sendMessageFunction (bye); + } + + } + } + +} + static inline bool isBroker (Core::federate_id_t id) { return ((id == 1) || (id >= 0x7000'0000)); } void ForwardingTimeCoordinator::updateTimeFactors () @@ -402,6 +434,10 @@ void ForwardingTimeCoordinator::transmitTimingMessage (ActionMessage &msg) const bool ForwardingTimeCoordinator::processTimeMessage (const ActionMessage &cmd) { + if (cmd.action() == CMD_DISCONNECT) + { + removeDependent (cmd.source_id); + } return dependencies.updateTime (cmd); } diff --git a/src/helics/core/ForwardingTimeCoordinator.hpp b/src/helics/core/ForwardingTimeCoordinator.hpp index d9076c8fb2..17ab929b4f 100644 --- a/src/helics/core/ForwardingTimeCoordinator.hpp +++ b/src/helics/core/ForwardingTimeCoordinator.hpp @@ -97,6 +97,8 @@ class ForwardingTimeCoordinator @param fedID the identifier of the federate to remove*/ void removeDependent (Core::federate_id_t fedID); + /** disconnect*/ + void disconnect (); /** check if entry to the executing state can be granted*/ message_processing_result checkExecEntry (); diff --git a/src/helics/core/NetworkBrokerData.cpp b/src/helics/core/NetworkBrokerData.cpp index 24d6ffa82e..8a6d800b60 100644 --- a/src/helics/core/NetworkBrokerData.cpp +++ b/src/helics/core/NetworkBrokerData.cpp @@ -24,6 +24,7 @@ static const ArgDescriptors extraArgs{ { "local", ArgDescriptor::arg_type_t::flag_type,"use local interface(default)" }, {"ipv4", ArgDescriptor::arg_type_t::flag_type,"use external ipv4 addresses"}, { "ipv6", ArgDescriptor::arg_type_t::flag_type,"use external ipv6 addresses" }, + {"reuse_address", ArgDescriptor::arg_type_t::flag_type, "allow the server to reuse a bound address"}, { "external", ArgDescriptor::arg_type_t::flag_type,"use all external interfaces" }, {"brokerport"s, ArgDescriptor::arg_type_t::int_type, "port number for the broker priority port"s}, {"localport"s, ArgDescriptor::arg_type_t::int_type, "port number for the local receive port"s}, @@ -81,6 +82,10 @@ void NetworkBrokerData::initializeFromArgs (int argc, const char *const *argv, c checkAndUpdateBrokerAddress (localAddress); } + if (vm.count("reuse_address") > 0) + { + reuse_address = true; + } if (vm.count ("broker") > 0) { auto addr = vm["broker"].as (); diff --git a/src/helics/core/NetworkBrokerData.hpp b/src/helics/core/NetworkBrokerData.hpp index 24964588f8..7bf5b54927 100644 --- a/src/helics/core/NetworkBrokerData.hpp +++ b/src/helics/core/NetworkBrokerData.hpp @@ -39,6 +39,7 @@ class NetworkBrokerData int brokerPort = -1; //!< the port number to use for the main broker interface int portStart = -1; //!< the starting port for automatic port definitions interface_networks interfaceNetwork = interface_networks::local; + bool reuse_address = false; //!< allow reuse of binding address public: NetworkBrokerData () = default; /** constructor from the allowed type*/ diff --git a/src/helics/core/TimeCoordinator.cpp b/src/helics/core/TimeCoordinator.cpp index 8f460fb2d7..ffc0c12c71 100644 --- a/src/helics/core/TimeCoordinator.cpp +++ b/src/helics/core/TimeCoordinator.cpp @@ -8,6 +8,7 @@ All rights reserved. See LICENSE file and DISCLAIMER for more details. #include "../flag-definitions.h" #include #include "../common/fmt_format.h" +#include namespace helics { @@ -57,9 +58,32 @@ void TimeCoordinator::enteringExecMode (iteration_request mode) void TimeCoordinator::disconnect () { - ActionMessage bye (CMD_DISCONNECT); - bye.source_id = source_id; - transmitTimingMessage (bye); + if (sendMessageFunction) + { + ActionMessage bye (CMD_DISCONNECT); + bye.source_id = source_id; + std::set connections (dependents.begin (), dependents.end ()); + for (auto dep : dependencies) + { + if (dep.Tnext < Time::maxVal ()) + { + connections.insert (dep.fedID); + } + } + for (auto fed : connections) + { + bye.dest_id = fed; + if (fed == source_id) + { + processTimeMessage (bye); + } + else + { + sendMessageFunction (bye); + } + + } + } } void TimeCoordinator::timeRequest (Time nextTime, @@ -338,10 +362,7 @@ message_processing_result TimeCoordinator::checkTimeGrant () { time_granted = Time::maxVal(); time_grantBase = Time::maxVal(); - - ActionMessage treq(CMD_DISCONNECT); - treq.source_id = source_id; - transmitTimingMessage(treq); + disconnect (); return message_processing_result::halted; } } @@ -597,12 +618,12 @@ static bool isDelayableMessage (const ActionMessage &cmd, Core::federate_id_t lo message_process_result TimeCoordinator::processTimeMessage (const ActionMessage &cmd) { - if ((cmd.action () == CMD_TIME_BLOCK) || (cmd.action () == CMD_TIME_UNBLOCK)) - { + switch (cmd.action()) + { + case CMD_TIME_BLOCK: + case CMD_TIME_UNBLOCK: return processTimeBlockMessage (cmd); - } - if (cmd.action() == CMD_FORCE_TIME_GRANT) - { + case CMD_FORCE_TIME_GRANT: if (time_granted < cmd.actionTime) { time_granted = cmd.actionTime; @@ -615,7 +636,13 @@ message_process_result TimeCoordinator::processTimeMessage (const ActionMessage return message_process_result::processed; } return message_process_result::no_effect; - } + case CMD_DISCONNECT: + //this command requires removing dependents as well as dealing with dependency processing + removeDependent (cmd.source_id); + break; + default: + break; + } if (isDelayableMessage (cmd, source_id)) { auto dep = dependencies.getDependencyInfo (cmd.source_id); diff --git a/src/helics/core/TimeDependencies.cpp b/src/helics/core/TimeDependencies.cpp index b088878bf2..eda9bf2de5 100644 --- a/src/helics/core/TimeDependencies.cpp +++ b/src/helics/core/TimeDependencies.cpp @@ -214,10 +214,21 @@ constexpr Core::federate_id_t global_broker_id_shift = 0x7000'0000; bool TimeDependencies::hasActiveTimeDependencies () const { - return std::any_of (dependencies.begin (), dependencies.end (), [](const auto &dep) { + for (auto & dep : dependencies) + { + auto v1 = (dep.fedID >= global_federate_id_shift); + auto v2 = (dep.fedID < global_broker_id_shift); + auto v3 = (dep.Tnext < Time::maxVal ()); + if (v1&&v2&&v3) + { + return true; + } + } + return false; + /* return std::any_of (dependencies.begin (), dependencies.end (), [](const auto &dep) { return (((dep.fedID >= global_federate_id_shift) && (dep.fedID < global_broker_id_shift)) && (dep.Tnext < Time::maxVal ())); - }); + });*/ } void TimeDependencies::resetIteratingExecRequests () diff --git a/src/helics/core/ipc/IpcBroker.cpp b/src/helics/core/ipc/IpcBroker.cpp index bb34b69a61..cdea6f8a20 100644 --- a/src/helics/core/ipc/IpcBroker.cpp +++ b/src/helics/core/ipc/IpcBroker.cpp @@ -103,8 +103,9 @@ bool IpcBroker::brokerConnect () brokerloc = brokername + "_queue.hqf"; } comms = std::make_unique (fileloc, brokerloc); - comms->setCallback ([this](ActionMessage M) { addActionMessage (std::move (M)); }); + comms->setCallback ([this](ActionMessage &&M) { addActionMessage (std::move (M)); }); comms->setMessageSize (maxMessageSize, maxMessageCount); + comms->setTimeout (networkTimeout); return comms->connect (); } diff --git a/src/helics/core/ipc/IpcComms.cpp b/src/helics/core/ipc/IpcComms.cpp index 7624847a80..68cd49cf4d 100644 --- a/src/helics/core/ipc/IpcComms.cpp +++ b/src/helics/core/ipc/IpcComms.cpp @@ -41,11 +41,11 @@ void IpcComms::queue_rx_function () ActionMessage err (CMD_ERROR); err.payload = rxQueue.getError (); ActionCallback (std::move (err)); - rx_status = connection_status::error; // the connection has failed + setRxStatus (connection_status::error); // the connection has failed rxQueue.changeState (queue_state_t::closing); return; } - rx_status = connection_status::connected; // this is a atomic indicator that the rx queue is ready + setRxStatus (connection_status::connected); // this is a atomic indicator that the rx queue is ready bool operating = false; while (true) { @@ -64,7 +64,7 @@ void IpcComms::queue_rx_function () ActionMessage err (CMD_ERROR); err.payload = rxQueue.getError (); ActionCallback (std::move (err)); - rx_status = connection_status::error; // the connection has failed + setRxStatus (connection_status::error); // the connection has failed rxQueue.changeState (queue_state_t::closing); ipcbackchannel = 0; return; @@ -113,7 +113,7 @@ void IpcComms::queue_rx_function () { std::cerr << "error changing states" << std::endl; } - rx_status = connection_status::terminated; + setRxStatus (connection_status::terminated); } void IpcComms::queue_tx_function () @@ -123,7 +123,6 @@ void IpcComms::queue_tx_function () std::map routes; //!< table of the routes to other brokers bool hasBroker = false; - int sleep_counter = 50; if (!brokerTarget_.empty ()) { bool conn = brokerQueue.connect (brokerTarget_, true, 20); @@ -132,29 +131,23 @@ void IpcComms::queue_tx_function () ActionMessage err (CMD_ERROR); err.payload = std::string ("Unable to open broker connection ->") + brokerQueue.getError (); ActionCallback (std::move (err)); - tx_status = connection_status::error; + setTxStatus(connection_status::error); return; } hasBroker = true; } - sleep_counter = 50; // wait for the receiver to startup - while (rx_status == connection_status::startup) + if (!rxTrigger.wait_forActivation (std::chrono::milliseconds (3000))) { - std::this_thread::sleep_for (std::chrono::milliseconds (sleep_counter)); - sleep_counter *= 2; - if (sleep_counter > 1700) - { ActionMessage err (CMD_ERROR); err.payload = "Unable to link with receiver"; ActionCallback (std::move (err)); - tx_status = connection_status::error; + setTxStatus (connection_status::error); return; - } } - if (rx_status == connection_status::error) + if (getRxStatus() == connection_status::error) { - tx_status = connection_status::error; + setTxStatus (connection_status::error); return; } bool conn = rxQueue.connect (localTarget_, false, 0); @@ -164,13 +157,13 @@ void IpcComms::queue_tx_function () ipcbackchannel = IPC_BACKCHANNEL_TRY_RESET; while (ipcbackchannel != 0) { - if (rx_status != connection_status::connected) + if (getRxStatus() != connection_status::connected) { break; } std::this_thread::sleep_for (std::chrono::milliseconds (100)); } - if (rx_status == connection_status::connected) + if (getRxStatus () == connection_status::connected) { conn = rxQueue.connect (localTarget_, false, 0); } @@ -179,12 +172,12 @@ void IpcComms::queue_tx_function () ActionMessage err (CMD_ERROR); err.payload = std::string ("Unable to open receiver connection ->") + brokerQueue.getError (); ActionCallback (std::move (err)); - tx_status = connection_status::error; + setRxStatus(connection_status::error); return; } } - tx_status = connection_status::connected; + setTxStatus(connection_status::connected); bool operating = false; while (true) { @@ -251,18 +244,18 @@ void IpcComms::queue_tx_function () } } DISCONNECT_TX_QUEUE: - tx_status = connection_status::terminated; + setTxStatus (connection_status::terminated); } void IpcComms::closeReceiver () { - if ((rx_status == connection_status::error) || (rx_status == connection_status::terminated)) + if ((getRxStatus() == connection_status::error) || (getRxStatus() == connection_status::terminated)) { return; } ActionMessage cmd (CMD_PROTOCOL); cmd.index = CLOSE_RECEIVER; - if (tx_status == connection_status::connected) + if (getTxStatus() == connection_status::connected) { transmit (-1, cmd); } diff --git a/src/helics/core/ipc/IpcCore.cpp b/src/helics/core/ipc/IpcCore.cpp index e007300676..35dfc6f047 100644 --- a/src/helics/core/ipc/IpcCore.cpp +++ b/src/helics/core/ipc/IpcCore.cpp @@ -86,7 +86,8 @@ bool IpcCore::brokerConnect () } comms = std::make_unique (fileloc, brokerloc); - comms->setCallback ([this](ActionMessage M) { addActionMessage (std::move (M)); }); + comms->setCallback ([this](ActionMessage &&M) { addActionMessage (std::move (M)); }); + comms->setTimeout (networkTimeout); return comms->connect (); } diff --git a/src/helics/core/mpi/MpiComms.cpp b/src/helics/core/mpi/MpiComms.cpp index da24036924..c3b9e708f7 100644 --- a/src/helics/core/mpi/MpiComms.cpp +++ b/src/helics/core/mpi/MpiComms.cpp @@ -49,7 +49,7 @@ int MpiComms::processIncomingMessage (ActionMessage &M) void MpiComms::queue_rx_function () { - rx_status = connection_status::connected; + setRxStatus(connection_status::connected); while (true) { @@ -86,12 +86,12 @@ void MpiComms::queue_rx_function () CLOSE_RX_LOOP: std::cout << "Shutdown RX Loop for " << commAddress << std::endl; shutdown = true; - rx_status = connection_status::terminated; + setRxStatus(connection_status::terminated); } void MpiComms::queue_tx_function () { - tx_status = connection_status::connected; + setTxStatus( connection_status::connected); auto &mpi_service = MpiService::getInstance (); @@ -171,11 +171,11 @@ void MpiComms::queue_tx_function () CLOSE_TX_LOOP: std::cout << "Shutdown TX Loop for " << commAddress << std::endl; routes.clear (); - if (rx_status == connection_status::connected) + if (getRxStatus() == connection_status::connected) { shutdown = true; } - tx_status = connection_status::terminated; + setTxStatus(connection_status::terminated); mpi_service.removeMpiComms (this); } diff --git a/src/helics/core/tcp/TcpBroker.cpp b/src/helics/core/tcp/TcpBroker.cpp index 3c072051db..0f3fdaa07e 100644 --- a/src/helics/core/tcp/TcpBroker.cpp +++ b/src/helics/core/tcp/TcpBroker.cpp @@ -42,9 +42,9 @@ bool TcpBroker::brokerConnect () setAsRoot (); } comms = std::make_unique (netInfo); - comms->setCallback ([this](ActionMessage M) { addActionMessage (std::move (M)); }); + comms->setCallback ([this](ActionMessage &&M) { addActionMessage (std::move (M)); }); comms->setName (getIdentifier ()); - + comms->setTimeout (networkTimeout); // comms->setMessageSize(maxMessageSize, maxMessageCount); auto res = comms->connect (); if (res) diff --git a/src/helics/core/tcp/TcpComms.cpp b/src/helics/core/tcp/TcpComms.cpp index f40bbc3e2f..0c8aac270b 100644 --- a/src/helics/core/tcp/TcpComms.cpp +++ b/src/helics/core/tcp/TcpComms.cpp @@ -22,16 +22,19 @@ namespace tcp using boost::asio::ip::tcp; TcpComms::TcpComms () noexcept {} -TcpComms::TcpComms (const std::string &brokerTarget, const std::string &localTarget, interface_networks targetNetwork) - : CommsInterface (brokerTarget, localTarget,targetNetwork) +TcpComms::TcpComms (const std::string &brokerTarget, + const std::string &localTarget, + interface_networks targetNetwork) + : CommsInterface (brokerTarget, localTarget, targetNetwork) { if (localTarget_.empty ()) { - if ((brokerTarget_ == "udp://127.0.0.1") || (brokerTarget_ == "udp://localhost") || (brokerTarget_ == "localhost")) + if ((brokerTarget_ == "tcp://127.0.0.1") || (brokerTarget_ == "tcp://localhost") || + (brokerTarget_ == "localhost")) { localTarget_ = "localhost"; } - else if (brokerTarget_.empty()) + else if (brokerTarget_.empty ()) { switch (interfaceNetwork) { @@ -45,8 +48,7 @@ TcpComms::TcpComms (const std::string &brokerTarget, const std::string &localTar } else { - localTarget_ = generateMatchingInterfaceAddress(brokerTarget_, interfaceNetwork); - + localTarget_ = generateMatchingInterfaceAddress (brokerTarget_, interfaceNetwork); } } } @@ -56,11 +58,12 @@ TcpComms::TcpComms (const NetworkBrokerData &netInfo) { if (localTarget_.empty ()) { - if ((brokerTarget_ == "tcp://127.0.0.1") || (brokerTarget_ == "tcp://localhost") || (brokerTarget_ == "localhost")) + if ((brokerTarget_ == "tcp://127.0.0.1") || (brokerTarget_ == "tcp://localhost") || + (brokerTarget_ == "localhost")) { localTarget_ = "localhost"; } - else if (brokerTarget_.empty()) + else if (brokerTarget_.empty ()) { switch (interfaceNetwork) { @@ -74,14 +77,18 @@ TcpComms::TcpComms (const NetworkBrokerData &netInfo) } else { - localTarget_ = generateMatchingInterfaceAddress(brokerTarget_, interfaceNetwork); - + localTarget_ = generateMatchingInterfaceAddress (brokerTarget_, interfaceNetwork); } } if (netInfo.portStart > 0) { openPortStart = netInfo.portStart; } + if (PortNumber > 0) + { + autoPortNumber = false; + } + reuse_address = netInfo.reuse_address; } /** destructor*/ @@ -89,7 +96,7 @@ TcpComms::~TcpComms () { disconnect (); } void TcpComms::setBrokerPort (int brokerPortNumber) { - if (rx_status == connection_status::startup) + if (getRxStatus () == connection_status::startup) { brokerPort = brokerPortNumber; } @@ -112,9 +119,13 @@ int TcpComms::findOpenPort () void TcpComms::setPortNumber (int localPortNumber) { - if (rx_status == connection_status::startup) + if (getRxStatus () == connection_status::startup) { PortNumber = localPortNumber; + if (PortNumber > 0) + { + autoPortNumber = false; + } } } @@ -246,7 +257,7 @@ size_t TcpComms::dataReceive (std::shared_ptr connection, const bool TcpComms::commErrorHandler (std::shared_ptr /*connection*/, const boost::system::error_code &error) { - if (rx_status == connection_status::connected) + if (getRxStatus () == connection_status::connected) { if ((error != boost::asio::error::eof) && (error != boost::asio::error::operation_aborted)) { @@ -295,19 +306,42 @@ void TcpComms::queue_rx_function () case CLOSE_RECEIVER: case DISCONNECT: disconnecting = true; - rx_status = connection_status::terminated; + setRxStatus (connection_status::terminated); return; } } } if (PortNumber < 0) { - rx_status = connection_status::error; + setRxStatus (connection_status::error); return; } auto ioserv = AsioServiceManager::getServicePointer (); - auto server = helics::tcp::TcpServer::create (ioserv->getBaseService (), PortNumber, maxMessageSize_); - + auto server = helics::tcp::TcpServer::create (ioserv->getBaseService (), localTarget_, PortNumber, + reuse_address, maxMessageSize_); + while (!server->isReady ()) + { + if ((autoPortNumber) && (hasBroker)) + { // If we failed and we are on an automatically assigned port number, just try a different port + server->close (); + ++PortNumber; + server = helics::tcp::TcpServer::create (ioserv->getBaseService (), localTarget_, PortNumber, + reuse_address, maxMessageSize_); + } + else + { + std::cerr << "retrying tcp bind\n"; + std::this_thread::sleep_for (std::chrono::milliseconds (150)); + auto connected = server->reConnect (connectionTimeout); + if (!connected) + { + std::cerr << "unable to bind to tcp connection socket\n"; + server->close (); + setRxStatus (connection_status::error); + return; + } + } + } auto serviceLoop = ioserv->runServiceLoop (); server->setDataCall ([this](TcpRxConnection::pointer connection, const char *data, size_t datasize) { return dataReceive (connection, data, datasize); @@ -316,7 +350,7 @@ void TcpComms::queue_rx_function () return commErrorHandler (connection, error); }); server->start (); - rx_status = connection_status::connected; + setRxStatus (connection_status::connected); bool loopRunning = true; while (loopRunning) { @@ -335,7 +369,7 @@ void TcpComms::queue_rx_function () disconnecting = true; server->close (); - rx_status = connection_status::terminated; + setRxStatus (connection_status::terminated); } void TcpComms::txReceive (const char *data, size_t bytes_received, const std::string &errorMessage) @@ -387,7 +421,7 @@ void TcpComms::queue_tx_function () if (cumsleep >= connectionTimeout) { std::cerr << "initial connection to broker timed out\n" << std::endl; - tx_status = connection_status::terminated; + setTxStatus (connection_status::terminated); return; } } @@ -403,7 +437,7 @@ void TcpComms::queue_tx_function () catch (const boost::system::system_error &error) { std::cerr << "error in initial send to broker " << error.what () << '\n'; - tx_status = connection_status::terminated; + setTxStatus (connection_status::terminated); return; } std::vector rx (512); @@ -439,7 +473,7 @@ void TcpComms::queue_tx_function () else if (mess->second.index == DISCONNECT) { brokerConnection->cancel (); - tx_status = connection_status::terminated; + setTxStatus (connection_status::terminated); return; } } @@ -449,7 +483,7 @@ void TcpComms::queue_tx_function () { brokerConnection->cancel (); std::cerr << "port number query to broker timed out\n" << std::endl; - tx_status = connection_status::terminated; + setTxStatus (connection_status::terminated); return; } } @@ -471,7 +505,7 @@ void TcpComms::queue_tx_function () rxMessageQueue.push (m); } } - tx_status = connection_status::connected; + setTxStatus (connection_status::connected); // std::vector txlist; while (true) @@ -628,11 +662,11 @@ void TcpComms::queue_tx_function () rt.second->close (); } routes.clear (); - if (rx_status == connection_status::connected) + if (getRxStatus () == connection_status::connected) { closeReceiver (); } - tx_status = connection_status::terminated; + setTxStatus (connection_status::terminated); } void TcpComms::closeReceiver () diff --git a/src/helics/core/tcp/TcpComms.h b/src/helics/core/tcp/TcpComms.h index d162089d76..fac24b76e1 100644 --- a/src/helics/core/tcp/TcpComms.h +++ b/src/helics/core/tcp/TcpComms.h @@ -19,8 +19,8 @@ namespace asio { class io_context; using io_service = io_context; -} -} +} // namespace asio +} // namespace boost #else namespace boost { @@ -28,7 +28,7 @@ namespace asio { class io_service; } -} +} // namespace boost #endif namespace boost @@ -37,15 +37,12 @@ namespace system { class error_code; } -} - - +} // namespace boost namespace helics { namespace tcp { - class TcpRxConnection; class TcpConnection; @@ -55,7 +52,9 @@ class TcpComms final : public CommsInterface public: /** default constructor*/ TcpComms () noexcept; - TcpComms (const std::string &brokerTarget, const std::string &localTarget, interface_networks targetNetwork = interface_networks::local); + TcpComms (const std::string &brokerTarget, + const std::string &localTarget, + interface_networks targetNetwork = interface_networks::local); TcpComms (const NetworkBrokerData &netInfo); /** destructor*/ ~TcpComms (); @@ -66,6 +65,8 @@ class TcpComms final : public CommsInterface private: int brokerPort = -1; + bool autoPortNumber = true; + bool reuse_address = false; std::atomic PortNumber{-1}; std::set usedPortNumbers; int openPortStart = -1; @@ -108,4 +109,3 @@ class TcpComms final : public CommsInterface } // namespace tcp } // namespace helics - diff --git a/src/helics/core/tcp/TcpCore.cpp b/src/helics/core/tcp/TcpCore.cpp index 5c5bb5444c..06eb3c7a43 100644 --- a/src/helics/core/tcp/TcpCore.cpp +++ b/src/helics/core/tcp/TcpCore.cpp @@ -33,9 +33,9 @@ bool TcpCore::brokerConnect () netInfo.brokerAddress = "localhost"; } comms = std::make_unique (netInfo); - comms->setCallback ([this](ActionMessage M) { addActionMessage (std::move (M)); }); + comms->setCallback ([this](ActionMessage &&M) { addActionMessage (std::move (M)); }); comms->setName (getIdentifier ()); - + comms->setTimeout (networkTimeout); auto res = comms->connect (); if (res) { diff --git a/src/helics/core/tcp/TcpHelperClasses.cpp b/src/helics/core/tcp/TcpHelperClasses.cpp index 99b112c318..1d9c2a1e7a 100644 --- a/src/helics/core/tcp/TcpHelperClasses.cpp +++ b/src/helics/core/tcp/TcpHelperClasses.cpp @@ -18,54 +18,61 @@ void TcpRxConnection::start () { if (triggerhalt) { - receiving = false; + receivingHalt.trigger (); return; } if (state == connection_state_t::prestart) { - receiving = true; - state=connection_state_t::halted; + receivingHalt.activate (); + state = connection_state_t::halted; } connection_state_t exp = connection_state_t::halted; if (state.compare_exchange_strong (exp, connection_state_t::receiving)) { - if (!receiving.load()) + if (!receivingHalt.isActive ()) + { + receivingHalt.activate (); + } + if (!triggerhalt) + { + socket_.async_receive (boost::asio::buffer (data.data () + residBufferSize, + data.size () - residBufferSize), + [this](const boost::system::error_code &error, size_t bytes_transferred) { + handle_read (error, bytes_transferred); + }); + } + else { - receiving.store(true); + receivingHalt.trigger (); } - socket_.async_receive (boost::asio::buffer (data.data () + residBufferSize, - data.size () - residBufferSize), - [this](const boost::system::error_code &error, - size_t bytes_transferred) { - handle_read (error, bytes_transferred); - }); } - else if (exp!=connection_state_t::receiving) + else if (exp != connection_state_t::receiving) { - receiving = false; + receivingHalt.trigger (); } } -void TcpRxConnection::setDataCall(std::function dataFunc) +void TcpRxConnection::setDataCall (std::function dataFunc) { if (state == connection_state_t::prestart) { - dataCall = std::move(dataFunc); + dataCall = std::move (dataFunc); } else { - throw(std::runtime_error("cannot set data callback after socket is started")); + throw (std::runtime_error ("cannot set data callback after socket is started")); } } -void TcpRxConnection::setErrorCall(std::function errorFunc) +void TcpRxConnection::setErrorCall ( + std::function errorFunc) { if (state == connection_state_t::prestart) { - errorCall = std::move(errorFunc); + errorCall = std::move (errorFunc); } else { - throw(std::runtime_error("cannot set error callback after socket is started")); + throw (std::runtime_error ("cannot set error callback after socket is started")); } } @@ -74,7 +81,7 @@ void TcpRxConnection::handle_read (const boost::system::error_code &error, size_ if (triggerhalt) { state = connection_state_t::halted; - receiving = false; + receivingHalt.trigger (); return; } if (!error) @@ -99,7 +106,7 @@ void TcpRxConnection::handle_read (const boost::system::error_code &error, size_ else if (error == boost::asio::error::operation_aborted) { state = connection_state_t::halted; - receiving = false; + receivingHalt.trigger (); return; } else @@ -130,7 +137,8 @@ void TcpRxConnection::handle_read (const boost::system::error_code &error, size_ } else { - receiving = false; + state = connection_state_t::halted; + receivingHalt.trigger (); } } else if ((error != boost::asio::error::eof) && (error != boost::asio::error::operation_aborted)) @@ -140,11 +148,12 @@ void TcpRxConnection::handle_read (const boost::system::error_code &error, size_ std::cerr << "receive error " << error.message () << std::endl; } state = connection_state_t::halted; - receiving = false; + receivingHalt.trigger (); } else { - receiving = false; + state = connection_state_t::halted; + receivingHalt.trigger (); } } } @@ -168,17 +177,62 @@ void TcpRxConnection::close () triggerhalt = true; state = connection_state_t::closed; boost::system::error_code ec; - socket_.shutdown (boost::asio::ip::tcp::socket::shutdown_send, ec); - if (ec) + if (socket_.is_open ()) + { + socket_.shutdown (boost::asio::ip::tcp::socket::shutdown_both, ec); + if (ec) + { + std::cerr << "error occurred sending shutdown::" << ec << std::endl; + ec.clear (); + } + socket_.close (ec); + receivingHalt.wait (); + } + else + { + if (receivingHalt.isActive ()) + { + socket_.close (ec); + receivingHalt.wait (); + } + } +} + +void TcpRxConnection::closeNoWait () +{ + triggerhalt = true; + state = connection_state_t::closed; + boost::system::error_code ec; + if (socket_.is_open ()) { - std::cerr << "error occurred sending shutdown::" << ec << std::endl; + socket_.shutdown (boost::asio::ip::tcp::socket::shutdown_both, ec); + if (ec) + { + std::cerr << "error occurred sending shutdown::" << ec << std::endl; + ec.clear (); + } + socket_.close (ec); } - socket_.close (); - while (receiving) + else { - std::this_thread::yield(); + if (receivingHalt.isActive ()) + { + socket_.close (ec); + } + } +} + +/** wait on the closing actions*/ +void TcpRxConnection::waitOnClose () +{ + if (triggerhalt) + { + receivingHalt.wait (); + } + else + { + close (); } - } TcpConnection::pointer TcpConnection::create (boost::asio::io_service &io_service, @@ -206,33 +260,49 @@ void TcpConnection::connect_handler (const boost::system::error_code &error) { if (!error) { - connected.store (true); + connected.activate (); } else { std::cerr << "connection error " << error.message () << ": code =" << error.value () << '\n'; } } -void TcpConnection::send (const void *buffer, size_t dataLength) +size_t TcpConnection::send (const void *buffer, size_t dataLength) { if (!isConnected ()) { - waitUntilConnected (200); + if (!waitUntilConnected (300)) + { + std::cerr << "connection timeout waiting again" << std::endl; + } + if (!waitUntilConnected (200)) + { + std::cerr << "connection timeout twice, now returning" << std::endl; + return 0; + } } auto sz = socket_.send (boost::asio::buffer (buffer, dataLength)); assert (sz == dataLength); - ((void)(sz)); + return sz; } -void TcpConnection::send (const std::string &dataString) +size_t TcpConnection::send (const std::string &dataString) { if (!isConnected ()) { - waitUntilConnected (200); + if (!waitUntilConnected (300)) + { + std::cerr << "connection timeout waiting again" << std::endl; + } + if (!waitUntilConnected (200)) + { + std::cerr << "connection timeout twice, now returning" << std::endl; + return 0; + } } auto sz = socket_.send (boost::asio::buffer (dataString)); assert (sz == dataString.size ()); - ((void)(sz)); + return sz; } size_t TcpConnection::receive (void *buffer, size_t maxDataLength) @@ -240,116 +310,492 @@ size_t TcpConnection::receive (void *buffer, size_t maxDataLength) return socket_.receive (boost::asio::buffer (buffer, maxDataLength)); } -int TcpConnection::waitUntilConnected (int timeOut) +bool TcpConnection::waitUntilConnected (int timeOut) { - int cnt = 0; - while (!isConnected ()) + if (isConnected ()) { - std::this_thread::sleep_for (std::chrono::milliseconds (50)); - cnt += 50; - if (cnt > timeOut) - { - return (-1); - } + return true; + } + if (timeOut < 0) + { + connected.waitActivation (); + return true; + } + else + { + return connected.wait_forActivation (std::chrono::milliseconds (timeOut)); } - return 0; } void TcpConnection::close () { cancel (); boost::system::error_code ec; - socket_.shutdown (boost::asio::ip::tcp::socket::shutdown_send, ec); + socket_.shutdown (boost::asio::ip::tcp::socket::shutdown_both, ec); if (ec) { // I don't know what to do with this, in practice this message is mostly spurious - // but is seems I should do something with it, I just don't know what + // but it seems I should do something with it, I just don't know what // std::cerr << "error occurred sending shutdown" << std::endl; - ((void)(ec)); + ec.clear (); + } + else + { + boost::asio::socket_base::linger optionLinger (true, 2); + socket_.set_option (optionLinger, ec); } - socket_.close (); + socket_.close (ec); } -TcpServer::pointer TcpServer::create (boost::asio::io_service &io_service, int PortNum, int nominalBufferSize) +TcpAcceptor::TcpAcceptor (boost::asio::io_service &io_service, boost::asio::ip::tcp::endpoint &ep) + : acceptor_ (io_service), endpoint_ (ep) { - return pointer (new TcpServer (io_service, PortNum, nominalBufferSize)); + acceptor_.open (ep.protocol ()); } +TcpAcceptor::TcpAcceptor (boost::asio::io_service &io_service, int port) + : acceptor_ (io_service, boost::asio::ip::tcp::endpoint (boost::asio::ip::tcp::v4 (), port)), + endpoint_ (boost::asio::ip::tcp::v4 (), port), state (accepting_state_t::connected) +{ +} -void TcpServer::start () +bool TcpAcceptor::connect () { - if (halted) + accepting_state_t exp = accepting_state_t::opened; + if (state.compare_exchange_strong (exp, accepting_state_t::connecting)) { - return; + boost::system::error_code ec; + acceptor_.bind (endpoint_, ec); + if (ec) + { + state = accepting_state_t::opened; + return false; + } + state = accepting_state_t::connected; + return true; + } + return (state == accepting_state_t::connected); +} + +bool TcpAcceptor::connect (int timeout) +{ + if (state == accepting_state_t::halted) + { + state = accepting_state_t::opened; } - bool exp = false; - if (accepting.compare_exchange_strong (exp, true)) + accepting_state_t exp = accepting_state_t::opened; + if (state.compare_exchange_strong (exp, accepting_state_t::connecting)) { - auto connects = connections.lock(); - if (!connects->empty ()) + bool bindsuccess = false; + int tcount = 0; + while (!bindsuccess) { - for (auto &conn :*connects) + boost::system::error_code ec; + acceptor_.bind (endpoint_, ec); + if (ec) { - if (!conn->isReceiving()) + if (tcount > timeout) { - conn->start(); + state = accepting_state_t::opened; + break; } + std::this_thread::sleep_for (std::chrono::milliseconds (200)); + tcount += 200; + } + else + { + state = accepting_state_t::connected; + bindsuccess = true; } } - TcpRxConnection::pointer new_connection = - TcpRxConnection::create (acceptor_.get_io_service (), bufferSize); - auto &socket = new_connection->socket(); - acceptor_.async_accept (socket, [this, connection=std::move(new_connection)]( - const boost::system::error_code &error) { - handle_accept (connection, error); + return bindsuccess; + } + return (state == accepting_state_t::connected); +} + +/** start the acceptor*/ +bool TcpAcceptor::start (TcpRxConnection::pointer conn) +{ + if (!conn) + { + if (accepting.isActive ()) + { + accepting.trigger (); + } + return false; + } + if (state != accepting_state_t::connected) + { + conn->close (); + if (accepting.isActive ()) + { + accepting.trigger (); + } + return false; + } + if (accepting.activate ()) + { + auto &socket = conn->socket (); + acceptor_.listen (); + auto ptr = shared_from_this (); + acceptor_.async_accept (socket, [this, apointer = std::move (ptr), + connection = std::move (conn)](const boost::system::error_code &error) { + handle_accept (apointer, connection, error); }); + return true; } + else + { + conn->close (); + return false; + } +} + +/** close the acceptor*/ +void TcpAcceptor::close () +{ + state = accepting_state_t::halted; + acceptor_.close (); + accepting.wait (); } -void TcpServer::handle_accept (TcpRxConnection::pointer new_connection, const boost::system::error_code &error) +std::string TcpAcceptor::to_string () const { + auto str = endpoint_.address ().to_string (); + str += ':'; + str += std::to_string (endpoint_.port ()); + return str; +} +void TcpAcceptor::handle_accept (TcpAcceptor::pointer ptr, + TcpRxConnection::pointer new_connection, + const boost::system::error_code &error) +{ + if (state != accepting_state_t::connected) + { + boost::asio::socket_base::linger optionLinger (true, 0); + try + { + new_connection->socket ().set_option (optionLinger); + } + catch (...) + { + } + new_connection->close (); + accepting.reset (); + return; + } if (!error) { - new_connection->setDataCall (dataCall); - new_connection->setErrorCall (errorCall); - { //scope for the connection lock - auto connects = connections.lock(); - // new_connection->index = static_cast (connects->size()); - // the previous 3 calls have to be made before this call since they could be used immediately - new_connection->start(); - connects->push_back(std::move(new_connection)); + if (acceptCall) + { + accepting.reset (); + acceptCall (std::move (ptr), std::move (new_connection)); + if (!accepting.isActive ()) + { + accepting.trigger (); + } } - accepting = false; - if (!halted) + else { - start(); + boost::asio::socket_base::linger optionLinger (true, 0); + try + { + new_connection->socket ().set_option (optionLinger); + } + catch (...) + { + } + new_connection->close (); + accepting.reset (); } } else if (error != boost::asio::error::operation_aborted) { - std::cerr << " error in accept::" << error.message() << std::endl; - accepting = false; + if (errorCall) + { + errorCall (std::move (ptr), error); + } + else + { + std::cerr << " error in accept::" << error.message () << std::endl; + } + boost::asio::socket_base::linger optionLinger (true, 0); + try + { + new_connection->socket ().set_option (optionLinger); + } + catch (...) + { + } + new_connection->close (); + accepting.reset (); + } + else + { + new_connection->close (); + accepting.reset (); + } +} + +TcpServer::TcpServer (boost::asio::io_service &io_service, + const std::string &address, + int portNum, + bool port_reuse, + int nominalBufferSize) + : ioserv (io_service), bufferSize (nominalBufferSize), reuse_address (port_reuse) +{ + if ((address == "*") || (address == "tcp://*")) + { + acceptors.push_back (TcpAcceptor::create (ioserv, portNum)); + } + else if (address == "localhost") + { + endpoints.push_back (boost::asio::ip::tcp::endpoint (boost::asio::ip::tcp::v4 (), portNum)); + } + else + { + tcp::resolver resolver (io_service); + tcp::resolver::query query (tcp::v4 (), address, std::to_string (portNum), + tcp::resolver::query::canonical_name); + tcp::resolver::iterator endpoint_iterator = resolver.resolve (query); + tcp::resolver::iterator end; + if (endpoint_iterator != end) + { + while (endpoint_iterator != end) + { + endpoints.push_back (*endpoint_iterator); + ++endpoint_iterator; + } + } + else + { + halted = true; + return; + } + } + initialConnect (); +} + +TcpServer::TcpServer (boost::asio::io_service &io_service, + const std::string &address, + const std::string &port, + bool port_reuse, + int nominalBufferSize) + : ioserv (io_service), bufferSize (nominalBufferSize), reuse_address (port_reuse) +{ + tcp::resolver resolver (io_service); + tcp::resolver::query query (tcp::v4 (), address, port, tcp::resolver::query::canonical_name); + tcp::resolver::iterator endpoint_iterator = resolver.resolve (query); + tcp::resolver::iterator end; + if (endpoint_iterator != end) + { + while (endpoint_iterator != end) + { + endpoints.push_back (*endpoint_iterator); + ++endpoint_iterator; + } } else { - accepting = false; + halted = true; + return; + } + initialConnect (); +} + +TcpServer::TcpServer (boost::asio::io_service &io_service, int portNum, int nominalBufferSize) + : ioserv (io_service), bufferSize (nominalBufferSize) +{ + endpoints.push_back (boost::asio::ip::tcp::endpoint (boost::asio::ip::tcp::v4 (), portNum)); + initialConnect (); +} + +TcpServer::~TcpServer () { close (); } + +void TcpServer::initialConnect () +{ + if (halted == true) + { + return; + } + for (auto &ep : endpoints) + { + auto acc = TcpAcceptor::create (ioserv, ep); + if (reuse_address) + { + acc->set_option (tcp::acceptor::reuse_address (true)); + } + else + { + acc->set_option (tcp::acceptor::reuse_address (false)); + } + acc->setAcceptCall ( + [this](TcpAcceptor::pointer accPtr, TcpRxConnection::pointer conn) { handle_accept (accPtr, conn); }); + acceptors.push_back (std::move (acc)); + } + for (auto &acc : acceptors) + { + if (!acc->connect ()) + { + halted = true; + break; + } + } +} + +bool TcpServer::reConnect (int timeout) +{ + halted = false; + bool partialConnect = false; + for (auto &acc : acceptors) + { + if (!acc->isConnected ()) + { + if (!acc->connect (timeout)) + { + if (partialConnect) + { + std::cerr << "unable to connect all acceptors on " << acc->to_string () << '\n'; + } + else + { + std::cerr << "unable to connect on " << acc->to_string () << '\n'; + } + + halted = true; + break; + } + } + partialConnect = true; + } + return !halted; +} + +TcpServer::pointer TcpServer::create (boost::asio::io_service &io_service, + const std::string &address, + int PortNum, + bool port_reuse, + int nominalBufferSize) +{ + return pointer (new TcpServer (io_service, address, PortNum, port_reuse, nominalBufferSize)); +} + +TcpServer::pointer TcpServer::create (boost::asio::io_service &io_service, + const std::string &address, + const std::string &port, + bool port_reuse, + int nominalBufferSize) +{ + return pointer (new TcpServer (io_service, address, port, port_reuse, nominalBufferSize)); +} + +TcpServer::pointer TcpServer::create (boost::asio::io_service &io_service, int PortNum, int nominalBufferSize) +{ + return pointer (new TcpServer (io_service, PortNum, nominalBufferSize)); +} + +void TcpServer::start () +{ + if (halted) + { + return; + } + + if (!halted) + { + { // scope for the lock_guard + std::lock_guard lock (accepting); + if (!connections.empty ()) + { + for (auto &conn : connections) + { + if (!conn->isReceiving ()) + { + conn->start (); + } + } + } + } + + for (auto &acc : acceptors) + { + acc->start (TcpRxConnection::create (ioserv, bufferSize)); + } + } +} + +void TcpServer::handle_accept (TcpAcceptor::pointer acc, TcpRxConnection::pointer new_connection) +{ + /*setting linger to 1 second*/ + boost::asio::socket_base::linger optionLinger (true, 0); + new_connection->socket ().set_option (optionLinger); + // Set options here + if (halted) + { + new_connection->close (); + return; + } + + if (!halted) + { + new_connection->setDataCall (dataCall); + new_connection->setErrorCall (errorCall); + new_connection->start (); + { // scope for the lock_guard + + std::unique_lock lock (accepting); + if (!halted) + { + connections.push_back (std::move (new_connection)); + } + else + { + lock.unlock (); + new_connection->close (); + return; + } + } + acc->start (TcpRxConnection::create (ioserv, bufferSize)); + } + else + { + new_connection->close (); } } void TcpServer::close () { halted = true; - acceptor_.close(); - auto connects = connections.lock(); - for (auto &conn : *connects) + if (acceptors.size () == 1) { - conn->close (); + acceptors[0]->close (); + } + else if (!acceptors.empty ()) + { + // cancel first to give the threads some time to process + for (auto &acc : acceptors) + { + acc->cancel (); + } + for (auto &acc : acceptors) + { + acc->close (); + } + } + + acceptors.clear (); + std::unique_lock lock (accepting); + auto sz = connections.size (); + lock.unlock (); + for (decltype (sz) ii = 0; ii < sz; ++ii) + { + connections[ii]->closeNoWait (); } - while (accepting) + for (decltype (sz) ii = 0; ii < sz; ++ii) { - std::this_thread::yield (); + connections[ii]->waitOnClose (); } - connects->clear (); + connections.clear (); } } // namespace tcp diff --git a/src/helics/core/tcp/TcpHelperClasses.h b/src/helics/core/tcp/TcpHelperClasses.h index ad25b5c6d5..557470e132 100644 --- a/src/helics/core/tcp/TcpHelperClasses.h +++ b/src/helics/core/tcp/TcpHelperClasses.h @@ -5,12 +5,13 @@ All rights reserved. See LICENSE file and DISCLAIMER for more details. */ #pragma once +#include "../../common/GuardedTypes.hpp" +#include "../../common/TriggerVariable.hpp" #include #include #include #include #include -#include "../../common/GuardedTypes.hpp" namespace helics { @@ -20,13 +21,13 @@ namespace tcp class TcpRxConnection : public std::enable_shared_from_this { public: - enum class connection_state_t - { - prestart = -1, - halted = 0, - receiving=1, - closed=2, - }; + enum class connection_state_t + { + prestart = -1, + halted = 0, + receiving = 1, + closed = 2, + }; typedef std::shared_ptr pointer; /** create an RxConnection object using the specified service and bufferSize*/ @@ -37,17 +38,19 @@ class TcpRxConnection : public std::enable_shared_from_this /** get the underlying socket object*/ boost::asio::ip::tcp::socket &socket () { return socket_; } /** start the receiving loop*/ - void start(); + void start (); /** close the socket*/ void close (); - bool isReceiving() const - { - return receiving.load(); - } + /** perform the close actions but don't wait for them to be processed*/ + void closeNoWait (); + /** wait on the closing actions*/ + void waitOnClose (); + /**check if the connection is receiving data*/ + bool isReceiving () const { return receivingHalt.isActive (); } /** set the callback for the data object*/ - void setDataCall(std::function dataFunc); + void setDataCall (std::function dataFunc); /** set the callback for an error*/ - void setErrorCall(std::function errorFunc); + void setErrorCall (std::function errorFunc); /** send raw data @throws boost::system::system_error on failure*/ @@ -56,7 +59,7 @@ class TcpRxConnection : public std::enable_shared_from_this @throws boost::system::system_error on failure*/ void send (const std::string &dataString); - //int index = 0; + // int index = 0; private: TcpRxConnection (boost::asio::io_service &io_service, size_t bufferSize) @@ -68,13 +71,88 @@ class TcpRxConnection : public std::enable_shared_from_this std::atomic residBufferSize{0}; boost::asio::ip::tcp::socket socket_; std::vector data; - std::atomic triggerhalt{ false }; - std::atomic receiving{ false }; + std::atomic triggerhalt{false}; + TriggerVariable receivingHalt; std::function dataCall; std::function errorCall; std::atomic state{connection_state_t::prestart}; }; +/** tcp acceptor*/ +class TcpAcceptor : public std::enable_shared_from_this +{ + public: + enum class accepting_state_t + { + opened = 0, + connecting = 1, + connected = 2, + halted = 3, + closed = 4, + }; + typedef std::shared_ptr pointer; + /** create an RxConnection object using the specified service and bufferSize*/ + static pointer create (boost::asio::io_service &io_service, boost::asio::ip::tcp::endpoint &ep) + { + return pointer (new TcpAcceptor (io_service, ep)); + } + + static pointer create (boost::asio::io_service &io_service, int port) + { + return pointer (new TcpAcceptor (io_service, port)); + } + /** destructor to make sure everything is closed without threading issues*/ + ~TcpAcceptor () { close (); }; + + /** connect the acceptor to the socket*/ + bool connect (); + /** connect the acceptor to the socket if disconnected and try up to timeout*/ + bool connect (int timeout); + /** start the acceptor*/ + bool start (TcpRxConnection::pointer conn); + /** cancel pending operations*/ + void cancel () { acceptor_.cancel (); } + /** close the socket*/ + void close (); + /** check if the acceptor is current accepting new connections*/ + bool isAccepting () const { return accepting.isActive (); } + /** check if the acceptor is ready to begin accepting*/ + bool isConnected () const { return (state.load () == accepting_state_t::connected); } + /** set the callback for the data object*/ + void setAcceptCall (std::function accFunc) + { + acceptCall = std::move (accFunc); + } + + /** set the error path callback*/ + void setErrorCall (std::function errorFunc) + { + errorCall = std::move (errorFunc); + } + /** set an option on the underlying acceptor*/ + template + void set_option (const X &option) + { + acceptor_.set_option (option); + } + /** generate a string from the associated endpoint*/ + std::string to_string () const; + + private: + TcpAcceptor (boost::asio::io_service &io_service, boost::asio::ip::tcp::endpoint &ep); + TcpAcceptor (boost::asio::io_service &io_service, int port); + /** function for handling the asynchronous return from a read request*/ + void handle_accept (TcpAcceptor::pointer ptr, + TcpRxConnection::pointer new_connection, + const boost::system::error_code &error); + boost::asio::ip::tcp::acceptor acceptor_; + boost::asio::ip::tcp::endpoint endpoint_; + std::function acceptCall; + std::function errorCall; + std::atomic state{accepting_state_t::opened}; + TriggerVariable accepting; +}; + /** tcp socket connection for connecting to a server*/ class TcpConnection : public std::enable_shared_from_this { @@ -93,10 +171,10 @@ class TcpConnection : public std::enable_shared_from_this void close (); /** send raw data @throws boost::system::system_error on failure*/ - void send (const void *buffer, size_t dataLength); + size_t send (const void *buffer, size_t dataLength); /** send a string @throws boost::system::system_error on failure*/ - void send (const std::string &dataString); + size_t send (const std::string &dataString); /** do a blocking receive on the socket @throw boost::system::system_error on failure @return the number of bytes received @@ -162,12 +240,12 @@ class TcpConnection : public std::enable_shared_from_this public: /** check if the socket has finished the connection process*/ - bool isConnected () const { return connected.load (); } + bool isConnected () const { return connected.isActive (); } /** wait until the socket has finished the connection process - @param timeOut the number of ms to wait for the connection process to finish (-1) for no limit - @return 0 if connected, -1 if the timeout was reached, -2 if error + @param timeOut the number of ms to wait for the connection process to finish (<0) for no limit + @return true if connected, false if the timeout was reached */ - int waitUntilConnected (int timeOut); + bool waitUntilConnected (int timeOut); private: TcpConnection (boost::asio::io_service &io_service, @@ -176,7 +254,7 @@ class TcpConnection : public std::enable_shared_from_this size_t bufferSize); boost::asio::ip::tcp::socket socket_; - std::atomic connected{false}; //!< flag indicating connectivity + TriggerVariable connected; //!< variable indicating connectivity std::vector data; void connect_handler (const boost::system::error_code &error); @@ -189,38 +267,68 @@ class TcpServer : public std::enable_shared_from_this public: typedef std::shared_ptr pointer; + static pointer create (boost::asio::io_service &io_service, + const std::string &address, + const std::string &port, + bool reuse_port = false, + int nominalBufferSize = 10192); + + static pointer create (boost::asio::io_service &io_service, + const std::string &address, + int PortNum, + bool reuse_port = false, + int nominalBufferSize = 10192); static pointer create (boost::asio::io_service &io_service, int PortNum, int nominalBufferSize = 10192); public: - /** start accepting new connections*/ + ~TcpServer (); + /**set the port reuse flag */ + void setPortReuse (bool reuse) { reuse_address = reuse; } + /** start accepting new connections*/ void start (); /** close the server*/ void close (); - + /** check if the server is ready to start*/ + bool isReady () const { return !(halted.load ()); } + /** reConnect the server with the same address*/ + bool reConnect (int timeout); + /** set the data callback*/ void setDataCall (std::function dataFunc) { dataCall = std::move (dataFunc); } + /** set the error path callback*/ void setErrorCall (std::function errorFunc) { errorCall = std::move (errorFunc); } - void handle_accept (TcpRxConnection::pointer new_connection, const boost::system::error_code &error); + void handle_accept (TcpAcceptor::pointer acc, TcpRxConnection::pointer new_connection); private: - TcpServer (boost::asio::io_service &io_service, int PortNum, int nominalBufferSize) - : acceptor_ (io_service, boost::asio::ip::tcp::endpoint (boost::asio::ip::tcp::v4 (), PortNum)), - bufferSize (nominalBufferSize) - { - } + TcpServer (boost::asio::io_service &io_service, + const std::string &address, + int portNum, + bool port_reuse, + int nominalBufferSize); + TcpServer (boost::asio::io_service &io_service, + const std::string &address, + const std::string &port, + bool port_reuse, + int nominalBufferSize); + TcpServer (boost::asio::io_service &io_service, int portNum, int nominalBufferSize); - boost::asio::ip::tcp::acceptor acceptor_; - std::atomic accepting{false}; + void initialConnect (); + boost::asio::io_service &ioserv; + std::mutex accepting; + std::vector acceptors; + std::vector endpoints; size_t bufferSize; std::function dataCall; std::function errorCall; - std::atomic halted{ false }; - guarded>> connections; + std::atomic halted{false}; + bool reuse_address = false; + // this data structure is protected by the accepting mutex + std::vector> connections; }; } // namespace tcp diff --git a/src/helics/core/udp/UdpBroker.cpp b/src/helics/core/udp/UdpBroker.cpp index fcbfc4ba59..4b2bf85f6b 100644 --- a/src/helics/core/udp/UdpBroker.cpp +++ b/src/helics/core/udp/UdpBroker.cpp @@ -42,9 +42,9 @@ bool UdpBroker::brokerConnect () setAsRoot (); } comms = std::make_unique (netInfo); - comms->setCallback ([this](ActionMessage M) { addActionMessage (std::move (M)); }); + comms->setCallback ([this](ActionMessage &&M) { addActionMessage (std::move (M)); }); comms->setName (getIdentifier ()); - + comms->setTimeout (networkTimeout); // comms->setMessageSize(maxMessageSize, maxMessageCount); auto res = comms->connect (); if (res) diff --git a/src/helics/core/udp/UdpComms.cpp b/src/helics/core/udp/UdpComms.cpp index 5a298ce07e..59d4bf769b 100644 --- a/src/helics/core/udp/UdpComms.cpp +++ b/src/helics/core/udp/UdpComms.cpp @@ -91,13 +91,17 @@ UdpComms::UdpComms (const NetworkBrokerData &netInfo) } promisePort = std::promise (); futurePort = promisePort.get_future (); + if (PortNumber > 0) + { + autoPortNumber = false; + } } /** destructor*/ UdpComms::~UdpComms () { disconnect (); } void UdpComms::setBrokerPort (int brokerPortNumber) { - if (rx_status == connection_status::startup) + if (getRxStatus() == connection_status::startup) { brokerPort = brokerPortNumber; } @@ -120,9 +124,13 @@ int UdpComms::findOpenPort () void UdpComms::setPortNumber (int localPortNumber) { - if (rx_status == connection_status::startup) + if (getRxStatus() == connection_status::startup) { PortNumber = localPortNumber; + if (PortNumber > 0) + { + autoPortNumber = false; + } } } @@ -188,35 +196,73 @@ void UdpComms::queue_rx_function () } if (PortNumber < 0) { - rx_status = connection_status::error; + setRxStatus( connection_status::error); return; } auto ioserv = AsioServiceManager::getServicePointer (); udp::socket socket (ioserv->getBaseService ()); socket.open (udp::v4 ()); - int cntr = 0; - while (true) + int t_cnt = 0; + bool bindsuccess = false; + while (!bindsuccess) { try { socket.bind (udp::endpoint (udp::v4 (), PortNumber)); - break; + bindsuccess = true; } catch (const boost::system::system_error &error) { - if (cntr == 1) + if ((autoPortNumber) && (hasBroker)) + { // If we failed and we are on an automatically assigned port number, just try a different port + int tries = 0; + while (!bindsuccess) + { + ++PortNumber; + try + { + socket.bind (udp::endpoint (udp::v4 (), PortNumber)); + bindsuccess = true; + } + catch (const boost::system::system_error &) + { + ++tries; + if (tries > 10) + { + break; + } + } + } + if (bindsuccess) + { + continue; + } + else + { + disconnecting = true; + std::cerr << "Unable to bind socket " << makePortAddress (localTarget_, PortNumber) << " " + << error.what () << std::endl; + socket.close (); + setRxStatus( connection_status::error); + return; + } + + } + if (t_cnt == 0) { std::cerr << "bind error on UDP socket " << error.what () << std::endl; } - std::this_thread::sleep_for (std::chrono::milliseconds (100)); - if (cntr > 40) + std::this_thread::sleep_for (std::chrono::milliseconds (200)); + t_cnt += 200; + if (t_cnt > connectionTimeout) { - std::cerr << "Unable to bind socket " << error.what () << std::endl; + disconnecting = true; + std::cerr << "Unable to bind socket " << makePortAddress (localTarget_, PortNumber) << " " + << error.what () << std::endl; socket.close (); - rx_status = connection_status::error; + setRxStatus( connection_status::error); return; } - ++cntr; } } @@ -224,13 +270,13 @@ void UdpComms::queue_rx_function () udp::endpoint remote_endp; boost::system::error_code error; boost::system::error_code ignored_error; - rx_status = connection_status::connected; + setRxStatus( connection_status::connected); while (true) { auto len = socket.receive_from (boost::asio::buffer (data), remote_endp, 0, error); if (error) { - rx_status = connection_status::error; + setRxStatus( connection_status::error); return; } if (len == 5) @@ -277,7 +323,7 @@ void UdpComms::queue_rx_function () } CLOSE_RX_LOOP: disconnecting = true; - rx_status = connection_status::terminated; + setRxStatus( connection_status::terminated); } void UdpComms::queue_tx_function () @@ -350,7 +396,7 @@ void UdpComms::queue_tx_function () { PortNumber = -1; promisePort.set_value (-1); - tx_status = connection_status::terminated; + setTxStatus( connection_status::terminated); return; } } @@ -372,7 +418,7 @@ void UdpComms::queue_tx_function () udp::resolver::query queryLocal (udp::v4 (), localTarget_, std::to_string (PortNumber)); udp::endpoint rxEndpoint = *resolver.resolve (queryLocal); - tx_status = connection_status::connected; + setTxStatus( connection_status::connected); while (true) { @@ -472,12 +518,12 @@ void UdpComms::queue_tx_function () CLOSE_TX_LOOP: routes.clear (); - if (rx_status == connection_status::connected) + if (getRxStatus() == connection_status::connected) { if (closingRx) { int cnt = 0; - while (rx_status == connection_status::connected) + while (getRxStatus() == connection_status::connected) { std::this_thread::sleep_for (std::chrono::milliseconds (100)); ++cnt; @@ -507,12 +553,12 @@ void UdpComms::queue_tx_function () } } - tx_status = connection_status::terminated; + setTxStatus( connection_status::terminated); } void UdpComms::closeReceiver () { - if (tx_status == connection_status::connected) + if (getTxStatus() == connection_status::connected) { ActionMessage cmd (CMD_PROTOCOL); cmd.index = CLOSE_RECEIVER; diff --git a/src/helics/core/udp/UdpComms.h b/src/helics/core/udp/UdpComms.h index 9f292e584a..a8c9b1f250 100644 --- a/src/helics/core/udp/UdpComms.h +++ b/src/helics/core/udp/UdpComms.h @@ -51,6 +51,7 @@ class UdpComms final : public CommsInterface std::atomic PortNumber{-1}; std::set usedPortNumbers; int openPortStart = -1; + bool autoPortNumber = true; std::atomic hasBroker{false}; virtual void queue_rx_function () override; //!< the functional loop for the receive queue virtual void queue_tx_function () override; //!< the loop for transmitting data diff --git a/src/helics/core/udp/UdpCore.cpp b/src/helics/core/udp/UdpCore.cpp index 33889aa9de..97280829c6 100644 --- a/src/helics/core/udp/UdpCore.cpp +++ b/src/helics/core/udp/UdpCore.cpp @@ -32,9 +32,9 @@ bool UdpCore::brokerConnect () netInfo.brokerAddress = "localhost"; } comms = std::make_unique (netInfo); - comms->setCallback ([this](ActionMessage M) { addActionMessage (std::move (M)); }); + comms->setCallback ([this](ActionMessage &&M) { addActionMessage (std::move (M)); }); comms->setName (getIdentifier ()); - + comms->setTimeout (networkTimeout); auto res = comms->connect (); if (res) { diff --git a/src/helics/core/zmq/ZmqBroker.cpp b/src/helics/core/zmq/ZmqBroker.cpp index 7d5ed79eb4..604a02c668 100644 --- a/src/helics/core/zmq/ZmqBroker.cpp +++ b/src/helics/core/zmq/ZmqBroker.cpp @@ -43,9 +43,9 @@ bool ZmqBroker::brokerConnect () } zmqContextManager::startContext (); comms = std::make_unique (netInfo); - comms->setCallback ([this](ActionMessage M) { addActionMessage (std::move (M)); }); + comms->setCallback ([this](ActionMessage &&M) { addActionMessage (std::move (M)); }); comms->setName (getIdentifier ()); - + comms->setTimeout (networkTimeout); // comms->setMessageSize(maxMessageSize, maxMessageCount); auto res = comms->connect (); if (res) diff --git a/src/helics/core/zmq/ZmqComms.cpp b/src/helics/core/zmq/ZmqComms.cpp index 6000ea7d2e..abc021fca8 100644 --- a/src/helics/core/zmq/ZmqComms.cpp +++ b/src/helics/core/zmq/ZmqComms.cpp @@ -20,10 +20,40 @@ static const int BEGIN_OPEN_PORT_RANGE_SUBBROKER = 23600; static const int DEFAULT_BROKER_PULL_PORT_NUMBER = 23405; static const int DEFAULT_BROKER_REP_PORT_NUMBER = 23404; -namespace helics +/** bind a zmq socket, with a timeout and timeout period*/ +static bool bindzmqSocket (zmq::socket_t &socket, const std::string &address, int port, int timeout, int period=200) { + bool bindsuccess = false; + int tcount = 0; + while (!bindsuccess) + { + try + { + socket.bind (helics::makePortAddress (address, port)); + bindsuccess = true; + } + catch (const zmq::error_t &) + { + if (tcount == 0) + { + std::cerr << "zmq binding error on socket sleeping then will try again \n"; + } + if (tcount > timeout) + { + break; + } + std::this_thread::sleep_for (std::chrono::milliseconds (period)); + tcount += period; + } + } + return bindsuccess; +} + + namespace helics + { namespace zeromq { + ZmqComms::ZmqComms (const std::string &brokerTarget, const std::string &localTarget, interface_networks targetNetwork) : CommsInterface (brokerTarget, localTarget,targetNetwork) { @@ -112,6 +142,7 @@ ZmqComms::ZmqComms (const NetworkBrokerData &netInfo) : CommsInterface (netInfo) { repPortNumber = netInfo.portNumber; pullPortNumber = repPortNumber + 1; + autoPortNumber = false; } if (netInfo.portStart > 0) { @@ -123,7 +154,7 @@ ZmqComms::~ZmqComms () { disconnect (); } void ZmqComms::setBrokerPort (int brokerPort) { - if (rx_status == connection_status::startup) + if (getRxStatus () == connection_status::startup) { brokerReqPort = brokerPort; brokerPushPort = brokerReqPort + 1; @@ -148,10 +179,14 @@ std::pair ZmqComms::findOpenPorts () void ZmqComms::setPortNumber (int portNumber) { - if (rx_status == connection_status::startup) + if (getRxStatus () == connection_status::startup) { repPortNumber = portNumber; pullPortNumber = portNumber + 1; + if (portNumber > 0) + { + autoPortNumber = false; + } } } @@ -180,7 +215,7 @@ int ZmqComms::processIncomingMessage (zmq::message_t &msg) case CLOSE_RECEIVER: return (-1); case RECONNECT_RECEIVER: - rx_status = connection_status::connected; + setRxStatus ( connection_status::connected); break; default: break; @@ -256,7 +291,7 @@ void ZmqComms::queue_rx_function () catch (const zmq::error_t &) { std::cerr << "binding error on internal comms socket" << std::endl; - rx_status = connection_status::error; + setRxStatus ( connection_status::error); return; } controlSocket.setsockopt (ZMQ_LINGER, 200); @@ -299,67 +334,47 @@ void ZmqComms::queue_rx_function () { std::cout << "broker name " << brokerName_ << " does not match broker connection\n"; disconnecting = true; - rx_status = connection_status::error; + setRxStatus ( connection_status::error); return; } else if (M.index == DISCONNECT) { disconnecting = true; - rx_status = connection_status::terminated; + setRxStatus ( connection_status::terminated); return; } else if (M.index == DISCONNECT_ERROR) { disconnecting = true; - rx_status = connection_status::error; + setRxStatus ( connection_status::error); return; } } } - try + auto bindsuccess = bindzmqSocket (repSocket, localTarget_, repPortNumber, connectionTimeout); + if (!bindsuccess) { - repSocket.bind (makePortAddress (localTarget_, repPortNumber)); - } - catch (const zmq::error_t &) - { - std::cerr << "binding error on reply socket sleeping then will try again \n"; - std::this_thread::sleep_for (std::chrono::milliseconds (100)); - try - { - repSocket.bind (makePortAddress (localTarget_, repPortNumber)); - } - catch (const zmq::error_t &ze) - { - pullSocket.close (); - disconnecting = true; - std::cerr << "zmqError binding rep port " << makePortAddress (localTarget_, repPortNumber) - << ze.what () << '\n'; - rx_status = connection_status::error; - return; - } - } - try - { - pullSocket.bind (makePortAddress (localTarget_, pullPortNumber)); + pullSocket.close (); + repSocket.close (); + disconnecting = true; + std::cerr << " unable to bind zmq socket giving up " << makePortAddress (localTarget_, repPortNumber) + << '\n'; + setRxStatus ( connection_status::error); + return; } - catch (const zmq::error_t &) + bindsuccess = bindzmqSocket (pullSocket, localTarget_, pullPortNumber, connectionTimeout); + + if (!bindsuccess) { - std::cerr << "binding error on pull socket sleeping then will try again \n"; - std::this_thread::sleep_for (std::chrono::milliseconds (100)); - try - { - pullSocket.bind (makePortAddress (localTarget_, pullPortNumber)); - } - catch (const zmq::error_t &ze) - { - disconnecting = true; - std::cerr << "zmqError binding pull port " << makePortAddress (localTarget_, pullPortNumber) - << ze.what () << '\n'; - rx_status = connection_status::error; - return; - } + pullSocket.close (); + repSocket.close (); + disconnecting = true; + std::cerr << " unable to bind zmq socket giving up " << makePortAddress (localTarget_, pullPortNumber) << '\n'; + setRxStatus ( connection_status::error); + return; } + std::vector poller (3); poller[0].socket = static_cast (controlSocket); poller[0].events = ZMQ_POLLIN; @@ -367,7 +382,7 @@ void ZmqComms::queue_rx_function () poller[1].events = ZMQ_POLLIN; poller[2].socket = static_cast (repSocket); poller[2].events = ZMQ_POLLIN; - rx_status = connection_status::connected; // this is a atomic indicator that the rx queue is ready + setRxStatus ( connection_status::connected); // this is a atomic indicator that the rx queue is ready while (true) { auto rc = zmq::poll (poller); @@ -406,7 +421,7 @@ void ZmqComms::queue_rx_function () } } disconnecting = true; - rx_status = connection_status::terminated; + setRxStatus ( connection_status::terminated); } int ZmqComms::initializeBrokerConnections (zmq::socket_t &controlSocket) @@ -429,7 +444,7 @@ int ZmqComms::initializeBrokerConnections (zmq::socket_t &controlSocket) { std::cerr << "unable to connect with broker at " << makePortAddress (brokerTarget_, brokerReqPort) << ":" << ze.what () << '\n'; - tx_status = connection_status::error; + setTxStatus ( connection_status::error); ActionMessage M (CMD_PROTOCOL); M.index = DISCONNECT_ERROR; controlSocket.send (M.to_string ()); @@ -457,14 +472,14 @@ int ZmqComms::initializeBrokerConnections (zmq::socket_t &controlSocket) if (rc < 0) { std::cerr << "unable to connect with zmq broker\n"; - tx_status = connection_status::error; + setTxStatus ( connection_status::error); } else if (rc == 0) { std::cerr << "zmq broker connection timed out\n"; - tx_status = connection_status::error; + setTxStatus ( connection_status::error); } - if (tx_status == connection_status::error) + if (getTxStatus () == connection_status::error) { ActionMessage M (CMD_PROTOCOL); M.index = DISCONNECT_ERROR; @@ -486,13 +501,13 @@ int ZmqComms::initializeBrokerConnections (zmq::socket_t &controlSocket) else if (rxcmd.index == DISCONNECT) { controlSocket.send (msg); - tx_status = connection_status::terminated; + setTxStatus ( connection_status::terminated); return (-3); } else if (rxcmd.index == DISCONNECT_ERROR) { controlSocket.send (msg); - tx_status = connection_status::error; + setTxStatus ( connection_status::error); return (-4); } } @@ -501,7 +516,7 @@ int ZmqComms::initializeBrokerConnections (zmq::socket_t &controlSocket) if (cnt > 10) { // we can't get the broker to respond with port numbers - tx_status = connection_status::error; + setTxStatus ( connection_status::error); ActionMessage M (CMD_PROTOCOL); M.index = DISCONNECT_ERROR; controlSocket.send (M.to_string ()); @@ -523,14 +538,14 @@ int ZmqComms::initializeBrokerConnections (zmq::socket_t &controlSocket) if (rc < 0) { std::cerr << "unable to connect with zmq broker (2)\n"; - tx_status = connection_status::error; + setTxStatus ( connection_status::error); } else if (rc == 0) { std::cerr << "zmq broker connection timed out (2)\n"; - tx_status = connection_status::error; + setTxStatus ( connection_status::error); } - if (tx_status == connection_status::error) + if (getTxStatus () == connection_status::error) { ActionMessage M (CMD_PROTOCOL); M.index = DISCONNECT_ERROR; @@ -554,13 +569,13 @@ int ZmqComms::initializeBrokerConnections (zmq::socket_t &controlSocket) else if (rxcmd.index == DISCONNECT) { controlSocket.send (msg); - tx_status = connection_status::terminated; + setTxStatus ( connection_status::terminated); return (-3); } else if (rxcmd.index == DISCONNECT_ERROR) { controlSocket.send (msg); - tx_status = connection_status::error; + setTxStatus ( connection_status::error); return (-4); } } @@ -569,7 +584,7 @@ int ZmqComms::initializeBrokerConnections (zmq::socket_t &controlSocket) if (cnt > 10) { // we can't get the broker to respond with port numbers - tx_status = connection_status::error; + setTxStatus ( connection_status::error); return (-1); } } @@ -604,8 +619,6 @@ void ZmqComms::queue_tx_function () std::vector buffer; auto ctx = zmqContextManager::getContextPointer (); - conditionalChangeOnDestroy cchange (tx_status, connection_status::error, - connection_status::connected); // Setup the control socket for comms with the receiver zmq::socket_t controlSocket (ctx->getContext (), ZMQ_PAIR); controlSocket.setsockopt (ZMQ_LINGER, 200); @@ -614,6 +627,7 @@ void ZmqComms::queue_tx_function () auto res = initializeBrokerConnections (controlSocket); if (res < 0) { + setTxStatus (connection_status::error); controlSocket.close (); return; } @@ -628,7 +642,7 @@ void ZmqComms::queue_tx_function () priority_routes.addRoutes (0, makePortAddress (brokerTarget_, brokerReqPort)); brokerPushSocket.connect (makePortAddress (brokerTarget_, brokerPushPort)); } - tx_status = connection_status::connected; + setTxStatus ( connection_status::connected); zmq::message_t msg; while (true) { @@ -675,7 +689,7 @@ void ZmqComms::queue_tx_function () switch (cmd.index) { case RECONNECT: - tx_status = connection_status::connected; + setTxStatus ( connection_status::connected); break; case NEW_ROUTE: { @@ -765,19 +779,19 @@ void ZmqComms::queue_tx_function () brokerPushSocket.close (); routes.clear (); - if (rx_status == connection_status::connected) + if (getRxStatus () == connection_status::connected) { controlSocket.send (std::string ("close"), ZMQ_NOBLOCK); } controlSocket.close (); - tx_status = connection_status::terminated; + setTxStatus ( connection_status::terminated); } void ZmqComms::closeReceiver () { - if (tx_status == connection_status::connected) + if (getTxStatus () == connection_status::connected) { ActionMessage cmd (CMD_PROTOCOL); cmd.index = CLOSE_RECEIVER; diff --git a/src/helics/core/zmq/ZmqComms.h b/src/helics/core/zmq/ZmqComms.h index 98513910e9..6124a0174e 100644 --- a/src/helics/core/zmq/ZmqComms.h +++ b/src/helics/core/zmq/ZmqComms.h @@ -43,6 +43,7 @@ class ZmqComms final:public CommsInterface { std::set usedPortNumbers; int openPortStart = -1; std::atomic hasBroker{ false }; + bool autoPortNumber = true; virtual void queue_rx_function() override; //!< the functional loop for the receive queue virtual void queue_tx_function() override; //!< the loop for transmitting data virtual void closeReceiver() override; //!< function to instruct the receiver loop to close diff --git a/src/helics/core/zmq/ZmqCore.cpp b/src/helics/core/zmq/ZmqCore.cpp index 2f5d1ac45a..fd571d3e1e 100644 --- a/src/helics/core/zmq/ZmqCore.cpp +++ b/src/helics/core/zmq/ZmqCore.cpp @@ -33,9 +33,9 @@ bool ZmqCore::brokerConnect () netInfo.brokerAddress = "tcp://127.0.0.1"; } comms = std::make_unique (netInfo); - comms->setCallback ([this](ActionMessage M) { addActionMessage (std::move (M)); }); + comms->setCallback ([this](ActionMessage &&M) { addActionMessage (std::move (M)); }); comms->setName (getIdentifier ()); - + comms->setTimeout (networkTimeout); // comms->setMessageSize(maxMessageSize, maxMessageCount); auto res = comms->connect (); if (res) diff --git a/src/helics/cpp98/Broker.hpp b/src/helics/cpp98/Broker.hpp index 1b3a0530d9..279bc5857b 100644 --- a/src/helics/cpp98/Broker.hpp +++ b/src/helics/cpp98/Broker.hpp @@ -9,56 +9,52 @@ All rights reserved. See LICENSE file and DISCLAIMER for more details. #include "../shared_api_library/helics.h" #include "config.hpp" +#include #include -#include namespace helics98 { - class Broker { public: // Default constructor, not meant to be used - Broker ():broker(NULL) {}; + Broker () : broker (NULL){}; Broker (std::string type, std::string name, std::string initString) { - broker = helicsCreateBroker (type.c_str(), name.c_str(), initString.c_str()); + broker = helicsCreateBroker (type.c_str (), name.c_str (), initString.c_str ()); if (broker == NULL) { - throw(std::runtime_error("broker creation failed")); + throw (std::runtime_error ("broker creation failed")); } - if (helicsBrokerIsConnected(broker) != helics_true) + if (helicsBrokerIsConnected (broker) != helics_true) { - throw(std::runtime_error("broker creation failed")); + throw (std::runtime_error ("broker creation failed")); } } Broker (std::string type, std::string name, int argc, const char **argv) { - broker = helicsCreateBrokerFromArgs (type.c_str(), name.c_str(), argc, argv); + broker = helicsCreateBrokerFromArgs (type.c_str (), name.c_str (), argc, argv); if (broker == NULL) { - throw(std::runtime_error("broker creation failed")); + throw (std::runtime_error ("broker creation failed")); } } - Broker(const Broker &brk) - { - broker = helicsBrokerClone(brk.broker); - } - Broker &operator=(const Broker &brk) + Broker (const Broker &brk) { broker = helicsBrokerClone (brk.broker); } + Broker &operator= (const Broker &brk) { - broker = helicsBrokerClone(brk.broker); + broker = helicsBrokerClone (brk.broker); return *this; } #ifdef HELICS_HAS_RVALUE_REFS - Broker(Broker &&brk) noexcept + Broker (Broker &&brk) noexcept { broker = brk.broker; brk.broker = NULL; } - Broker &operator=(Broker &&brk) noexcept + Broker &operator= (Broker &&brk) noexcept { broker = brk.broker; brk.broker = NULL; @@ -69,39 +65,35 @@ class Broker { if (broker != NULL) { - helicsBrokerFree(broker); + helicsBrokerFree (broker); } } - operator helics_broker() { return broker; } + operator helics_broker () { return broker; } - helics_broker baseObject() const { return broker; } + helics_broker baseObject () const { return broker; } - bool isConnected () const - { - return helicsBrokerIsConnected (broker); - } - void disconnect() - { - helicsBrokerDisconnect(broker); - } - std::string getIdentifier() const + bool isConnected () const { return helicsBrokerIsConnected (broker); } + void disconnect () { helicsBrokerDisconnect (broker); } + bool waitForDisconnect (int msToWait=-1) { return (helicsBrokerWaitForDisconnect (broker, msToWait) == helics_ok); } + std::string getIdentifier () const { char str[255]; - helicsBrokerGetIdentifier(broker, &str[0], sizeof(str)); - std::string result(str); + helicsBrokerGetIdentifier (broker, &str[0], sizeof (str)); + std::string result (str); return result; } - std::string getAddress() const + std::string getAddress () const { char str[255]; - helicsBrokerGetAddress(broker, &str[0], sizeof(str)); - std::string result(str); + helicsBrokerGetAddress (broker, &str[0], sizeof (str)); + std::string result (str); return result; } + protected: helics_broker broker; }; -} //namespace helics +} // namespace helics #endif diff --git a/src/helics/cpp98/Core.hpp b/src/helics/cpp98/Core.hpp index 7080340fdb..62ff750f93 100644 --- a/src/helics/cpp98/Core.hpp +++ b/src/helics/cpp98/Core.hpp @@ -12,7 +12,7 @@ All rights reserved. See LICENSE file and DISCLAIMER for more details. #include "config.hpp" #include #include "../cpp98/Filter.hpp" -#include +#include namespace helics98 { diff --git a/src/helics/cpp98/Federate.hpp b/src/helics/cpp98/Federate.hpp index 4260f9affc..dec6769345 100644 --- a/src/helics/cpp98/Federate.hpp +++ b/src/helics/cpp98/Federate.hpp @@ -297,7 +297,7 @@ class Federate a federate, core, or broker @param queryStr a string with the query see other documentation for specific properties to query, can be defined by the federate - @return a string with the value requested. this is either going to be a vector of strings value or a json + @return a string with the value requested. this is either going to be a vector of strings value or a JSON string stored in the first element of the vector. The string "#invalid" is returned if the query was not valid */ std::string query (const std::string &target, const std::string &queryStr) diff --git a/src/helics/cpp98/ValueFederate.hpp b/src/helics/cpp98/ValueFederate.hpp index 8558e2a7b3..89b8a37575 100644 --- a/src/helics/cpp98/ValueFederate.hpp +++ b/src/helics/cpp98/ValueFederate.hpp @@ -48,7 +48,7 @@ class ValueFederate : public virtual Federate fed = helicsCreateValueFederateFromJson (jsonString.c_str()); if (fed == NULL) { - throw(std::runtime_error("fed==nullptr create from json")); + throw(std::runtime_error("fed==nullptr create from JSON")); } } diff --git a/src/helics/shared_api_library/FederateExport.cpp b/src/helics/shared_api_library/FederateExport.cpp index e38ef2ccdc..f1c876f9e2 100644 --- a/src/helics/shared_api_library/FederateExport.cpp +++ b/src/helics/shared_api_library/FederateExport.cpp @@ -135,12 +135,12 @@ helics_federate helicsCreateValueFederate (const helics_federate_info_t fi) return (fed); } -helics_federate helicsCreateValueFederateFromJson (const char *json) +helics_federate helicsCreateValueFederateFromJson (const char *JSON) { auto FedI = std::make_unique (); try { - FedI->fedptr = std::make_shared ((json != nullptr) ? std::string (json) : std::string ()); + FedI->fedptr = std::make_shared ((JSON != nullptr) ? std::string (JSON) : std::string ()); } catch (const helics::RegistrationFailure &) { @@ -179,13 +179,13 @@ helics_federate helicsCreateMessageFederate (const helics_federate_info_t fi) return (fed); } -helics_federate helicsCreateMessageFederateFromJson (const char *json) +helics_federate helicsCreateMessageFederateFromJson (const char *JSON) { auto FedI = std::make_unique (); try { - FedI->fedptr = std::make_shared ((json != nullptr) ? std::string (json) : std::string ()); + FedI->fedptr = std::make_shared ((JSON != nullptr) ? std::string (JSON) : std::string ()); } catch (const helics::RegistrationFailure &) { @@ -224,12 +224,12 @@ helics_federate helicsCreateCombinationFederate (const helics_federate_info_t fi return (fed); } -helics_federate helicsCreateCombinationFederateFromJson (const char *json) +helics_federate helicsCreateCombinationFederateFromJson (const char *JSON) { auto FedI = std::make_unique (); try { - FedI->fedptr = std::make_shared ((json != nullptr) ? std::string (json) : std::string ()); + FedI->fedptr = std::make_shared ((JSON != nullptr) ? std::string (JSON) : std::string ()); } catch (const helics::RegistrationFailure &) { diff --git a/src/helics/shared_api_library/helics.h b/src/helics/shared_api_library/helics.h index 15c1cee2f4..7d5cb26a2c 100644 --- a/src/helics/shared_api_library/helics.h +++ b/src/helics/shared_api_library/helics.h @@ -82,6 +82,12 @@ a connected broker implies is attached to cores or cores could reach out to comm return 0 if not connected , something else if it is connected*/ HELICS_EXPORT int helicsBrokerIsConnected (helics_broker broker); +/** wait for the broker to disconnect +@param broker the broker to wait for +@param msToWait the time out in millisecond (<0 for infinite timeout) +*/ +HELICS_EXPORT helics_status helicsBrokerWaitForDisconnect (helics_broker broker, int msToWait); + /** check if a core is connected a connected core implies is attached to federate or federates could be attached to it return 0 if not connected , something else if it is connected*/ @@ -138,6 +144,15 @@ HELICS_EXPORT helics_federate helicsGetFederateByName (const char *fedName); */ HELICS_EXPORT helics_status helicsBrokerDisconnect (helics_broker broker); +/** disconnect and free a broker*/ +HELICS_EXPORT void helicsDestroyFederate (helics_federate fed); + +/** disconnect and free a broker*/ +HELICS_EXPORT void helicsDestroyBroker (helics_broker broker); + +/** disconnect and free a core*/ +HELICS_EXPORT void helicsDestroyCore (helics_core core); + /** release the memory associated with a core*/ HELICS_EXPORT void helicsCoreFree (helics_core core); /** release the memory associated with a broker*/ @@ -156,7 +171,7 @@ HELICS_EXPORT helics_federate helicsCreateValueFederate (const helics_federate_i @param JSON a JSON file or a JSON string that contains setup and configuration information @return an opaque value federate object */ -HELICS_EXPORT helics_federate helicsCreateValueFederateFromJson (const char *json); +HELICS_EXPORT helics_federate helicsCreateValueFederateFromJson (const char *JSON); /** create a message federate from a federate info object @details helics_message_federate objects can be used in all functions that take a helics_message_federate or helics_federate object as an @@ -172,7 +187,7 @@ argument @param JSON a JSON file or a JSON string that contains setup and configuration information @return an opaque message federate object */ -HELICS_EXPORT helics_federate helicsCreateMessageFederateFromJson (const char *json); +HELICS_EXPORT helics_federate helicsCreateMessageFederateFromJson (const char *JSON); /** create a combination federate from a federate info object @details combination federates are both value federates and message federates, objects can be used in all functions that take a @@ -188,7 +203,7 @@ helics_federate, helics_message_federate or helics_federate object as an argumen @param JSON a JSON file or a JSON string that contains setup and configuration information @return an opaque combination federate object */ -HELICS_EXPORT helics_federate helicsCreateCombinationFederateFromJson (const char *json); +HELICS_EXPORT helics_federate helicsCreateCombinationFederateFromJson (const char *JSON); /** create a new reference to an existing federate @details this will create a new helics_federate object that references the existing federate it must be freed as well diff --git a/src/helics/shared_api_library/helicsExport.cpp b/src/helics/shared_api_library/helicsExport.cpp index 573a5feb12..688f26a824 100644 --- a/src/helics/shared_api_library/helicsExport.cpp +++ b/src/helics/shared_api_library/helicsExport.cpp @@ -708,8 +708,27 @@ helics_status helicsCoreDisconnect (helics_core core) } } -helics_status helicsBrokerDisconnect (helics_broker broker) +helics_status helicsBrokerWaitForDisconnect (helics_broker broker, int msToWait) { + if (broker == nullptr) + { + return helics_invalid_object; + } + auto brk = getBroker (broker); + if (brk == nullptr) + { + return helics_invalid_object; + } + brk->waitForDisconnect (msToWait); + if (brk->isConnected()) + { + return helics_warning; + } + return helics_ok; +} + + helics_status helicsBrokerDisconnect (helics_broker broker) + { if (broker == nullptr) { return helics_error; @@ -730,6 +749,26 @@ helics_status helicsBrokerDisconnect (helics_broker broker) } } +void helicsDestroyFederate (helics_federate fed) +{ + helicsFederateFinalize (fed); + helicsFederateFree (fed); +} + + +void helicsDestroyBroker(helics_broker broker) +{ + helicsBrokerDisconnect (broker); + helicsBrokerFree (broker); +} + + +void helicsDestroyCore(helics_core core) +{ + helicsCoreDisconnect (core); + helicsCoreFree (core); +} + void helicsCoreFree (helics_core core) { auto coreObj = helics::getCoreObject (core); @@ -1004,7 +1043,7 @@ helics::FedObject *MasterObjectHolder::findFed (const std::string &fedName) auto handle = feds.lock (); for (auto &fed : (*handle)) { - if ((fed)&&(fed->fedptr)) + if ((fed) && (fed->fedptr)) { if (fed->fedptr->getName () == fedName) { @@ -1049,15 +1088,38 @@ void MasterObjectHolder::deleteAll () return; } { - auto brokerHandle = brokers.lock (); - brokerHandle->clear (); + auto fedHandle = feds.lock (); + for (auto &fed : fedHandle) + { + if ((fed)&&(fed->fedptr)) + { + fed->fedptr->finalize (); + } + } + fedHandle->clear (); } { auto coreHandle = cores.lock (); + for (auto &cr : coreHandle) + { + if ((cr)&&(cr->coreptr)) + { + cr->coreptr->disconnect (); + } + } coreHandle->clear (); } - auto fedHandle = feds.lock (); - fedHandle->clear (); + { + auto brokerHandle = brokers.lock (); + for (auto &brk : brokerHandle) + { + if ((brk)&&(brk->brokerptr)) + { + brk->brokerptr->disconnect (); + } + } + brokerHandle->clear (); + } } std::shared_ptr getMasterHolder () diff --git a/swig/java/interface/helics.java b/swig/java/interface/helics.java index 4901f00fbc..69378eddf7 100644 --- a/swig/java/interface/helics.java +++ b/swig/java/interface/helics.java @@ -67,6 +67,10 @@ public static int helicsBrokerIsConnected(SWIGTYPE_p_void broker) { return helicsJNI.helicsBrokerIsConnected(SWIGTYPE_p_void.getCPtr(broker)); } + public static helics_status helicsBrokerWaitForDisconnect(SWIGTYPE_p_void broker, int msToWait) { + return helics_status.swigToEnum(helicsJNI.helicsBrokerWaitForDisconnect(SWIGTYPE_p_void.getCPtr(broker), msToWait)); + } + public static int helicsCoreIsConnected(SWIGTYPE_p_void core) { return helicsJNI.helicsCoreIsConnected(SWIGTYPE_p_void.getCPtr(core)); } @@ -100,6 +104,18 @@ public static helics_status helicsBrokerDisconnect(SWIGTYPE_p_void broker) { return helics_status.swigToEnum(helicsJNI.helicsBrokerDisconnect(SWIGTYPE_p_void.getCPtr(broker))); } + public static void helicsDestroyFederate(SWIGTYPE_p_void fed) { + helicsJNI.helicsDestroyFederate(SWIGTYPE_p_void.getCPtr(fed)); + } + + public static void helicsDestroyBroker(SWIGTYPE_p_void broker) { + helicsJNI.helicsDestroyBroker(SWIGTYPE_p_void.getCPtr(broker)); + } + + public static void helicsDestroyCore(SWIGTYPE_p_void core) { + helicsJNI.helicsDestroyCore(SWIGTYPE_p_void.getCPtr(core)); + } + public static void helicsCoreFree(SWIGTYPE_p_void core) { helicsJNI.helicsCoreFree(SWIGTYPE_p_void.getCPtr(core)); } @@ -113,8 +129,8 @@ public static SWIGTYPE_p_void helicsCreateValueFederate(SWIGTYPE_p_void fi) { return (cPtr == 0) ? null : new SWIGTYPE_p_void(cPtr, false); } - public static SWIGTYPE_p_void helicsCreateValueFederateFromJson(String json) { - long cPtr = helicsJNI.helicsCreateValueFederateFromJson(json); + public static SWIGTYPE_p_void helicsCreateValueFederateFromJson(String JSON) { + long cPtr = helicsJNI.helicsCreateValueFederateFromJson(JSON); return (cPtr == 0) ? null : new SWIGTYPE_p_void(cPtr, false); } @@ -123,8 +139,8 @@ public static SWIGTYPE_p_void helicsCreateMessageFederate(SWIGTYPE_p_void fi) { return (cPtr == 0) ? null : new SWIGTYPE_p_void(cPtr, false); } - public static SWIGTYPE_p_void helicsCreateMessageFederateFromJson(String json) { - long cPtr = helicsJNI.helicsCreateMessageFederateFromJson(json); + public static SWIGTYPE_p_void helicsCreateMessageFederateFromJson(String JSON) { + long cPtr = helicsJNI.helicsCreateMessageFederateFromJson(JSON); return (cPtr == 0) ? null : new SWIGTYPE_p_void(cPtr, false); } @@ -133,8 +149,8 @@ public static SWIGTYPE_p_void helicsCreateCombinationFederate(SWIGTYPE_p_void fi return (cPtr == 0) ? null : new SWIGTYPE_p_void(cPtr, false); } - public static SWIGTYPE_p_void helicsCreateCombinationFederateFromJson(String json) { - long cPtr = helicsJNI.helicsCreateCombinationFederateFromJson(json); + public static SWIGTYPE_p_void helicsCreateCombinationFederateFromJson(String JSON) { + long cPtr = helicsJNI.helicsCreateCombinationFederateFromJson(JSON); return (cPtr == 0) ? null : new SWIGTYPE_p_void(cPtr, false); } diff --git a/swig/java/interface/helicsJNI.java b/swig/java/interface/helicsJNI.java index b01e730d11..3586cd6ba9 100644 --- a/swig/java/interface/helicsJNI.java +++ b/swig/java/interface/helicsJNI.java @@ -9,7 +9,9 @@ package com.java.helics; public class helicsJNI { - + static { + System.loadLibrary("JNIhelicsd"); + } public final static native int helics_ok_get(); public final static native double helics_time_zero_get(); public final static native double helics_time_epsilon_get(); @@ -61,6 +63,7 @@ public class helicsJNI { public final static native long helicsCreateBrokerFromArgs(String jarg1, String jarg2, String[] jarg3); public final static native long helicsBrokerClone(long jarg1); public final static native int helicsBrokerIsConnected(long jarg1); + public final static native int helicsBrokerWaitForDisconnect(long jarg1, int jarg2); public final static native int helicsCoreIsConnected(long jarg1); public final static native int helicsBrokerGetIdentifier(long jarg1, byte[] jarg2); public final static native int helicsCoreGetIdentifier(long jarg1, byte[] jarg2); @@ -69,6 +72,9 @@ public class helicsJNI { public final static native int helicsCoreDisconnect(long jarg1); public final static native long helicsGetFederateByName(String jarg1); public final static native int helicsBrokerDisconnect(long jarg1); + public final static native void helicsDestroyFederate(long jarg1); + public final static native void helicsDestroyBroker(long jarg1); + public final static native void helicsDestroyCore(long jarg1); public final static native void helicsCoreFree(long jarg1); public final static native void helicsBrokerFree(long jarg1); public final static native long helicsCreateValueFederate(long jarg1); diff --git a/swig/java/interface/helicsJavaJAVA_wrap.c b/swig/java/interface/helicsJavaJAVA_wrap.c index a26127f808..bd1565f9ec 100644 --- a/swig/java/interface/helicsJavaJAVA_wrap.c +++ b/swig/java/interface/helicsJavaJAVA_wrap.c @@ -1063,6 +1063,22 @@ SWIGEXPORT jint JNICALL Java_com_java_helics_helicsJNI_helicsBrokerIsConnected(J } +SWIGEXPORT jint JNICALL Java_com_java_helics_helicsJNI_helicsBrokerWaitForDisconnect(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2) { + jint jresult = 0 ; + helics_broker arg1 = (helics_broker) 0 ; + int arg2 ; + helics_status result; + + (void)jenv; + (void)jcls; + arg1 = *(helics_broker *)&jarg1; + arg2 = (int)jarg2; + result = (helics_status)helicsBrokerWaitForDisconnect(arg1,arg2); + jresult = (jint)result; + return jresult; +} + + SWIGEXPORT jint JNICALL Java_com_java_helics_helicsJNI_helicsCoreIsConnected(JNIEnv *jenv, jclass jcls, jlong jarg1) { jint jresult = 0 ; helics_core arg1 = (helics_core) 0 ; @@ -1207,6 +1223,36 @@ SWIGEXPORT jint JNICALL Java_com_java_helics_helicsJNI_helicsBrokerDisconnect(JN } +SWIGEXPORT void JNICALL Java_com_java_helics_helicsJNI_helicsDestroyFederate(JNIEnv *jenv, jclass jcls, jlong jarg1) { + helics_federate arg1 = (helics_federate) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(helics_federate *)&jarg1; + helicsDestroyFederate(arg1); +} + + +SWIGEXPORT void JNICALL Java_com_java_helics_helicsJNI_helicsDestroyBroker(JNIEnv *jenv, jclass jcls, jlong jarg1) { + helics_broker arg1 = (helics_broker) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(helics_broker *)&jarg1; + helicsDestroyBroker(arg1); +} + + +SWIGEXPORT void JNICALL Java_com_java_helics_helicsJNI_helicsDestroyCore(JNIEnv *jenv, jclass jcls, jlong jarg1) { + helics_core arg1 = (helics_core) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(helics_core *)&jarg1; + helicsDestroyCore(arg1); +} + + SWIGEXPORT void JNICALL Java_com_java_helics_helicsJNI_helicsCoreFree(JNIEnv *jenv, jclass jcls, jlong jarg1) { helics_core arg1 = (helics_core) 0 ; diff --git a/swig/matlab/+helics/HELICS_CORE_TYPE_DEFAULT.m b/swig/matlab/+helics/HELICS_CORE_TYPE_DEFAULT.m index f6981f2b6e..68c45d8d2b 100644 --- a/swig/matlab/+helics/HELICS_CORE_TYPE_DEFAULT.m +++ b/swig/matlab/+helics/HELICS_CORE_TYPE_DEFAULT.m @@ -1,7 +1,7 @@ function v = HELICS_CORE_TYPE_DEFAULT() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876585); + vInitialized = helicsMEX(0, 1818783868); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_CORE_TYPE_INTERPROCESS.m b/swig/matlab/+helics/HELICS_CORE_TYPE_INTERPROCESS.m index 190ebbcc52..fb27e1d006 100644 --- a/swig/matlab/+helics/HELICS_CORE_TYPE_INTERPROCESS.m +++ b/swig/matlab/+helics/HELICS_CORE_TYPE_INTERPROCESS.m @@ -1,7 +1,7 @@ function v = HELICS_CORE_TYPE_INTERPROCESS() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876589); + vInitialized = helicsMEX(0, 1818783872); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_CORE_TYPE_IPC.m b/swig/matlab/+helics/HELICS_CORE_TYPE_IPC.m index a8bf35595f..9f0406e02f 100644 --- a/swig/matlab/+helics/HELICS_CORE_TYPE_IPC.m +++ b/swig/matlab/+helics/HELICS_CORE_TYPE_IPC.m @@ -1,7 +1,7 @@ function v = HELICS_CORE_TYPE_IPC() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876590); + vInitialized = helicsMEX(0, 1818783873); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_CORE_TYPE_MPI.m b/swig/matlab/+helics/HELICS_CORE_TYPE_MPI.m index 19e54beebe..cf3bc6fd28 100644 --- a/swig/matlab/+helics/HELICS_CORE_TYPE_MPI.m +++ b/swig/matlab/+helics/HELICS_CORE_TYPE_MPI.m @@ -1,7 +1,7 @@ function v = HELICS_CORE_TYPE_MPI() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876587); + vInitialized = helicsMEX(0, 1818783870); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_CORE_TYPE_TCP.m b/swig/matlab/+helics/HELICS_CORE_TYPE_TCP.m index 75283e23d5..0aeff179f5 100644 --- a/swig/matlab/+helics/HELICS_CORE_TYPE_TCP.m +++ b/swig/matlab/+helics/HELICS_CORE_TYPE_TCP.m @@ -1,7 +1,7 @@ function v = HELICS_CORE_TYPE_TCP() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876591); + vInitialized = helicsMEX(0, 1818783874); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_CORE_TYPE_TEST.m b/swig/matlab/+helics/HELICS_CORE_TYPE_TEST.m index 9a93532b34..1e1188d323 100644 --- a/swig/matlab/+helics/HELICS_CORE_TYPE_TEST.m +++ b/swig/matlab/+helics/HELICS_CORE_TYPE_TEST.m @@ -1,7 +1,7 @@ function v = HELICS_CORE_TYPE_TEST() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876588); + vInitialized = helicsMEX(0, 1818783871); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_CORE_TYPE_UDP.m b/swig/matlab/+helics/HELICS_CORE_TYPE_UDP.m index aef32140b9..b4e3152403 100644 --- a/swig/matlab/+helics/HELICS_CORE_TYPE_UDP.m +++ b/swig/matlab/+helics/HELICS_CORE_TYPE_UDP.m @@ -1,7 +1,7 @@ function v = HELICS_CORE_TYPE_UDP() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876592); + vInitialized = helicsMEX(0, 1818783875); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_CORE_TYPE_ZMQ.m b/swig/matlab/+helics/HELICS_CORE_TYPE_ZMQ.m index b6275c73b2..59666575f8 100644 --- a/swig/matlab/+helics/HELICS_CORE_TYPE_ZMQ.m +++ b/swig/matlab/+helics/HELICS_CORE_TYPE_ZMQ.m @@ -1,7 +1,7 @@ function v = HELICS_CORE_TYPE_ZMQ() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876586); + vInitialized = helicsMEX(0, 1818783869); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_DATA_TYPE_BOOLEAN.m b/swig/matlab/+helics/HELICS_DATA_TYPE_BOOLEAN.m index 93f04fa62f..dd5857df72 100644 --- a/swig/matlab/+helics/HELICS_DATA_TYPE_BOOLEAN.m +++ b/swig/matlab/+helics/HELICS_DATA_TYPE_BOOLEAN.m @@ -1,7 +1,7 @@ function v = HELICS_DATA_TYPE_BOOLEAN() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876599); + vInitialized = helicsMEX(0, 1818783882); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_DATA_TYPE_COMPLEX.m b/swig/matlab/+helics/HELICS_DATA_TYPE_COMPLEX.m index b31657c8f1..d4599eba3b 100644 --- a/swig/matlab/+helics/HELICS_DATA_TYPE_COMPLEX.m +++ b/swig/matlab/+helics/HELICS_DATA_TYPE_COMPLEX.m @@ -1,7 +1,7 @@ function v = HELICS_DATA_TYPE_COMPLEX() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876596); + vInitialized = helicsMEX(0, 1818783879); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_DATA_TYPE_DOUBLE.m b/swig/matlab/+helics/HELICS_DATA_TYPE_DOUBLE.m index 5875e08be9..69a1d79fbe 100644 --- a/swig/matlab/+helics/HELICS_DATA_TYPE_DOUBLE.m +++ b/swig/matlab/+helics/HELICS_DATA_TYPE_DOUBLE.m @@ -1,7 +1,7 @@ function v = HELICS_DATA_TYPE_DOUBLE() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876594); + vInitialized = helicsMEX(0, 1818783877); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_DATA_TYPE_INT.m b/swig/matlab/+helics/HELICS_DATA_TYPE_INT.m index 3cafc4fcb3..13105f4c03 100644 --- a/swig/matlab/+helics/HELICS_DATA_TYPE_INT.m +++ b/swig/matlab/+helics/HELICS_DATA_TYPE_INT.m @@ -1,7 +1,7 @@ function v = HELICS_DATA_TYPE_INT() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876595); + vInitialized = helicsMEX(0, 1818783878); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_DATA_TYPE_NAMEDPOINT.m b/swig/matlab/+helics/HELICS_DATA_TYPE_NAMEDPOINT.m index 612a563157..3f9b7abd15 100644 --- a/swig/matlab/+helics/HELICS_DATA_TYPE_NAMEDPOINT.m +++ b/swig/matlab/+helics/HELICS_DATA_TYPE_NAMEDPOINT.m @@ -1,7 +1,7 @@ function v = HELICS_DATA_TYPE_NAMEDPOINT() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876598); + vInitialized = helicsMEX(0, 1818783881); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_DATA_TYPE_RAW.m b/swig/matlab/+helics/HELICS_DATA_TYPE_RAW.m index dfb3facc4a..077a0a0ec8 100644 --- a/swig/matlab/+helics/HELICS_DATA_TYPE_RAW.m +++ b/swig/matlab/+helics/HELICS_DATA_TYPE_RAW.m @@ -1,7 +1,7 @@ function v = HELICS_DATA_TYPE_RAW() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876600); + vInitialized = helicsMEX(0, 1818783883); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_DATA_TYPE_STRING.m b/swig/matlab/+helics/HELICS_DATA_TYPE_STRING.m index 4298cb994a..c67ed8e270 100644 --- a/swig/matlab/+helics/HELICS_DATA_TYPE_STRING.m +++ b/swig/matlab/+helics/HELICS_DATA_TYPE_STRING.m @@ -1,7 +1,7 @@ function v = HELICS_DATA_TYPE_STRING() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876593); + vInitialized = helicsMEX(0, 1818783876); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_DATA_TYPE_VECTOR.m b/swig/matlab/+helics/HELICS_DATA_TYPE_VECTOR.m index 69a710e2af..4eba313f87 100644 --- a/swig/matlab/+helics/HELICS_DATA_TYPE_VECTOR.m +++ b/swig/matlab/+helics/HELICS_DATA_TYPE_VECTOR.m @@ -1,7 +1,7 @@ function v = HELICS_DATA_TYPE_VECTOR() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876597); + vInitialized = helicsMEX(0, 1818783880); end v = vInitialized; end diff --git a/swig/matlab/+helics/force_iteration.m b/swig/matlab/+helics/force_iteration.m index 5fe645b7de..a95dd71cb0 100644 --- a/swig/matlab/+helics/force_iteration.m +++ b/swig/matlab/+helics/force_iteration.m @@ -1,7 +1,7 @@ function v = force_iteration() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876564); + vInitialized = helicsMEX(0, 1818783847); end v = vInitialized; end diff --git a/swig/matlab/+helics/helicsBrokerDisconnect.m b/swig/matlab/+helics/helicsBrokerDisconnect.m index e3d07cfbe3..fc11b34fa3 100644 --- a/swig/matlab/+helics/helicsBrokerDisconnect.m +++ b/swig/matlab/+helics/helicsBrokerDisconnect.m @@ -14,5 +14,5 @@ %------- %a helics_status enumeration indicating any error condition % - [varargout{1:nargout}] = helicsMEX(47, varargin{:}); + [varargout{1:nargout}] = helicsMEX(48, varargin{:}); end diff --git a/swig/matlab/+helics/helicsBrokerFree.m b/swig/matlab/+helics/helicsBrokerFree.m index ba3d5aa48f..9864e501b4 100644 --- a/swig/matlab/+helics/helicsBrokerFree.m +++ b/swig/matlab/+helics/helicsBrokerFree.m @@ -1,5 +1,5 @@ function varargout = helicsBrokerFree(varargin) %release the memory associated with a broker % - [varargout{1:nargout}] = helicsMEX(49, varargin{:}); + [varargout{1:nargout}] = helicsMEX(53, varargin{:}); end diff --git a/swig/matlab/+helics/helicsBrokerGetAddress.m b/swig/matlab/+helics/helicsBrokerGetAddress.m index 1b085c7dbe..147b787737 100644 --- a/swig/matlab/+helics/helicsBrokerGetAddress.m +++ b/swig/matlab/+helics/helicsBrokerGetAddress.m @@ -14,5 +14,5 @@ %------- %a helics_status enumeration indicating any error condition % - [varargout{1:nargout}] = helicsMEX(43, varargin{:}); + [varargout{1:nargout}] = helicsMEX(44, varargin{:}); end diff --git a/swig/matlab/+helics/helicsBrokerGetIdentifier.m b/swig/matlab/+helics/helicsBrokerGetIdentifier.m index d832c559d1..a04c726751 100644 --- a/swig/matlab/+helics/helicsBrokerGetIdentifier.m +++ b/swig/matlab/+helics/helicsBrokerGetIdentifier.m @@ -14,5 +14,5 @@ %------- %a helics_status enumeration indicating any error condition % - [varargout{1:nargout}] = helicsMEX(41, varargin{:}); + [varargout{1:nargout}] = helicsMEX(42, varargin{:}); end diff --git a/swig/matlab/+helics/helicsBrokerWaitForDisconnect.m b/swig/matlab/+helics/helicsBrokerWaitForDisconnect.m new file mode 100644 index 0000000000..66b6ff1eb4 --- /dev/null +++ b/swig/matlab/+helics/helicsBrokerWaitForDisconnect.m @@ -0,0 +1,3 @@ +function varargout = helicsBrokerWaitForDisconnect(varargin) + [varargout{1:nargout}] = helicsMEX(40, varargin{:}); +end diff --git a/swig/matlab/+helics/helicsCleanupHelicsLibrary.m b/swig/matlab/+helics/helicsCleanupHelicsLibrary.m index 57fe1db1ba..56ea851f16 100644 --- a/swig/matlab/+helics/helicsCleanupHelicsLibrary.m +++ b/swig/matlab/+helics/helicsCleanupHelicsLibrary.m @@ -1,3 +1,3 @@ function varargout = helicsCleanupHelicsLibrary(varargin) - [varargout{1:nargout}] = helicsMEX(113, varargin{:}); + [varargout{1:nargout}] = helicsMEX(117, varargin{:}); end diff --git a/swig/matlab/+helics/helicsCloseLibrary.m b/swig/matlab/+helics/helicsCloseLibrary.m index 9046ed7ec5..199468b97e 100644 --- a/swig/matlab/+helics/helicsCloseLibrary.m +++ b/swig/matlab/+helics/helicsCloseLibrary.m @@ -2,5 +2,5 @@ %call when done using the helics library, this function will ensure the threads %are closed properly if possible this should be the last call before exiting, % - [varargout{1:nargout}] = helicsMEX(76, varargin{:}); + [varargout{1:nargout}] = helicsMEX(80, varargin{:}); end diff --git a/swig/matlab/+helics/helicsCoreDisconnect.m b/swig/matlab/+helics/helicsCoreDisconnect.m index 0785b7c289..472f2017de 100644 --- a/swig/matlab/+helics/helicsCoreDisconnect.m +++ b/swig/matlab/+helics/helicsCoreDisconnect.m @@ -14,5 +14,5 @@ %------- %a helics_status enumeration indicating any error condition % - [varargout{1:nargout}] = helicsMEX(45, varargin{:}); + [varargout{1:nargout}] = helicsMEX(46, varargin{:}); end diff --git a/swig/matlab/+helics/helicsCoreFree.m b/swig/matlab/+helics/helicsCoreFree.m index 7ac320223e..fef3cccd69 100644 --- a/swig/matlab/+helics/helicsCoreFree.m +++ b/swig/matlab/+helics/helicsCoreFree.m @@ -1,5 +1,5 @@ function varargout = helicsCoreFree(varargin) %release the memory associated with a core % - [varargout{1:nargout}] = helicsMEX(48, varargin{:}); + [varargout{1:nargout}] = helicsMEX(52, varargin{:}); end diff --git a/swig/matlab/+helics/helicsCoreGetIdentifier.m b/swig/matlab/+helics/helicsCoreGetIdentifier.m index ea4bfc76eb..f38282335a 100644 --- a/swig/matlab/+helics/helicsCoreGetIdentifier.m +++ b/swig/matlab/+helics/helicsCoreGetIdentifier.m @@ -14,5 +14,5 @@ %------- %a helics_status enumeration indicating any error condition % - [varargout{1:nargout}] = helicsMEX(42, varargin{:}); + [varargout{1:nargout}] = helicsMEX(43, varargin{:}); end diff --git a/swig/matlab/+helics/helicsCoreIsConnected.m b/swig/matlab/+helics/helicsCoreIsConnected.m index 628ebd7dc2..864342540d 100644 --- a/swig/matlab/+helics/helicsCoreIsConnected.m +++ b/swig/matlab/+helics/helicsCoreIsConnected.m @@ -3,5 +3,5 @@ %federates could be attached to it return 0 if not connected , something else if %it is connected % - [varargout{1:nargout}] = helicsMEX(40, varargin{:}); + [varargout{1:nargout}] = helicsMEX(41, varargin{:}); end diff --git a/swig/matlab/+helics/helicsCoreRegisterCloningFilter.m b/swig/matlab/+helics/helicsCoreRegisterCloningFilter.m index 3cf41b6794..ce23ddf271 100644 --- a/swig/matlab/+helics/helicsCoreRegisterCloningFilter.m +++ b/swig/matlab/+helics/helicsCoreRegisterCloningFilter.m @@ -1,4 +1,4 @@ function varargout = helicsCoreRegisterCloningFilter(varargin) % - [varargout{1:nargout}] = helicsMEX(180, varargin{:}); + [varargout{1:nargout}] = helicsMEX(184, varargin{:}); end diff --git a/swig/matlab/+helics/helicsCoreRegisterDestinationFilter.m b/swig/matlab/+helics/helicsCoreRegisterDestinationFilter.m index 754f1ac4f5..c3018f9144 100644 --- a/swig/matlab/+helics/helicsCoreRegisterDestinationFilter.m +++ b/swig/matlab/+helics/helicsCoreRegisterDestinationFilter.m @@ -1,4 +1,4 @@ function varargout = helicsCoreRegisterDestinationFilter(varargin) % - [varargout{1:nargout}] = helicsMEX(179, varargin{:}); + [varargout{1:nargout}] = helicsMEX(183, varargin{:}); end diff --git a/swig/matlab/+helics/helicsCoreRegisterSourceFilter.m b/swig/matlab/+helics/helicsCoreRegisterSourceFilter.m index ef0670c1fd..ddf2649aa9 100644 --- a/swig/matlab/+helics/helicsCoreRegisterSourceFilter.m +++ b/swig/matlab/+helics/helicsCoreRegisterSourceFilter.m @@ -1,4 +1,4 @@ function varargout = helicsCoreRegisterSourceFilter(varargin) % - [varargout{1:nargout}] = helicsMEX(178, varargin{:}); + [varargout{1:nargout}] = helicsMEX(182, varargin{:}); end diff --git a/swig/matlab/+helics/helicsCoreSetReadyToInit.m b/swig/matlab/+helics/helicsCoreSetReadyToInit.m index cecc3e6003..9d06db891d 100644 --- a/swig/matlab/+helics/helicsCoreSetReadyToInit.m +++ b/swig/matlab/+helics/helicsCoreSetReadyToInit.m @@ -1,3 +1,3 @@ function varargout = helicsCoreSetReadyToInit(varargin) - [varargout{1:nargout}] = helicsMEX(44, varargin{:}); + [varargout{1:nargout}] = helicsMEX(45, varargin{:}); end diff --git a/swig/matlab/+helics/helicsCreateCombinationFederate.m b/swig/matlab/+helics/helicsCreateCombinationFederate.m index 7532e1426a..809c64b614 100644 --- a/swig/matlab/+helics/helicsCreateCombinationFederate.m +++ b/swig/matlab/+helics/helicsCreateCombinationFederate.m @@ -14,5 +14,5 @@ %------- %an opaque value federate object nullptr if the object creation failed % - [varargout{1:nargout}] = helicsMEX(54, varargin{:}); + [varargout{1:nargout}] = helicsMEX(58, varargin{:}); end diff --git a/swig/matlab/+helics/helicsCreateCombinationFederateFromJson.m b/swig/matlab/+helics/helicsCreateCombinationFederateFromJson.m index 7e890c4bf1..c50d2b8881 100644 --- a/swig/matlab/+helics/helicsCreateCombinationFederateFromJson.m +++ b/swig/matlab/+helics/helicsCreateCombinationFederateFromJson.m @@ -15,5 +15,5 @@ %------- %an opaque combination federate object % - [varargout{1:nargout}] = helicsMEX(55, varargin{:}); + [varargout{1:nargout}] = helicsMEX(59, varargin{:}); end diff --git a/swig/matlab/+helics/helicsCreateMessageFederate.m b/swig/matlab/+helics/helicsCreateMessageFederate.m index f806048604..6a9d7d8f69 100644 --- a/swig/matlab/+helics/helicsCreateMessageFederate.m +++ b/swig/matlab/+helics/helicsCreateMessageFederate.m @@ -13,5 +13,5 @@ %------- %an opaque message federate object % - [varargout{1:nargout}] = helicsMEX(52, varargin{:}); + [varargout{1:nargout}] = helicsMEX(56, varargin{:}); end diff --git a/swig/matlab/+helics/helicsCreateMessageFederateFromJson.m b/swig/matlab/+helics/helicsCreateMessageFederateFromJson.m index 8ca1f5f846..ce18ea303b 100644 --- a/swig/matlab/+helics/helicsCreateMessageFederateFromJson.m +++ b/swig/matlab/+helics/helicsCreateMessageFederateFromJson.m @@ -14,5 +14,5 @@ %------- %an opaque message federate object % - [varargout{1:nargout}] = helicsMEX(53, varargin{:}); + [varargout{1:nargout}] = helicsMEX(57, varargin{:}); end diff --git a/swig/matlab/+helics/helicsCreateQuery.m b/swig/matlab/+helics/helicsCreateQuery.m index 7140f7ee0a..c14523adee 100644 --- a/swig/matlab/+helics/helicsCreateQuery.m +++ b/swig/matlab/+helics/helicsCreateQuery.m @@ -3,5 +3,5 @@ % %a query object consists of a target and query string % - [varargout{1:nargout}] = helicsMEX(105, varargin{:}); + [varargout{1:nargout}] = helicsMEX(109, varargin{:}); end diff --git a/swig/matlab/+helics/helicsCreateValueFederate.m b/swig/matlab/+helics/helicsCreateValueFederate.m index 4d8910796a..3e2a8398da 100644 --- a/swig/matlab/+helics/helicsCreateValueFederate.m +++ b/swig/matlab/+helics/helicsCreateValueFederate.m @@ -13,5 +13,5 @@ %------- %an opaque value federate object % - [varargout{1:nargout}] = helicsMEX(50, varargin{:}); + [varargout{1:nargout}] = helicsMEX(54, varargin{:}); end diff --git a/swig/matlab/+helics/helicsCreateValueFederateFromJson.m b/swig/matlab/+helics/helicsCreateValueFederateFromJson.m index d5a1bf70b6..0aa7e42722 100644 --- a/swig/matlab/+helics/helicsCreateValueFederateFromJson.m +++ b/swig/matlab/+helics/helicsCreateValueFederateFromJson.m @@ -14,5 +14,5 @@ %------- %an opaque value federate object % - [varargout{1:nargout}] = helicsMEX(51, varargin{:}); + [varargout{1:nargout}] = helicsMEX(55, varargin{:}); end diff --git a/swig/matlab/+helics/helicsDestroyBroker.m b/swig/matlab/+helics/helicsDestroyBroker.m new file mode 100644 index 0000000000..8d23f45d80 --- /dev/null +++ b/swig/matlab/+helics/helicsDestroyBroker.m @@ -0,0 +1,3 @@ +function varargout = helicsDestroyBroker(varargin) + [varargout{1:nargout}] = helicsMEX(50, varargin{:}); +end diff --git a/swig/matlab/+helics/helicsDestroyCore.m b/swig/matlab/+helics/helicsDestroyCore.m new file mode 100644 index 0000000000..e4dc6a0ee3 --- /dev/null +++ b/swig/matlab/+helics/helicsDestroyCore.m @@ -0,0 +1,3 @@ +function varargout = helicsDestroyCore(varargin) + [varargout{1:nargout}] = helicsMEX(51, varargin{:}); +end diff --git a/swig/matlab/+helics/helicsDestroyFederate.m b/swig/matlab/+helics/helicsDestroyFederate.m new file mode 100644 index 0000000000..80162b6ff1 --- /dev/null +++ b/swig/matlab/+helics/helicsDestroyFederate.m @@ -0,0 +1,3 @@ +function varargout = helicsDestroyFederate(varargin) + [varargout{1:nargout}] = helicsMEX(49, varargin{:}); +end diff --git a/swig/matlab/+helics/helicsEndpointGetMessage.m b/swig/matlab/+helics/helicsEndpointGetMessage.m index 1cbee7f9bb..69f73c917f 100644 --- a/swig/matlab/+helics/helicsEndpointGetMessage.m +++ b/swig/matlab/+helics/helicsEndpointGetMessage.m @@ -10,5 +10,5 @@ %------- %a message object % - [varargout{1:nargout}] = helicsMEX(170, varargin{:}); + [varargout{1:nargout}] = helicsMEX(174, varargin{:}); end diff --git a/swig/matlab/+helics/helicsEndpointGetName.m b/swig/matlab/+helics/helicsEndpointGetName.m index 723e054549..698b6bcfaa 100644 --- a/swig/matlab/+helics/helicsEndpointGetName.m +++ b/swig/matlab/+helics/helicsEndpointGetName.m @@ -14,5 +14,5 @@ %------- %a status variable % - [varargout{1:nargout}] = helicsMEX(173, varargin{:}); + [varargout{1:nargout}] = helicsMEX(177, varargin{:}); end diff --git a/swig/matlab/+helics/helicsEndpointGetType.m b/swig/matlab/+helics/helicsEndpointGetType.m index c9480f5896..51a46ba7f5 100644 --- a/swig/matlab/+helics/helicsEndpointGetType.m +++ b/swig/matlab/+helics/helicsEndpointGetType.m @@ -14,5 +14,5 @@ %------- %a status variable % - [varargout{1:nargout}] = helicsMEX(172, varargin{:}); + [varargout{1:nargout}] = helicsMEX(176, varargin{:}); end diff --git a/swig/matlab/+helics/helicsEndpointHasMessage.m b/swig/matlab/+helics/helicsEndpointHasMessage.m index cb7a0d4d2b..7d0d06a2ec 100644 --- a/swig/matlab/+helics/helicsEndpointHasMessage.m +++ b/swig/matlab/+helics/helicsEndpointHasMessage.m @@ -1,4 +1,4 @@ function varargout = helicsEndpointHasMessage(varargin) % - [varargout{1:nargout}] = helicsMEX(167, varargin{:}); + [varargout{1:nargout}] = helicsMEX(171, varargin{:}); end diff --git a/swig/matlab/+helics/helicsEndpointReceiveCount.m b/swig/matlab/+helics/helicsEndpointReceiveCount.m index 2957a1143d..c9935a5c54 100644 --- a/swig/matlab/+helics/helicsEndpointReceiveCount.m +++ b/swig/matlab/+helics/helicsEndpointReceiveCount.m @@ -1,5 +1,5 @@ function varargout = helicsEndpointReceiveCount(varargin) %Returns the number of pending receives for all endpoints of particular federate. % - [varargout{1:nargout}] = helicsMEX(169, varargin{:}); + [varargout{1:nargout}] = helicsMEX(173, varargin{:}); end diff --git a/swig/matlab/+helics/helicsEndpointSendEventRaw.m b/swig/matlab/+helics/helicsEndpointSendEventRaw.m index 657f0d98ff..cee825fdf9 100644 --- a/swig/matlab/+helics/helicsEndpointSendEventRaw.m +++ b/swig/matlab/+helics/helicsEndpointSendEventRaw.m @@ -1,4 +1,4 @@ function varargout = helicsEndpointSendEventRaw(varargin) % - [varargout{1:nargout}] = helicsMEX(163, varargin{:}); + [varargout{1:nargout}] = helicsMEX(167, varargin{:}); end diff --git a/swig/matlab/+helics/helicsEndpointSendMessage.m b/swig/matlab/+helics/helicsEndpointSendMessage.m index b6a039018f..c4f86d77dd 100644 --- a/swig/matlab/+helics/helicsEndpointSendMessage.m +++ b/swig/matlab/+helics/helicsEndpointSendMessage.m @@ -1,4 +1,4 @@ function varargout = helicsEndpointSendMessage(varargin) % - [varargout{1:nargout}] = helicsMEX(164, varargin{:}); + [varargout{1:nargout}] = helicsMEX(168, varargin{:}); end diff --git a/swig/matlab/+helics/helicsEndpointSendMessageRaw.m b/swig/matlab/+helics/helicsEndpointSendMessageRaw.m index cc7041d0f0..b5c8f42e19 100644 --- a/swig/matlab/+helics/helicsEndpointSendMessageRaw.m +++ b/swig/matlab/+helics/helicsEndpointSendMessageRaw.m @@ -1,4 +1,4 @@ function varargout = helicsEndpointSendMessageRaw(varargin) % - [varargout{1:nargout}] = helicsMEX(162, varargin{:}); + [varargout{1:nargout}] = helicsMEX(166, varargin{:}); end diff --git a/swig/matlab/+helics/helicsEndpointSetDefaultDestination.m b/swig/matlab/+helics/helicsEndpointSetDefaultDestination.m index a0c5013899..4ad3bb13b1 100644 --- a/swig/matlab/+helics/helicsEndpointSetDefaultDestination.m +++ b/swig/matlab/+helics/helicsEndpointSetDefaultDestination.m @@ -1,4 +1,4 @@ function varargout = helicsEndpointSetDefaultDestination(varargin) % - [varargout{1:nargout}] = helicsMEX(161, varargin{:}); + [varargout{1:nargout}] = helicsMEX(165, varargin{:}); end diff --git a/swig/matlab/+helics/helicsEndpointSubscribe.m b/swig/matlab/+helics/helicsEndpointSubscribe.m index 23cf4ef351..3dbf314772 100644 --- a/swig/matlab/+helics/helicsEndpointSubscribe.m +++ b/swig/matlab/+helics/helicsEndpointSubscribe.m @@ -11,5 +11,5 @@ % the type of the publication that is expected (nullptr or "" for DON'T % CARE) % - [varargout{1:nargout}] = helicsMEX(165, varargin{:}); + [varargout{1:nargout}] = helicsMEX(169, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateClone.m b/swig/matlab/+helics/helicsFederateClone.m index c84609214d..85e3c8d851 100644 --- a/swig/matlab/+helics/helicsFederateClone.m +++ b/swig/matlab/+helics/helicsFederateClone.m @@ -1,3 +1,3 @@ function varargout = helicsFederateClone(varargin) - [varargout{1:nargout}] = helicsMEX(56, varargin{:}); + [varargout{1:nargout}] = helicsMEX(60, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateEnterExecutionMode.m b/swig/matlab/+helics/helicsFederateEnterExecutionMode.m index 21253fa8b3..cbf636fc82 100644 --- a/swig/matlab/+helics/helicsFederateEnterExecutionMode.m +++ b/swig/matlab/+helics/helicsFederateEnterExecutionMode.m @@ -14,5 +14,5 @@ %a helics_status enumeration helics_error if something went wrong %helicsInvalidReference if fed is invalid % - [varargout{1:nargout}] = helicsMEX(81, varargin{:}); + [varargout{1:nargout}] = helicsMEX(85, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateEnterExecutionModeAsync.m b/swig/matlab/+helics/helicsFederateEnterExecutionModeAsync.m index e8e8d3f70f..f778028cc6 100644 --- a/swig/matlab/+helics/helicsFederateEnterExecutionModeAsync.m +++ b/swig/matlab/+helics/helicsFederateEnterExecutionModeAsync.m @@ -4,5 +4,5 @@ %this call is non-blocking and will return immediately call /ref %helicsFederateEnterExecutionModeComplete to finish the call sequence /ref % - [varargout{1:nargout}] = helicsMEX(82, varargin{:}); + [varargout{1:nargout}] = helicsMEX(86, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateEnterExecutionModeComplete.m b/swig/matlab/+helics/helicsFederateEnterExecutionModeComplete.m index 1eff992e07..bb43f0a3b1 100644 --- a/swig/matlab/+helics/helicsFederateEnterExecutionModeComplete.m +++ b/swig/matlab/+helics/helicsFederateEnterExecutionModeComplete.m @@ -6,5 +6,5 @@ %* `fed` : % the federate object to complete the call % - [varargout{1:nargout}] = helicsMEX(83, varargin{:}); + [varargout{1:nargout}] = helicsMEX(87, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateEnterExecutionModeIterative.m b/swig/matlab/+helics/helicsFederateEnterExecutionModeIterative.m index 9e1e544058..711b619d8c 100644 --- a/swig/matlab/+helics/helicsFederateEnterExecutionModeIterative.m +++ b/swig/matlab/+helics/helicsFederateEnterExecutionModeIterative.m @@ -1,4 +1,4 @@ function varargout = helicsFederateEnterExecutionModeIterative(varargin) % - [varargout{1:nargout}] = helicsMEX(84, varargin{:}); + [varargout{1:nargout}] = helicsMEX(88, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateEnterExecutionModeIterativeAsync.m b/swig/matlab/+helics/helicsFederateEnterExecutionModeIterativeAsync.m index f91fb59d59..e1c6e85dba 100644 --- a/swig/matlab/+helics/helicsFederateEnterExecutionModeIterativeAsync.m +++ b/swig/matlab/+helics/helicsFederateEnterExecutionModeIterativeAsync.m @@ -1,4 +1,4 @@ function varargout = helicsFederateEnterExecutionModeIterativeAsync(varargin) % - [varargout{1:nargout}] = helicsMEX(85, varargin{:}); + [varargout{1:nargout}] = helicsMEX(89, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateEnterExecutionModeIterativeComplete.m b/swig/matlab/+helics/helicsFederateEnterExecutionModeIterativeComplete.m index 4fcce30f4d..2a870ca59a 100644 --- a/swig/matlab/+helics/helicsFederateEnterExecutionModeIterativeComplete.m +++ b/swig/matlab/+helics/helicsFederateEnterExecutionModeIterativeComplete.m @@ -1,4 +1,4 @@ function varargout = helicsFederateEnterExecutionModeIterativeComplete(varargin) % - [varargout{1:nargout}] = helicsMEX(86, varargin{:}); + [varargout{1:nargout}] = helicsMEX(90, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateEnterInitializationMode.m b/swig/matlab/+helics/helicsFederateEnterInitializationMode.m index 6dacccf4d7..4e562bea29 100644 --- a/swig/matlab/+helics/helicsFederateEnterInitializationMode.m +++ b/swig/matlab/+helics/helicsFederateEnterInitializationMode.m @@ -5,5 +5,5 @@ %iteration is requested on entry to the execution state This is a blocking call %and will block until the core allows it to proceed % - [varargout{1:nargout}] = helicsMEX(77, varargin{:}); + [varargout{1:nargout}] = helicsMEX(81, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateEnterInitializationModeAsync.m b/swig/matlab/+helics/helicsFederateEnterInitializationModeAsync.m index 515a6de803..b19543414b 100644 --- a/swig/matlab/+helics/helicsFederateEnterInitializationModeAsync.m +++ b/swig/matlab/+helics/helicsFederateEnterInitializationModeAsync.m @@ -3,5 +3,5 @@ %helicsFederateEnterInitializationModeFinalize must be called to finish the %operation % - [varargout{1:nargout}] = helicsMEX(78, varargin{:}); + [varargout{1:nargout}] = helicsMEX(82, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateEnterInitializationModeComplete.m b/swig/matlab/+helics/helicsFederateEnterInitializationModeComplete.m index 2b46704f6e..85f31d4df3 100644 --- a/swig/matlab/+helics/helicsFederateEnterInitializationModeComplete.m +++ b/swig/matlab/+helics/helicsFederateEnterInitializationModeComplete.m @@ -1,5 +1,5 @@ function varargout = helicsFederateEnterInitializationModeComplete(varargin) %finalize the entry to initialize mode that was initiated with % - [varargout{1:nargout}] = helicsMEX(80, varargin{:}); + [varargout{1:nargout}] = helicsMEX(84, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateFinalize.m b/swig/matlab/+helics/helicsFederateFinalize.m index abf9ea329d..2ec720d7d5 100644 --- a/swig/matlab/+helics/helicsFederateFinalize.m +++ b/swig/matlab/+helics/helicsFederateFinalize.m @@ -2,5 +2,5 @@ %finalize the federate this halts all communication in the federate and %disconnects it from the core % - [varargout{1:nargout}] = helicsMEX(74, varargin{:}); + [varargout{1:nargout}] = helicsMEX(78, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateFree.m b/swig/matlab/+helics/helicsFederateFree.m index f245325017..d393295e0a 100644 --- a/swig/matlab/+helics/helicsFederateFree.m +++ b/swig/matlab/+helics/helicsFederateFree.m @@ -1,5 +1,5 @@ function varargout = helicsFederateFree(varargin) %release the memory associated withe a federate % - [varargout{1:nargout}] = helicsMEX(75, varargin{:}); + [varargout{1:nargout}] = helicsMEX(79, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateGetCoreObject.m b/swig/matlab/+helics/helicsFederateGetCoreObject.m index ffaa289e69..62b03d271e 100644 --- a/swig/matlab/+helics/helicsFederateGetCoreObject.m +++ b/swig/matlab/+helics/helicsFederateGetCoreObject.m @@ -10,5 +10,5 @@ %------- %a core object, nullptr if invalid % - [varargout{1:nargout}] = helicsMEX(88, varargin{:}); + [varargout{1:nargout}] = helicsMEX(92, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateGetCurrentTime.m b/swig/matlab/+helics/helicsFederateGetCurrentTime.m index 59116ffe5a..77db29a85c 100644 --- a/swig/matlab/+helics/helicsFederateGetCurrentTime.m +++ b/swig/matlab/+helics/helicsFederateGetCurrentTime.m @@ -12,5 +12,5 @@ %------- %helics_status object indicating success or error % - [varargout{1:nargout}] = helicsMEX(104, varargin{:}); + [varargout{1:nargout}] = helicsMEX(108, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateGetEndpointCount.m b/swig/matlab/+helics/helicsFederateGetEndpointCount.m index ea692b2a13..f626e4ef76 100644 --- a/swig/matlab/+helics/helicsFederateGetEndpointCount.m +++ b/swig/matlab/+helics/helicsFederateGetEndpointCount.m @@ -1,3 +1,3 @@ function varargout = helicsFederateGetEndpointCount(varargin) - [varargout{1:nargout}] = helicsMEX(174, varargin{:}); + [varargout{1:nargout}] = helicsMEX(178, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateGetMessage.m b/swig/matlab/+helics/helicsFederateGetMessage.m index a7bcb7c26c..c65a74ea9c 100644 --- a/swig/matlab/+helics/helicsFederateGetMessage.m +++ b/swig/matlab/+helics/helicsFederateGetMessage.m @@ -8,5 +8,5 @@ %------- %a unique_ptr to a Message object containing the message data % - [varargout{1:nargout}] = helicsMEX(171, varargin{:}); + [varargout{1:nargout}] = helicsMEX(175, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateGetName.m b/swig/matlab/+helics/helicsFederateGetName.m index 60cd659bfb..5a1be9e597 100644 --- a/swig/matlab/+helics/helicsFederateGetName.m +++ b/swig/matlab/+helics/helicsFederateGetName.m @@ -14,5 +14,5 @@ %------- %helics_status object indicating success or error % - [varargout{1:nargout}] = helicsMEX(95, varargin{:}); + [varargout{1:nargout}] = helicsMEX(99, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateGetPublicationCount.m b/swig/matlab/+helics/helicsFederateGetPublicationCount.m index bfb54ec617..5a26e23bb9 100644 --- a/swig/matlab/+helics/helicsFederateGetPublicationCount.m +++ b/swig/matlab/+helics/helicsFederateGetPublicationCount.m @@ -1,3 +1,3 @@ function varargout = helicsFederateGetPublicationCount(varargin) - [varargout{1:nargout}] = helicsMEX(157, varargin{:}); + [varargout{1:nargout}] = helicsMEX(161, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateGetState.m b/swig/matlab/+helics/helicsFederateGetState.m index 2173940266..76ed7aff35 100644 --- a/swig/matlab/+helics/helicsFederateGetState.m +++ b/swig/matlab/+helics/helicsFederateGetState.m @@ -8,5 +8,5 @@ %* `state` : % the resulting state if helics_status return helics_ok % - [varargout{1:nargout}] = helicsMEX(87, varargin{:}); + [varargout{1:nargout}] = helicsMEX(91, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateGetSubscriptionCount.m b/swig/matlab/+helics/helicsFederateGetSubscriptionCount.m index 1116d02dc8..92db06f658 100644 --- a/swig/matlab/+helics/helicsFederateGetSubscriptionCount.m +++ b/swig/matlab/+helics/helicsFederateGetSubscriptionCount.m @@ -1,3 +1,3 @@ function varargout = helicsFederateGetSubscriptionCount(varargin) - [varargout{1:nargout}] = helicsMEX(158, varargin{:}); + [varargout{1:nargout}] = helicsMEX(162, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateHasMessage.m b/swig/matlab/+helics/helicsFederateHasMessage.m index df6f3ea143..a1364fc1b4 100644 --- a/swig/matlab/+helics/helicsFederateHasMessage.m +++ b/swig/matlab/+helics/helicsFederateHasMessage.m @@ -1,5 +1,5 @@ function varargout = helicsFederateHasMessage(varargin) %check if the federate has any outstanding messages % - [varargout{1:nargout}] = helicsMEX(166, varargin{:}); + [varargout{1:nargout}] = helicsMEX(170, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateInfoCreate.m b/swig/matlab/+helics/helicsFederateInfoCreate.m index 20815abb0b..c0494ac452 100644 --- a/swig/matlab/+helics/helicsFederateInfoCreate.m +++ b/swig/matlab/+helics/helicsFederateInfoCreate.m @@ -6,5 +6,5 @@ %------- %a helics_federate_info_t object which is a reference to the created object % - [varargout{1:nargout}] = helicsMEX(57, varargin{:}); + [varargout{1:nargout}] = helicsMEX(61, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateInfoFree.m b/swig/matlab/+helics/helicsFederateInfoFree.m index e0562562c6..7b6a2dd322 100644 --- a/swig/matlab/+helics/helicsFederateInfoFree.m +++ b/swig/matlab/+helics/helicsFederateInfoFree.m @@ -1,5 +1,5 @@ function varargout = helicsFederateInfoFree(varargin) %delete the memory associated with a federate info object % - [varargout{1:nargout}] = helicsMEX(59, varargin{:}); + [varargout{1:nargout}] = helicsMEX(63, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateInfoLoadFromArgs.m b/swig/matlab/+helics/helicsFederateInfoLoadFromArgs.m index 8c2342b1ad..cd28c1451c 100644 --- a/swig/matlab/+helics/helicsFederateInfoLoadFromArgs.m +++ b/swig/matlab/+helics/helicsFederateInfoLoadFromArgs.m @@ -14,5 +14,5 @@ %------- %a helics_status enumeration indicating success or any potential errors % - [varargout{1:nargout}] = helicsMEX(58, varargin{:}); + [varargout{1:nargout}] = helicsMEX(62, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateInfoSetCoreInitString.m b/swig/matlab/+helics/helicsFederateInfoSetCoreInitString.m index b186dfa4f5..9a2f62528d 100644 --- a/swig/matlab/+helics/helicsFederateInfoSetCoreInitString.m +++ b/swig/matlab/+helics/helicsFederateInfoSetCoreInitString.m @@ -14,5 +14,5 @@ %a helics_status enumeration helics_ok on success helicsInvalidReference if fi is %not a valid reference % - [varargout{1:nargout}] = helicsMEX(62, varargin{:}); + [varargout{1:nargout}] = helicsMEX(66, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateInfoSetCoreName.m b/swig/matlab/+helics/helicsFederateInfoSetCoreName.m index c496b0b477..7d393e0d49 100644 --- a/swig/matlab/+helics/helicsFederateInfoSetCoreName.m +++ b/swig/matlab/+helics/helicsFederateInfoSetCoreName.m @@ -13,5 +13,5 @@ %a helics_status enumeration helics_ok on success helicsInvalidReference if fi is %not a valid reference % - [varargout{1:nargout}] = helicsMEX(61, varargin{:}); + [varargout{1:nargout}] = helicsMEX(65, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateInfoSetCoreType.m b/swig/matlab/+helics/helicsFederateInfoSetCoreType.m index 21816b237f..6153319a21 100644 --- a/swig/matlab/+helics/helicsFederateInfoSetCoreType.m +++ b/swig/matlab/+helics/helicsFederateInfoSetCoreType.m @@ -1,4 +1,4 @@ function varargout = helicsFederateInfoSetCoreType(varargin) % - [varargout{1:nargout}] = helicsMEX(64, varargin{:}); + [varargout{1:nargout}] = helicsMEX(68, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateInfoSetCoreTypeFromString.m b/swig/matlab/+helics/helicsFederateInfoSetCoreTypeFromString.m index 78e9aff6bd..a1e75e745f 100644 --- a/swig/matlab/+helics/helicsFederateInfoSetCoreTypeFromString.m +++ b/swig/matlab/+helics/helicsFederateInfoSetCoreTypeFromString.m @@ -13,5 +13,5 @@ %a helics_status enumeration helics_ok on success helicsInvalidReference if fi is %not a valid reference helics_discard if the string is not recognized % - [varargout{1:nargout}] = helicsMEX(63, varargin{:}); + [varargout{1:nargout}] = helicsMEX(67, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateInfoSetFederateName.m b/swig/matlab/+helics/helicsFederateInfoSetFederateName.m index 08f7dbf3b6..201beb65a1 100644 --- a/swig/matlab/+helics/helicsFederateInfoSetFederateName.m +++ b/swig/matlab/+helics/helicsFederateInfoSetFederateName.m @@ -12,5 +12,5 @@ %------- %a helics_status enumeration helics_ok on success % - [varargout{1:nargout}] = helicsMEX(60, varargin{:}); + [varargout{1:nargout}] = helicsMEX(64, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateInfoSetFlag.m b/swig/matlab/+helics/helicsFederateInfoSetFlag.m index e2a610b247..7adb7f0fb4 100644 --- a/swig/matlab/+helics/helicsFederateInfoSetFlag.m +++ b/swig/matlab/+helics/helicsFederateInfoSetFlag.m @@ -1,4 +1,4 @@ function varargout = helicsFederateInfoSetFlag(varargin) % - [varargout{1:nargout}] = helicsMEX(65, varargin{:}); + [varargout{1:nargout}] = helicsMEX(69, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateInfoSetInputDelay.m b/swig/matlab/+helics/helicsFederateInfoSetInputDelay.m index 180f521146..f03a0f6132 100644 --- a/swig/matlab/+helics/helicsFederateInfoSetInputDelay.m +++ b/swig/matlab/+helics/helicsFederateInfoSetInputDelay.m @@ -1,4 +1,4 @@ function varargout = helicsFederateInfoSetInputDelay(varargin) % - [varargout{1:nargout}] = helicsMEX(69, varargin{:}); + [varargout{1:nargout}] = helicsMEX(73, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateInfoSetLoggingLevel.m b/swig/matlab/+helics/helicsFederateInfoSetLoggingLevel.m index e080af8872..d460c771c8 100644 --- a/swig/matlab/+helics/helicsFederateInfoSetLoggingLevel.m +++ b/swig/matlab/+helics/helicsFederateInfoSetLoggingLevel.m @@ -1,4 +1,4 @@ function varargout = helicsFederateInfoSetLoggingLevel(varargin) % - [varargout{1:nargout}] = helicsMEX(73, varargin{:}); + [varargout{1:nargout}] = helicsMEX(77, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateInfoSetMaxIterations.m b/swig/matlab/+helics/helicsFederateInfoSetMaxIterations.m index c3ee3c6c5e..4d4960f51c 100644 --- a/swig/matlab/+helics/helicsFederateInfoSetMaxIterations.m +++ b/swig/matlab/+helics/helicsFederateInfoSetMaxIterations.m @@ -1,4 +1,4 @@ function varargout = helicsFederateInfoSetMaxIterations(varargin) % - [varargout{1:nargout}] = helicsMEX(72, varargin{:}); + [varargout{1:nargout}] = helicsMEX(76, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateInfoSetOutputDelay.m b/swig/matlab/+helics/helicsFederateInfoSetOutputDelay.m index d772b0bf0d..958d4d7ddb 100644 --- a/swig/matlab/+helics/helicsFederateInfoSetOutputDelay.m +++ b/swig/matlab/+helics/helicsFederateInfoSetOutputDelay.m @@ -1,4 +1,4 @@ function varargout = helicsFederateInfoSetOutputDelay(varargin) % - [varargout{1:nargout}] = helicsMEX(67, varargin{:}); + [varargout{1:nargout}] = helicsMEX(71, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateInfoSetPeriod.m b/swig/matlab/+helics/helicsFederateInfoSetPeriod.m index 9460207162..d400d21737 100644 --- a/swig/matlab/+helics/helicsFederateInfoSetPeriod.m +++ b/swig/matlab/+helics/helicsFederateInfoSetPeriod.m @@ -1,4 +1,4 @@ function varargout = helicsFederateInfoSetPeriod(varargin) % - [varargout{1:nargout}] = helicsMEX(71, varargin{:}); + [varargout{1:nargout}] = helicsMEX(75, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateInfoSetSeparator.m b/swig/matlab/+helics/helicsFederateInfoSetSeparator.m index 1be8749689..ce5db6c999 100644 --- a/swig/matlab/+helics/helicsFederateInfoSetSeparator.m +++ b/swig/matlab/+helics/helicsFederateInfoSetSeparator.m @@ -1,3 +1,3 @@ function varargout = helicsFederateInfoSetSeparator(varargin) - [varargout{1:nargout}] = helicsMEX(66, varargin{:}); + [varargout{1:nargout}] = helicsMEX(70, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateInfoSetTimeDelta.m b/swig/matlab/+helics/helicsFederateInfoSetTimeDelta.m index afb1876a88..40f4568a2c 100644 --- a/swig/matlab/+helics/helicsFederateInfoSetTimeDelta.m +++ b/swig/matlab/+helics/helicsFederateInfoSetTimeDelta.m @@ -1,4 +1,4 @@ function varargout = helicsFederateInfoSetTimeDelta(varargin) % - [varargout{1:nargout}] = helicsMEX(68, varargin{:}); + [varargout{1:nargout}] = helicsMEX(72, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateInfoSetTimeOffset.m b/swig/matlab/+helics/helicsFederateInfoSetTimeOffset.m index 0a486a5897..5767ff10ee 100644 --- a/swig/matlab/+helics/helicsFederateInfoSetTimeOffset.m +++ b/swig/matlab/+helics/helicsFederateInfoSetTimeOffset.m @@ -1,4 +1,4 @@ function varargout = helicsFederateInfoSetTimeOffset(varargin) % - [varargout{1:nargout}] = helicsMEX(70, varargin{:}); + [varargout{1:nargout}] = helicsMEX(74, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateIsAsyncOperationCompleted.m b/swig/matlab/+helics/helicsFederateIsAsyncOperationCompleted.m index b6b7c315d0..7c14959fc5 100644 --- a/swig/matlab/+helics/helicsFederateIsAsyncOperationCompleted.m +++ b/swig/matlab/+helics/helicsFederateIsAsyncOperationCompleted.m @@ -10,5 +10,5 @@ %------- %0 if not completed, 1 if completed % - [varargout{1:nargout}] = helicsMEX(79, varargin{:}); + [varargout{1:nargout}] = helicsMEX(83, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateReceiveCount.m b/swig/matlab/+helics/helicsFederateReceiveCount.m index ac101a572f..3305fbe04c 100644 --- a/swig/matlab/+helics/helicsFederateReceiveCount.m +++ b/swig/matlab/+helics/helicsFederateReceiveCount.m @@ -1,5 +1,5 @@ function varargout = helicsFederateReceiveCount(varargin) %Returns the number of pending receives for the specified destination endpoint. % - [varargout{1:nargout}] = helicsMEX(168, varargin{:}); + [varargout{1:nargout}] = helicsMEX(172, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateRegisterCloningFilter.m b/swig/matlab/+helics/helicsFederateRegisterCloningFilter.m index f9b50287c5..0cd025fb2b 100644 --- a/swig/matlab/+helics/helicsFederateRegisterCloningFilter.m +++ b/swig/matlab/+helics/helicsFederateRegisterCloningFilter.m @@ -1,4 +1,4 @@ function varargout = helicsFederateRegisterCloningFilter(varargin) % - [varargout{1:nargout}] = helicsMEX(177, varargin{:}); + [varargout{1:nargout}] = helicsMEX(181, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateRegisterDestinationFilter.m b/swig/matlab/+helics/helicsFederateRegisterDestinationFilter.m index 28c98e5f09..bbeb66fb22 100644 --- a/swig/matlab/+helics/helicsFederateRegisterDestinationFilter.m +++ b/swig/matlab/+helics/helicsFederateRegisterDestinationFilter.m @@ -1,4 +1,4 @@ function varargout = helicsFederateRegisterDestinationFilter(varargin) % - [varargout{1:nargout}] = helicsMEX(176, varargin{:}); + [varargout{1:nargout}] = helicsMEX(180, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateRegisterEndpoint.m b/swig/matlab/+helics/helicsFederateRegisterEndpoint.m index a276ed74af..3c3a6cbc5b 100644 --- a/swig/matlab/+helics/helicsFederateRegisterEndpoint.m +++ b/swig/matlab/+helics/helicsFederateRegisterEndpoint.m @@ -1,4 +1,4 @@ function varargout = helicsFederateRegisterEndpoint(varargin) % - [varargout{1:nargout}] = helicsMEX(159, varargin{:}); + [varargout{1:nargout}] = helicsMEX(163, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateRegisterGlobalEndpoint.m b/swig/matlab/+helics/helicsFederateRegisterGlobalEndpoint.m index be8accb6f1..a247d870b3 100644 --- a/swig/matlab/+helics/helicsFederateRegisterGlobalEndpoint.m +++ b/swig/matlab/+helics/helicsFederateRegisterGlobalEndpoint.m @@ -1,4 +1,4 @@ function varargout = helicsFederateRegisterGlobalEndpoint(varargin) % - [varargout{1:nargout}] = helicsMEX(160, varargin{:}); + [varargout{1:nargout}] = helicsMEX(164, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateRegisterGlobalPublication.m b/swig/matlab/+helics/helicsFederateRegisterGlobalPublication.m index 89b66bd1d2..3cfa62996c 100644 --- a/swig/matlab/+helics/helicsFederateRegisterGlobalPublication.m +++ b/swig/matlab/+helics/helicsFederateRegisterGlobalPublication.m @@ -1,4 +1,4 @@ function varargout = helicsFederateRegisterGlobalPublication(varargin) % - [varargout{1:nargout}] = helicsMEX(120, varargin{:}); + [varargout{1:nargout}] = helicsMEX(124, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateRegisterGlobalTypePublication.m b/swig/matlab/+helics/helicsFederateRegisterGlobalTypePublication.m index c6d66079ef..a0015ea354 100644 --- a/swig/matlab/+helics/helicsFederateRegisterGlobalTypePublication.m +++ b/swig/matlab/+helics/helicsFederateRegisterGlobalTypePublication.m @@ -1,4 +1,4 @@ function varargout = helicsFederateRegisterGlobalTypePublication(varargin) % - [varargout{1:nargout}] = helicsMEX(121, varargin{:}); + [varargout{1:nargout}] = helicsMEX(125, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateRegisterOptionalSubscription.m b/swig/matlab/+helics/helicsFederateRegisterOptionalSubscription.m index f80c650072..1fa294fc8b 100644 --- a/swig/matlab/+helics/helicsFederateRegisterOptionalSubscription.m +++ b/swig/matlab/+helics/helicsFederateRegisterOptionalSubscription.m @@ -23,5 +23,5 @@ %------- %an object containing the subscription % - [varargout{1:nargout}] = helicsMEX(116, varargin{:}); + [varargout{1:nargout}] = helicsMEX(120, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateRegisterOptionalTypeSubscription.m b/swig/matlab/+helics/helicsFederateRegisterOptionalTypeSubscription.m index 176b78a5cf..06ed9a5a98 100644 --- a/swig/matlab/+helics/helicsFederateRegisterOptionalTypeSubscription.m +++ b/swig/matlab/+helics/helicsFederateRegisterOptionalTypeSubscription.m @@ -23,5 +23,5 @@ %------- %an object containing the subscription % - [varargout{1:nargout}] = helicsMEX(117, varargin{:}); + [varargout{1:nargout}] = helicsMEX(121, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateRegisterPublication.m b/swig/matlab/+helics/helicsFederateRegisterPublication.m index 0691cddaf9..2b84c938e0 100644 --- a/swig/matlab/+helics/helicsFederateRegisterPublication.m +++ b/swig/matlab/+helics/helicsFederateRegisterPublication.m @@ -1,4 +1,4 @@ function varargout = helicsFederateRegisterPublication(varargin) % - [varargout{1:nargout}] = helicsMEX(118, varargin{:}); + [varargout{1:nargout}] = helicsMEX(122, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateRegisterSourceFilter.m b/swig/matlab/+helics/helicsFederateRegisterSourceFilter.m index 7f171ab52f..f5f3d5d09d 100644 --- a/swig/matlab/+helics/helicsFederateRegisterSourceFilter.m +++ b/swig/matlab/+helics/helicsFederateRegisterSourceFilter.m @@ -20,5 +20,5 @@ %------- %a helics_source_filter object % - [varargout{1:nargout}] = helicsMEX(175, varargin{:}); + [varargout{1:nargout}] = helicsMEX(179, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateRegisterSubscription.m b/swig/matlab/+helics/helicsFederateRegisterSubscription.m index 1b7defa71e..bf5f95263e 100644 --- a/swig/matlab/+helics/helicsFederateRegisterSubscription.m +++ b/swig/matlab/+helics/helicsFederateRegisterSubscription.m @@ -21,5 +21,5 @@ %------- %an object containing the subscription % - [varargout{1:nargout}] = helicsMEX(114, varargin{:}); + [varargout{1:nargout}] = helicsMEX(118, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateRegisterTypePublication.m b/swig/matlab/+helics/helicsFederateRegisterTypePublication.m index 89f4a0a5ff..891a863f64 100644 --- a/swig/matlab/+helics/helicsFederateRegisterTypePublication.m +++ b/swig/matlab/+helics/helicsFederateRegisterTypePublication.m @@ -1,4 +1,4 @@ function varargout = helicsFederateRegisterTypePublication(varargin) % - [varargout{1:nargout}] = helicsMEX(119, varargin{:}); + [varargout{1:nargout}] = helicsMEX(123, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateRegisterTypeSubscription.m b/swig/matlab/+helics/helicsFederateRegisterTypeSubscription.m index 8a5db36903..ffe73c6171 100644 --- a/swig/matlab/+helics/helicsFederateRegisterTypeSubscription.m +++ b/swig/matlab/+helics/helicsFederateRegisterTypeSubscription.m @@ -21,5 +21,5 @@ %------- %an object containing the subscription % - [varargout{1:nargout}] = helicsMEX(115, varargin{:}); + [varargout{1:nargout}] = helicsMEX(119, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateRequestTime.m b/swig/matlab/+helics/helicsFederateRequestTime.m index b46c63c2b5..56097ee28b 100644 --- a/swig/matlab/+helics/helicsFederateRequestTime.m +++ b/swig/matlab/+helics/helicsFederateRequestTime.m @@ -15,5 +15,5 @@ %a helics_status if the return value is equal to helics_ok the timeOut will %contain the new granted time, otherwise timeOut is invalid % - [varargout{1:nargout}] = helicsMEX(89, varargin{:}); + [varargout{1:nargout}] = helicsMEX(93, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateRequestTimeAsync.m b/swig/matlab/+helics/helicsFederateRequestTimeAsync.m index aa793998b2..69faf52706 100644 --- a/swig/matlab/+helics/helicsFederateRequestTimeAsync.m +++ b/swig/matlab/+helics/helicsFederateRequestTimeAsync.m @@ -1,4 +1,4 @@ function varargout = helicsFederateRequestTimeAsync(varargin) % - [varargout{1:nargout}] = helicsMEX(91, varargin{:}); + [varargout{1:nargout}] = helicsMEX(95, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateRequestTimeComplete.m b/swig/matlab/+helics/helicsFederateRequestTimeComplete.m index 5fdd1a707f..f8e082a51e 100644 --- a/swig/matlab/+helics/helicsFederateRequestTimeComplete.m +++ b/swig/matlab/+helics/helicsFederateRequestTimeComplete.m @@ -1,4 +1,4 @@ function varargout = helicsFederateRequestTimeComplete(varargin) % - [varargout{1:nargout}] = helicsMEX(92, varargin{:}); + [varargout{1:nargout}] = helicsMEX(96, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateRequestTimeIterative.m b/swig/matlab/+helics/helicsFederateRequestTimeIterative.m index f84e1166ea..c8c6fc359c 100644 --- a/swig/matlab/+helics/helicsFederateRequestTimeIterative.m +++ b/swig/matlab/+helics/helicsFederateRequestTimeIterative.m @@ -22,5 +22,5 @@ %------- %a helics_status object with a return code of the result % - [varargout{1:nargout}] = helicsMEX(90, varargin{:}); + [varargout{1:nargout}] = helicsMEX(94, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateRequestTimeIterativeAsync.m b/swig/matlab/+helics/helicsFederateRequestTimeIterativeAsync.m index b5111862aa..a94fa100ae 100644 --- a/swig/matlab/+helics/helicsFederateRequestTimeIterativeAsync.m +++ b/swig/matlab/+helics/helicsFederateRequestTimeIterativeAsync.m @@ -1,4 +1,4 @@ function varargout = helicsFederateRequestTimeIterativeAsync(varargin) % - [varargout{1:nargout}] = helicsMEX(93, varargin{:}); + [varargout{1:nargout}] = helicsMEX(97, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateRequestTimeIterativeComplete.m b/swig/matlab/+helics/helicsFederateRequestTimeIterativeComplete.m index 4d48dc4988..29121afe78 100644 --- a/swig/matlab/+helics/helicsFederateRequestTimeIterativeComplete.m +++ b/swig/matlab/+helics/helicsFederateRequestTimeIterativeComplete.m @@ -1,4 +1,4 @@ function varargout = helicsFederateRequestTimeIterativeComplete(varargin) % - [varargout{1:nargout}] = helicsMEX(94, varargin{:}); + [varargout{1:nargout}] = helicsMEX(98, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateSetFlag.m b/swig/matlab/+helics/helicsFederateSetFlag.m index 2013598b49..413e20df4a 100644 --- a/swig/matlab/+helics/helicsFederateSetFlag.m +++ b/swig/matlab/+helics/helicsFederateSetFlag.m @@ -10,5 +10,5 @@ %* `flagValue` : % the new value of the flag 0 for false !=0 for true % - [varargout{1:nargout}] = helicsMEX(100, varargin{:}); + [varargout{1:nargout}] = helicsMEX(104, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateSetInputDelay.m b/swig/matlab/+helics/helicsFederateSetInputDelay.m index 4464cc66d2..3e784519e8 100644 --- a/swig/matlab/+helics/helicsFederateSetInputDelay.m +++ b/swig/matlab/+helics/helicsFederateSetInputDelay.m @@ -9,5 +9,5 @@ %* `lookAhead` : % the look ahead time % - [varargout{1:nargout}] = helicsMEX(98, varargin{:}); + [varargout{1:nargout}] = helicsMEX(102, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateSetLoggingLevel.m b/swig/matlab/+helics/helicsFederateSetLoggingLevel.m index 56b01f6671..a360bbf994 100644 --- a/swig/matlab/+helics/helicsFederateSetLoggingLevel.m +++ b/swig/matlab/+helics/helicsFederateSetLoggingLevel.m @@ -7,5 +7,5 @@ %* `loggingLevel` : % (-1: none, 0: error_only, 1: warnings, 2: normal, 3: debug, 4: trace) % - [varargout{1:nargout}] = helicsMEX(102, varargin{:}); + [varargout{1:nargout}] = helicsMEX(106, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateSetMaxIterations.m b/swig/matlab/+helics/helicsFederateSetMaxIterations.m index 63b1b8164e..4e7a4fc942 100644 --- a/swig/matlab/+helics/helicsFederateSetMaxIterations.m +++ b/swig/matlab/+helics/helicsFederateSetMaxIterations.m @@ -1,3 +1,3 @@ function varargout = helicsFederateSetMaxIterations(varargin) - [varargout{1:nargout}] = helicsMEX(103, varargin{:}); + [varargout{1:nargout}] = helicsMEX(107, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateSetOutputDelay.m b/swig/matlab/+helics/helicsFederateSetOutputDelay.m index 8d52c3ae77..a11cad8b51 100644 --- a/swig/matlab/+helics/helicsFederateSetOutputDelay.m +++ b/swig/matlab/+helics/helicsFederateSetOutputDelay.m @@ -9,5 +9,5 @@ %* `lookAhead` : % the look ahead time % - [varargout{1:nargout}] = helicsMEX(97, varargin{:}); + [varargout{1:nargout}] = helicsMEX(101, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateSetPeriod.m b/swig/matlab/+helics/helicsFederateSetPeriod.m index 69a99114a4..75ef0f75d3 100644 --- a/swig/matlab/+helics/helicsFederateSetPeriod.m +++ b/swig/matlab/+helics/helicsFederateSetPeriod.m @@ -10,5 +10,5 @@ %* `offset` : % the shift of the period from 0 offset must be < period % - [varargout{1:nargout}] = helicsMEX(99, varargin{:}); + [varargout{1:nargout}] = helicsMEX(103, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateSetSeparator.m b/swig/matlab/+helics/helicsFederateSetSeparator.m index f03a12edf2..3901d3ada0 100644 --- a/swig/matlab/+helics/helicsFederateSetSeparator.m +++ b/swig/matlab/+helics/helicsFederateSetSeparator.m @@ -1,3 +1,3 @@ function varargout = helicsFederateSetSeparator(varargin) - [varargout{1:nargout}] = helicsMEX(101, varargin{:}); + [varargout{1:nargout}] = helicsMEX(105, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFederateSetTimeDelta.m b/swig/matlab/+helics/helicsFederateSetTimeDelta.m index 0cc892cbeb..425c2cd324 100644 --- a/swig/matlab/+helics/helicsFederateSetTimeDelta.m +++ b/swig/matlab/+helics/helicsFederateSetTimeDelta.m @@ -6,5 +6,5 @@ %* `tdelta` : % the minimum time delta to return from a time request function % - [varargout{1:nargout}] = helicsMEX(96, varargin{:}); + [varargout{1:nargout}] = helicsMEX(100, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFilterAddDeliveryEndpoint.m b/swig/matlab/+helics/helicsFilterAddDeliveryEndpoint.m index 4d5a9d214e..3c1d6b4634 100644 --- a/swig/matlab/+helics/helicsFilterAddDeliveryEndpoint.m +++ b/swig/matlab/+helics/helicsFilterAddDeliveryEndpoint.m @@ -1,4 +1,4 @@ function varargout = helicsFilterAddDeliveryEndpoint(varargin) % - [varargout{1:nargout}] = helicsMEX(187, varargin{:}); + [varargout{1:nargout}] = helicsMEX(191, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFilterAddDestinationTarget.m b/swig/matlab/+helics/helicsFilterAddDestinationTarget.m index 8578a90ee8..9a2837ff56 100644 --- a/swig/matlab/+helics/helicsFilterAddDestinationTarget.m +++ b/swig/matlab/+helics/helicsFilterAddDestinationTarget.m @@ -1,4 +1,4 @@ function varargout = helicsFilterAddDestinationTarget(varargin) % - [varargout{1:nargout}] = helicsMEX(185, varargin{:}); + [varargout{1:nargout}] = helicsMEX(189, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFilterAddSourceTarget.m b/swig/matlab/+helics/helicsFilterAddSourceTarget.m index 7094b62d39..cb24e42f71 100644 --- a/swig/matlab/+helics/helicsFilterAddSourceTarget.m +++ b/swig/matlab/+helics/helicsFilterAddSourceTarget.m @@ -1,4 +1,4 @@ function varargout = helicsFilterAddSourceTarget(varargin) % - [varargout{1:nargout}] = helicsMEX(186, varargin{:}); + [varargout{1:nargout}] = helicsMEX(190, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFilterGetName.m b/swig/matlab/+helics/helicsFilterGetName.m index a3bb65608c..1f6e15149d 100644 --- a/swig/matlab/+helics/helicsFilterGetName.m +++ b/swig/matlab/+helics/helicsFilterGetName.m @@ -1,5 +1,5 @@ function varargout = helicsFilterGetName(varargin) %get the name of the filter % - [varargout{1:nargout}] = helicsMEX(182, varargin{:}); + [varargout{1:nargout}] = helicsMEX(186, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFilterGetTarget.m b/swig/matlab/+helics/helicsFilterGetTarget.m index 1234c8cde2..64bb45e09a 100644 --- a/swig/matlab/+helics/helicsFilterGetTarget.m +++ b/swig/matlab/+helics/helicsFilterGetTarget.m @@ -1,5 +1,5 @@ function varargout = helicsFilterGetTarget(varargin) %get the target of the filter % - [varargout{1:nargout}] = helicsMEX(181, varargin{:}); + [varargout{1:nargout}] = helicsMEX(185, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFilterRemoveDeliveryEndpoint.m b/swig/matlab/+helics/helicsFilterRemoveDeliveryEndpoint.m index 34e359bc92..612afb8c28 100644 --- a/swig/matlab/+helics/helicsFilterRemoveDeliveryEndpoint.m +++ b/swig/matlab/+helics/helicsFilterRemoveDeliveryEndpoint.m @@ -1,4 +1,4 @@ function varargout = helicsFilterRemoveDeliveryEndpoint(varargin) % - [varargout{1:nargout}] = helicsMEX(190, varargin{:}); + [varargout{1:nargout}] = helicsMEX(194, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFilterRemoveDestinationTarget.m b/swig/matlab/+helics/helicsFilterRemoveDestinationTarget.m index 8dac5c5e7f..72c4afd8b2 100644 --- a/swig/matlab/+helics/helicsFilterRemoveDestinationTarget.m +++ b/swig/matlab/+helics/helicsFilterRemoveDestinationTarget.m @@ -1,4 +1,4 @@ function varargout = helicsFilterRemoveDestinationTarget(varargin) % - [varargout{1:nargout}] = helicsMEX(188, varargin{:}); + [varargout{1:nargout}] = helicsMEX(192, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFilterRemoveSourceTarget.m b/swig/matlab/+helics/helicsFilterRemoveSourceTarget.m index fbc9741c36..f94fdf8b11 100644 --- a/swig/matlab/+helics/helicsFilterRemoveSourceTarget.m +++ b/swig/matlab/+helics/helicsFilterRemoveSourceTarget.m @@ -1,4 +1,4 @@ function varargout = helicsFilterRemoveSourceTarget(varargin) % - [varargout{1:nargout}] = helicsMEX(189, varargin{:}); + [varargout{1:nargout}] = helicsMEX(193, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFilterSet.m b/swig/matlab/+helics/helicsFilterSet.m index 732732552b..dbf6c0cb67 100644 --- a/swig/matlab/+helics/helicsFilterSet.m +++ b/swig/matlab/+helics/helicsFilterSet.m @@ -1,4 +1,4 @@ function varargout = helicsFilterSet(varargin) % - [varargout{1:nargout}] = helicsMEX(183, varargin{:}); + [varargout{1:nargout}] = helicsMEX(187, varargin{:}); end diff --git a/swig/matlab/+helics/helicsFilterSetString.m b/swig/matlab/+helics/helicsFilterSetString.m index a8a4a1ec8d..956bec1ebc 100644 --- a/swig/matlab/+helics/helicsFilterSetString.m +++ b/swig/matlab/+helics/helicsFilterSetString.m @@ -1,3 +1,3 @@ function varargout = helicsFilterSetString(varargin) - [varargout{1:nargout}] = helicsMEX(184, varargin{:}); + [varargout{1:nargout}] = helicsMEX(188, varargin{:}); end diff --git a/swig/matlab/+helics/helicsGetFederateByName.m b/swig/matlab/+helics/helicsGetFederateByName.m index 50a0cab11a..11cafc3219 100644 --- a/swig/matlab/+helics/helicsGetFederateByName.m +++ b/swig/matlab/+helics/helicsGetFederateByName.m @@ -1,3 +1,3 @@ function varargout = helicsGetFederateByName(varargin) - [varargout{1:nargout}] = helicsMEX(46, varargin{:}); + [varargout{1:nargout}] = helicsMEX(47, varargin{:}); end diff --git a/swig/matlab/+helics/helicsPublicationGetKey.m b/swig/matlab/+helics/helicsPublicationGetKey.m index 074b52a502..0f1649e2af 100644 --- a/swig/matlab/+helics/helicsPublicationGetKey.m +++ b/swig/matlab/+helics/helicsPublicationGetKey.m @@ -1,4 +1,4 @@ function varargout = helicsPublicationGetKey(varargin) % - [varargout{1:nargout}] = helicsMEX(152, varargin{:}); + [varargout{1:nargout}] = helicsMEX(156, varargin{:}); end diff --git a/swig/matlab/+helics/helicsPublicationGetType.m b/swig/matlab/+helics/helicsPublicationGetType.m index cd0912d797..dee6c9a3a6 100644 --- a/swig/matlab/+helics/helicsPublicationGetType.m +++ b/swig/matlab/+helics/helicsPublicationGetType.m @@ -1,4 +1,4 @@ function varargout = helicsPublicationGetType(varargin) % - [varargout{1:nargout}] = helicsMEX(150, varargin{:}); + [varargout{1:nargout}] = helicsMEX(154, varargin{:}); end diff --git a/swig/matlab/+helics/helicsPublicationGetUnits.m b/swig/matlab/+helics/helicsPublicationGetUnits.m index 09360b0f3f..d6f865a1eb 100644 --- a/swig/matlab/+helics/helicsPublicationGetUnits.m +++ b/swig/matlab/+helics/helicsPublicationGetUnits.m @@ -1,4 +1,4 @@ function varargout = helicsPublicationGetUnits(varargin) % - [varargout{1:nargout}] = helicsMEX(154, varargin{:}); + [varargout{1:nargout}] = helicsMEX(158, varargin{:}); end diff --git a/swig/matlab/+helics/helicsPublicationPublishBoolean.m b/swig/matlab/+helics/helicsPublicationPublishBoolean.m index 1ccb31f615..90e790b6b0 100644 --- a/swig/matlab/+helics/helicsPublicationPublishBoolean.m +++ b/swig/matlab/+helics/helicsPublicationPublishBoolean.m @@ -1,3 +1,3 @@ function varargout = helicsPublicationPublishBoolean(varargin) - [varargout{1:nargout}] = helicsMEX(125, varargin{:}); + [varargout{1:nargout}] = helicsMEX(129, varargin{:}); end diff --git a/swig/matlab/+helics/helicsPublicationPublishComplex.m b/swig/matlab/+helics/helicsPublicationPublishComplex.m index e60d26ff19..c1352d7658 100644 --- a/swig/matlab/+helics/helicsPublicationPublishComplex.m +++ b/swig/matlab/+helics/helicsPublicationPublishComplex.m @@ -1,4 +1,4 @@ function varargout = helicsPublicationPublishComplex(varargin) % - [varargout{1:nargout}] = helicsMEX(127, varargin{:}); + [varargout{1:nargout}] = helicsMEX(131, varargin{:}); end diff --git a/swig/matlab/+helics/helicsPublicationPublishDouble.m b/swig/matlab/+helics/helicsPublicationPublishDouble.m index 291fddbf21..4e823e6f61 100644 --- a/swig/matlab/+helics/helicsPublicationPublishDouble.m +++ b/swig/matlab/+helics/helicsPublicationPublishDouble.m @@ -1,4 +1,4 @@ function varargout = helicsPublicationPublishDouble(varargin) % - [varargout{1:nargout}] = helicsMEX(126, varargin{:}); + [varargout{1:nargout}] = helicsMEX(130, varargin{:}); end diff --git a/swig/matlab/+helics/helicsPublicationPublishInteger.m b/swig/matlab/+helics/helicsPublicationPublishInteger.m index 56d7aa4b4d..8037c2f6b5 100644 --- a/swig/matlab/+helics/helicsPublicationPublishInteger.m +++ b/swig/matlab/+helics/helicsPublicationPublishInteger.m @@ -1,4 +1,4 @@ function varargout = helicsPublicationPublishInteger(varargin) % - [varargout{1:nargout}] = helicsMEX(124, varargin{:}); + [varargout{1:nargout}] = helicsMEX(128, varargin{:}); end diff --git a/swig/matlab/+helics/helicsPublicationPublishNamedPoint.m b/swig/matlab/+helics/helicsPublicationPublishNamedPoint.m index 79963847c8..477948fc0a 100644 --- a/swig/matlab/+helics/helicsPublicationPublishNamedPoint.m +++ b/swig/matlab/+helics/helicsPublicationPublishNamedPoint.m @@ -1,3 +1,3 @@ function varargout = helicsPublicationPublishNamedPoint(varargin) - [varargout{1:nargout}] = helicsMEX(129, varargin{:}); + [varargout{1:nargout}] = helicsMEX(133, varargin{:}); end diff --git a/swig/matlab/+helics/helicsPublicationPublishRaw.m b/swig/matlab/+helics/helicsPublicationPublishRaw.m index 54c6e299c9..692949a34a 100644 --- a/swig/matlab/+helics/helicsPublicationPublishRaw.m +++ b/swig/matlab/+helics/helicsPublicationPublishRaw.m @@ -1,3 +1,3 @@ function varargout = helicsPublicationPublishRaw(varargin) - [varargout{1:nargout}] = helicsMEX(122, varargin{:}); + [varargout{1:nargout}] = helicsMEX(126, varargin{:}); end diff --git a/swig/matlab/+helics/helicsPublicationPublishString.m b/swig/matlab/+helics/helicsPublicationPublishString.m index 3d25c7161f..bf21fdb797 100644 --- a/swig/matlab/+helics/helicsPublicationPublishString.m +++ b/swig/matlab/+helics/helicsPublicationPublishString.m @@ -1,4 +1,4 @@ function varargout = helicsPublicationPublishString(varargin) % - [varargout{1:nargout}] = helicsMEX(123, varargin{:}); + [varargout{1:nargout}] = helicsMEX(127, varargin{:}); end diff --git a/swig/matlab/+helics/helicsPublicationPublishVector.m b/swig/matlab/+helics/helicsPublicationPublishVector.m index ba0a9ff665..f67e44573b 100644 --- a/swig/matlab/+helics/helicsPublicationPublishVector.m +++ b/swig/matlab/+helics/helicsPublicationPublishVector.m @@ -1,4 +1,4 @@ function varargout = helicsPublicationPublishVector(varargin) % - [varargout{1:nargout}] = helicsMEX(128, varargin{:}); + [varargout{1:nargout}] = helicsMEX(132, varargin{:}); end diff --git a/swig/matlab/+helics/helicsQueryBrokerExecute.m b/swig/matlab/+helics/helicsQueryBrokerExecute.m index 69a473d324..b6e21a9a9d 100644 --- a/swig/matlab/+helics/helicsQueryBrokerExecute.m +++ b/swig/matlab/+helics/helicsQueryBrokerExecute.m @@ -1,3 +1,3 @@ function varargout = helicsQueryBrokerExecute(varargin) - [varargout{1:nargout}] = helicsMEX(108, varargin{:}); + [varargout{1:nargout}] = helicsMEX(112, varargin{:}); end diff --git a/swig/matlab/+helics/helicsQueryCoreExecute.m b/swig/matlab/+helics/helicsQueryCoreExecute.m index 1882af9ecb..c2747de81a 100644 --- a/swig/matlab/+helics/helicsQueryCoreExecute.m +++ b/swig/matlab/+helics/helicsQueryCoreExecute.m @@ -1,3 +1,3 @@ function varargout = helicsQueryCoreExecute(varargin) - [varargout{1:nargout}] = helicsMEX(107, varargin{:}); + [varargout{1:nargout}] = helicsMEX(111, varargin{:}); end diff --git a/swig/matlab/+helics/helicsQueryExecute.m b/swig/matlab/+helics/helicsQueryExecute.m index c1c547afd9..a330e4ef32 100644 --- a/swig/matlab/+helics/helicsQueryExecute.m +++ b/swig/matlab/+helics/helicsQueryExecute.m @@ -16,5 +16,5 @@ %a pointer to a string. the string will remain valid until the query is freed or %executed again the return will be nullptr if fed or query is an invalid object % - [varargout{1:nargout}] = helicsMEX(106, varargin{:}); + [varargout{1:nargout}] = helicsMEX(110, varargin{:}); end diff --git a/swig/matlab/+helics/helicsQueryExecuteAsync.m b/swig/matlab/+helics/helicsQueryExecuteAsync.m index e054f17aa4..9c26c7a5fc 100644 --- a/swig/matlab/+helics/helicsQueryExecuteAsync.m +++ b/swig/matlab/+helics/helicsQueryExecuteAsync.m @@ -12,5 +12,5 @@ %------- %a helics status enumeration with the result of the query specification % - [varargout{1:nargout}] = helicsMEX(109, varargin{:}); + [varargout{1:nargout}] = helicsMEX(113, varargin{:}); end diff --git a/swig/matlab/+helics/helicsQueryExecuteComplete.m b/swig/matlab/+helics/helicsQueryExecuteComplete.m index ea956796ba..91298686ed 100644 --- a/swig/matlab/+helics/helicsQueryExecuteComplete.m +++ b/swig/matlab/+helics/helicsQueryExecuteComplete.m @@ -14,5 +14,5 @@ %a pointer to a string. the string will remain valid until the query is freed or %executed again the return will be nullptr if query is an invalid object % - [varargout{1:nargout}] = helicsMEX(110, varargin{:}); + [varargout{1:nargout}] = helicsMEX(114, varargin{:}); end diff --git a/swig/matlab/+helics/helicsQueryFree.m b/swig/matlab/+helics/helicsQueryFree.m index 6c4c23d8bc..1ad1f870c6 100644 --- a/swig/matlab/+helics/helicsQueryFree.m +++ b/swig/matlab/+helics/helicsQueryFree.m @@ -1,5 +1,5 @@ function varargout = helicsQueryFree(varargin) %free the memory associated with a query object % - [varargout{1:nargout}] = helicsMEX(112, varargin{:}); + [varargout{1:nargout}] = helicsMEX(116, varargin{:}); end diff --git a/swig/matlab/+helics/helicsQueryIsCompleted.m b/swig/matlab/+helics/helicsQueryIsCompleted.m index 6eb95dc0d9..7e116c1b7a 100644 --- a/swig/matlab/+helics/helicsQueryIsCompleted.m +++ b/swig/matlab/+helics/helicsQueryIsCompleted.m @@ -7,5 +7,5 @@ %was made with a result and false if an async query has not completed or is %invalid % - [varargout{1:nargout}] = helicsMEX(111, varargin{:}); + [varargout{1:nargout}] = helicsMEX(115, varargin{:}); end diff --git a/swig/matlab/+helics/helicsSubscriptionGetBoolean.m b/swig/matlab/+helics/helicsSubscriptionGetBoolean.m index 8a2ade11b6..601cefc316 100644 --- a/swig/matlab/+helics/helicsSubscriptionGetBoolean.m +++ b/swig/matlab/+helics/helicsSubscriptionGetBoolean.m @@ -1,3 +1,3 @@ function varargout = helicsSubscriptionGetBoolean(varargin) - [varargout{1:nargout}] = helicsMEX(135, varargin{:}); + [varargout{1:nargout}] = helicsMEX(139, varargin{:}); end diff --git a/swig/matlab/+helics/helicsSubscriptionGetComplex.m b/swig/matlab/+helics/helicsSubscriptionGetComplex.m index 2c2e41c1c6..e665090110 100644 --- a/swig/matlab/+helics/helicsSubscriptionGetComplex.m +++ b/swig/matlab/+helics/helicsSubscriptionGetComplex.m @@ -1,4 +1,4 @@ function varargout = helicsSubscriptionGetComplex(varargin) % - [varargout{1:nargout}] = helicsMEX(137, varargin{:}); + [varargout{1:nargout}] = helicsMEX(141, varargin{:}); end diff --git a/swig/matlab/+helics/helicsSubscriptionGetDouble.m b/swig/matlab/+helics/helicsSubscriptionGetDouble.m index 8b6549625a..9dc1210400 100644 --- a/swig/matlab/+helics/helicsSubscriptionGetDouble.m +++ b/swig/matlab/+helics/helicsSubscriptionGetDouble.m @@ -1,4 +1,4 @@ function varargout = helicsSubscriptionGetDouble(varargin) % - [varargout{1:nargout}] = helicsMEX(136, varargin{:}); + [varargout{1:nargout}] = helicsMEX(140, varargin{:}); end diff --git a/swig/matlab/+helics/helicsSubscriptionGetInteger.m b/swig/matlab/+helics/helicsSubscriptionGetInteger.m index 97242158ae..858e88b5bb 100644 --- a/swig/matlab/+helics/helicsSubscriptionGetInteger.m +++ b/swig/matlab/+helics/helicsSubscriptionGetInteger.m @@ -1,4 +1,4 @@ function varargout = helicsSubscriptionGetInteger(varargin) % - [varargout{1:nargout}] = helicsMEX(134, varargin{:}); + [varargout{1:nargout}] = helicsMEX(138, varargin{:}); end diff --git a/swig/matlab/+helics/helicsSubscriptionGetKey.m b/swig/matlab/+helics/helicsSubscriptionGetKey.m index bb27027d2c..39a1de1828 100644 --- a/swig/matlab/+helics/helicsSubscriptionGetKey.m +++ b/swig/matlab/+helics/helicsSubscriptionGetKey.m @@ -1,4 +1,4 @@ function varargout = helicsSubscriptionGetKey(varargin) % - [varargout{1:nargout}] = helicsMEX(151, varargin{:}); + [varargout{1:nargout}] = helicsMEX(155, varargin{:}); end diff --git a/swig/matlab/+helics/helicsSubscriptionGetNamedPoint.m b/swig/matlab/+helics/helicsSubscriptionGetNamedPoint.m index de18134c9e..418069d4ff 100644 --- a/swig/matlab/+helics/helicsSubscriptionGetNamedPoint.m +++ b/swig/matlab/+helics/helicsSubscriptionGetNamedPoint.m @@ -1,3 +1,3 @@ function varargout = helicsSubscriptionGetNamedPoint(varargin) - [varargout{1:nargout}] = helicsMEX(140, varargin{:}); + [varargout{1:nargout}] = helicsMEX(144, varargin{:}); end diff --git a/swig/matlab/+helics/helicsSubscriptionGetRawValue.m b/swig/matlab/+helics/helicsSubscriptionGetRawValue.m index cdafa80fd5..2fba8b1726 100644 --- a/swig/matlab/+helics/helicsSubscriptionGetRawValue.m +++ b/swig/matlab/+helics/helicsSubscriptionGetRawValue.m @@ -1,3 +1,3 @@ function varargout = helicsSubscriptionGetRawValue(varargin) - [varargout{1:nargout}] = helicsMEX(131, varargin{:}); + [varargout{1:nargout}] = helicsMEX(135, varargin{:}); end diff --git a/swig/matlab/+helics/helicsSubscriptionGetString.m b/swig/matlab/+helics/helicsSubscriptionGetString.m index 2dd43b84a7..b4209f862e 100644 --- a/swig/matlab/+helics/helicsSubscriptionGetString.m +++ b/swig/matlab/+helics/helicsSubscriptionGetString.m @@ -1,4 +1,4 @@ function varargout = helicsSubscriptionGetString(varargin) % - [varargout{1:nargout}] = helicsMEX(133, varargin{:}); + [varargout{1:nargout}] = helicsMEX(137, varargin{:}); end diff --git a/swig/matlab/+helics/helicsSubscriptionGetStringSize.m b/swig/matlab/+helics/helicsSubscriptionGetStringSize.m index ddd8ccb8c6..193f09c462 100644 --- a/swig/matlab/+helics/helicsSubscriptionGetStringSize.m +++ b/swig/matlab/+helics/helicsSubscriptionGetStringSize.m @@ -1,3 +1,3 @@ function varargout = helicsSubscriptionGetStringSize(varargin) - [varargout{1:nargout}] = helicsMEX(132, varargin{:}); + [varargout{1:nargout}] = helicsMEX(136, varargin{:}); end diff --git a/swig/matlab/+helics/helicsSubscriptionGetType.m b/swig/matlab/+helics/helicsSubscriptionGetType.m index f83f8cfdaa..1700da6888 100644 --- a/swig/matlab/+helics/helicsSubscriptionGetType.m +++ b/swig/matlab/+helics/helicsSubscriptionGetType.m @@ -1,4 +1,4 @@ function varargout = helicsSubscriptionGetType(varargin) % - [varargout{1:nargout}] = helicsMEX(149, varargin{:}); + [varargout{1:nargout}] = helicsMEX(153, varargin{:}); end diff --git a/swig/matlab/+helics/helicsSubscriptionGetUnits.m b/swig/matlab/+helics/helicsSubscriptionGetUnits.m index ef781c3a92..44ff3cbf67 100644 --- a/swig/matlab/+helics/helicsSubscriptionGetUnits.m +++ b/swig/matlab/+helics/helicsSubscriptionGetUnits.m @@ -1,4 +1,4 @@ function varargout = helicsSubscriptionGetUnits(varargin) % - [varargout{1:nargout}] = helicsMEX(153, varargin{:}); + [varargout{1:nargout}] = helicsMEX(157, varargin{:}); end diff --git a/swig/matlab/+helics/helicsSubscriptionGetValueSize.m b/swig/matlab/+helics/helicsSubscriptionGetValueSize.m index 763aa24038..a8f0aed2d3 100644 --- a/swig/matlab/+helics/helicsSubscriptionGetValueSize.m +++ b/swig/matlab/+helics/helicsSubscriptionGetValueSize.m @@ -1,4 +1,4 @@ function varargout = helicsSubscriptionGetValueSize(varargin) % - [varargout{1:nargout}] = helicsMEX(130, varargin{:}); + [varargout{1:nargout}] = helicsMEX(134, varargin{:}); end diff --git a/swig/matlab/+helics/helicsSubscriptionGetVector.m b/swig/matlab/+helics/helicsSubscriptionGetVector.m index b3f6733321..93826460e9 100644 --- a/swig/matlab/+helics/helicsSubscriptionGetVector.m +++ b/swig/matlab/+helics/helicsSubscriptionGetVector.m @@ -12,5 +12,5 @@ %* `actualSize` : % pointer to variable to store the actual size % - [varargout{1:nargout}] = helicsMEX(139, varargin{:}); + [varargout{1:nargout}] = helicsMEX(143, varargin{:}); end diff --git a/swig/matlab/+helics/helicsSubscriptionGetVectorSize.m b/swig/matlab/+helics/helicsSubscriptionGetVectorSize.m index 3e55fea049..2239a76747 100644 --- a/swig/matlab/+helics/helicsSubscriptionGetVectorSize.m +++ b/swig/matlab/+helics/helicsSubscriptionGetVectorSize.m @@ -1,4 +1,4 @@ function varargout = helicsSubscriptionGetVectorSize(varargin) % - [varargout{1:nargout}] = helicsMEX(138, varargin{:}); + [varargout{1:nargout}] = helicsMEX(142, varargin{:}); end diff --git a/swig/matlab/+helics/helicsSubscriptionIsUpdated.m b/swig/matlab/+helics/helicsSubscriptionIsUpdated.m index ed29664efb..99859b4af2 100644 --- a/swig/matlab/+helics/helicsSubscriptionIsUpdated.m +++ b/swig/matlab/+helics/helicsSubscriptionIsUpdated.m @@ -1,4 +1,4 @@ function varargout = helicsSubscriptionIsUpdated(varargin) % - [varargout{1:nargout}] = helicsMEX(155, varargin{:}); + [varargout{1:nargout}] = helicsMEX(159, varargin{:}); end diff --git a/swig/matlab/+helics/helicsSubscriptionLastUpdateTime.m b/swig/matlab/+helics/helicsSubscriptionLastUpdateTime.m index fbc5c0ccf6..363e48c271 100644 --- a/swig/matlab/+helics/helicsSubscriptionLastUpdateTime.m +++ b/swig/matlab/+helics/helicsSubscriptionLastUpdateTime.m @@ -1,4 +1,4 @@ function varargout = helicsSubscriptionLastUpdateTime(varargin) % - [varargout{1:nargout}] = helicsMEX(156, varargin{:}); + [varargout{1:nargout}] = helicsMEX(160, varargin{:}); end diff --git a/swig/matlab/+helics/helicsSubscriptionSetDefaultBoolean.m b/swig/matlab/+helics/helicsSubscriptionSetDefaultBoolean.m index e71eef3472..fad42ac057 100644 --- a/swig/matlab/+helics/helicsSubscriptionSetDefaultBoolean.m +++ b/swig/matlab/+helics/helicsSubscriptionSetDefaultBoolean.m @@ -1,3 +1,3 @@ function varargout = helicsSubscriptionSetDefaultBoolean(varargin) - [varargout{1:nargout}] = helicsMEX(144, varargin{:}); + [varargout{1:nargout}] = helicsMEX(148, varargin{:}); end diff --git a/swig/matlab/+helics/helicsSubscriptionSetDefaultComplex.m b/swig/matlab/+helics/helicsSubscriptionSetDefaultComplex.m index ce96a0ec7f..248b21f996 100644 --- a/swig/matlab/+helics/helicsSubscriptionSetDefaultComplex.m +++ b/swig/matlab/+helics/helicsSubscriptionSetDefaultComplex.m @@ -1,4 +1,4 @@ function varargout = helicsSubscriptionSetDefaultComplex(varargin) % - [varargout{1:nargout}] = helicsMEX(146, varargin{:}); + [varargout{1:nargout}] = helicsMEX(150, varargin{:}); end diff --git a/swig/matlab/+helics/helicsSubscriptionSetDefaultDouble.m b/swig/matlab/+helics/helicsSubscriptionSetDefaultDouble.m index a9a074390f..712734a88b 100644 --- a/swig/matlab/+helics/helicsSubscriptionSetDefaultDouble.m +++ b/swig/matlab/+helics/helicsSubscriptionSetDefaultDouble.m @@ -1,4 +1,4 @@ function varargout = helicsSubscriptionSetDefaultDouble(varargin) % - [varargout{1:nargout}] = helicsMEX(145, varargin{:}); + [varargout{1:nargout}] = helicsMEX(149, varargin{:}); end diff --git a/swig/matlab/+helics/helicsSubscriptionSetDefaultInteger.m b/swig/matlab/+helics/helicsSubscriptionSetDefaultInteger.m index 1d7268af83..4ad5724c71 100644 --- a/swig/matlab/+helics/helicsSubscriptionSetDefaultInteger.m +++ b/swig/matlab/+helics/helicsSubscriptionSetDefaultInteger.m @@ -1,4 +1,4 @@ function varargout = helicsSubscriptionSetDefaultInteger(varargin) % - [varargout{1:nargout}] = helicsMEX(143, varargin{:}); + [varargout{1:nargout}] = helicsMEX(147, varargin{:}); end diff --git a/swig/matlab/+helics/helicsSubscriptionSetDefaultNamedPoint.m b/swig/matlab/+helics/helicsSubscriptionSetDefaultNamedPoint.m index 795b0960b4..8979315ae6 100644 --- a/swig/matlab/+helics/helicsSubscriptionSetDefaultNamedPoint.m +++ b/swig/matlab/+helics/helicsSubscriptionSetDefaultNamedPoint.m @@ -1,3 +1,3 @@ function varargout = helicsSubscriptionSetDefaultNamedPoint(varargin) - [varargout{1:nargout}] = helicsMEX(148, varargin{:}); + [varargout{1:nargout}] = helicsMEX(152, varargin{:}); end diff --git a/swig/matlab/+helics/helicsSubscriptionSetDefaultRaw.m b/swig/matlab/+helics/helicsSubscriptionSetDefaultRaw.m index b72f3c6cfc..9c34756bce 100644 --- a/swig/matlab/+helics/helicsSubscriptionSetDefaultRaw.m +++ b/swig/matlab/+helics/helicsSubscriptionSetDefaultRaw.m @@ -1,3 +1,3 @@ function varargout = helicsSubscriptionSetDefaultRaw(varargin) - [varargout{1:nargout}] = helicsMEX(141, varargin{:}); + [varargout{1:nargout}] = helicsMEX(145, varargin{:}); end diff --git a/swig/matlab/+helics/helicsSubscriptionSetDefaultString.m b/swig/matlab/+helics/helicsSubscriptionSetDefaultString.m index 558c93df13..3a01cfa013 100644 --- a/swig/matlab/+helics/helicsSubscriptionSetDefaultString.m +++ b/swig/matlab/+helics/helicsSubscriptionSetDefaultString.m @@ -1,4 +1,4 @@ function varargout = helicsSubscriptionSetDefaultString(varargin) % - [varargout{1:nargout}] = helicsMEX(142, varargin{:}); + [varargout{1:nargout}] = helicsMEX(146, varargin{:}); end diff --git a/swig/matlab/+helics/helicsSubscriptionSetDefaultVector.m b/swig/matlab/+helics/helicsSubscriptionSetDefaultVector.m index 9ba7b2b4a4..f946b1b111 100644 --- a/swig/matlab/+helics/helicsSubscriptionSetDefaultVector.m +++ b/swig/matlab/+helics/helicsSubscriptionSetDefaultVector.m @@ -1,4 +1,4 @@ function varargout = helicsSubscriptionSetDefaultVector(varargin) % - [varargout{1:nargout}] = helicsMEX(147, varargin{:}); + [varargout{1:nargout}] = helicsMEX(151, varargin{:}); end diff --git a/swig/matlab/+helics/helics_clone_filter.m b/swig/matlab/+helics/helics_clone_filter.m index 692b50448d..9d0ff77ec6 100644 --- a/swig/matlab/+helics/helics_clone_filter.m +++ b/swig/matlab/+helics/helics_clone_filter.m @@ -1,7 +1,7 @@ function v = helics_clone_filter() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876584); + vInitialized = helicsMEX(0, 1818783867); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_custom_filter.m b/swig/matlab/+helics/helics_custom_filter.m index 72f7a6d77e..f0317fde3c 100644 --- a/swig/matlab/+helics/helics_custom_filter.m +++ b/swig/matlab/+helics/helics_custom_filter.m @@ -1,7 +1,7 @@ function v = helics_custom_filter() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876579); + vInitialized = helicsMEX(0, 1818783862); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_delay_filter.m b/swig/matlab/+helics/helics_delay_filter.m index d009a77fff..4aaf364013 100644 --- a/swig/matlab/+helics/helics_delay_filter.m +++ b/swig/matlab/+helics/helics_delay_filter.m @@ -1,7 +1,7 @@ function v = helics_delay_filter() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876580); + vInitialized = helicsMEX(0, 1818783863); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_discard.m b/swig/matlab/+helics/helics_discard.m index e3b7bd05a2..30456d4077 100644 --- a/swig/matlab/+helics/helics_discard.m +++ b/swig/matlab/+helics/helics_discard.m @@ -1,7 +1,7 @@ function v = helics_discard() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876557); + vInitialized = helicsMEX(0, 1818783840); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_error.m b/swig/matlab/+helics/helics_error.m index 025f302ce8..ce72e773ba 100644 --- a/swig/matlab/+helics/helics_error.m +++ b/swig/matlab/+helics/helics_error.m @@ -1,7 +1,7 @@ function v = helics_error() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876562); + vInitialized = helicsMEX(0, 1818783845); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_error_state.m b/swig/matlab/+helics/helics_error_state.m index 36ba519000..90d7466a2e 100644 --- a/swig/matlab/+helics/helics_error_state.m +++ b/swig/matlab/+helics/helics_error_state.m @@ -1,7 +1,7 @@ function v = helics_error_state() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876574); + vInitialized = helicsMEX(0, 1818783857); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_execution_state.m b/swig/matlab/+helics/helics_execution_state.m index 047dc5f80b..b260846b66 100644 --- a/swig/matlab/+helics/helics_execution_state.m +++ b/swig/matlab/+helics/helics_execution_state.m @@ -1,7 +1,7 @@ function v = helics_execution_state() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876572); + vInitialized = helicsMEX(0, 1818783855); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_finalize_state.m b/swig/matlab/+helics/helics_finalize_state.m index 4618914f42..177f1b51b5 100644 --- a/swig/matlab/+helics/helics_finalize_state.m +++ b/swig/matlab/+helics/helics_finalize_state.m @@ -1,7 +1,7 @@ function v = helics_finalize_state() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876573); + vInitialized = helicsMEX(0, 1818783856); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_initialization_state.m b/swig/matlab/+helics/helics_initialization_state.m index c3370b87b1..20831153c5 100644 --- a/swig/matlab/+helics/helics_initialization_state.m +++ b/swig/matlab/+helics/helics_initialization_state.m @@ -1,7 +1,7 @@ function v = helics_initialization_state() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876571); + vInitialized = helicsMEX(0, 1818783854); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_invalid_argument.m b/swig/matlab/+helics/helics_invalid_argument.m index cfb265f6b8..a8d3cd356c 100644 --- a/swig/matlab/+helics/helics_invalid_argument.m +++ b/swig/matlab/+helics/helics_invalid_argument.m @@ -1,7 +1,7 @@ function v = helics_invalid_argument() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876556); + vInitialized = helicsMEX(0, 1818783839); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_invalid_function_call.m b/swig/matlab/+helics/helics_invalid_function_call.m index 8099243ade..bef9f8915e 100644 --- a/swig/matlab/+helics/helics_invalid_function_call.m +++ b/swig/matlab/+helics/helics_invalid_function_call.m @@ -1,7 +1,7 @@ function v = helics_invalid_function_call() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876561); + vInitialized = helicsMEX(0, 1818783844); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_invalid_object.m b/swig/matlab/+helics/helics_invalid_object.m index e1baa61740..621b3032f3 100644 --- a/swig/matlab/+helics/helics_invalid_object.m +++ b/swig/matlab/+helics/helics_invalid_object.m @@ -1,7 +1,7 @@ function v = helics_invalid_object() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876555); + vInitialized = helicsMEX(0, 1818783838); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_invalid_state_transition.m b/swig/matlab/+helics/helics_invalid_state_transition.m index d122a9282f..c70285945a 100644 --- a/swig/matlab/+helics/helics_invalid_state_transition.m +++ b/swig/matlab/+helics/helics_invalid_state_transition.m @@ -1,7 +1,7 @@ function v = helics_invalid_state_transition() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876560); + vInitialized = helicsMEX(0, 1818783843); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_ok.m b/swig/matlab/+helics/helics_ok.m index 63231010ea..ad2f439a9e 100644 --- a/swig/matlab/+helics/helics_ok.m +++ b/swig/matlab/+helics/helics_ok.m @@ -1,7 +1,7 @@ function v = helics_ok() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876553); + vInitialized = helicsMEX(0, 1818783836); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_pending_exec_state.m b/swig/matlab/+helics/helics_pending_exec_state.m index 9015c51452..cc24e11274 100644 --- a/swig/matlab/+helics/helics_pending_exec_state.m +++ b/swig/matlab/+helics/helics_pending_exec_state.m @@ -1,7 +1,7 @@ function v = helics_pending_exec_state() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876576); + vInitialized = helicsMEX(0, 1818783859); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_pending_init_state.m b/swig/matlab/+helics/helics_pending_init_state.m index 57e04d5fa0..33c7021f9e 100644 --- a/swig/matlab/+helics/helics_pending_init_state.m +++ b/swig/matlab/+helics/helics_pending_init_state.m @@ -1,7 +1,7 @@ function v = helics_pending_init_state() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876575); + vInitialized = helicsMEX(0, 1818783858); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_pending_iterative_time_state.m b/swig/matlab/+helics/helics_pending_iterative_time_state.m index a0774ec361..b15f41c265 100644 --- a/swig/matlab/+helics/helics_pending_iterative_time_state.m +++ b/swig/matlab/+helics/helics_pending_iterative_time_state.m @@ -1,7 +1,7 @@ function v = helics_pending_iterative_time_state() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876578); + vInitialized = helicsMEX(0, 1818783861); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_pending_time_state.m b/swig/matlab/+helics/helics_pending_time_state.m index b2184ab42d..d9eb825c01 100644 --- a/swig/matlab/+helics/helics_pending_time_state.m +++ b/swig/matlab/+helics/helics_pending_time_state.m @@ -1,7 +1,7 @@ function v = helics_pending_time_state() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876577); + vInitialized = helicsMEX(0, 1818783860); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_randomDelay_filter.m b/swig/matlab/+helics/helics_randomDelay_filter.m index f8b85858cc..88003d1079 100644 --- a/swig/matlab/+helics/helics_randomDelay_filter.m +++ b/swig/matlab/+helics/helics_randomDelay_filter.m @@ -1,7 +1,7 @@ function v = helics_randomDelay_filter() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876581); + vInitialized = helicsMEX(0, 1818783864); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_randomDrop_filter.m b/swig/matlab/+helics/helics_randomDrop_filter.m index 0a85f4788a..a5f775f6b7 100644 --- a/swig/matlab/+helics/helics_randomDrop_filter.m +++ b/swig/matlab/+helics/helics_randomDrop_filter.m @@ -1,7 +1,7 @@ function v = helics_randomDrop_filter() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876582); + vInitialized = helicsMEX(0, 1818783865); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_registration_failure.m b/swig/matlab/+helics/helics_registration_failure.m index 6836435f4b..1d1b5cb359 100644 --- a/swig/matlab/+helics/helics_registration_failure.m +++ b/swig/matlab/+helics/helics_registration_failure.m @@ -1,7 +1,7 @@ function v = helics_registration_failure() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876554); + vInitialized = helicsMEX(0, 1818783837); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_reroute_filter.m b/swig/matlab/+helics/helics_reroute_filter.m index 9984407204..db96103548 100644 --- a/swig/matlab/+helics/helics_reroute_filter.m +++ b/swig/matlab/+helics/helics_reroute_filter.m @@ -1,7 +1,7 @@ function v = helics_reroute_filter() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876583); + vInitialized = helicsMEX(0, 1818783866); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_startup_state.m b/swig/matlab/+helics/helics_startup_state.m index be80449632..09a4fa9475 100644 --- a/swig/matlab/+helics/helics_startup_state.m +++ b/swig/matlab/+helics/helics_startup_state.m @@ -1,7 +1,7 @@ function v = helics_startup_state() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876570); + vInitialized = helicsMEX(0, 1818783853); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_terminated.m b/swig/matlab/+helics/helics_terminated.m index 593b754fa8..0b363b7214 100644 --- a/swig/matlab/+helics/helics_terminated.m +++ b/swig/matlab/+helics/helics_terminated.m @@ -1,7 +1,7 @@ function v = helics_terminated() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876558); + vInitialized = helicsMEX(0, 1818783841); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_warning.m b/swig/matlab/+helics/helics_warning.m index b046d6cdbf..fc317e6c8a 100644 --- a/swig/matlab/+helics/helics_warning.m +++ b/swig/matlab/+helics/helics_warning.m @@ -1,7 +1,7 @@ function v = helics_warning() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876559); + vInitialized = helicsMEX(0, 1818783842); end v = vInitialized; end diff --git a/swig/matlab/+helics/iterate_if_needed.m b/swig/matlab/+helics/iterate_if_needed.m index 638625b145..0ce5e2f4c8 100644 --- a/swig/matlab/+helics/iterate_if_needed.m +++ b/swig/matlab/+helics/iterate_if_needed.m @@ -1,7 +1,7 @@ function v = iterate_if_needed() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876565); + vInitialized = helicsMEX(0, 1818783848); end v = vInitialized; end diff --git a/swig/matlab/+helics/iterating.m b/swig/matlab/+helics/iterating.m index 7b475fb55c..2aef58297b 100644 --- a/swig/matlab/+helics/iterating.m +++ b/swig/matlab/+helics/iterating.m @@ -1,7 +1,7 @@ function v = iterating() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876569); + vInitialized = helicsMEX(0, 1818783852); end v = vInitialized; end diff --git a/swig/matlab/+helics/iteration_error.m b/swig/matlab/+helics/iteration_error.m index 87c540a90b..fc72f90cde 100644 --- a/swig/matlab/+helics/iteration_error.m +++ b/swig/matlab/+helics/iteration_error.m @@ -1,7 +1,7 @@ function v = iteration_error() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876567); + vInitialized = helicsMEX(0, 1818783850); end v = vInitialized; end diff --git a/swig/matlab/+helics/iteration_halted.m b/swig/matlab/+helics/iteration_halted.m index 257dd33f13..e82be64491 100644 --- a/swig/matlab/+helics/iteration_halted.m +++ b/swig/matlab/+helics/iteration_halted.m @@ -1,7 +1,7 @@ function v = iteration_halted() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876568); + vInitialized = helicsMEX(0, 1818783851); end v = vInitialized; end diff --git a/swig/matlab/+helics/next_step.m b/swig/matlab/+helics/next_step.m index 82a2140e2a..ba732d8720 100644 --- a/swig/matlab/+helics/next_step.m +++ b/swig/matlab/+helics/next_step.m @@ -1,7 +1,7 @@ function v = next_step() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876566); + vInitialized = helicsMEX(0, 1818783849); end v = vInitialized; end diff --git a/swig/matlab/+helics/no_iteration.m b/swig/matlab/+helics/no_iteration.m index 37c34d4f4e..7f7259ebcd 100644 --- a/swig/matlab/+helics/no_iteration.m +++ b/swig/matlab/+helics/no_iteration.m @@ -1,7 +1,7 @@ function v = no_iteration() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1329876563); + vInitialized = helicsMEX(0, 1818783846); end v = vInitialized; end diff --git a/swig/matlab/helicsMEX.cpp b/swig/matlab/helicsMEX.cpp index 57fcf96cc0..704bc217d8 100644 --- a/swig/matlab/helicsMEX.cpp +++ b/swig/matlab/helicsMEX.cpp @@ -2507,6 +2507,36 @@ int _wrap_helicsBrokerIsConnected(int resc, mxArray *resv[], int argc, mxArray * } +int _wrap_helicsBrokerWaitForDisconnect(int resc, mxArray *resv[], int argc, mxArray *argv[]) { + helics_broker arg1 = (helics_broker) 0 ; + int arg2 ; + int res1 ; + int val2 ; + int ecode2 = 0 ; + mxArray * _out; + helics_status result; + + if (!SWIG_check_num_args("helicsBrokerWaitForDisconnect",argc,2,2,0)) { + SWIG_fail; + } + res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsBrokerWaitForDisconnect" "', argument " "1"" of type '" "helics_broker""'"); + } + ecode2 = SWIG_AsVal_int(argv[1], &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsBrokerWaitForDisconnect" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + result = (helics_status)helicsBrokerWaitForDisconnect(arg1,arg2); + _out = SWIG_From_int(static_cast< int >(result)); + if (_out) --resc, *resv++ = _out; + return 0; +fail: + return 1; +} + + int _wrap_helicsCoreIsConnected(int resc, mxArray *resv[], int argc, mxArray *argv[]) { helics_core arg1 = (helics_core) 0 ; int res1 ; @@ -2733,6 +2763,69 @@ int _wrap_helicsBrokerDisconnect(int resc, mxArray *resv[], int argc, mxArray *a } +int _wrap_helicsDestroyFederate(int resc, mxArray *resv[], int argc, mxArray *argv[]) { + helics_federate arg1 = (helics_federate) 0 ; + int res1 ; + mxArray * _out; + + if (!SWIG_check_num_args("helicsDestroyFederate",argc,1,1,0)) { + SWIG_fail; + } + res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsDestroyFederate" "', argument " "1"" of type '" "helics_federate""'"); + } + helicsDestroyFederate(arg1); + _out = (mxArray*)0; + if (_out) --resc, *resv++ = _out; + return 0; +fail: + return 1; +} + + +int _wrap_helicsDestroyBroker(int resc, mxArray *resv[], int argc, mxArray *argv[]) { + helics_broker arg1 = (helics_broker) 0 ; + int res1 ; + mxArray * _out; + + if (!SWIG_check_num_args("helicsDestroyBroker",argc,1,1,0)) { + SWIG_fail; + } + res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsDestroyBroker" "', argument " "1"" of type '" "helics_broker""'"); + } + helicsDestroyBroker(arg1); + _out = (mxArray*)0; + if (_out) --resc, *resv++ = _out; + return 0; +fail: + return 1; +} + + +int _wrap_helicsDestroyCore(int resc, mxArray *resv[], int argc, mxArray *argv[]) { + helics_core arg1 = (helics_core) 0 ; + int res1 ; + mxArray * _out; + + if (!SWIG_check_num_args("helicsDestroyCore",argc,1,1,0)) { + SWIG_fail; + } + res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsDestroyCore" "', argument " "1"" of type '" "helics_core""'"); + } + helicsDestroyCore(arg1); + _out = (mxArray*)0; + if (_out) --resc, *resv++ = _out; + return 0; +fail: + return 1; +} + + int _wrap_helicsCoreFree(int resc, mxArray *resv[], int argc, mxArray *argv[]) { helics_core arg1 = (helics_core) 0 ; int res1 ; @@ -7881,54 +7974,54 @@ SWIGINTERN int swigConstant(int SWIGUNUSEDPARM(resc), mxArray *resv[], int argc, } int con_id = (int)mxGetScalar(*argv++); switch (con_id) { - case 1329876553: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_ok",SWIG_From_int(static_cast< int >(helics_ok)));; break; - case 1329876554: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_registration_failure",SWIG_From_int(static_cast< int >(helics_registration_failure)));; break; - case 1329876555: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_invalid_object",SWIG_From_int(static_cast< int >(helics_invalid_object)));; break; - case 1329876556: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_invalid_argument",SWIG_From_int(static_cast< int >(helics_invalid_argument)));; break; - case 1329876557: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_discard",SWIG_From_int(static_cast< int >(helics_discard)));; break; - case 1329876558: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_terminated",SWIG_From_int(static_cast< int >(helics_terminated)));; break; - case 1329876559: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_warning",SWIG_From_int(static_cast< int >(helics_warning)));; break; - case 1329876560: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_invalid_state_transition",SWIG_From_int(static_cast< int >(helics_invalid_state_transition)));; break; - case 1329876561: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_invalid_function_call",SWIG_From_int(static_cast< int >(helics_invalid_function_call)));; break; - case 1329876562: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_error",SWIG_From_int(static_cast< int >(helics_error)));; break; - case 1329876563: *resv = SWIG_Matlab_SetConstant(module_ns,"no_iteration",SWIG_From_int(static_cast< int >(no_iteration)));; break; - case 1329876564: *resv = SWIG_Matlab_SetConstant(module_ns,"force_iteration",SWIG_From_int(static_cast< int >(force_iteration)));; break; - case 1329876565: *resv = SWIG_Matlab_SetConstant(module_ns,"iterate_if_needed",SWIG_From_int(static_cast< int >(iterate_if_needed)));; break; - case 1329876566: *resv = SWIG_Matlab_SetConstant(module_ns,"next_step",SWIG_From_int(static_cast< int >(next_step)));; break; - case 1329876567: *resv = SWIG_Matlab_SetConstant(module_ns,"iteration_error",SWIG_From_int(static_cast< int >(iteration_error)));; break; - case 1329876568: *resv = SWIG_Matlab_SetConstant(module_ns,"iteration_halted",SWIG_From_int(static_cast< int >(iteration_halted)));; break; - case 1329876569: *resv = SWIG_Matlab_SetConstant(module_ns,"iterating",SWIG_From_int(static_cast< int >(iterating)));; break; - case 1329876570: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_startup_state",SWIG_From_int(static_cast< int >(helics_startup_state)));; break; - case 1329876571: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_initialization_state",SWIG_From_int(static_cast< int >(helics_initialization_state)));; break; - case 1329876572: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_execution_state",SWIG_From_int(static_cast< int >(helics_execution_state)));; break; - case 1329876573: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_finalize_state",SWIG_From_int(static_cast< int >(helics_finalize_state)));; break; - case 1329876574: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_error_state",SWIG_From_int(static_cast< int >(helics_error_state)));; break; - case 1329876575: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_pending_init_state",SWIG_From_int(static_cast< int >(helics_pending_init_state)));; break; - case 1329876576: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_pending_exec_state",SWIG_From_int(static_cast< int >(helics_pending_exec_state)));; break; - case 1329876577: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_pending_time_state",SWIG_From_int(static_cast< int >(helics_pending_time_state)));; break; - case 1329876578: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_pending_iterative_time_state",SWIG_From_int(static_cast< int >(helics_pending_iterative_time_state)));; break; - case 1329876579: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_custom_filter",SWIG_From_int(static_cast< int >(helics_custom_filter)));; break; - case 1329876580: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_delay_filter",SWIG_From_int(static_cast< int >(helics_delay_filter)));; break; - case 1329876581: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_randomDelay_filter",SWIG_From_int(static_cast< int >(helics_randomDelay_filter)));; break; - case 1329876582: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_randomDrop_filter",SWIG_From_int(static_cast< int >(helics_randomDrop_filter)));; break; - case 1329876583: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_reroute_filter",SWIG_From_int(static_cast< int >(helics_reroute_filter)));; break; - case 1329876584: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_clone_filter",SWIG_From_int(static_cast< int >(helics_clone_filter)));; break; - case 1329876585: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_DEFAULT",SWIG_From_int(static_cast< int >(0)));; break; - case 1329876586: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_ZMQ",SWIG_From_int(static_cast< int >(1)));; break; - case 1329876587: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_MPI",SWIG_From_int(static_cast< int >(2)));; break; - case 1329876588: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_TEST",SWIG_From_int(static_cast< int >(3)));; break; - case 1329876589: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_INTERPROCESS",SWIG_From_int(static_cast< int >(4)));; break; - case 1329876590: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_IPC",SWIG_From_int(static_cast< int >(5)));; break; - case 1329876591: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_TCP",SWIG_From_int(static_cast< int >(6)));; break; - case 1329876592: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_UDP",SWIG_From_int(static_cast< int >(7)));; break; - case 1329876593: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_STRING",SWIG_From_int(static_cast< int >(0)));; break; - case 1329876594: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_DOUBLE",SWIG_From_int(static_cast< int >(1)));; break; - case 1329876595: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_INT",SWIG_From_int(static_cast< int >(2)));; break; - case 1329876596: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_COMPLEX",SWIG_From_int(static_cast< int >(3)));; break; - case 1329876597: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_VECTOR",SWIG_From_int(static_cast< int >(4)));; break; - case 1329876598: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_NAMEDPOINT",SWIG_From_int(static_cast< int >(6)));; break; - case 1329876599: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_BOOLEAN",SWIG_From_int(static_cast< int >(7)));; break; - case 1329876600: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_RAW",SWIG_From_int(static_cast< int >(25)));; break; + case 1818783836: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_ok",SWIG_From_int(static_cast< int >(helics_ok)));; break; + case 1818783837: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_registration_failure",SWIG_From_int(static_cast< int >(helics_registration_failure)));; break; + case 1818783838: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_invalid_object",SWIG_From_int(static_cast< int >(helics_invalid_object)));; break; + case 1818783839: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_invalid_argument",SWIG_From_int(static_cast< int >(helics_invalid_argument)));; break; + case 1818783840: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_discard",SWIG_From_int(static_cast< int >(helics_discard)));; break; + case 1818783841: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_terminated",SWIG_From_int(static_cast< int >(helics_terminated)));; break; + case 1818783842: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_warning",SWIG_From_int(static_cast< int >(helics_warning)));; break; + case 1818783843: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_invalid_state_transition",SWIG_From_int(static_cast< int >(helics_invalid_state_transition)));; break; + case 1818783844: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_invalid_function_call",SWIG_From_int(static_cast< int >(helics_invalid_function_call)));; break; + case 1818783845: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_error",SWIG_From_int(static_cast< int >(helics_error)));; break; + case 1818783846: *resv = SWIG_Matlab_SetConstant(module_ns,"no_iteration",SWIG_From_int(static_cast< int >(no_iteration)));; break; + case 1818783847: *resv = SWIG_Matlab_SetConstant(module_ns,"force_iteration",SWIG_From_int(static_cast< int >(force_iteration)));; break; + case 1818783848: *resv = SWIG_Matlab_SetConstant(module_ns,"iterate_if_needed",SWIG_From_int(static_cast< int >(iterate_if_needed)));; break; + case 1818783849: *resv = SWIG_Matlab_SetConstant(module_ns,"next_step",SWIG_From_int(static_cast< int >(next_step)));; break; + case 1818783850: *resv = SWIG_Matlab_SetConstant(module_ns,"iteration_error",SWIG_From_int(static_cast< int >(iteration_error)));; break; + case 1818783851: *resv = SWIG_Matlab_SetConstant(module_ns,"iteration_halted",SWIG_From_int(static_cast< int >(iteration_halted)));; break; + case 1818783852: *resv = SWIG_Matlab_SetConstant(module_ns,"iterating",SWIG_From_int(static_cast< int >(iterating)));; break; + case 1818783853: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_startup_state",SWIG_From_int(static_cast< int >(helics_startup_state)));; break; + case 1818783854: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_initialization_state",SWIG_From_int(static_cast< int >(helics_initialization_state)));; break; + case 1818783855: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_execution_state",SWIG_From_int(static_cast< int >(helics_execution_state)));; break; + case 1818783856: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_finalize_state",SWIG_From_int(static_cast< int >(helics_finalize_state)));; break; + case 1818783857: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_error_state",SWIG_From_int(static_cast< int >(helics_error_state)));; break; + case 1818783858: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_pending_init_state",SWIG_From_int(static_cast< int >(helics_pending_init_state)));; break; + case 1818783859: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_pending_exec_state",SWIG_From_int(static_cast< int >(helics_pending_exec_state)));; break; + case 1818783860: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_pending_time_state",SWIG_From_int(static_cast< int >(helics_pending_time_state)));; break; + case 1818783861: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_pending_iterative_time_state",SWIG_From_int(static_cast< int >(helics_pending_iterative_time_state)));; break; + case 1818783862: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_custom_filter",SWIG_From_int(static_cast< int >(helics_custom_filter)));; break; + case 1818783863: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_delay_filter",SWIG_From_int(static_cast< int >(helics_delay_filter)));; break; + case 1818783864: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_randomDelay_filter",SWIG_From_int(static_cast< int >(helics_randomDelay_filter)));; break; + case 1818783865: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_randomDrop_filter",SWIG_From_int(static_cast< int >(helics_randomDrop_filter)));; break; + case 1818783866: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_reroute_filter",SWIG_From_int(static_cast< int >(helics_reroute_filter)));; break; + case 1818783867: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_clone_filter",SWIG_From_int(static_cast< int >(helics_clone_filter)));; break; + case 1818783868: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_DEFAULT",SWIG_From_int(static_cast< int >(0)));; break; + case 1818783869: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_ZMQ",SWIG_From_int(static_cast< int >(1)));; break; + case 1818783870: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_MPI",SWIG_From_int(static_cast< int >(2)));; break; + case 1818783871: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_TEST",SWIG_From_int(static_cast< int >(3)));; break; + case 1818783872: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_INTERPROCESS",SWIG_From_int(static_cast< int >(4)));; break; + case 1818783873: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_IPC",SWIG_From_int(static_cast< int >(5)));; break; + case 1818783874: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_TCP",SWIG_From_int(static_cast< int >(6)));; break; + case 1818783875: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_UDP",SWIG_From_int(static_cast< int >(7)));; break; + case 1818783876: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_STRING",SWIG_From_int(static_cast< int >(0)));; break; + case 1818783877: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_DOUBLE",SWIG_From_int(static_cast< int >(1)));; break; + case 1818783878: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_INT",SWIG_From_int(static_cast< int >(2)));; break; + case 1818783879: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_COMPLEX",SWIG_From_int(static_cast< int >(3)));; break; + case 1818783880: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_VECTOR",SWIG_From_int(static_cast< int >(4)));; break; + case 1818783881: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_NAMEDPOINT",SWIG_From_int(static_cast< int >(6)));; break; + case 1818783882: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_BOOLEAN",SWIG_From_int(static_cast< int >(7)));; break; + case 1818783883: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_RAW",SWIG_From_int(static_cast< int >(25)));; break; default: SWIG_Error(SWIG_RuntimeError, "No such constant."); return 1; @@ -7978,157 +8071,161 @@ SWIGINTERN const char* SwigFunctionName(int fcn_id) { case 37: return "_wrap_helicsCreateBrokerFromArgs"; case 38: return "_wrap_helicsBrokerClone"; case 39: return "_wrap_helicsBrokerIsConnected"; - case 40: return "_wrap_helicsCoreIsConnected"; - case 41: return "_wrap_helicsBrokerGetIdentifier"; - case 42: return "_wrap_helicsCoreGetIdentifier"; - case 43: return "_wrap_helicsBrokerGetAddress"; - case 44: return "_wrap_helicsCoreSetReadyToInit"; - case 45: return "_wrap_helicsCoreDisconnect"; - case 46: return "_wrap_helicsGetFederateByName"; - case 47: return "_wrap_helicsBrokerDisconnect"; - case 48: return "_wrap_helicsCoreFree"; - case 49: return "_wrap_helicsBrokerFree"; - case 50: return "_wrap_helicsCreateValueFederate"; - case 51: return "_wrap_helicsCreateValueFederateFromJson"; - case 52: return "_wrap_helicsCreateMessageFederate"; - case 53: return "_wrap_helicsCreateMessageFederateFromJson"; - case 54: return "_wrap_helicsCreateCombinationFederate"; - case 55: return "_wrap_helicsCreateCombinationFederateFromJson"; - case 56: return "_wrap_helicsFederateClone"; - case 57: return "_wrap_helicsFederateInfoCreate"; - case 58: return "_wrap_helicsFederateInfoLoadFromArgs"; - case 59: return "_wrap_helicsFederateInfoFree"; - case 60: return "_wrap_helicsFederateInfoSetFederateName"; - case 61: return "_wrap_helicsFederateInfoSetCoreName"; - case 62: return "_wrap_helicsFederateInfoSetCoreInitString"; - case 63: return "_wrap_helicsFederateInfoSetCoreTypeFromString"; - case 64: return "_wrap_helicsFederateInfoSetCoreType"; - case 65: return "_wrap_helicsFederateInfoSetFlag"; - case 66: return "_wrap_helicsFederateInfoSetSeparator"; - case 67: return "_wrap_helicsFederateInfoSetOutputDelay"; - case 68: return "_wrap_helicsFederateInfoSetTimeDelta"; - case 69: return "_wrap_helicsFederateInfoSetInputDelay"; - case 70: return "_wrap_helicsFederateInfoSetTimeOffset"; - case 71: return "_wrap_helicsFederateInfoSetPeriod"; - case 72: return "_wrap_helicsFederateInfoSetMaxIterations"; - case 73: return "_wrap_helicsFederateInfoSetLoggingLevel"; - case 74: return "_wrap_helicsFederateFinalize"; - case 75: return "_wrap_helicsFederateFree"; - case 76: return "_wrap_helicsCloseLibrary"; - case 77: return "_wrap_helicsFederateEnterInitializationMode"; - case 78: return "_wrap_helicsFederateEnterInitializationModeAsync"; - case 79: return "_wrap_helicsFederateIsAsyncOperationCompleted"; - case 80: return "_wrap_helicsFederateEnterInitializationModeComplete"; - case 81: return "_wrap_helicsFederateEnterExecutionMode"; - case 82: return "_wrap_helicsFederateEnterExecutionModeAsync"; - case 83: return "_wrap_helicsFederateEnterExecutionModeComplete"; - case 84: return "_wrap_helicsFederateEnterExecutionModeIterative"; - case 85: return "_wrap_helicsFederateEnterExecutionModeIterativeAsync"; - case 86: return "_wrap_helicsFederateEnterExecutionModeIterativeComplete"; - case 87: return "_wrap_helicsFederateGetState"; - case 88: return "_wrap_helicsFederateGetCoreObject"; - case 89: return "_wrap_helicsFederateRequestTime"; - case 90: return "_wrap_helicsFederateRequestTimeIterative"; - case 91: return "_wrap_helicsFederateRequestTimeAsync"; - case 92: return "_wrap_helicsFederateRequestTimeComplete"; - case 93: return "_wrap_helicsFederateRequestTimeIterativeAsync"; - case 94: return "_wrap_helicsFederateRequestTimeIterativeComplete"; - case 95: return "_wrap_helicsFederateGetName"; - case 96: return "_wrap_helicsFederateSetTimeDelta"; - case 97: return "_wrap_helicsFederateSetOutputDelay"; - case 98: return "_wrap_helicsFederateSetInputDelay"; - case 99: return "_wrap_helicsFederateSetPeriod"; - case 100: return "_wrap_helicsFederateSetFlag"; - case 101: return "_wrap_helicsFederateSetSeparator"; - case 102: return "_wrap_helicsFederateSetLoggingLevel"; - case 103: return "_wrap_helicsFederateSetMaxIterations"; - case 104: return "_wrap_helicsFederateGetCurrentTime"; - case 105: return "_wrap_helicsCreateQuery"; - case 106: return "_wrap_helicsQueryExecute"; - case 107: return "_wrap_helicsQueryCoreExecute"; - case 108: return "_wrap_helicsQueryBrokerExecute"; - case 109: return "_wrap_helicsQueryExecuteAsync"; - case 110: return "_wrap_helicsQueryExecuteComplete"; - case 111: return "_wrap_helicsQueryIsCompleted"; - case 112: return "_wrap_helicsQueryFree"; - case 113: return "_wrap_helicsCleanupHelicsLibrary"; - case 114: return "_wrap_helicsFederateRegisterSubscription"; - case 115: return "_wrap_helicsFederateRegisterTypeSubscription"; - case 116: return "_wrap_helicsFederateRegisterOptionalSubscription"; - case 117: return "_wrap_helicsFederateRegisterOptionalTypeSubscription"; - case 118: return "_wrap_helicsFederateRegisterPublication"; - case 119: return "_wrap_helicsFederateRegisterTypePublication"; - case 120: return "_wrap_helicsFederateRegisterGlobalPublication"; - case 121: return "_wrap_helicsFederateRegisterGlobalTypePublication"; - case 122: return "_wrap_helicsPublicationPublishRaw"; - case 123: return "_wrap_helicsPublicationPublishString"; - case 124: return "_wrap_helicsPublicationPublishInteger"; - case 125: return "_wrap_helicsPublicationPublishBoolean"; - case 126: return "_wrap_helicsPublicationPublishDouble"; - case 127: return "_wrap_helicsPublicationPublishComplex"; - case 128: return "_wrap_helicsPublicationPublishVector"; - case 129: return "_wrap_helicsPublicationPublishNamedPoint"; - case 130: return "_wrap_helicsSubscriptionGetValueSize"; - case 131: return "_wrap_helicsSubscriptionGetRawValue"; - case 132: return "_wrap_helicsSubscriptionGetStringSize"; - case 133: return "_wrap_helicsSubscriptionGetString"; - case 134: return "_wrap_helicsSubscriptionGetInteger"; - case 135: return "_wrap_helicsSubscriptionGetBoolean"; - case 136: return "_wrap_helicsSubscriptionGetDouble"; - case 137: return "_wrap_helicsSubscriptionGetComplex"; - case 138: return "_wrap_helicsSubscriptionGetVectorSize"; - case 139: return "_wrap_helicsSubscriptionGetVector"; - case 140: return "_wrap_helicsSubscriptionGetNamedPoint"; - case 141: return "_wrap_helicsSubscriptionSetDefaultRaw"; - case 142: return "_wrap_helicsSubscriptionSetDefaultString"; - case 143: return "_wrap_helicsSubscriptionSetDefaultInteger"; - case 144: return "_wrap_helicsSubscriptionSetDefaultBoolean"; - case 145: return "_wrap_helicsSubscriptionSetDefaultDouble"; - case 146: return "_wrap_helicsSubscriptionSetDefaultComplex"; - case 147: return "_wrap_helicsSubscriptionSetDefaultVector"; - case 148: return "_wrap_helicsSubscriptionSetDefaultNamedPoint"; - case 149: return "_wrap_helicsSubscriptionGetType"; - case 150: return "_wrap_helicsPublicationGetType"; - case 151: return "_wrap_helicsSubscriptionGetKey"; - case 152: return "_wrap_helicsPublicationGetKey"; - case 153: return "_wrap_helicsSubscriptionGetUnits"; - case 154: return "_wrap_helicsPublicationGetUnits"; - case 155: return "_wrap_helicsSubscriptionIsUpdated"; - case 156: return "_wrap_helicsSubscriptionLastUpdateTime"; - case 157: return "_wrap_helicsFederateGetPublicationCount"; - case 158: return "_wrap_helicsFederateGetSubscriptionCount"; - case 159: return "_wrap_helicsFederateRegisterEndpoint"; - case 160: return "_wrap_helicsFederateRegisterGlobalEndpoint"; - case 161: return "_wrap_helicsEndpointSetDefaultDestination"; - case 162: return "_wrap_helicsEndpointSendMessageRaw"; - case 163: return "_wrap_helicsEndpointSendEventRaw"; - case 164: return "_wrap_helicsEndpointSendMessage"; - case 165: return "_wrap_helicsEndpointSubscribe"; - case 166: return "_wrap_helicsFederateHasMessage"; - case 167: return "_wrap_helicsEndpointHasMessage"; - case 168: return "_wrap_helicsFederateReceiveCount"; - case 169: return "_wrap_helicsEndpointReceiveCount"; - case 170: return "_wrap_helicsEndpointGetMessage"; - case 171: return "_wrap_helicsFederateGetMessage"; - case 172: return "_wrap_helicsEndpointGetType"; - case 173: return "_wrap_helicsEndpointGetName"; - case 174: return "_wrap_helicsFederateGetEndpointCount"; - case 175: return "_wrap_helicsFederateRegisterSourceFilter"; - case 176: return "_wrap_helicsFederateRegisterDestinationFilter"; - case 177: return "_wrap_helicsFederateRegisterCloningFilter"; - case 178: return "_wrap_helicsCoreRegisterSourceFilter"; - case 179: return "_wrap_helicsCoreRegisterDestinationFilter"; - case 180: return "_wrap_helicsCoreRegisterCloningFilter"; - case 181: return "_wrap_helicsFilterGetTarget"; - case 182: return "_wrap_helicsFilterGetName"; - case 183: return "_wrap_helicsFilterSet"; - case 184: return "_wrap_helicsFilterSetString"; - case 185: return "_wrap_helicsFilterAddDestinationTarget"; - case 186: return "_wrap_helicsFilterAddSourceTarget"; - case 187: return "_wrap_helicsFilterAddDeliveryEndpoint"; - case 188: return "_wrap_helicsFilterRemoveDestinationTarget"; - case 189: return "_wrap_helicsFilterRemoveSourceTarget"; - case 190: return "_wrap_helicsFilterRemoveDeliveryEndpoint"; + case 40: return "_wrap_helicsBrokerWaitForDisconnect"; + case 41: return "_wrap_helicsCoreIsConnected"; + case 42: return "_wrap_helicsBrokerGetIdentifier"; + case 43: return "_wrap_helicsCoreGetIdentifier"; + case 44: return "_wrap_helicsBrokerGetAddress"; + case 45: return "_wrap_helicsCoreSetReadyToInit"; + case 46: return "_wrap_helicsCoreDisconnect"; + case 47: return "_wrap_helicsGetFederateByName"; + case 48: return "_wrap_helicsBrokerDisconnect"; + case 49: return "_wrap_helicsDestroyFederate"; + case 50: return "_wrap_helicsDestroyBroker"; + case 51: return "_wrap_helicsDestroyCore"; + case 52: return "_wrap_helicsCoreFree"; + case 53: return "_wrap_helicsBrokerFree"; + case 54: return "_wrap_helicsCreateValueFederate"; + case 55: return "_wrap_helicsCreateValueFederateFromJson"; + case 56: return "_wrap_helicsCreateMessageFederate"; + case 57: return "_wrap_helicsCreateMessageFederateFromJson"; + case 58: return "_wrap_helicsCreateCombinationFederate"; + case 59: return "_wrap_helicsCreateCombinationFederateFromJson"; + case 60: return "_wrap_helicsFederateClone"; + case 61: return "_wrap_helicsFederateInfoCreate"; + case 62: return "_wrap_helicsFederateInfoLoadFromArgs"; + case 63: return "_wrap_helicsFederateInfoFree"; + case 64: return "_wrap_helicsFederateInfoSetFederateName"; + case 65: return "_wrap_helicsFederateInfoSetCoreName"; + case 66: return "_wrap_helicsFederateInfoSetCoreInitString"; + case 67: return "_wrap_helicsFederateInfoSetCoreTypeFromString"; + case 68: return "_wrap_helicsFederateInfoSetCoreType"; + case 69: return "_wrap_helicsFederateInfoSetFlag"; + case 70: return "_wrap_helicsFederateInfoSetSeparator"; + case 71: return "_wrap_helicsFederateInfoSetOutputDelay"; + case 72: return "_wrap_helicsFederateInfoSetTimeDelta"; + case 73: return "_wrap_helicsFederateInfoSetInputDelay"; + case 74: return "_wrap_helicsFederateInfoSetTimeOffset"; + case 75: return "_wrap_helicsFederateInfoSetPeriod"; + case 76: return "_wrap_helicsFederateInfoSetMaxIterations"; + case 77: return "_wrap_helicsFederateInfoSetLoggingLevel"; + case 78: return "_wrap_helicsFederateFinalize"; + case 79: return "_wrap_helicsFederateFree"; + case 80: return "_wrap_helicsCloseLibrary"; + case 81: return "_wrap_helicsFederateEnterInitializationMode"; + case 82: return "_wrap_helicsFederateEnterInitializationModeAsync"; + case 83: return "_wrap_helicsFederateIsAsyncOperationCompleted"; + case 84: return "_wrap_helicsFederateEnterInitializationModeComplete"; + case 85: return "_wrap_helicsFederateEnterExecutionMode"; + case 86: return "_wrap_helicsFederateEnterExecutionModeAsync"; + case 87: return "_wrap_helicsFederateEnterExecutionModeComplete"; + case 88: return "_wrap_helicsFederateEnterExecutionModeIterative"; + case 89: return "_wrap_helicsFederateEnterExecutionModeIterativeAsync"; + case 90: return "_wrap_helicsFederateEnterExecutionModeIterativeComplete"; + case 91: return "_wrap_helicsFederateGetState"; + case 92: return "_wrap_helicsFederateGetCoreObject"; + case 93: return "_wrap_helicsFederateRequestTime"; + case 94: return "_wrap_helicsFederateRequestTimeIterative"; + case 95: return "_wrap_helicsFederateRequestTimeAsync"; + case 96: return "_wrap_helicsFederateRequestTimeComplete"; + case 97: return "_wrap_helicsFederateRequestTimeIterativeAsync"; + case 98: return "_wrap_helicsFederateRequestTimeIterativeComplete"; + case 99: return "_wrap_helicsFederateGetName"; + case 100: return "_wrap_helicsFederateSetTimeDelta"; + case 101: return "_wrap_helicsFederateSetOutputDelay"; + case 102: return "_wrap_helicsFederateSetInputDelay"; + case 103: return "_wrap_helicsFederateSetPeriod"; + case 104: return "_wrap_helicsFederateSetFlag"; + case 105: return "_wrap_helicsFederateSetSeparator"; + case 106: return "_wrap_helicsFederateSetLoggingLevel"; + case 107: return "_wrap_helicsFederateSetMaxIterations"; + case 108: return "_wrap_helicsFederateGetCurrentTime"; + case 109: return "_wrap_helicsCreateQuery"; + case 110: return "_wrap_helicsQueryExecute"; + case 111: return "_wrap_helicsQueryCoreExecute"; + case 112: return "_wrap_helicsQueryBrokerExecute"; + case 113: return "_wrap_helicsQueryExecuteAsync"; + case 114: return "_wrap_helicsQueryExecuteComplete"; + case 115: return "_wrap_helicsQueryIsCompleted"; + case 116: return "_wrap_helicsQueryFree"; + case 117: return "_wrap_helicsCleanupHelicsLibrary"; + case 118: return "_wrap_helicsFederateRegisterSubscription"; + case 119: return "_wrap_helicsFederateRegisterTypeSubscription"; + case 120: return "_wrap_helicsFederateRegisterOptionalSubscription"; + case 121: return "_wrap_helicsFederateRegisterOptionalTypeSubscription"; + case 122: return "_wrap_helicsFederateRegisterPublication"; + case 123: return "_wrap_helicsFederateRegisterTypePublication"; + case 124: return "_wrap_helicsFederateRegisterGlobalPublication"; + case 125: return "_wrap_helicsFederateRegisterGlobalTypePublication"; + case 126: return "_wrap_helicsPublicationPublishRaw"; + case 127: return "_wrap_helicsPublicationPublishString"; + case 128: return "_wrap_helicsPublicationPublishInteger"; + case 129: return "_wrap_helicsPublicationPublishBoolean"; + case 130: return "_wrap_helicsPublicationPublishDouble"; + case 131: return "_wrap_helicsPublicationPublishComplex"; + case 132: return "_wrap_helicsPublicationPublishVector"; + case 133: return "_wrap_helicsPublicationPublishNamedPoint"; + case 134: return "_wrap_helicsSubscriptionGetValueSize"; + case 135: return "_wrap_helicsSubscriptionGetRawValue"; + case 136: return "_wrap_helicsSubscriptionGetStringSize"; + case 137: return "_wrap_helicsSubscriptionGetString"; + case 138: return "_wrap_helicsSubscriptionGetInteger"; + case 139: return "_wrap_helicsSubscriptionGetBoolean"; + case 140: return "_wrap_helicsSubscriptionGetDouble"; + case 141: return "_wrap_helicsSubscriptionGetComplex"; + case 142: return "_wrap_helicsSubscriptionGetVectorSize"; + case 143: return "_wrap_helicsSubscriptionGetVector"; + case 144: return "_wrap_helicsSubscriptionGetNamedPoint"; + case 145: return "_wrap_helicsSubscriptionSetDefaultRaw"; + case 146: return "_wrap_helicsSubscriptionSetDefaultString"; + case 147: return "_wrap_helicsSubscriptionSetDefaultInteger"; + case 148: return "_wrap_helicsSubscriptionSetDefaultBoolean"; + case 149: return "_wrap_helicsSubscriptionSetDefaultDouble"; + case 150: return "_wrap_helicsSubscriptionSetDefaultComplex"; + case 151: return "_wrap_helicsSubscriptionSetDefaultVector"; + case 152: return "_wrap_helicsSubscriptionSetDefaultNamedPoint"; + case 153: return "_wrap_helicsSubscriptionGetType"; + case 154: return "_wrap_helicsPublicationGetType"; + case 155: return "_wrap_helicsSubscriptionGetKey"; + case 156: return "_wrap_helicsPublicationGetKey"; + case 157: return "_wrap_helicsSubscriptionGetUnits"; + case 158: return "_wrap_helicsPublicationGetUnits"; + case 159: return "_wrap_helicsSubscriptionIsUpdated"; + case 160: return "_wrap_helicsSubscriptionLastUpdateTime"; + case 161: return "_wrap_helicsFederateGetPublicationCount"; + case 162: return "_wrap_helicsFederateGetSubscriptionCount"; + case 163: return "_wrap_helicsFederateRegisterEndpoint"; + case 164: return "_wrap_helicsFederateRegisterGlobalEndpoint"; + case 165: return "_wrap_helicsEndpointSetDefaultDestination"; + case 166: return "_wrap_helicsEndpointSendMessageRaw"; + case 167: return "_wrap_helicsEndpointSendEventRaw"; + case 168: return "_wrap_helicsEndpointSendMessage"; + case 169: return "_wrap_helicsEndpointSubscribe"; + case 170: return "_wrap_helicsFederateHasMessage"; + case 171: return "_wrap_helicsEndpointHasMessage"; + case 172: return "_wrap_helicsFederateReceiveCount"; + case 173: return "_wrap_helicsEndpointReceiveCount"; + case 174: return "_wrap_helicsEndpointGetMessage"; + case 175: return "_wrap_helicsFederateGetMessage"; + case 176: return "_wrap_helicsEndpointGetType"; + case 177: return "_wrap_helicsEndpointGetName"; + case 178: return "_wrap_helicsFederateGetEndpointCount"; + case 179: return "_wrap_helicsFederateRegisterSourceFilter"; + case 180: return "_wrap_helicsFederateRegisterDestinationFilter"; + case 181: return "_wrap_helicsFederateRegisterCloningFilter"; + case 182: return "_wrap_helicsCoreRegisterSourceFilter"; + case 183: return "_wrap_helicsCoreRegisterDestinationFilter"; + case 184: return "_wrap_helicsCoreRegisterCloningFilter"; + case 185: return "_wrap_helicsFilterGetTarget"; + case 186: return "_wrap_helicsFilterGetName"; + case 187: return "_wrap_helicsFilterSet"; + case 188: return "_wrap_helicsFilterSetString"; + case 189: return "_wrap_helicsFilterAddDestinationTarget"; + case 190: return "_wrap_helicsFilterAddSourceTarget"; + case 191: return "_wrap_helicsFilterAddDeliveryEndpoint"; + case 192: return "_wrap_helicsFilterRemoveDestinationTarget"; + case 193: return "_wrap_helicsFilterRemoveSourceTarget"; + case 194: return "_wrap_helicsFilterRemoveDeliveryEndpoint"; default: return 0; } } @@ -8225,157 +8322,161 @@ void mexFunction(int resc, mxArray *resv[], int argc, const mxArray *argv[]) { case 37: flag=_wrap_helicsCreateBrokerFromArgs(resc,resv,argc,(mxArray**)(argv)); break; case 38: flag=_wrap_helicsBrokerClone(resc,resv,argc,(mxArray**)(argv)); break; case 39: flag=_wrap_helicsBrokerIsConnected(resc,resv,argc,(mxArray**)(argv)); break; - case 40: flag=_wrap_helicsCoreIsConnected(resc,resv,argc,(mxArray**)(argv)); break; - case 41: flag=_wrap_helicsBrokerGetIdentifier(resc,resv,argc,(mxArray**)(argv)); break; - case 42: flag=_wrap_helicsCoreGetIdentifier(resc,resv,argc,(mxArray**)(argv)); break; - case 43: flag=_wrap_helicsBrokerGetAddress(resc,resv,argc,(mxArray**)(argv)); break; - case 44: flag=_wrap_helicsCoreSetReadyToInit(resc,resv,argc,(mxArray**)(argv)); break; - case 45: flag=_wrap_helicsCoreDisconnect(resc,resv,argc,(mxArray**)(argv)); break; - case 46: flag=_wrap_helicsGetFederateByName(resc,resv,argc,(mxArray**)(argv)); break; - case 47: flag=_wrap_helicsBrokerDisconnect(resc,resv,argc,(mxArray**)(argv)); break; - case 48: flag=_wrap_helicsCoreFree(resc,resv,argc,(mxArray**)(argv)); break; - case 49: flag=_wrap_helicsBrokerFree(resc,resv,argc,(mxArray**)(argv)); break; - case 50: flag=_wrap_helicsCreateValueFederate(resc,resv,argc,(mxArray**)(argv)); break; - case 51: flag=_wrap_helicsCreateValueFederateFromJson(resc,resv,argc,(mxArray**)(argv)); break; - case 52: flag=_wrap_helicsCreateMessageFederate(resc,resv,argc,(mxArray**)(argv)); break; - case 53: flag=_wrap_helicsCreateMessageFederateFromJson(resc,resv,argc,(mxArray**)(argv)); break; - case 54: flag=_wrap_helicsCreateCombinationFederate(resc,resv,argc,(mxArray**)(argv)); break; - case 55: flag=_wrap_helicsCreateCombinationFederateFromJson(resc,resv,argc,(mxArray**)(argv)); break; - case 56: flag=_wrap_helicsFederateClone(resc,resv,argc,(mxArray**)(argv)); break; - case 57: flag=_wrap_helicsFederateInfoCreate(resc,resv,argc,(mxArray**)(argv)); break; - case 58: flag=_wrap_helicsFederateInfoLoadFromArgs(resc,resv,argc,(mxArray**)(argv)); break; - case 59: flag=_wrap_helicsFederateInfoFree(resc,resv,argc,(mxArray**)(argv)); break; - case 60: flag=_wrap_helicsFederateInfoSetFederateName(resc,resv,argc,(mxArray**)(argv)); break; - case 61: flag=_wrap_helicsFederateInfoSetCoreName(resc,resv,argc,(mxArray**)(argv)); break; - case 62: flag=_wrap_helicsFederateInfoSetCoreInitString(resc,resv,argc,(mxArray**)(argv)); break; - case 63: flag=_wrap_helicsFederateInfoSetCoreTypeFromString(resc,resv,argc,(mxArray**)(argv)); break; - case 64: flag=_wrap_helicsFederateInfoSetCoreType(resc,resv,argc,(mxArray**)(argv)); break; - case 65: flag=_wrap_helicsFederateInfoSetFlag(resc,resv,argc,(mxArray**)(argv)); break; - case 66: flag=_wrap_helicsFederateInfoSetSeparator(resc,resv,argc,(mxArray**)(argv)); break; - case 67: flag=_wrap_helicsFederateInfoSetOutputDelay(resc,resv,argc,(mxArray**)(argv)); break; - case 68: flag=_wrap_helicsFederateInfoSetTimeDelta(resc,resv,argc,(mxArray**)(argv)); break; - case 69: flag=_wrap_helicsFederateInfoSetInputDelay(resc,resv,argc,(mxArray**)(argv)); break; - case 70: flag=_wrap_helicsFederateInfoSetTimeOffset(resc,resv,argc,(mxArray**)(argv)); break; - case 71: flag=_wrap_helicsFederateInfoSetPeriod(resc,resv,argc,(mxArray**)(argv)); break; - case 72: flag=_wrap_helicsFederateInfoSetMaxIterations(resc,resv,argc,(mxArray**)(argv)); break; - case 73: flag=_wrap_helicsFederateInfoSetLoggingLevel(resc,resv,argc,(mxArray**)(argv)); break; - case 74: flag=_wrap_helicsFederateFinalize(resc,resv,argc,(mxArray**)(argv)); break; - case 75: flag=_wrap_helicsFederateFree(resc,resv,argc,(mxArray**)(argv)); break; - case 76: flag=_wrap_helicsCloseLibrary(resc,resv,argc,(mxArray**)(argv)); break; - case 77: flag=_wrap_helicsFederateEnterInitializationMode(resc,resv,argc,(mxArray**)(argv)); break; - case 78: flag=_wrap_helicsFederateEnterInitializationModeAsync(resc,resv,argc,(mxArray**)(argv)); break; - case 79: flag=_wrap_helicsFederateIsAsyncOperationCompleted(resc,resv,argc,(mxArray**)(argv)); break; - case 80: flag=_wrap_helicsFederateEnterInitializationModeComplete(resc,resv,argc,(mxArray**)(argv)); break; - case 81: flag=_wrap_helicsFederateEnterExecutionMode(resc,resv,argc,(mxArray**)(argv)); break; - case 82: flag=_wrap_helicsFederateEnterExecutionModeAsync(resc,resv,argc,(mxArray**)(argv)); break; - case 83: flag=_wrap_helicsFederateEnterExecutionModeComplete(resc,resv,argc,(mxArray**)(argv)); break; - case 84: flag=_wrap_helicsFederateEnterExecutionModeIterative(resc,resv,argc,(mxArray**)(argv)); break; - case 85: flag=_wrap_helicsFederateEnterExecutionModeIterativeAsync(resc,resv,argc,(mxArray**)(argv)); break; - case 86: flag=_wrap_helicsFederateEnterExecutionModeIterativeComplete(resc,resv,argc,(mxArray**)(argv)); break; - case 87: flag=_wrap_helicsFederateGetState(resc,resv,argc,(mxArray**)(argv)); break; - case 88: flag=_wrap_helicsFederateGetCoreObject(resc,resv,argc,(mxArray**)(argv)); break; - case 89: flag=_wrap_helicsFederateRequestTime(resc,resv,argc,(mxArray**)(argv)); break; - case 90: flag=_wrap_helicsFederateRequestTimeIterative(resc,resv,argc,(mxArray**)(argv)); break; - case 91: flag=_wrap_helicsFederateRequestTimeAsync(resc,resv,argc,(mxArray**)(argv)); break; - case 92: flag=_wrap_helicsFederateRequestTimeComplete(resc,resv,argc,(mxArray**)(argv)); break; - case 93: flag=_wrap_helicsFederateRequestTimeIterativeAsync(resc,resv,argc,(mxArray**)(argv)); break; - case 94: flag=_wrap_helicsFederateRequestTimeIterativeComplete(resc,resv,argc,(mxArray**)(argv)); break; - case 95: flag=_wrap_helicsFederateGetName(resc,resv,argc,(mxArray**)(argv)); break; - case 96: flag=_wrap_helicsFederateSetTimeDelta(resc,resv,argc,(mxArray**)(argv)); break; - case 97: flag=_wrap_helicsFederateSetOutputDelay(resc,resv,argc,(mxArray**)(argv)); break; - case 98: flag=_wrap_helicsFederateSetInputDelay(resc,resv,argc,(mxArray**)(argv)); break; - case 99: flag=_wrap_helicsFederateSetPeriod(resc,resv,argc,(mxArray**)(argv)); break; - case 100: flag=_wrap_helicsFederateSetFlag(resc,resv,argc,(mxArray**)(argv)); break; - case 101: flag=_wrap_helicsFederateSetSeparator(resc,resv,argc,(mxArray**)(argv)); break; - case 102: flag=_wrap_helicsFederateSetLoggingLevel(resc,resv,argc,(mxArray**)(argv)); break; - case 103: flag=_wrap_helicsFederateSetMaxIterations(resc,resv,argc,(mxArray**)(argv)); break; - case 104: flag=_wrap_helicsFederateGetCurrentTime(resc,resv,argc,(mxArray**)(argv)); break; - case 105: flag=_wrap_helicsCreateQuery(resc,resv,argc,(mxArray**)(argv)); break; - case 106: flag=_wrap_helicsQueryExecute(resc,resv,argc,(mxArray**)(argv)); break; - case 107: flag=_wrap_helicsQueryCoreExecute(resc,resv,argc,(mxArray**)(argv)); break; - case 108: flag=_wrap_helicsQueryBrokerExecute(resc,resv,argc,(mxArray**)(argv)); break; - case 109: flag=_wrap_helicsQueryExecuteAsync(resc,resv,argc,(mxArray**)(argv)); break; - case 110: flag=_wrap_helicsQueryExecuteComplete(resc,resv,argc,(mxArray**)(argv)); break; - case 111: flag=_wrap_helicsQueryIsCompleted(resc,resv,argc,(mxArray**)(argv)); break; - case 112: flag=_wrap_helicsQueryFree(resc,resv,argc,(mxArray**)(argv)); break; - case 113: flag=_wrap_helicsCleanupHelicsLibrary(resc,resv,argc,(mxArray**)(argv)); break; - case 114: flag=_wrap_helicsFederateRegisterSubscription(resc,resv,argc,(mxArray**)(argv)); break; - case 115: flag=_wrap_helicsFederateRegisterTypeSubscription(resc,resv,argc,(mxArray**)(argv)); break; - case 116: flag=_wrap_helicsFederateRegisterOptionalSubscription(resc,resv,argc,(mxArray**)(argv)); break; - case 117: flag=_wrap_helicsFederateRegisterOptionalTypeSubscription(resc,resv,argc,(mxArray**)(argv)); break; - case 118: flag=_wrap_helicsFederateRegisterPublication(resc,resv,argc,(mxArray**)(argv)); break; - case 119: flag=_wrap_helicsFederateRegisterTypePublication(resc,resv,argc,(mxArray**)(argv)); break; - case 120: flag=_wrap_helicsFederateRegisterGlobalPublication(resc,resv,argc,(mxArray**)(argv)); break; - case 121: flag=_wrap_helicsFederateRegisterGlobalTypePublication(resc,resv,argc,(mxArray**)(argv)); break; - case 122: flag=_wrap_helicsPublicationPublishRaw(resc,resv,argc,(mxArray**)(argv)); break; - case 123: flag=_wrap_helicsPublicationPublishString(resc,resv,argc,(mxArray**)(argv)); break; - case 124: flag=_wrap_helicsPublicationPublishInteger(resc,resv,argc,(mxArray**)(argv)); break; - case 125: flag=_wrap_helicsPublicationPublishBoolean(resc,resv,argc,(mxArray**)(argv)); break; - case 126: flag=_wrap_helicsPublicationPublishDouble(resc,resv,argc,(mxArray**)(argv)); break; - case 127: flag=_wrap_helicsPublicationPublishComplex(resc,resv,argc,(mxArray**)(argv)); break; - case 128: flag=_wrap_helicsPublicationPublishVector(resc,resv,argc,(mxArray**)(argv)); break; - case 129: flag=_wrap_helicsPublicationPublishNamedPoint(resc,resv,argc,(mxArray**)(argv)); break; - case 130: flag=_wrap_helicsSubscriptionGetValueSize(resc,resv,argc,(mxArray**)(argv)); break; - case 131: flag=_wrap_helicsSubscriptionGetRawValue(resc,resv,argc,(mxArray**)(argv)); break; - case 132: flag=_wrap_helicsSubscriptionGetStringSize(resc,resv,argc,(mxArray**)(argv)); break; - case 133: flag=_wrap_helicsSubscriptionGetString(resc,resv,argc,(mxArray**)(argv)); break; - case 134: flag=_wrap_helicsSubscriptionGetInteger(resc,resv,argc,(mxArray**)(argv)); break; - case 135: flag=_wrap_helicsSubscriptionGetBoolean(resc,resv,argc,(mxArray**)(argv)); break; - case 136: flag=_wrap_helicsSubscriptionGetDouble(resc,resv,argc,(mxArray**)(argv)); break; - case 137: flag=_wrap_helicsSubscriptionGetComplex(resc,resv,argc,(mxArray**)(argv)); break; - case 138: flag=_wrap_helicsSubscriptionGetVectorSize(resc,resv,argc,(mxArray**)(argv)); break; - case 139: flag=_wrap_helicsSubscriptionGetVector(resc,resv,argc,(mxArray**)(argv)); break; - case 140: flag=_wrap_helicsSubscriptionGetNamedPoint(resc,resv,argc,(mxArray**)(argv)); break; - case 141: flag=_wrap_helicsSubscriptionSetDefaultRaw(resc,resv,argc,(mxArray**)(argv)); break; - case 142: flag=_wrap_helicsSubscriptionSetDefaultString(resc,resv,argc,(mxArray**)(argv)); break; - case 143: flag=_wrap_helicsSubscriptionSetDefaultInteger(resc,resv,argc,(mxArray**)(argv)); break; - case 144: flag=_wrap_helicsSubscriptionSetDefaultBoolean(resc,resv,argc,(mxArray**)(argv)); break; - case 145: flag=_wrap_helicsSubscriptionSetDefaultDouble(resc,resv,argc,(mxArray**)(argv)); break; - case 146: flag=_wrap_helicsSubscriptionSetDefaultComplex(resc,resv,argc,(mxArray**)(argv)); break; - case 147: flag=_wrap_helicsSubscriptionSetDefaultVector(resc,resv,argc,(mxArray**)(argv)); break; - case 148: flag=_wrap_helicsSubscriptionSetDefaultNamedPoint(resc,resv,argc,(mxArray**)(argv)); break; - case 149: flag=_wrap_helicsSubscriptionGetType(resc,resv,argc,(mxArray**)(argv)); break; - case 150: flag=_wrap_helicsPublicationGetType(resc,resv,argc,(mxArray**)(argv)); break; - case 151: flag=_wrap_helicsSubscriptionGetKey(resc,resv,argc,(mxArray**)(argv)); break; - case 152: flag=_wrap_helicsPublicationGetKey(resc,resv,argc,(mxArray**)(argv)); break; - case 153: flag=_wrap_helicsSubscriptionGetUnits(resc,resv,argc,(mxArray**)(argv)); break; - case 154: flag=_wrap_helicsPublicationGetUnits(resc,resv,argc,(mxArray**)(argv)); break; - case 155: flag=_wrap_helicsSubscriptionIsUpdated(resc,resv,argc,(mxArray**)(argv)); break; - case 156: flag=_wrap_helicsSubscriptionLastUpdateTime(resc,resv,argc,(mxArray**)(argv)); break; - case 157: flag=_wrap_helicsFederateGetPublicationCount(resc,resv,argc,(mxArray**)(argv)); break; - case 158: flag=_wrap_helicsFederateGetSubscriptionCount(resc,resv,argc,(mxArray**)(argv)); break; - case 159: flag=_wrap_helicsFederateRegisterEndpoint(resc,resv,argc,(mxArray**)(argv)); break; - case 160: flag=_wrap_helicsFederateRegisterGlobalEndpoint(resc,resv,argc,(mxArray**)(argv)); break; - case 161: flag=_wrap_helicsEndpointSetDefaultDestination(resc,resv,argc,(mxArray**)(argv)); break; - case 162: flag=_wrap_helicsEndpointSendMessageRaw(resc,resv,argc,(mxArray**)(argv)); break; - case 163: flag=_wrap_helicsEndpointSendEventRaw(resc,resv,argc,(mxArray**)(argv)); break; - case 164: flag=_wrap_helicsEndpointSendMessage(resc,resv,argc,(mxArray**)(argv)); break; - case 165: flag=_wrap_helicsEndpointSubscribe(resc,resv,argc,(mxArray**)(argv)); break; - case 166: flag=_wrap_helicsFederateHasMessage(resc,resv,argc,(mxArray**)(argv)); break; - case 167: flag=_wrap_helicsEndpointHasMessage(resc,resv,argc,(mxArray**)(argv)); break; - case 168: flag=_wrap_helicsFederateReceiveCount(resc,resv,argc,(mxArray**)(argv)); break; - case 169: flag=_wrap_helicsEndpointReceiveCount(resc,resv,argc,(mxArray**)(argv)); break; - case 170: flag=_wrap_helicsEndpointGetMessage(resc,resv,argc,(mxArray**)(argv)); break; - case 171: flag=_wrap_helicsFederateGetMessage(resc,resv,argc,(mxArray**)(argv)); break; - case 172: flag=_wrap_helicsEndpointGetType(resc,resv,argc,(mxArray**)(argv)); break; - case 173: flag=_wrap_helicsEndpointGetName(resc,resv,argc,(mxArray**)(argv)); break; - case 174: flag=_wrap_helicsFederateGetEndpointCount(resc,resv,argc,(mxArray**)(argv)); break; - case 175: flag=_wrap_helicsFederateRegisterSourceFilter(resc,resv,argc,(mxArray**)(argv)); break; - case 176: flag=_wrap_helicsFederateRegisterDestinationFilter(resc,resv,argc,(mxArray**)(argv)); break; - case 177: flag=_wrap_helicsFederateRegisterCloningFilter(resc,resv,argc,(mxArray**)(argv)); break; - case 178: flag=_wrap_helicsCoreRegisterSourceFilter(resc,resv,argc,(mxArray**)(argv)); break; - case 179: flag=_wrap_helicsCoreRegisterDestinationFilter(resc,resv,argc,(mxArray**)(argv)); break; - case 180: flag=_wrap_helicsCoreRegisterCloningFilter(resc,resv,argc,(mxArray**)(argv)); break; - case 181: flag=_wrap_helicsFilterGetTarget(resc,resv,argc,(mxArray**)(argv)); break; - case 182: flag=_wrap_helicsFilterGetName(resc,resv,argc,(mxArray**)(argv)); break; - case 183: flag=_wrap_helicsFilterSet(resc,resv,argc,(mxArray**)(argv)); break; - case 184: flag=_wrap_helicsFilterSetString(resc,resv,argc,(mxArray**)(argv)); break; - case 185: flag=_wrap_helicsFilterAddDestinationTarget(resc,resv,argc,(mxArray**)(argv)); break; - case 186: flag=_wrap_helicsFilterAddSourceTarget(resc,resv,argc,(mxArray**)(argv)); break; - case 187: flag=_wrap_helicsFilterAddDeliveryEndpoint(resc,resv,argc,(mxArray**)(argv)); break; - case 188: flag=_wrap_helicsFilterRemoveDestinationTarget(resc,resv,argc,(mxArray**)(argv)); break; - case 189: flag=_wrap_helicsFilterRemoveSourceTarget(resc,resv,argc,(mxArray**)(argv)); break; - case 190: flag=_wrap_helicsFilterRemoveDeliveryEndpoint(resc,resv,argc,(mxArray**)(argv)); break; + case 40: flag=_wrap_helicsBrokerWaitForDisconnect(resc,resv,argc,(mxArray**)(argv)); break; + case 41: flag=_wrap_helicsCoreIsConnected(resc,resv,argc,(mxArray**)(argv)); break; + case 42: flag=_wrap_helicsBrokerGetIdentifier(resc,resv,argc,(mxArray**)(argv)); break; + case 43: flag=_wrap_helicsCoreGetIdentifier(resc,resv,argc,(mxArray**)(argv)); break; + case 44: flag=_wrap_helicsBrokerGetAddress(resc,resv,argc,(mxArray**)(argv)); break; + case 45: flag=_wrap_helicsCoreSetReadyToInit(resc,resv,argc,(mxArray**)(argv)); break; + case 46: flag=_wrap_helicsCoreDisconnect(resc,resv,argc,(mxArray**)(argv)); break; + case 47: flag=_wrap_helicsGetFederateByName(resc,resv,argc,(mxArray**)(argv)); break; + case 48: flag=_wrap_helicsBrokerDisconnect(resc,resv,argc,(mxArray**)(argv)); break; + case 49: flag=_wrap_helicsDestroyFederate(resc,resv,argc,(mxArray**)(argv)); break; + case 50: flag=_wrap_helicsDestroyBroker(resc,resv,argc,(mxArray**)(argv)); break; + case 51: flag=_wrap_helicsDestroyCore(resc,resv,argc,(mxArray**)(argv)); break; + case 52: flag=_wrap_helicsCoreFree(resc,resv,argc,(mxArray**)(argv)); break; + case 53: flag=_wrap_helicsBrokerFree(resc,resv,argc,(mxArray**)(argv)); break; + case 54: flag=_wrap_helicsCreateValueFederate(resc,resv,argc,(mxArray**)(argv)); break; + case 55: flag=_wrap_helicsCreateValueFederateFromJson(resc,resv,argc,(mxArray**)(argv)); break; + case 56: flag=_wrap_helicsCreateMessageFederate(resc,resv,argc,(mxArray**)(argv)); break; + case 57: flag=_wrap_helicsCreateMessageFederateFromJson(resc,resv,argc,(mxArray**)(argv)); break; + case 58: flag=_wrap_helicsCreateCombinationFederate(resc,resv,argc,(mxArray**)(argv)); break; + case 59: flag=_wrap_helicsCreateCombinationFederateFromJson(resc,resv,argc,(mxArray**)(argv)); break; + case 60: flag=_wrap_helicsFederateClone(resc,resv,argc,(mxArray**)(argv)); break; + case 61: flag=_wrap_helicsFederateInfoCreate(resc,resv,argc,(mxArray**)(argv)); break; + case 62: flag=_wrap_helicsFederateInfoLoadFromArgs(resc,resv,argc,(mxArray**)(argv)); break; + case 63: flag=_wrap_helicsFederateInfoFree(resc,resv,argc,(mxArray**)(argv)); break; + case 64: flag=_wrap_helicsFederateInfoSetFederateName(resc,resv,argc,(mxArray**)(argv)); break; + case 65: flag=_wrap_helicsFederateInfoSetCoreName(resc,resv,argc,(mxArray**)(argv)); break; + case 66: flag=_wrap_helicsFederateInfoSetCoreInitString(resc,resv,argc,(mxArray**)(argv)); break; + case 67: flag=_wrap_helicsFederateInfoSetCoreTypeFromString(resc,resv,argc,(mxArray**)(argv)); break; + case 68: flag=_wrap_helicsFederateInfoSetCoreType(resc,resv,argc,(mxArray**)(argv)); break; + case 69: flag=_wrap_helicsFederateInfoSetFlag(resc,resv,argc,(mxArray**)(argv)); break; + case 70: flag=_wrap_helicsFederateInfoSetSeparator(resc,resv,argc,(mxArray**)(argv)); break; + case 71: flag=_wrap_helicsFederateInfoSetOutputDelay(resc,resv,argc,(mxArray**)(argv)); break; + case 72: flag=_wrap_helicsFederateInfoSetTimeDelta(resc,resv,argc,(mxArray**)(argv)); break; + case 73: flag=_wrap_helicsFederateInfoSetInputDelay(resc,resv,argc,(mxArray**)(argv)); break; + case 74: flag=_wrap_helicsFederateInfoSetTimeOffset(resc,resv,argc,(mxArray**)(argv)); break; + case 75: flag=_wrap_helicsFederateInfoSetPeriod(resc,resv,argc,(mxArray**)(argv)); break; + case 76: flag=_wrap_helicsFederateInfoSetMaxIterations(resc,resv,argc,(mxArray**)(argv)); break; + case 77: flag=_wrap_helicsFederateInfoSetLoggingLevel(resc,resv,argc,(mxArray**)(argv)); break; + case 78: flag=_wrap_helicsFederateFinalize(resc,resv,argc,(mxArray**)(argv)); break; + case 79: flag=_wrap_helicsFederateFree(resc,resv,argc,(mxArray**)(argv)); break; + case 80: flag=_wrap_helicsCloseLibrary(resc,resv,argc,(mxArray**)(argv)); break; + case 81: flag=_wrap_helicsFederateEnterInitializationMode(resc,resv,argc,(mxArray**)(argv)); break; + case 82: flag=_wrap_helicsFederateEnterInitializationModeAsync(resc,resv,argc,(mxArray**)(argv)); break; + case 83: flag=_wrap_helicsFederateIsAsyncOperationCompleted(resc,resv,argc,(mxArray**)(argv)); break; + case 84: flag=_wrap_helicsFederateEnterInitializationModeComplete(resc,resv,argc,(mxArray**)(argv)); break; + case 85: flag=_wrap_helicsFederateEnterExecutionMode(resc,resv,argc,(mxArray**)(argv)); break; + case 86: flag=_wrap_helicsFederateEnterExecutionModeAsync(resc,resv,argc,(mxArray**)(argv)); break; + case 87: flag=_wrap_helicsFederateEnterExecutionModeComplete(resc,resv,argc,(mxArray**)(argv)); break; + case 88: flag=_wrap_helicsFederateEnterExecutionModeIterative(resc,resv,argc,(mxArray**)(argv)); break; + case 89: flag=_wrap_helicsFederateEnterExecutionModeIterativeAsync(resc,resv,argc,(mxArray**)(argv)); break; + case 90: flag=_wrap_helicsFederateEnterExecutionModeIterativeComplete(resc,resv,argc,(mxArray**)(argv)); break; + case 91: flag=_wrap_helicsFederateGetState(resc,resv,argc,(mxArray**)(argv)); break; + case 92: flag=_wrap_helicsFederateGetCoreObject(resc,resv,argc,(mxArray**)(argv)); break; + case 93: flag=_wrap_helicsFederateRequestTime(resc,resv,argc,(mxArray**)(argv)); break; + case 94: flag=_wrap_helicsFederateRequestTimeIterative(resc,resv,argc,(mxArray**)(argv)); break; + case 95: flag=_wrap_helicsFederateRequestTimeAsync(resc,resv,argc,(mxArray**)(argv)); break; + case 96: flag=_wrap_helicsFederateRequestTimeComplete(resc,resv,argc,(mxArray**)(argv)); break; + case 97: flag=_wrap_helicsFederateRequestTimeIterativeAsync(resc,resv,argc,(mxArray**)(argv)); break; + case 98: flag=_wrap_helicsFederateRequestTimeIterativeComplete(resc,resv,argc,(mxArray**)(argv)); break; + case 99: flag=_wrap_helicsFederateGetName(resc,resv,argc,(mxArray**)(argv)); break; + case 100: flag=_wrap_helicsFederateSetTimeDelta(resc,resv,argc,(mxArray**)(argv)); break; + case 101: flag=_wrap_helicsFederateSetOutputDelay(resc,resv,argc,(mxArray**)(argv)); break; + case 102: flag=_wrap_helicsFederateSetInputDelay(resc,resv,argc,(mxArray**)(argv)); break; + case 103: flag=_wrap_helicsFederateSetPeriod(resc,resv,argc,(mxArray**)(argv)); break; + case 104: flag=_wrap_helicsFederateSetFlag(resc,resv,argc,(mxArray**)(argv)); break; + case 105: flag=_wrap_helicsFederateSetSeparator(resc,resv,argc,(mxArray**)(argv)); break; + case 106: flag=_wrap_helicsFederateSetLoggingLevel(resc,resv,argc,(mxArray**)(argv)); break; + case 107: flag=_wrap_helicsFederateSetMaxIterations(resc,resv,argc,(mxArray**)(argv)); break; + case 108: flag=_wrap_helicsFederateGetCurrentTime(resc,resv,argc,(mxArray**)(argv)); break; + case 109: flag=_wrap_helicsCreateQuery(resc,resv,argc,(mxArray**)(argv)); break; + case 110: flag=_wrap_helicsQueryExecute(resc,resv,argc,(mxArray**)(argv)); break; + case 111: flag=_wrap_helicsQueryCoreExecute(resc,resv,argc,(mxArray**)(argv)); break; + case 112: flag=_wrap_helicsQueryBrokerExecute(resc,resv,argc,(mxArray**)(argv)); break; + case 113: flag=_wrap_helicsQueryExecuteAsync(resc,resv,argc,(mxArray**)(argv)); break; + case 114: flag=_wrap_helicsQueryExecuteComplete(resc,resv,argc,(mxArray**)(argv)); break; + case 115: flag=_wrap_helicsQueryIsCompleted(resc,resv,argc,(mxArray**)(argv)); break; + case 116: flag=_wrap_helicsQueryFree(resc,resv,argc,(mxArray**)(argv)); break; + case 117: flag=_wrap_helicsCleanupHelicsLibrary(resc,resv,argc,(mxArray**)(argv)); break; + case 118: flag=_wrap_helicsFederateRegisterSubscription(resc,resv,argc,(mxArray**)(argv)); break; + case 119: flag=_wrap_helicsFederateRegisterTypeSubscription(resc,resv,argc,(mxArray**)(argv)); break; + case 120: flag=_wrap_helicsFederateRegisterOptionalSubscription(resc,resv,argc,(mxArray**)(argv)); break; + case 121: flag=_wrap_helicsFederateRegisterOptionalTypeSubscription(resc,resv,argc,(mxArray**)(argv)); break; + case 122: flag=_wrap_helicsFederateRegisterPublication(resc,resv,argc,(mxArray**)(argv)); break; + case 123: flag=_wrap_helicsFederateRegisterTypePublication(resc,resv,argc,(mxArray**)(argv)); break; + case 124: flag=_wrap_helicsFederateRegisterGlobalPublication(resc,resv,argc,(mxArray**)(argv)); break; + case 125: flag=_wrap_helicsFederateRegisterGlobalTypePublication(resc,resv,argc,(mxArray**)(argv)); break; + case 126: flag=_wrap_helicsPublicationPublishRaw(resc,resv,argc,(mxArray**)(argv)); break; + case 127: flag=_wrap_helicsPublicationPublishString(resc,resv,argc,(mxArray**)(argv)); break; + case 128: flag=_wrap_helicsPublicationPublishInteger(resc,resv,argc,(mxArray**)(argv)); break; + case 129: flag=_wrap_helicsPublicationPublishBoolean(resc,resv,argc,(mxArray**)(argv)); break; + case 130: flag=_wrap_helicsPublicationPublishDouble(resc,resv,argc,(mxArray**)(argv)); break; + case 131: flag=_wrap_helicsPublicationPublishComplex(resc,resv,argc,(mxArray**)(argv)); break; + case 132: flag=_wrap_helicsPublicationPublishVector(resc,resv,argc,(mxArray**)(argv)); break; + case 133: flag=_wrap_helicsPublicationPublishNamedPoint(resc,resv,argc,(mxArray**)(argv)); break; + case 134: flag=_wrap_helicsSubscriptionGetValueSize(resc,resv,argc,(mxArray**)(argv)); break; + case 135: flag=_wrap_helicsSubscriptionGetRawValue(resc,resv,argc,(mxArray**)(argv)); break; + case 136: flag=_wrap_helicsSubscriptionGetStringSize(resc,resv,argc,(mxArray**)(argv)); break; + case 137: flag=_wrap_helicsSubscriptionGetString(resc,resv,argc,(mxArray**)(argv)); break; + case 138: flag=_wrap_helicsSubscriptionGetInteger(resc,resv,argc,(mxArray**)(argv)); break; + case 139: flag=_wrap_helicsSubscriptionGetBoolean(resc,resv,argc,(mxArray**)(argv)); break; + case 140: flag=_wrap_helicsSubscriptionGetDouble(resc,resv,argc,(mxArray**)(argv)); break; + case 141: flag=_wrap_helicsSubscriptionGetComplex(resc,resv,argc,(mxArray**)(argv)); break; + case 142: flag=_wrap_helicsSubscriptionGetVectorSize(resc,resv,argc,(mxArray**)(argv)); break; + case 143: flag=_wrap_helicsSubscriptionGetVector(resc,resv,argc,(mxArray**)(argv)); break; + case 144: flag=_wrap_helicsSubscriptionGetNamedPoint(resc,resv,argc,(mxArray**)(argv)); break; + case 145: flag=_wrap_helicsSubscriptionSetDefaultRaw(resc,resv,argc,(mxArray**)(argv)); break; + case 146: flag=_wrap_helicsSubscriptionSetDefaultString(resc,resv,argc,(mxArray**)(argv)); break; + case 147: flag=_wrap_helicsSubscriptionSetDefaultInteger(resc,resv,argc,(mxArray**)(argv)); break; + case 148: flag=_wrap_helicsSubscriptionSetDefaultBoolean(resc,resv,argc,(mxArray**)(argv)); break; + case 149: flag=_wrap_helicsSubscriptionSetDefaultDouble(resc,resv,argc,(mxArray**)(argv)); break; + case 150: flag=_wrap_helicsSubscriptionSetDefaultComplex(resc,resv,argc,(mxArray**)(argv)); break; + case 151: flag=_wrap_helicsSubscriptionSetDefaultVector(resc,resv,argc,(mxArray**)(argv)); break; + case 152: flag=_wrap_helicsSubscriptionSetDefaultNamedPoint(resc,resv,argc,(mxArray**)(argv)); break; + case 153: flag=_wrap_helicsSubscriptionGetType(resc,resv,argc,(mxArray**)(argv)); break; + case 154: flag=_wrap_helicsPublicationGetType(resc,resv,argc,(mxArray**)(argv)); break; + case 155: flag=_wrap_helicsSubscriptionGetKey(resc,resv,argc,(mxArray**)(argv)); break; + case 156: flag=_wrap_helicsPublicationGetKey(resc,resv,argc,(mxArray**)(argv)); break; + case 157: flag=_wrap_helicsSubscriptionGetUnits(resc,resv,argc,(mxArray**)(argv)); break; + case 158: flag=_wrap_helicsPublicationGetUnits(resc,resv,argc,(mxArray**)(argv)); break; + case 159: flag=_wrap_helicsSubscriptionIsUpdated(resc,resv,argc,(mxArray**)(argv)); break; + case 160: flag=_wrap_helicsSubscriptionLastUpdateTime(resc,resv,argc,(mxArray**)(argv)); break; + case 161: flag=_wrap_helicsFederateGetPublicationCount(resc,resv,argc,(mxArray**)(argv)); break; + case 162: flag=_wrap_helicsFederateGetSubscriptionCount(resc,resv,argc,(mxArray**)(argv)); break; + case 163: flag=_wrap_helicsFederateRegisterEndpoint(resc,resv,argc,(mxArray**)(argv)); break; + case 164: flag=_wrap_helicsFederateRegisterGlobalEndpoint(resc,resv,argc,(mxArray**)(argv)); break; + case 165: flag=_wrap_helicsEndpointSetDefaultDestination(resc,resv,argc,(mxArray**)(argv)); break; + case 166: flag=_wrap_helicsEndpointSendMessageRaw(resc,resv,argc,(mxArray**)(argv)); break; + case 167: flag=_wrap_helicsEndpointSendEventRaw(resc,resv,argc,(mxArray**)(argv)); break; + case 168: flag=_wrap_helicsEndpointSendMessage(resc,resv,argc,(mxArray**)(argv)); break; + case 169: flag=_wrap_helicsEndpointSubscribe(resc,resv,argc,(mxArray**)(argv)); break; + case 170: flag=_wrap_helicsFederateHasMessage(resc,resv,argc,(mxArray**)(argv)); break; + case 171: flag=_wrap_helicsEndpointHasMessage(resc,resv,argc,(mxArray**)(argv)); break; + case 172: flag=_wrap_helicsFederateReceiveCount(resc,resv,argc,(mxArray**)(argv)); break; + case 173: flag=_wrap_helicsEndpointReceiveCount(resc,resv,argc,(mxArray**)(argv)); break; + case 174: flag=_wrap_helicsEndpointGetMessage(resc,resv,argc,(mxArray**)(argv)); break; + case 175: flag=_wrap_helicsFederateGetMessage(resc,resv,argc,(mxArray**)(argv)); break; + case 176: flag=_wrap_helicsEndpointGetType(resc,resv,argc,(mxArray**)(argv)); break; + case 177: flag=_wrap_helicsEndpointGetName(resc,resv,argc,(mxArray**)(argv)); break; + case 178: flag=_wrap_helicsFederateGetEndpointCount(resc,resv,argc,(mxArray**)(argv)); break; + case 179: flag=_wrap_helicsFederateRegisterSourceFilter(resc,resv,argc,(mxArray**)(argv)); break; + case 180: flag=_wrap_helicsFederateRegisterDestinationFilter(resc,resv,argc,(mxArray**)(argv)); break; + case 181: flag=_wrap_helicsFederateRegisterCloningFilter(resc,resv,argc,(mxArray**)(argv)); break; + case 182: flag=_wrap_helicsCoreRegisterSourceFilter(resc,resv,argc,(mxArray**)(argv)); break; + case 183: flag=_wrap_helicsCoreRegisterDestinationFilter(resc,resv,argc,(mxArray**)(argv)); break; + case 184: flag=_wrap_helicsCoreRegisterCloningFilter(resc,resv,argc,(mxArray**)(argv)); break; + case 185: flag=_wrap_helicsFilterGetTarget(resc,resv,argc,(mxArray**)(argv)); break; + case 186: flag=_wrap_helicsFilterGetName(resc,resv,argc,(mxArray**)(argv)); break; + case 187: flag=_wrap_helicsFilterSet(resc,resv,argc,(mxArray**)(argv)); break; + case 188: flag=_wrap_helicsFilterSetString(resc,resv,argc,(mxArray**)(argv)); break; + case 189: flag=_wrap_helicsFilterAddDestinationTarget(resc,resv,argc,(mxArray**)(argv)); break; + case 190: flag=_wrap_helicsFilterAddSourceTarget(resc,resv,argc,(mxArray**)(argv)); break; + case 191: flag=_wrap_helicsFilterAddDeliveryEndpoint(resc,resv,argc,(mxArray**)(argv)); break; + case 192: flag=_wrap_helicsFilterRemoveDestinationTarget(resc,resv,argc,(mxArray**)(argv)); break; + case 193: flag=_wrap_helicsFilterRemoveSourceTarget(resc,resv,argc,(mxArray**)(argv)); break; + case 194: flag=_wrap_helicsFilterRemoveDeliveryEndpoint(resc,resv,argc,(mxArray**)(argv)); break; default: flag=1, SWIG_Error(SWIG_RuntimeError, "No function id %d.", fcn_id); } if (flag) { diff --git a/swig/python/helics.py b/swig/python/helics.py index fbfc2cde8e..11b5380019 100644 --- a/swig/python/helics.py +++ b/swig/python/helics.py @@ -387,6 +387,10 @@ def helicsBrokerIsConnected(broker: 'helics_broker') -> "int": """ return _helics.helicsBrokerIsConnected(broker) +def helicsBrokerWaitForDisconnect(broker: 'helics_broker', msToWait: 'int') -> "helics_status": + return _helics.helicsBrokerWaitForDisconnect(broker, msToWait) +helicsBrokerWaitForDisconnect = _helics.helicsBrokerWaitForDisconnect + def helicsCoreIsConnected(core: 'helics_core') -> "int": """ @@ -516,6 +520,18 @@ def helicsBrokerDisconnect(broker: 'helics_broker') -> "helics_status": """ return _helics.helicsBrokerDisconnect(broker) +def helicsDestroyFederate(fed: 'helics_federate') -> "void": + return _helics.helicsDestroyFederate(fed) +helicsDestroyFederate = _helics.helicsDestroyFederate + +def helicsDestroyBroker(broker: 'helics_broker') -> "void": + return _helics.helicsDestroyBroker(broker) +helicsDestroyBroker = _helics.helicsDestroyBroker + +def helicsDestroyCore(core: 'helics_core') -> "void": + return _helics.helicsDestroyCore(core) +helicsDestroyCore = _helics.helicsDestroyCore + def helicsCoreFree(core: 'helics_core') -> "void": """ @@ -555,7 +571,7 @@ def helicsCreateValueFederate(fi: 'helics_federate_info_t const') -> "helics_fed """ return _helics.helicsCreateValueFederate(fi) -def helicsCreateValueFederateFromJson(json: 'char const *') -> "helics_federate": +def helicsCreateValueFederateFromJson(JSON: 'char const *') -> "helics_federate": """ @@ -575,7 +591,7 @@ def helicsCreateValueFederateFromJson(json: 'char const *') -> "helics_federate" an opaque value federate object """ - return _helics.helicsCreateValueFederateFromJson(json) + return _helics.helicsCreateValueFederateFromJson(JSON) def helicsCreateMessageFederate(fi: 'helics_federate_info_t const') -> "helics_federate": """ @@ -598,7 +614,7 @@ def helicsCreateMessageFederate(fi: 'helics_federate_info_t const') -> "helics_f """ return _helics.helicsCreateMessageFederate(fi) -def helicsCreateMessageFederateFromJson(json: 'char const *') -> "helics_federate": +def helicsCreateMessageFederateFromJson(JSON: 'char const *') -> "helics_federate": """ @@ -618,7 +634,7 @@ def helicsCreateMessageFederateFromJson(json: 'char const *') -> "helics_federat an opaque message federate object """ - return _helics.helicsCreateMessageFederateFromJson(json) + return _helics.helicsCreateMessageFederateFromJson(JSON) def helicsCreateCombinationFederate(fi: 'helics_federate_info_t const') -> "helics_federate": """ @@ -642,7 +658,7 @@ def helicsCreateCombinationFederate(fi: 'helics_federate_info_t const') -> "heli """ return _helics.helicsCreateCombinationFederate(fi) -def helicsCreateCombinationFederateFromJson(json: 'char const *') -> "helics_federate": +def helicsCreateCombinationFederateFromJson(JSON: 'char const *') -> "helics_federate": """ @@ -663,7 +679,7 @@ def helicsCreateCombinationFederateFromJson(json: 'char const *') -> "helics_fed an opaque combination federate object """ - return _helics.helicsCreateCombinationFederateFromJson(json) + return _helics.helicsCreateCombinationFederateFromJson(JSON) def helicsFederateClone(fed: 'helics_federate') -> "helics_federate": return _helics.helicsFederateClone(fed) diff --git a/swig/python/helics_wrap.c b/swig/python/helics_wrap.c index 436ee9b9c7..581af20e30 100644 --- a/swig/python/helics_wrap.c +++ b/swig/python/helics_wrap.c @@ -4448,6 +4448,35 @@ SWIGINTERN PyObject *_wrap_helicsBrokerIsConnected(PyObject *SWIGUNUSEDPARM(self } +SWIGINTERN PyObject *_wrap_helicsBrokerWaitForDisconnect(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + helics_broker arg1 = (helics_broker) 0 ; + int arg2 ; + int res1 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + helics_status result; + + if (!PyArg_ParseTuple(args,(char *)"OO:helicsBrokerWaitForDisconnect",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0,SWIG_as_voidptrptr(&arg1), 0, 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsBrokerWaitForDisconnect" "', argument " "1"" of type '" "helics_broker""'"); + } + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsBrokerWaitForDisconnect" "', argument " "2"" of type '" "int""'"); + } + arg2 = (int)(val2); + result = (helics_status)helicsBrokerWaitForDisconnect(arg1,arg2); + resultobj = SWIG_From_int((int)(result)); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_helicsCoreIsConnected(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; helics_core arg1 = (helics_core) 0 ; @@ -4661,6 +4690,63 @@ SWIGINTERN PyObject *_wrap_helicsBrokerDisconnect(PyObject *SWIGUNUSEDPARM(self) } +SWIGINTERN PyObject *_wrap_helicsDestroyFederate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + helics_federate arg1 = (helics_federate) 0 ; + int res1 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:helicsDestroyFederate",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0,SWIG_as_voidptrptr(&arg1), 0, 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsDestroyFederate" "', argument " "1"" of type '" "helics_federate""'"); + } + helicsDestroyFederate(arg1); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_helicsDestroyBroker(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + helics_broker arg1 = (helics_broker) 0 ; + int res1 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:helicsDestroyBroker",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0,SWIG_as_voidptrptr(&arg1), 0, 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsDestroyBroker" "', argument " "1"" of type '" "helics_broker""'"); + } + helicsDestroyBroker(arg1); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_helicsDestroyCore(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + helics_core arg1 = (helics_core) 0 ; + int res1 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:helicsDestroyCore",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0,SWIG_as_voidptrptr(&arg1), 0, 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsDestroyCore" "', argument " "1"" of type '" "helics_core""'"); + } + helicsDestroyCore(arg1); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_helicsCoreFree(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; helics_core arg1 = (helics_core) 0 ; @@ -9516,6 +9602,7 @@ static PyMethodDef SwigMethods[] = { "else if it is connected\n" "\n" ""}, + { (char *)"helicsBrokerWaitForDisconnect", _wrap_helicsBrokerWaitForDisconnect, METH_VARARGS, NULL}, { (char *)"helicsCoreIsConnected", _wrap_helicsCoreIsConnected, METH_VARARGS, (char *)"\n" "\n" "\n" @@ -9621,6 +9708,9 @@ static PyMethodDef SwigMethods[] = { "a helics_status enumeration indicating any error condition\n" "\n" ""}, + { (char *)"helicsDestroyFederate", _wrap_helicsDestroyFederate, METH_VARARGS, NULL}, + { (char *)"helicsDestroyBroker", _wrap_helicsDestroyBroker, METH_VARARGS, NULL}, + { (char *)"helicsDestroyCore", _wrap_helicsDestroyCore, METH_VARARGS, NULL}, { (char *)"helicsCoreFree", _wrap_helicsCoreFree, METH_VARARGS, (char *)"\n" "\n" "\n" diff --git a/tests/helics/application_api/FederateTests.cpp b/tests/helics/application_api/FederateTests.cpp index e735617986..d0fce2316e 100644 --- a/tests/helics/application_api/FederateTests.cpp +++ b/tests/helics/application_api/FederateTests.cpp @@ -90,11 +90,11 @@ BOOST_AUTO_TEST_CASE (federate_broker_disconnect_test) res = Fed->requestTime (3.0); BOOST_CHECK_EQUAL (res, 3.0); brk->disconnect (); - std::this_thread::sleep_for (std::chrono::seconds (5)); + std::this_thread::sleep_for (std::chrono::seconds (2)); auto cptr = Fed->getCorePointer (); BOOST_CHECK (!cptr->isConnected ()); - BOOST_CHECK_THROW (res = Fed->requestTime (4.0), helics::FunctionExecutionFailure); - BOOST_CHECK (Fed->getCurrentState () == helics::Federate::op_states::error); + BOOST_CHECK_THROW (res = Fed->requestTime (4.0), helics::HelicsTerminated); + BOOST_CHECK (Fed->getCurrentState () == helics::Federate::op_states::finalize); } BOOST_AUTO_TEST_CASE (federate_bad_broker_error_zmq) diff --git a/tests/helics/application_api/FilterTests.cpp b/tests/helics/application_api/FilterTests.cpp index 947fdfbf6c..7746c23f37 100644 --- a/tests/helics/application_api/FilterTests.cpp +++ b/tests/helics/application_api/FilterTests.cpp @@ -50,7 +50,7 @@ BOOST_DATA_TEST_CASE (message_filter_registration, bdata::make (core_types_all), /** test a filter operator The filter operator delays the message by 2.5 seconds meaning it should arrive by 3 sec into the simulation */ -BOOST_DATA_TEST_CASE (message_filter_function, bdata::make (core_types_all), core_type) +BOOST_DATA_TEST_CASE (message_filter_function, bdata::make (ztypes), core_type) { auto broker = AddBroker (core_type, 2); AddFederates (core_type, 1, broker, 1.0, "filter"); @@ -90,7 +90,7 @@ BOOST_DATA_TEST_CASE (message_filter_function, bdata::make (core_types_all), cor fFed->requestTimeAsync (3.0); /*auto retTime = */ mFed->requestTime (3.0); - + BOOST_REQUIRE (mFed->hasMessage (p2)); auto m2 = mFed->getMessage (p2); @@ -110,8 +110,6 @@ BOOST_DATA_TEST_CASE (message_filter_function, bdata::make (core_types_all), cor /** test a filter operator The filter operator delays the message by 2.5 seconds meaning it should arrive by 3 sec into the simulation */ - - BOOST_DATA_TEST_CASE (message_filter_object, bdata::make (core_types), core_type) { auto broker = AddBroker (core_type, 2); @@ -340,9 +338,14 @@ BOOST_DATA_TEST_CASE (message_dest_filter_object, bdata::make (core_types), core mFed->requestTime (3.0); fFed->requestTimeComplete (); + auto filterCore = fFed->getCorePointer (); + auto mCore = mFed->getCorePointer (); mFed->finalize (); fFed->finalize (); BOOST_CHECK (fFed->getCurrentState () == helics::Federate::op_states::finalize); + helics::cleanupHelicsLibrary (); + BOOST_CHECK (!filterCore->isConnected ()); + BOOST_CHECK (!mCore->isConnected ()); } /** test a filter operator @@ -418,10 +421,15 @@ BOOST_DATA_TEST_CASE (message_filter_function_two_stage, bdata::make (core_types fFed->requestTimeComplete (); fFed2->requestTimeComplete (); + auto filterCore = fFed->getCorePointer (); + auto mCore = mFed->getCorePointer (); mFed->finalize (); fFed->finalize (); fFed2->finalize (); BOOST_CHECK (fFed->getCurrentState () == helics::Federate::op_states::finalize); + helics::cleanupHelicsLibrary (); + BOOST_CHECK (!filterCore->isConnected ()); + BOOST_CHECK (!mCore->isConnected ()); } /** test a filter operator @@ -496,10 +504,15 @@ BOOST_DATA_TEST_CASE (message_filter_function_two_stage_object, bdata::make (cor fFed->requestTimeComplete (); fFed2->requestTimeComplete (); + auto filterCore = fFed->getCorePointer (); + auto mCore = mFed->getCorePointer (); mFed->finalize (); fFed->finalize (); fFed2->finalize (); BOOST_CHECK (fFed->getCurrentState () == helics::Federate::op_states::finalize); + helics::cleanupHelicsLibrary (); + BOOST_CHECK (!filterCore->isConnected ()); + BOOST_CHECK (!mCore->isConnected ()); } /** test two filter operators The filter operator delays the message by 2.5 seconds meaning it should arrive by 3 sec into the simulation @@ -737,4 +750,68 @@ BOOST_AUTO_TEST_CASE (message_multi_clone_test) BOOST_CHECK (sFed->getCurrentState () == helics::Federate::op_states::finalize); } + +/** test whether a core termination when it should +*/ + +BOOST_DATA_TEST_CASE (test_filter_core_termination, bdata::make (core_types_2), core_type) +{ + auto broker = AddBroker (core_type, 2); + AddFederates (core_type, 1, broker, 1.0, "filter"); + AddFederates (core_type, 1, broker, 1.0, "message"); + + auto fFed = GetFederateAs (0); + auto mFed = GetFederateAs (1); + + auto p1 = mFed->registerGlobalEndpoint ("port1"); + auto p2 = mFed->registerGlobalEndpoint ("port2"); + + auto c2 = fFed->getCorePointer (); + auto f1 = c2->registerSourceFilter ("filter1", "port1",std::string(),std::string()); + auto timeOperator = std::make_shared (); + timeOperator->setTimeFunction ([](helics::Time time_in) { return time_in + 2.5; }); + c2->setFilterOperator (f1, timeOperator); + + fFed->enterExecutionStateAsync (); + mFed->enterExecutionState (); + fFed->enterExecutionStateComplete (); + + BOOST_CHECK (fFed->getCurrentState () == helics::Federate::op_states::execution); + helics::data_block data (500, 'a'); + mFed->sendMessage (p1, "port2", data); + + mFed->requestTimeAsync (1.0); + fFed->requestTime (1.0); + mFed->requestTimeComplete (); + fFed->finalize (); + auto res = mFed->hasMessage (); + BOOST_CHECK (!res); + + mFed->requestTime(2.0); + BOOST_REQUIRE (!mFed->hasMessage (p2)); + BOOST_CHECK (c2->isConnected ()); + mFed->requestTime (3.0); + mFed->sendMessage (p1, "port2", data); + BOOST_REQUIRE (mFed->hasMessage (p2)); + + auto m2 = mFed->getMessage (p2); + BOOST_CHECK_EQUAL (m2->source, "port1"); + BOOST_CHECK_EQUAL (m2->original_source, "port1"); + BOOST_CHECK_EQUAL (m2->dest, "port2"); + BOOST_CHECK_EQUAL (m2->data.size (), data.size ()); + BOOST_CHECK_EQUAL (m2->time, 2.5); + + mFed->requestTime (4.0); + BOOST_CHECK (!mFed->hasMessage (p2)); + mFed->requestTime (6.0); + BOOST_CHECK (mFed->hasMessage (p2)); + mFed->finalize (); + std::this_thread::sleep_for (std::chrono::milliseconds (200)); + if (c2->isConnected()) + { + std::this_thread::sleep_for (std::chrono::milliseconds (400)); + } + BOOST_CHECK (!c2->isConnected ()); + BOOST_CHECK (fFed->getCurrentState () == helics::Federate::op_states::finalize); +} BOOST_AUTO_TEST_SUITE_END () diff --git a/tests/helics/application_api/MessageFederateAdditionalTests.cpp b/tests/helics/application_api/MessageFederateAdditionalTests.cpp index a85a669666..4f33ea624a 100644 --- a/tests/helics/application_api/MessageFederateAdditionalTests.cpp +++ b/tests/helics/application_api/MessageFederateAdditionalTests.cpp @@ -33,6 +33,7 @@ BOOST_DATA_TEST_CASE (message_federate_initialize_tests, bdata::make (core_types BOOST_CHECK (mFed1->getCurrentState () == helics::Federate::op_states::execution); mFed1->finalize (); + std::this_thread::sleep_for(std::chrono::milliseconds(100)); BOOST_CHECK (mFed1->getCurrentState () == helics::Federate::op_states::finalize); } @@ -202,7 +203,7 @@ BOOST_DATA_TEST_CASE (message_federate_send_receive_callback_obj2, bdata::make ( auto mend = [&](const helics::Endpoint *ept, helics::Time rtime) { rxend = ept->getID (); timeRx = rtime; - }; + }; ep2.setCallback (mend); @@ -218,6 +219,7 @@ BOOST_DATA_TEST_CASE (message_federate_send_receive_callback_obj2, bdata::make ( auto time = mFed1->requestTime (1.0); BOOST_CHECK_EQUAL (time, 1.0); + auto res = ep2.hasMessage (); BOOST_CHECK (res); res = ep1.hasMessage (); @@ -442,10 +444,10 @@ BOOST_DATA_TEST_CASE (threefedPingPong, bdata::make (core_types), core_type) } AddBroker (core_type, "3"); - auto ctype = helics::coreTypeFromString (core_type); - PingPongFed p1 ("fedA", 0.5, ctype); - PingPongFed p2 ("fedB", 0.5, ctype); - PingPongFed p3 ("fedC", 0.5, ctype); + auto crtype = helics::coreTypeFromString (core_type); + PingPongFed p1 ("fedA", 0.5, crtype); + PingPongFed p2 ("fedB", 0.5, crtype); + PingPongFed p3 ("fedC", 0.5, crtype); p1.addTrigger (0.5, "fedB/port"); p1.addTrigger (0.5, "fedC/port"); diff --git a/tests/helics/application_api/ValueFederateKeyTests.cpp b/tests/helics/application_api/ValueFederateKeyTests.cpp index ff29dd1271..b28aeb3ff9 100644 --- a/tests/helics/application_api/ValueFederateKeyTests.cpp +++ b/tests/helics/application_api/ValueFederateKeyTests.cpp @@ -30,6 +30,7 @@ BOOST_DATA_TEST_CASE (value_federate_subscriber_and_publisher_registration, bdata::make (core_types_single), core_type) { + std::this_thread::sleep_for(std::chrono::milliseconds(100)); using namespace helics; SetupTest (core_type, 1); auto vFed1 = GetFederateAs (0); diff --git a/tests/helics/application_api/testFixtures.cpp b/tests/helics/application_api/testFixtures.cpp index 50157cc1dd..dc42251cdf 100644 --- a/tests/helics/application_api/testFixtures.cpp +++ b/tests/helics/application_api/testFixtures.cpp @@ -9,6 +9,7 @@ All rights reserved. See LICENSE file and DISCLAIMER for more details. #include "helics/core/BrokerFactory.hpp" #include "helics/core/CoreFactory.hpp" #include +#include bool hasIndexCode (const std::string &type_name) { @@ -26,14 +27,25 @@ int getIndexCode (const std::string &type_name) { return static_cast (type_ auto StartBrokerImp (const std::string &core_type_name, const std::string &initialization_string) { + helics::core_type type; if (hasIndexCode (core_type_name)) { std::string new_type (core_type_name.begin (), core_type_name.end () - 2); - auto core_type = helics::coreTypeFromString (new_type); - return helics::BrokerFactory::create (core_type, initialization_string); + type = helics::coreTypeFromString (new_type); } - auto core_type = helics::coreTypeFromString (core_type_name); - return helics::BrokerFactory::create (core_type, initialization_string); + else + { + type = helics::coreTypeFromString(core_type_name); + } + if (type == helics::core_type::TCP) + { + return helics::BrokerFactory::create(type, initialization_string+" --reuse_address"); + } + else + { + return helics::BrokerFactory::create(type, initialization_string); + } + } bool FederateTestFixture::hasIndexCode (const std::string &type_name) @@ -56,15 +68,24 @@ int FederateTestFixture::getIndexCode (const std::string &type_name) auto FederateTestFixture::AddBrokerImp (const std::string &core_type_name, const std::string &initialization_string) { + helics::core_type type; if (hasIndexCode (core_type_name)) { std::string new_type (core_type_name.begin (), core_type_name.end () - 2); - auto core_type = helics::coreTypeFromString (new_type); - return helics::BrokerFactory::create (core_type, initialization_string); + type = helics::coreTypeFromString (new_type); + } + else + { + type = helics::coreTypeFromString(core_type_name); + } + if (type == helics::core_type::TCP) + { + return helics::BrokerFactory::create(type, initialization_string + " --reuse_address"); + } + else + { + return helics::BrokerFactory::create(type, initialization_string); } - - auto core_type = helics::coreTypeFromString (core_type_name); - return helics::BrokerFactory::create (core_type, initialization_string); } FederateTestFixture::~FederateTestFixture () @@ -78,8 +99,21 @@ FederateTestFixture::~FederateTestFixture () } federates.clear (); for (auto &broker : brokers) - { - broker->disconnect (); + { + if (ctype.compare(0, 3, "tcp") == 0) + { + broker->waitForDisconnect(2000); + } + else + { + broker->waitForDisconnect(200); + } + + if (broker->isConnected()) + { + std::cout << "forcing disconnect\n"; + broker->disconnect (); + } } brokers.clear (); helics::cleanupHelicsLibrary (); diff --git a/tests/helics/application_api/testFixtures.hpp b/tests/helics/application_api/testFixtures.hpp index 72d53cce80..657993824f 100644 --- a/tests/helics/application_api/testFixtures.hpp +++ b/tests/helics/application_api/testFixtures.hpp @@ -5,45 +5,51 @@ All rights reserved. See LICENSE file and DISCLAIMER for more details. */ #pragma once -#include #include "helics/application_api/Federate.hpp" #include "helics/core/BrokerFactory.hpp" -#include "helics/core/CoreFactory.hpp" #include "helics/core/Core.hpp" +#include "helics/core/CoreFactory.hpp" +#include +#include -#ifndef DISABLE_TCP_CORE #ifdef HELICS_HAVE_ZEROMQ -const std::string core_types[] = {"test", "ipc_2", "tcp", "test_2", "zmq", "udp", "test_3", "zmq_3"}; -const std::string core_types_single[] = {"test", "ipc", "tcp", "zmq", "udp", "test_3", "zmq_3", "udp_3", "tcp_3"}; -const std::string core_types_all[] = {"test", "ipc_2", "tcp", "test_2", "zmq", "udp", - "test_3", "zmq_3", "ipc", "zmq_2", "udp_2", "tcp_2", - "udp_3", "tcp_3", "test_4", "zmq_4", "udp_4", "tcp_4"}; -const std::string core_types_extended[] = {"ipc", "zmq_2", "udp_2", "tcp_2", "udp_3", - "tcp_3", "test_4", "zmq_4", "udp_4", "tcp_4"}; +#define ZMQTEST "zmq", +#define ZMQTEST2 "zmq_2", +#define ZMQTEST3 "zmq_3", +#define ZMQTEST4 "zmq_4", #else -const std::string core_types[] = {"test", "ipc_2", "tcp", "test_2", "udp", "test_3"}; -const std::string core_types_single[] = {"test", "ipc", "tcp", "udp", "test_3", "udp_3", "tcp_3"}; -const std::string core_types_all[] = {"test", "ipc_2", "tcp", "test_2", "udp", "test_3", "ipc", - "udp_2", "tcp_2", "udp_3", "tcp_3", "test_4", "udp_4", "tcp_4"}; -const std::string core_types_extended[] = {"ipc", "udp_2", "tcp_2", "udp_3", "tcp_3", "test_4", "udp_4", "tcp_4"}; +#define ZMQTEST +#define ZMQTEST2 +#define ZMQTEST3 +#define ZMQTEST4 #endif +#ifndef DISABLE_TCP_CORE +#define TCPTEST "tcp", +#define TCPTEST2 "tcp_2", +#define TCPTEST3 "tcp_3", +#define TCPTEST4 "tcp_4", #else -#ifdef HELICS_HAVE_ZEROMQ -const std::string core_types[] = {"test", "ipc_2", "test_2", "zmq", "udp", "test_3", "zmq_3"}; -const std::string core_types_single[] = {"test", "ipc", "zmq", "udp", "test_3", "zmq_3"}; -const std::string core_types_all[] = {"test", "ipc_2", "test_2", "zmq", "udp", "test_3", "zmq_3", "ipc", - "zmq_2", "udp_2", "test_3", "udp_3", "test_4", "zmq_4", "udp_4"}; -const std::string core_types_extended[] = {"ipc", "zmq_2", "udp_2", "test_3", "udp_3", "test_4", "zmq_4", "udp_4"}; -#else -const std::string core_types[] = {"test", "ipc_2", "test_2", "udp", "test_3"}; -const std::string core_types_single[] = {"test", "ipc", "udp", "test_3", "udp_3"}; -const std::string core_types_all[] = {"test", "ipc_2", "test_2", "udp", "test_3", "ipc", - "udp_2", "test_3", "udp_3", "test_4", "udp_4"}; -const std::string core_types_extended[] = {"ipc", "udp_2", "test_3", "udp_3", "test_4", "udp_4"}; -#endif +#define TCPTEST +#define TCPTEST2 +#define TCPTEST3 +#define TCPTEST4 #endif +const std::string ztypes[] = {ZMQTEST ZMQTEST2 ZMQTEST3 ZMQTEST4}; +const std::string core_types[] = {"test", ZMQTEST3 "ipc_2", TCPTEST "test_2", ZMQTEST "udp", "test_3"}; + +const std::string core_types_2[] = {"ipc_2", TCPTEST2 "test_2", ZMQTEST2 "udp_2"}; + +const std::string core_types_simple[] = {"test", "ipc", TCPTEST ZMQTEST "udp"}; +const std::string core_types_single[] = {"test", "ipc", TCPTEST ZMQTEST "udp", "test_3", + ZMQTEST3 TCPTEST3 "udp_3"}; +const std::string core_types_all[] = { + "test", "ipc_2", TCPTEST "test_2", ZMQTEST "udp", "test_3", + ZMQTEST3 "ipc", ZMQTEST2 "udp_2", TCPTEST2 "udp_3", TCPTEST3 "test_4", ZMQTEST4 TCPTEST4 "udp_4"}; +const std::string core_types_extended[] = {"ipc", ZMQTEST2 "udp_2", TCPTEST2 "udp_3", TCPTEST3 "test_4", + ZMQTEST4 TCPTEST4 "udp_4"}; + const std::string defaultNamePrefix = "fed"; struct FederateTestFixture @@ -61,7 +67,19 @@ struct FederateTestFixture helics::Time time_delta = helics::timeZero, const std::string &name_prefix = defaultNamePrefix) { + ctype = core_type_name; auto broker = AddBroker (core_type_name, count); + if (!broker->isConnected ()) + { + broker->disconnect (); + broker = nullptr; + helics::cleanupHelicsLibrary (); + broker = AddBroker (core_type_name, count); + if (!broker->isConnected ()) + { + throw (std::runtime_error ("Unable to connect rootbroker")); + } + } AddFederates (core_type_name, count, broker, time_delta, name_prefix); } @@ -134,6 +152,10 @@ struct FederateTestFixture case 3: { auto subbroker = AddBroker (core_type_name, initString + " --federates " + std::to_string (count)); + if (!subbroker->isConnected ()) + { + throw (std::runtime_error ("Unable to connect subbroker")); + } auto newTypeString = core_type_name; newTypeString.push_back ('_'); newTypeString.push_back ('2'); @@ -151,6 +173,10 @@ struct FederateTestFixture for (int ii = 0; ii < count; ++ii) { auto subbroker = AddBroker (core_type_name, initString + " --federates 1"); + if (!subbroker->isConnected ()) + { + throw (std::runtime_error ("Unable to connect subbroker(mode 4)")); + } AddFederates (newTypeString, 1, subbroker, time_delta, name_prefix); } } @@ -190,6 +216,10 @@ struct FederateTestFixture int fedcnt = (ii > count - 3) ? 4 : (count - ii); auto subbroker = AddBroker (core_type_name, initString + " --federates " + std::to_string (fedcnt)); + if (!subbroker->isConnected ()) + { + throw (std::runtime_error ("Unable to connect subbroker(mode 4)")); + } AddFederates (newTypeString, fedcnt, subbroker, time_delta, name_prefix); } } @@ -202,6 +232,10 @@ struct FederateTestFixture for (int ii = 0; ii < count; ++ii) { auto subbroker = AddBroker (core_type_name, initString + " --federates 1"); + if (!subbroker->isConnected ()) + { + throw (std::runtime_error ("Unable to connect subbroker(mode 4)")); + } AddFederates (newTypeString, 1, subbroker, time_delta, name_prefix); } } @@ -221,6 +255,7 @@ struct FederateTestFixture std::vector> federates; std::string extraCoreArgs; std::string extraBrokerArgs; + std::string ctype; private: bool hasIndexCode (const std::string &type_name); diff --git a/tests/helics/core/TcpCore-tests.cpp b/tests/helics/core/TcpCore-tests.cpp index d92a60a27c..92c4094f8b 100644 --- a/tests/helics/core/TcpCore-tests.cpp +++ b/tests/helics/core/TcpCore-tests.cpp @@ -30,14 +30,16 @@ using boost::asio::ip::tcp; using helics::Core; #define TCP_BROKER_PORT 24160 +#define TCP_BROKER_PORT_STRING "24160" #define TCP_SECONDARY_PORT 24180 BOOST_AUTO_TEST_CASE (test_tcpServerConnections1) { std::atomic counter{0}; - std::string host = "localhost"; + std::string host = "127.0.0.1"; auto srv = AsioServiceManager::getServicePointer (); - auto server = helics::tcp::TcpServer::create (srv->getBaseService (), TCP_BROKER_PORT); + auto server = helics::tcp::TcpServer::create (srv->getBaseService (), host,TCP_BROKER_PORT); + BOOST_REQUIRE (server->isReady ()); auto serviceLoop = srv->runServiceLoop (); std::vector data (1024); std::atomic validData{true}; @@ -72,15 +74,18 @@ BOOST_AUTO_TEST_CASE (test_tcpServerConnections1) auto conn2 = helics::tcp::TcpConnection::create (srv->getBaseService (), host, "24160", 1024); auto conn3 = helics::tcp::TcpConnection::create (srv->getBaseService (), host, "24160", 1024); auto conn4 = helics::tcp::TcpConnection::create (srv->getBaseService (), host, "24160", 1024); - + BOOST_REQUIRE (conn1); + BOOST_REQUIRE (conn2); + BOOST_REQUIRE (conn3); + BOOST_REQUIRE (conn4); auto res = conn1->waitUntilConnected (1000); - BOOST_CHECK_EQUAL (res, 0); + BOOST_CHECK_EQUAL (res, true); res = conn2->waitUntilConnected (1000); - BOOST_CHECK_EQUAL (res, 0); + BOOST_CHECK_EQUAL (res, true); res = conn3->waitUntilConnected (1000); - BOOST_CHECK_EQUAL (res, 0); + BOOST_CHECK_EQUAL (res, true); res = conn4->waitUntilConnected (1000); - BOOST_CHECK_EQUAL (res, 0); + BOOST_CHECK_EQUAL (res, true); auto transmitFunc = [](helics::tcp::TcpConnection::pointer obj) { std::vector dataB (20); @@ -170,7 +175,7 @@ BOOST_AUTO_TEST_CASE (tcpComms_broker_test_transmit) helics::tcp::TcpComms comm (host, host); auto srv = AsioServiceManager::getServicePointer (); - auto server = helics::tcp::TcpServer::create (srv->getBaseService (), TCP_BROKER_PORT); + auto server = helics::tcp::TcpServer::create (srv->getBaseService (), host,TCP_BROKER_PORT); srv->runServiceLoop (); std::vector data (1024); server->setDataCall ( @@ -180,6 +185,7 @@ BOOST_AUTO_TEST_CASE (tcpComms_broker_test_transmit) ++counter; return data_Size; }); + BOOST_REQUIRE (server->isReady ()); server->start (); comm.setCallback ([](helics::ActionMessage /*m*/) {}); @@ -218,12 +224,12 @@ BOOST_AUTO_TEST_CASE (tcpComms_rx_test) std::atomic CommCounter{0}; std::atomic len{0}; helics::ActionMessage act; - std::string host = "localhost"; + std::string host = "127.0.0.1"; helics::tcp::TcpComms comm (host, host); std::mutex actguard; auto srv = AsioServiceManager::getServicePointer (); - auto server = helics::tcp::TcpServer::create (srv->getBaseService (), TCP_BROKER_PORT); + auto server = helics::tcp::TcpServer::create (srv->getBaseService (),host, TCP_BROKER_PORT_STRING); srv->runServiceLoop (); std::vector data (1024); server->setDataCall ([&data, &ServerCounter, &len](helics::tcp::TcpRxConnection::pointer, const char *data_rec, @@ -233,6 +239,7 @@ BOOST_AUTO_TEST_CASE (tcpComms_rx_test) ++ServerCounter; return data_Size; }); + BOOST_REQUIRE (server->isReady ()); server->start (); comm.setCallback ([&CommCounter, &act, &actguard](helics::ActionMessage m) { @@ -249,7 +256,7 @@ BOOST_AUTO_TEST_CASE (tcpComms_rx_test) auto txconn = helics::tcp::TcpConnection::create (srv->getBaseService (), host, "24180", 1024); auto res = txconn->waitUntilConnected (1000); - BOOST_REQUIRE_EQUAL (res, 0); + BOOST_REQUIRE_EQUAL (res, true); BOOST_REQUIRE (txconn->isConnected ()); @@ -280,10 +287,10 @@ BOOST_AUTO_TEST_CASE (tcpComm_transmit_through) helics::tcp::TcpComms comm (host, host); helics::tcp::TcpComms comm2 (host, std::string ()); - comm.setBrokerPort (TCP_BROKER_PORT); + comm.setBrokerPort (TCP_BROKER_PORT+1); comm.setName ("tests"); comm2.setName ("test2"); - comm2.setPortNumber (TCP_BROKER_PORT); + comm2.setPortNumber (TCP_BROKER_PORT+1); comm.setPortNumber (TCP_SECONDARY_PORT); comm.setCallback ([&counter, &act](helics::ActionMessage m) { @@ -334,13 +341,13 @@ BOOST_AUTO_TEST_CASE (tcpComm_transmit_add_route) helics::tcp::TcpComms comm2 (host, ""); helics::tcp::TcpComms comm3 (host, host); - comm.setBrokerPort (TCP_BROKER_PORT); + comm.setBrokerPort (TCP_BROKER_PORT+2); comm.setName ("tests"); comm2.setName ("broker"); comm3.setName ("test3"); - comm3.setBrokerPort (TCP_BROKER_PORT); + comm3.setBrokerPort (TCP_BROKER_PORT+2); - comm2.setPortNumber (TCP_BROKER_PORT); + comm2.setPortNumber (TCP_BROKER_PORT+2); comm.setPortNumber (TCP_SECONDARY_PORT); comm3.setPortNumber (23920); @@ -421,7 +428,7 @@ BOOST_AUTO_TEST_CASE (tcpCore_initialization_test) BOOST_CHECK (core->isInitialized ()); auto srv = AsioServiceManager::getServicePointer (); - auto server = helics::tcp::TcpServer::create (srv->getBaseService (), TCP_BROKER_PORT); + auto server = helics::tcp::TcpServer::create (srv->getBaseService (),"localhost", TCP_BROKER_PORT); srv->runServiceLoop (); std::vector data (1024); std::atomic len{0}; diff --git a/tests/helics/core/UdpCore-tests.cpp b/tests/helics/core/UdpCore-tests.cpp index 8057bd92ce..6ade05a9a5 100644 --- a/tests/helics/core/UdpCore-tests.cpp +++ b/tests/helics/core/UdpCore-tests.cpp @@ -22,7 +22,7 @@ All rights reserved. See LICENSE file and DISCLAIMER for more details. namespace utf = boost::unit_test; -BOOST_AUTO_TEST_SUITE (UDPCore_tests, *utf::label("ci")) +BOOST_AUTO_TEST_SUITE (UdpCore_tests, *utf::label("ci")) using boost::asio::ip::udp; using helics::Core; diff --git a/tests/helics/core/ZeromqCore-tests.cpp b/tests/helics/core/ZeromqCore-tests.cpp index 00300f20cc..64cbbf21e9 100644 --- a/tests/helics/core/ZeromqCore-tests.cpp +++ b/tests/helics/core/ZeromqCore-tests.cpp @@ -448,12 +448,12 @@ BOOST_AUTO_TEST_CASE (zmqComm_transmit_add_route) }); // need to launch the connection commands at the same time since they depend on eachother in this case - // auto connected_fut = std::async(std::launch::async, [&comm] {return comm.connect(); }); + auto connected_fut = std::async(std::launch::async, [&comm] {return comm.connect(); }); bool connected = comm2.connect (); BOOST_REQUIRE (connected); - // connected = connected_fut.get(); - connected = comm.connect (); + connected = connected_fut.get(); + //connected = comm.connect (); BOOST_REQUIRE (connected); connected = comm3.connect (); @@ -486,14 +486,11 @@ BOOST_AUTO_TEST_CASE (zmqComm_transmit_add_route) comm2.transmit (3, helics::CMD_ACK); std::this_thread::yield(); - if (counter3 != 1) + while (counter3 != 1) { std::this_thread::sleep_for (std::chrono::milliseconds (200)); } - if (counter3 != 1) - { - std::this_thread::sleep_for(std::chrono::milliseconds(200)); - } + BOOST_REQUIRE_EQUAL (counter3, 1); BOOST_CHECK (act3.lock()->action () == helics::action_message_def::action_t::cmd_ack); @@ -502,14 +499,11 @@ BOOST_AUTO_TEST_CASE (zmqComm_transmit_add_route) comm2.transmit (4, helics::CMD_ACK); std::this_thread::yield(); - if (counter != 1) - { - std::this_thread::sleep_for(std::chrono::milliseconds(200)); - } - if (counter != 1) + while (counter != 1) { std::this_thread::sleep_for(std::chrono::milliseconds(200)); } + BOOST_REQUIRE_EQUAL (counter, 1); BOOST_CHECK (act.lock()->action () == helics::action_message_def::action_t::cmd_ack); diff --git a/tests/helics/shared_library/cpptestFixtures.cpp b/tests/helics/shared_library/cpptestFixtures.cpp index 5d6d4ad78c..d38f003547 100644 --- a/tests/helics/shared_library/cpptestFixtures.cpp +++ b/tests/helics/shared_library/cpptestFixtures.cpp @@ -7,8 +7,8 @@ Institute; the National Renewable Energy Laboratory, operated by the Alliance fo Lawrence Livermore National Laboratory, operated by Lawrence Livermore National Security, LLC. */ -#include "cpptestFixtures.hpp" #include "../src/helics/cpp98/Broker.hpp" +#include "cpptestFixtures.hpp" #include #include @@ -24,8 +24,12 @@ static bool hasIndexCode (const std::string &type_name) return false; } -static auto StartBrokerImp (const std::string &core_type_name, const std::string &initialization_string) +static auto StartBrokerImp (const std::string &core_type_name, std::string initialization_string) { + if (core_type_name.compare(0, 3, "tcp") == 0) + { + initialization_string += " --reuse_address"; + } if (hasIndexCode (core_type_name)) { std::string new_type (core_type_name.begin (), core_type_name.end () - 2); @@ -54,13 +58,7 @@ int FederateTestFixture_cpp::getIndexCode (const std::string &type_name) auto FederateTestFixture_cpp::AddBrokerImp (const std::string &core_type_name, const std::string &initialization_string) { - if (hasIndexCode (core_type_name)) - { - std::string new_type (core_type_name.begin (), core_type_name.end () - 2); - return std::make_shared (new_type, std::string (), initialization_string); - } - - return std::make_shared (core_type_name, std::string (), initialization_string); + return StartBrokerImp(core_type_name, initialization_string); } FederateTestFixture_cpp::~FederateTestFixture_cpp () @@ -72,9 +70,22 @@ FederateTestFixture_cpp::~FederateTestFixture_cpp () federates.clear (); for (auto &broker : brokers) { - broker->disconnect (); + if (ctype.compare(0, 3, "tcp") == 0) + { + broker->waitForDisconnect(2000); + } + else + { + broker->waitForDisconnect(200); + } + + if (broker->isConnected()) + { + + broker->disconnect(); + } } - brokers.clear (); + brokers.clear(); helicsCleanupHelicsLibrary (); } @@ -97,7 +108,7 @@ FederateTestFixture_cpp::AddBroker (const std::string &core_type_name, const std } if (broker) { - brokers.push_back(broker); + brokers.push_back (broker); } return broker; } diff --git a/tests/helics/shared_library/cpptestFixtures.hpp b/tests/helics/shared_library/cpptestFixtures.hpp index 5cabd4c5c0..1f8b2685c7 100644 --- a/tests/helics/shared_library/cpptestFixtures.hpp +++ b/tests/helics/shared_library/cpptestFixtures.hpp @@ -53,7 +53,19 @@ struct FederateTestFixture_cpp helics_time_t time_delta = helics_time_zero, const std::string &name_prefix = "fed") { + ctype = core_type_name; auto broker = AddBroker (core_type_name, count); + if (!broker->isConnected()) + { + broker->disconnect(); + broker = nullptr; + helicsCleanupHelicsLibrary(); + broker = AddBroker(core_type_name, count); + if (!broker->isConnected()) + { + throw (std::runtime_error("Unable to connect rootbroker")); + } + } AddFederates (core_type_name, count, *broker, time_delta, name_prefix); } @@ -166,7 +178,7 @@ struct FederateTestFixture_cpp std::vector> federates; std::string extraCoreArgs; std::string extraBrokerArgs; - + std::string ctype; private: bool hasIndexCode (const std::string &type_name); int getIndexCode (const std::string &type_name); diff --git a/tests/helics/shared_library/ctestFixtures.cpp b/tests/helics/shared_library/ctestFixtures.cpp index dcffe84e17..3c5d06402d 100644 --- a/tests/helics/shared_library/ctestFixtures.cpp +++ b/tests/helics/shared_library/ctestFixtures.cpp @@ -21,8 +21,12 @@ static bool hasIndexCode (const std::string &type_name) return false; } -static auto StartBrokerImp (const std::string &core_type_name, const std::string &initialization_string) +static auto StartBrokerImp (const std::string &core_type_name, std::string initialization_string) { + if (core_type_name.compare(0, 3, "tcp") == 0) + { + initialization_string += " --reuse_address"; + } if (hasIndexCode (core_type_name)) { std::string new_type (core_type_name.begin (), core_type_name.end () - 2); @@ -49,15 +53,9 @@ int FederateTestFixture::getIndexCode (const std::string &type_name) } auto FederateTestFixture::AddBrokerImp (const std::string &core_type_name, - const std::string &initialization_string) + std::string initialization_string) { - if (hasIndexCode (core_type_name)) - { - std::string new_type (core_type_name.begin (), core_type_name.end () - 2); - return helicsCreateBroker (new_type.c_str (), NULL, initialization_string.c_str ()); - } - - return helicsCreateBroker (core_type_name.c_str (), NULL, initialization_string.c_str ()); + StartBrokerImp(core_type_name, std::move(initialization_string)); } FederateTestFixture::~FederateTestFixture () @@ -81,9 +79,26 @@ FederateTestFixture::~FederateTestFixture () } } federates.clear (); + + for (auto &broker : brokers) { - helicsBrokerDisconnect (broker); + helics_status res; + if (ctype.compare(0, 3, "tcp") == 0) + { + res = helicsBrokerWaitForDisconnect(broker, 2000); + } + else + { + res = helicsBrokerWaitForDisconnect(broker, 200); + } + + if (res != helics_ok) + { + printf ("forcing disconnect\n"); + helicsBrokerDisconnect (broker); + } + helicsBrokerFree (broker); } brokers.clear (); diff --git a/tests/helics/shared_library/ctestFixtures.hpp b/tests/helics/shared_library/ctestFixtures.hpp index 1edef6e96c..c5e5e7c6ba 100644 --- a/tests/helics/shared_library/ctestFixtures.hpp +++ b/tests/helics/shared_library/ctestFixtures.hpp @@ -49,6 +49,7 @@ struct FederateTestFixture helics_time_t time_delta = helics_time_zero, const std::string &name_prefix = "fed") { + ctype = core_type_name; helics_broker broker = AddBroker (core_type_name, count); BOOST_CHECK (nullptr != broker); AddFederates (ctor, core_type_name, count, broker, time_delta, name_prefix); @@ -174,9 +175,9 @@ struct FederateTestFixture std::vector federates; std::string extraCoreArgs; std::string extraBrokerArgs; - + std::string ctype; private: bool hasIndexCode (const std::string &type_name); int getIndexCode (const std::string &type_name); - auto AddBrokerImp (const std::string &core_type_name, const std::string &initialization_string); + auto AddBrokerImp (const std::string &core_type_name, std::string initialization_string); }; diff --git a/tests/helics/shared_library/test-value-federate2.cpp b/tests/helics/shared_library/test-value-federate2.cpp index 604860e19e..b11e76f2ea 100644 --- a/tests/helics/shared_library/test-value-federate2.cpp +++ b/tests/helics/shared_library/test-value-federate2.cpp @@ -136,7 +136,7 @@ BOOST_AUTO_TEST_CASE (test_file_load) helics_federate vFed; char s[100] = ""; // fi = helicsFederateInfoCreate(); - // path of the json file is hardcoded for now + // path of the JSON file is hardcoded for now vFed = helicsCreateValueFederateFromJson (TEST_DIR "/test_files/example_value_fed.json"); BOOST_REQUIRE (vFed != nullptr); CE (helicsFederateGetName (vFed, s, 100)); diff --git a/tests/helics/shared_library/test-value-federate2_cpp.cpp b/tests/helics/shared_library/test-value-federate2_cpp.cpp index 787bd05ac6..6b58c57018 100644 --- a/tests/helics/shared_library/test-value-federate2_cpp.cpp +++ b/tests/helics/shared_library/test-value-federate2_cpp.cpp @@ -135,7 +135,7 @@ BOOST_DATA_TEST_CASE (test_async_calls, bdata::make (core_types), core_type) BOOST_AUTO_TEST_CASE (test_file_load) { // fi = helicsFederateInfoCreate(); - // path of the json file is hardcoded for now + // path of the JSON file is hardcoded for now helics98::ValueFederate vFed (TEST_DIR "/test_files/example_value_fed.json"); BOOST_REQUIRE (vFed.baseObject () != nullptr); auto s = vFed.getName (); diff --git a/tests/helics/system_tests/ErrorTests.cpp b/tests/helics/system_tests/ErrorTests.cpp index 8cc104d199..869a3778a5 100644 --- a/tests/helics/system_tests/ErrorTests.cpp +++ b/tests/helics/system_tests/ErrorTests.cpp @@ -8,16 +8,19 @@ All rights reserved. See LICENSE file and DISCLAIMER for more details. #include "helics/core/core-exceptions.hpp" #include #include +#include #include /** these test cases test out the value converters */ +#include "../application_api/testFixtures.hpp" #include "helics/application_api/MessageFederate.hpp" #include "helics/application_api/Publications.hpp" #include "helics/application_api/Subscriptions.hpp" #include namespace utf = boost::unit_test; +namespace bdata = boost::unit_test::data; BOOST_FIXTURE_TEST_SUITE (error_tests, FederateTestFixture) #define CORE_TYPE_TO_TEST helics::core_type::TEST @@ -98,6 +101,8 @@ BOOST_AUTO_TEST_CASE (duplicate_publication_names2) auto fed2 = GetFederateAs (1); fed1->registerGlobalPublication ("testkey", ""); + fed1->enterInitializationStateAsync (); + fed2->registerGlobalPublication ("testkey", ""); BOOST_CHECK_THROW (fed2->enterInitializationState (), helics::RegistrationFailure); @@ -203,4 +208,42 @@ BOOST_AUTO_TEST_CASE (missing_required_pub) broker->disconnect (); } +/** test simple creation and destruction*/ +BOOST_DATA_TEST_CASE (test_duplicate_broker_name, bdata::make (core_types_simple), core_type) +{ + auto broker = AddBroker (core_type, "1 --name=brk1"); + BOOST_CHECK (broker->isConnected ()); + BOOST_CHECK_THROW (AddBroker (core_type, "1 --name=brk1 --timeout=500"), helics::RegistrationFailure); + broker->disconnect (); + helics::cleanupHelicsLibrary (); +} + +const std::string networkCores[] = {"zmq", "tcp", "udp"}; + +/** test simple creation and destruction*/ +BOOST_DATA_TEST_CASE (test_duplicate_default_brokers, bdata::make (networkCores), core_type) +{ + auto broker = AddBroker (core_type, "1"); + auto broker2 = AddBroker (core_type, "1 --timeout=500"); + BOOST_CHECK (!broker2->isConnected ()); + broker->disconnect (); + helics::cleanupHelicsLibrary (); +} + +/** test broker recovery*/ +BOOST_DATA_TEST_CASE (test_broker_recovery, bdata::make (networkCores), core_type) +{ + auto broker = AddBroker (core_type, "1"); + BOOST_REQUIRE (broker->isConnected ()); + auto res = std::async (std::launch::async, [&broker]() { + std::this_thread::sleep_for (std::chrono::milliseconds (1400)); + broker->disconnect (); + }); + auto broker2 = AddBroker (core_type, "1 --timeout=2500"); + BOOST_CHECK (!broker->isConnected ()); + BOOST_CHECK (broker2->isConnected ()); + broker2->disconnect (); + helics::cleanupHelicsLibrary (); +} + BOOST_AUTO_TEST_SUITE_END () From 80766f2c6a8657f9c47bf81fc2c3d32ab1e8c6d2 Mon Sep 17 00:00:00 2001 From: Ryan Mast Date: Wed, 12 Sep 2018 10:14:14 -0700 Subject: [PATCH 11/16] Allow clang thread sanitizer cron build to fail (#461) * Allow clang tsan cron build to fail on Travis (issue #460) --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index e4fa3bb8f2..ae551248b0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,6 +46,7 @@ jobs: fast_finish: true allow_failures: - os: osx + - name: "Clang 4 Thread Sanitizer" include: # XCode 6.4, OS X 10.10 From 55f362e465c42eace67a141490a789bc46c4d31c Mon Sep 17 00:00:00 2001 From: Philip Top Date: Fri, 21 Sep 2018 13:09:16 -0700 Subject: [PATCH 12/16] Logging update (#464) * add logging callback to comms interfaces * try to fix some more termination issues * add logging levels to flag-definitions.h * add summary message --- src/helics/core/BrokerBase.cpp | 6 ++ src/helics/core/BrokerBase.hpp | 4 +- src/helics/core/CommonCore.cpp | 69 +++++++++++-- src/helics/core/CommonCore.hpp | 8 +- src/helics/core/CommsInterface.cpp | 98 ++++++++++++------- src/helics/core/CommsInterface.hpp | 9 ++ src/helics/core/Core.hpp | 3 + src/helics/core/CoreBroker.cpp | 57 +++++++++-- src/helics/core/CoreBroker.hpp | 4 +- src/helics/core/FederateState.cpp | 63 ++++++++---- src/helics/core/ipc/IpcComms.cpp | 35 +++---- src/helics/core/loggingHelper.hpp | 60 ++++++++---- src/helics/core/tcp/TcpComms.cpp | 24 ++--- src/helics/core/udp/UdpComms.cpp | 37 ++++--- src/helics/flag-definitions.h | 13 ++- .../matlab/+helics/HELICS_CORE_TYPE_DEFAULT.m | 2 +- .../+helics/HELICS_CORE_TYPE_INTERPROCESS.m | 2 +- swig/matlab/+helics/HELICS_CORE_TYPE_IPC.m | 2 +- swig/matlab/+helics/HELICS_CORE_TYPE_MPI.m | 2 +- swig/matlab/+helics/HELICS_CORE_TYPE_TCP.m | 2 +- swig/matlab/+helics/HELICS_CORE_TYPE_TEST.m | 2 +- swig/matlab/+helics/HELICS_CORE_TYPE_UDP.m | 2 +- swig/matlab/+helics/HELICS_CORE_TYPE_ZMQ.m | 2 +- .../matlab/+helics/HELICS_DATA_TYPE_BOOLEAN.m | 2 +- .../matlab/+helics/HELICS_DATA_TYPE_COMPLEX.m | 2 +- swig/matlab/+helics/HELICS_DATA_TYPE_DOUBLE.m | 2 +- swig/matlab/+helics/HELICS_DATA_TYPE_INT.m | 2 +- .../+helics/HELICS_DATA_TYPE_NAMEDPOINT.m | 2 +- swig/matlab/+helics/HELICS_DATA_TYPE_RAW.m | 2 +- swig/matlab/+helics/HELICS_DATA_TYPE_STRING.m | 2 +- swig/matlab/+helics/HELICS_DATA_TYPE_VECTOR.m | 2 +- swig/matlab/+helics/force_iteration.m | 2 +- swig/matlab/+helics/helics_clone_filter.m | 2 +- swig/matlab/+helics/helics_custom_filter.m | 2 +- swig/matlab/+helics/helics_delay_filter.m | 2 +- swig/matlab/+helics/helics_discard.m | 2 +- swig/matlab/+helics/helics_error.m | 2 +- swig/matlab/+helics/helics_error_state.m | 2 +- swig/matlab/+helics/helics_execution_state.m | 2 +- swig/matlab/+helics/helics_finalize_state.m | 2 +- .../+helics/helics_initialization_state.m | 2 +- swig/matlab/+helics/helics_invalid_argument.m | 2 +- .../+helics/helics_invalid_function_call.m | 2 +- swig/matlab/+helics/helics_invalid_object.m | 2 +- .../+helics/helics_invalid_state_transition.m | 2 +- swig/matlab/+helics/helics_ok.m | 2 +- .../+helics/helics_pending_exec_state.m | 2 +- .../+helics/helics_pending_init_state.m | 2 +- .../helics_pending_iterative_time_state.m | 2 +- .../+helics/helics_pending_time_state.m | 2 +- .../+helics/helics_randomDelay_filter.m | 2 +- .../matlab/+helics/helics_randomDrop_filter.m | 2 +- .../+helics/helics_registration_failure.m | 2 +- swig/matlab/+helics/helics_reroute_filter.m | 2 +- swig/matlab/+helics/helics_startup_state.m | 2 +- swig/matlab/+helics/helics_terminated.m | 2 +- swig/matlab/+helics/helics_warning.m | 2 +- swig/matlab/+helics/iterate_if_needed.m | 2 +- swig/matlab/+helics/iterating.m | 2 +- swig/matlab/+helics/iteration_error.m | 2 +- swig/matlab/+helics/iteration_halted.m | 2 +- swig/matlab/+helics/next_step.m | 2 +- swig/matlab/+helics/no_iteration.m | 2 +- swig/matlab/helicsMEX.cpp | 96 +++++++++--------- .../application_api/FilterAdditionalTests.cpp | 7 +- 65 files changed, 455 insertions(+), 234 deletions(-) diff --git a/src/helics/core/BrokerBase.cpp b/src/helics/core/BrokerBase.cpp index b9f785c59b..7df7393c12 100644 --- a/src/helics/core/BrokerBase.cpp +++ b/src/helics/core/BrokerBase.cpp @@ -75,6 +75,8 @@ static const ArgDescriptors extraArgs{ {"logfile", "the file to log message to"}, {"loglevel", ArgDescriptor::arg_type_t::int_type, "the level which to log the higher this is set to the more gets logs (-1) for no logging"}, + {"log_level", ArgDescriptor::arg_type_t::int_type, + "the level which to log the higher this is set to the more gets logs (-1) for no logging"}, {"fileloglevel", ArgDescriptor::arg_type_t::int_type, "the level at which messages get sent to the file"}, {"consoleloglevel", ArgDescriptor::arg_type_t::int_type, "the level at which message get sent to the console"}, {"minbrokers", ArgDescriptor::arg_type_t::int_type, @@ -147,6 +149,10 @@ void BrokerBase::initializeFromCmdArgs (int argc, const char *const *argv) { maxLogLevel = vm["loglevel"].as (); } + if (vm.count ("log_level") > 0) + { + maxLogLevel = vm["log_level"].as (); + } if (vm.count ("logfile") > 0) { logFile = vm["logfile"].as (); diff --git a/src/helics/core/BrokerBase.hpp b/src/helics/core/BrokerBase.hpp index ba06eac5e2..d554e35a46 100644 --- a/src/helics/core/BrokerBase.hpp +++ b/src/helics/core/BrokerBase.hpp @@ -103,8 +103,6 @@ class BrokerBase */ void setLoggerFunction (std::function logFunction); - /** process a disconnect signal*/ - virtual void processDisconnect (bool skipUnregister = false) = 0; /** check if the main processing loop of a broker is running*/ bool isRunning () const { return mainLoopIsRunning.load (); } /** set the logging level */ @@ -120,6 +118,8 @@ class BrokerBase void queueProcessingLoop (); protected: + /** process a disconnect signal*/ + virtual void processDisconnect (bool skipUnregister = false) = 0; /** in the case of connection failure with a broker this function will try a reconnect procedure */ virtual bool tryReconnect () = 0; diff --git a/src/helics/core/CommonCore.cpp b/src/helics/core/CommonCore.cpp index c8ee1a6b02..3de49aa380 100644 --- a/src/helics/core/CommonCore.cpp +++ b/src/helics/core/CommonCore.cpp @@ -82,6 +82,7 @@ bool CommonCore::connect () setActionFlag (m, core_flag); transmit (0, m); brokerState = broker_state_t::connected; + disconnection.activate (); } else { @@ -110,7 +111,7 @@ void CommonCore::processDisconnect (bool skipUnregister) if (brokerState < broker_state_t::terminating) { brokerState = broker_state_t::terminating; - timeCoord->disconnect (); + sendDisconnect (); if (global_broker_id != 0) { ActionMessage dis (CMD_DISCONNECT); @@ -133,9 +134,27 @@ void CommonCore::processDisconnect (bool skipUnregister) { unregister (); } + disconnection.trigger (); } -void CommonCore::disconnect () { processDisconnect (); } +void CommonCore::disconnect () +{ + ActionMessage udisconnect (CMD_USER_DISCONNECT); + addActionMessage (udisconnect); + waitForDisconnect (); +} + +void CommonCore::waitForDisconnect (int msToWait) const +{ + if (msToWait <= 0) + { + disconnection.wait (); + } + else + { + disconnection.wait_for (std::chrono::milliseconds (msToWait)); + } +} void CommonCore::unregister () { @@ -793,7 +812,7 @@ handle_id_t CommonCore::registerSubscription (federate_id_t federateID, auto handle = createBasicHandle (fed->global_id, fed->local_id, handle_type_t::subscription, key, type, units, (check_mode == handle_check_mode::required)); - LOG_DEBUG (0, fed->getIdentifier (), fmt::format ("registering SUB {}", key)); + LOG_INTERFACES (0, fed->getIdentifier (), fmt::format ("registering SUB {}", key)); auto id = handle->handle; fed->interfaces ().createSubscription (id, key, type, units, check_mode); @@ -836,7 +855,7 @@ handle_id_t CommonCore::registerPublication (federate_id_t federateID, { throw (InvalidFunctionCall ("publications must be registered before calling enterInitializationMode")); } - LOG_DEBUG (0, fed->getIdentifier (), fmt::format ("registering PUB {}", key)); + LOG_INTERFACES (0, fed->getIdentifier (), fmt::format ("registering PUB {}", key)); auto pub = handles.read ([&key](auto &hand) { return hand.getPublication (key); }); if (pub != nullptr) // this key is already found { @@ -973,7 +992,8 @@ void CommonCore::setValue (handle_id_t handle, const char *data, uint64_t len) auto fed = getFederateAt (handleInfo->local_fed_id); if (fed->checkAndSetValue (handle, data, len)) { - LOG_DEBUG (0, fed->getIdentifier (), fmt::format ("setting Value for {} size {}", handleInfo->key, len)); + LOG_DATA_MESSAGES (0, fed->getIdentifier (), + fmt::format ("setting Value for {} size {}", handleInfo->key, len)); ActionMessage mv (CMD_PUB); mv.source_id = handleInfo->fed_id; mv.source_handle = handle; @@ -2278,7 +2298,7 @@ void CommonCore::processCommand (ActionMessage &&command) // brokerReconnect() LOG_ERROR (global_broker_id, getIdentifier (), "lost connection with server"); sendErrorToFederates (-5); - disconnect (); + processDisconnect (); brokerState = broker_state_t::errored; addActionMessage (CMD_STOP); } @@ -2309,6 +2329,22 @@ void CommonCore::processCommand (ActionMessage &&command) waitingForServerPingReply = false; } break; + case CMD_USER_DISCONNECT: + if (isConnected ()) + { + if (brokerState < broker_state_t::terminating) + { // only send a disconnect message if we haven't done so already + brokerState = broker_state_t::terminating; + sendDisconnect (); + ActionMessage m (CMD_DISCONNECT); + m.source_id = global_broker_id; + transmit (0, m); + } + } + addActionMessage (CMD_STOP); + // we can't just fall through since this may have generated other messages that need to be forwarded or + // processed + break; case CMD_STOP: if (isConnected ()) @@ -2316,7 +2352,7 @@ void CommonCore::processCommand (ActionMessage &&command) if (brokerState < broker_state_t::terminating) { // only send a disconnect message if we haven't done so already brokerState = broker_state_t::terminating; - timeCoord->disconnect (); + sendDisconnect (); ActionMessage m (CMD_DISCONNECT); m.source_id = global_broker_id; transmit (0, m); @@ -3164,6 +3200,25 @@ void CommonCore::checkDisconnect () } } +void CommonCore::sendDisconnect () +{ + LOG_CONNECTIONS (global_broker_id, "core", "sending disconnect"); + ActionMessage bye (CMD_STOP); + bye.source_id = global_broker_id; + for (auto &fed : loopFederates) + { + fed->addAction (bye); + if (hasTimeDependency) + { + timeCoord->removeDependency (fed->global_id); + timeCoord->removeDependent (fed->global_id); + } + } + if (hasTimeDependency) + { + timeCoord->disconnect (); + } +} bool CommonCore::checkForLocalPublication (ActionMessage &cmd) { auto handlelock = handles.lock_shared (); diff --git a/src/helics/core/CommonCore.hpp b/src/helics/core/CommonCore.hpp index 9773aa061d..18b5ad3e1a 100644 --- a/src/helics/core/CommonCore.hpp +++ b/src/helics/core/CommonCore.hpp @@ -18,6 +18,7 @@ All rights reserved. See LICENSE file and DISCLAIMER for more details. #include "../common/DualMappedVector.hpp" #include "../common/GuardedTypes.hpp" #include "../common/MappedPointerVector.hpp" +#include "../common/TriggerVariable.hpp" #include "HandlePointerManager.hpp" #include "helics_includes/any.hpp" #include @@ -165,8 +166,11 @@ class CommonCore : public Core, public BrokerBase virtual bool connect () override final; virtual bool isConnected () const override final; virtual void disconnect () override final; + virtual void waitForDisconnect (int msToWait = -1) const override final; /** unregister the core from any process find functions*/ void unregister (); + /** TODO figure out how to make this non-public, it needs to be called in a lambda function, may need a helper + * class of some sort*/ virtual void processDisconnect (bool skipUnregister = false) override final; private: @@ -320,7 +324,7 @@ class CommonCore : public Core, public BrokerBase std::atomic nextAirLock{0}; //!< the index of the next airlock to use std::array, 4> dataAirlocks; //!< airlocks for updating filter operators and other functions - + TriggerVariable disconnection; //!< controller for the disconnection process protected: /** deliver a message to the appropriate location*/ void deliverMessage (ActionMessage &message); @@ -377,6 +381,8 @@ class CommonCore : public Core, public BrokerBase void sendErrorToFederates (int error_code); /** check for a disconnect and take actions if the object can disconnect*/ void checkDisconnect (); + /** send a disconnect message to time dependencies and child federates*/ + void sendDisconnect (); }; } // namespace helics diff --git a/src/helics/core/CommsInterface.cpp b/src/helics/core/CommsInterface.cpp index 13f1f7ab1f..21f3b34a28 100644 --- a/src/helics/core/CommsInterface.cpp +++ b/src/helics/core/CommsInterface.cpp @@ -8,14 +8,16 @@ All rights reserved. See LICENSE file and DISCLAIMER for more details. namespace helics { -CommsInterface::CommsInterface (const std::string &localTarget, const std::string &brokerTarget, interface_networks targetNetwork) - : localTarget_ (localTarget), brokerTarget_ (brokerTarget), interfaceNetwork(targetNetwork) +CommsInterface::CommsInterface (const std::string &localTarget, + const std::string &brokerTarget, + interface_networks targetNetwork) + : localTarget_ (localTarget), brokerTarget_ (brokerTarget), interfaceNetwork (targetNetwork) { } CommsInterface::CommsInterface (const NetworkBrokerData &netInfo) : localTarget_ (netInfo.localInterface), brokerTarget_ (netInfo.brokerAddress), - brokerName_ (netInfo.brokerName), interfaceNetwork(netInfo.interfaceNetwork) + brokerName_ (netInfo.brokerName), interfaceNetwork (netInfo.interfaceNetwork) { } @@ -54,20 +56,20 @@ void CommsInterface::addRoute (int route_id, const std::string &routeInfo) transmit (-1, rt); } -void CommsInterface::setTxStatus(connection_status txStatus) +void CommsInterface::setTxStatus (connection_status txStatus) { - if (tx_status == txStatus) - { - return; - } - switch (txStatus) - { + if (tx_status == txStatus) + { + return; + } + switch (txStatus) + { case connection_status::connected: - if (tx_status == connection_status::startup) - { + if (tx_status == connection_status::startup) + { tx_status = txStatus; txTrigger.activate (); - } + } break; case connection_status::terminated: case connection_status::error: @@ -85,11 +87,10 @@ void CommsInterface::setTxStatus(connection_status txStatus) break; default: tx_status = txStatus; - } - + } } -void CommsInterface::setRxStatus(connection_status rxStatus) +void CommsInterface::setRxStatus (connection_status rxStatus) { if (rx_status == rxStatus) { @@ -106,18 +107,18 @@ void CommsInterface::setRxStatus(connection_status rxStatus) break; case connection_status::terminated: case connection_status::error: - if (rx_status == connection_status::startup) - { + if (rx_status == connection_status::startup) + { rx_status = rxStatus; rxTrigger.activate (); rxTrigger.trigger (); - } - else - { + } + else + { rx_status = rxStatus; rxTrigger.trigger (); - } - + } + break; default: rx_status = rxStatus; @@ -141,7 +142,7 @@ bool CommsInterface::connect () // bool exp = false; if (!ActionCallback) { - std::cerr << "no callback specified, the receiver cannot start\n"; + logError ("no callback specified, the receiver cannot start"); return false; } std::lock_guard syncLock (threadSyncLock); @@ -159,7 +160,7 @@ bool CommsInterface::connect () rxTrigger.waitActivation (); if (rx_status != connection_status::connected) { - // std::cerr << "receiver connection failure" << std::endl; + logError ("receiver connection failure"); if (tx_status == connection_status::connected) { if (queue_transmitter.joinable ()) @@ -174,7 +175,7 @@ bool CommsInterface::connect () if (tx_status != connection_status::connected) { - std::cerr << "transmitter connection failure" << std::endl; + logError ("transmitter connection failure"); if (rx_status == connection_status::connected) { if (queue_watcher.joinable ()) @@ -209,10 +210,10 @@ void CommsInterface::disconnect () int cnt = 0; while (rx_status.load () <= connection_status::connected) { - if (rxTrigger.wait_for(std::chrono::milliseconds(800))) - { + if (rxTrigger.wait_for (std::chrono::milliseconds (800))) + { continue; - } + } ++cnt; if ((cnt & 3) == 0) // call this every 2400 milliseconds { @@ -221,7 +222,7 @@ void CommsInterface::disconnect () } if (cnt == 14) // Eventually give up { - std::cerr << "unable to terminate connection\n"; + logError ("unable to terminate receiver connection"); break; } // check the trip detector @@ -247,7 +248,7 @@ void CommsInterface::disconnect () } if (cnt == 14) // Eventually give up { - std::cerr << "unable to terminate connection\n"; + logError ("unable to terminate transmit connection"); break; } // check the trip detector @@ -273,7 +274,7 @@ bool CommsInterface::reconnect () ++cnt; if (cnt == 400) // Eventually give up { - std::cerr << "unable to reconnect\n"; + logError ("unable to reconnect"); break; } } @@ -284,7 +285,7 @@ bool CommsInterface::reconnect () ++cnt; if (cnt == 400) { - std::cerr << "unable to reconnect\n"; + logError ("unable to reconnect"); break; } } @@ -298,6 +299,12 @@ void CommsInterface::setCallback (std::function callback ActionCallback = std::move (callback); } +void CommsInterface::setLoggingCallback ( + std::function callback) +{ + loggingCallback = std::move (callback); +} + void CommsInterface::setMessageSize (int maxMessageSize, int maxMessageCount) { if (maxMessageSize > 0) @@ -315,6 +322,31 @@ bool CommsInterface::isConnected () const return ((tx_status == connection_status::connected) && (rx_status == connection_status::connected)); } + +void CommsInterface::logWarning(const std::string &message) const +{ + if (loggingCallback) + { + loggingCallback (1, name, message); + } + else + { + std::cerr << "commWarning||" << name << ":" << message << std::endl; + } +} + +void CommsInterface::logError(const std::string &message) const +{ + if (loggingCallback) + { + loggingCallback (0, name, message); + } + else + { + std::cerr <<"commERROR||"< callback); + /** set the callback for processing the messages + */ + void setLoggingCallback ( + std::function callback); /** set the max message size and max Queue size */ void setMessageSize (int maxMessageSize, int maxMessageCount); @@ -66,6 +70,9 @@ class CommsInterface */ void setTimeout (int timeout) { connectionTimeout = timeout; } + protected: + void logWarning (const std::string &message) const; + void logError (const std::string &message) const; protected: // enumeration of the connection status flags for more immediate feedback from the processing threads enum class connection_status : int @@ -99,6 +106,8 @@ class CommsInterface int maxMessageCount_ = 512; //!< the maximum number of message to buffer (if needed) std::function ActionCallback; //!< the callback for what to do with a received message + std::function + loggingCallback; //!< callback for logging BlockingPriorityQueue> txQueue; //!< set of messages waiting to be transmitted // closing the files or connection can take some time so there is a need for inter-thread communication to not // spit out warning messages if it is in the process of disconnecting diff --git a/src/helics/core/Core.hpp b/src/helics/core/Core.hpp index b4fee505de..a61de05c4e 100644 --- a/src/helics/core/Core.hpp +++ b/src/helics/core/Core.hpp @@ -86,6 +86,9 @@ class Core * disconnect the core from its broker */ virtual void disconnect () = 0; + /** waits in the current thread until the core is disconnected + */ + virtual void waitForDisconnect (int msToWait = -1) const = 0; /** check if the core is ready to accept new federates */ diff --git a/src/helics/core/CoreBroker.cpp b/src/helics/core/CoreBroker.cpp index a54dd40aa9..367a36c0fe 100644 --- a/src/helics/core/CoreBroker.cpp +++ b/src/helics/core/CoreBroker.cpp @@ -120,6 +120,7 @@ void CoreBroker::processPriorityCommand (ActionMessage &&command) { case CMD_REG_FED: { + if (brokerState != operating) { if (allInitReady ()) @@ -178,6 +179,8 @@ void CoreBroker::processPriorityCommand (ActionMessage &&command) fedReply.dest_id = global_id; fedReply.name = command.name; transmit (route_id, fedReply); + LOG_CONNECTIONS (global_broker_id, getIdentifier (), + fmt::format ("registering federate {}({}) on route {}", command.name,global_id,route_id)); } } break; @@ -239,6 +242,9 @@ void CoreBroker::processPriorityCommand (ActionMessage &&command) brokerReply.dest_id = global_id; // the new id brokerReply.name = command.name; // the identifier of the broker transmit (route_id, brokerReply); + LOG_CONNECTIONS (global_broker_id, getIdentifier (), + fmt::format ("registering broker {}({}) on route {}", command.name, global_id, + route_id)); } } break; @@ -353,6 +359,36 @@ void CoreBroker::processPriorityCommand (ActionMessage &&command) } } +std::string CoreBroker::generateFederationSummary () const +{ + int pubs = 0; + int epts = 0; + int subs = 0; + int filt = 0; + for (auto &hand : handles) + { + switch (hand.handle_type) + { + case handle_type_t::publication: + ++pubs; + break; + case handle_type_t::subscription: + ++subs; + break; + case handle_type_t::endpoint: + ++epts; + break; + default: + ++filt; + break; + } + } + std::string output = fmt::format ("Federation Summary> \n\t{} federates\n\t {}brokers/cores\n\t{} " + "publications\n\t{} inputs\n\t{} endpoints\n\t{} filters\n<<<<<<<<<", + _federates.size (), _brokers.size (), pubs, subs, epts, filt); + return output; + } + void CoreBroker::transmitDelayedMessages () { auto msg = delayTransmitQueue.pop (); @@ -403,7 +439,8 @@ void CoreBroker::sendErrorToImmediateBrokers (int error_code) void CoreBroker::processCommand (ActionMessage &&command) { LOG_TRACE (global_broker_id, getIdentifier (), - fmt::format ("|| cmd:{} from {}", prettyPrintString (command), command.source_id)); + fmt::format ("|| cmd:{} from {} to ", prettyPrintString (command), command.source_id, + command.dest_id)); switch (command.action ()) { case CMD_IGNORE: @@ -470,10 +507,13 @@ void CoreBroker::processCommand (ActionMessage &&command) { if (_isRoot) { + LOG_TIMING (global_broker_id, "root", "entering initialization mode"); + LOG_SUMMARY (global_broker_id, "root", generateFederationSummary ()); executeInitializationOperations (); } else { + LOG_TIMING (global_broker_id, getIdentifier(), "entering initialization mode"); checkDependencies (); command.source_id = global_broker_id; transmit (0, command); @@ -628,8 +668,7 @@ void CoreBroker::processCommand (ActionMessage &&command) if (res == message_processing_result::next_step) { enteredExecutionMode = true; - LOG_DEBUG (global_broker_id, getIdentifier (), "entering Exec Mode"); - LOG_DEBUG (global_broker_id, getIdentifier (), "entering Exec Mode"); + LOG_TIMING (global_broker_id, getIdentifier (), "entering Exec Mode"); } } } @@ -650,7 +689,7 @@ void CoreBroker::processCommand (ActionMessage &&command) case CMD_TIME_GRANT: if (command.source_id == global_broker_id) { - LOG_DEBUG (global_broker_id, getIdentifier (), + LOG_TIMING(global_broker_id, getIdentifier (), fmt::format ("time request update {}", prettyPrintString (command))); for (auto dep : timeCoord->getDependents ()) { @@ -992,11 +1031,11 @@ bool CoreBroker::connect () broker_state_t exp = broker_state_t::initialized; if (brokerState.compare_exchange_strong (exp, broker_state_t::connecting)) { - LOG_NORMAL (0, getIdentifier (), "connecting"); + LOG_CONNECTIONS (0, getIdentifier (), "connecting"); auto res = brokerConnect (); if (res) { - LOG_NORMAL (0, getIdentifier (), fmt::format ("||connected on {}", getAddress ())); + LOG_CONNECTIONS (0, getIdentifier (), fmt::format ("||connected on {}", getAddress ())); if (!_isRoot) { ActionMessage m (CMD_REG_BROKER); @@ -1044,7 +1083,7 @@ void CoreBroker::waitForDisconnect (int msToWait) const void CoreBroker::processDisconnect (bool skipUnregister) { - LOG_NORMAL (0, getIdentifier (), "||disconnecting"); + LOG_CONNECTIONS (0, getIdentifier (), "||disconnecting"); if (brokerState > broker_state_t::initialized) { brokerState = broker_state_t::terminating; @@ -1420,6 +1459,10 @@ std::string CoreBroker::generateQueryAnswer (const std::string &request) cnts += '}'; return cnts; } + if (request == "summary") + { + return generateFederationSummary (); + } if (request == "federates") { return generateStringVector (_federates, [](auto &fed) { return fed.name; }); diff --git a/src/helics/core/CoreBroker.hpp b/src/helics/core/CoreBroker.hpp index 81d953314c..ec5f7afaa3 100644 --- a/src/helics/core/CoreBroker.hpp +++ b/src/helics/core/CoreBroker.hpp @@ -98,7 +98,7 @@ class CoreBroker : public Broker, public BrokerBase std::vector fedMapRequestors; //!< list of requesters for the active federate map JsonMapBuilder depMap; //!< builder for the dependency graph std::vector depMapRequestors; //!< list of requesters for the dependency graph - TriggerVariable disconnection; //!< controller for the disconection process + TriggerVariable disconnection; //!< controller for the disconnection process private: /** function that processes all the messages @param[in] command -- the message to process @@ -251,6 +251,8 @@ class CoreBroker : public Broker, public BrokerBase void sendErrorToImmediateBrokers (int error_code); /** send a disconnect message to time dependencies and child brokers*/ void sendDisconnect (); + /** generate a string about the federation summarizing connections*/ + std::string generateFederationSummary () const; }; } // namespace helics diff --git a/src/helics/core/FederateState.cpp b/src/helics/core/FederateState.cpp index 1b8157ba2c..607e5bda2d 100644 --- a/src/helics/core/FederateState.cpp +++ b/src/helics/core/FederateState.cpp @@ -20,47 +20,69 @@ All rights reserved. See LICENSE file and DISCLAIMER for more details. #include static const std::string nullStr; -#define LOG_ERROR(message) logMessage (0, nullStr, message) -#define LOG_WARNING(message) logMessage (1, nullStr, message) +#define LOG_ERROR(message) logMessage (LOG_LEVEL_ERROR, nullStr, message) +#define LOG_WARNING(message) logMessage (LOG_LEVEL_WARNING, nullStr, message) #ifndef LOGGING_DISABLED -#define LOG_NORMAL(message) \ + +#define LOG_SUMMARY(message) \ + do \ + { \ + if (logLevel >= LOG_LEVEL_SUMMARY) \ + { \ + logMessage (LOG_LEVEL_SUMMARY, nullStr, message); \ + } \ + } while (false) + +#define LOG_INTERFACES(message) \ do \ { \ - if (logLevel >= 2) \ + if (logLevel >= LOG_LEVEL_INTERFACES) \ { \ - logMessage (2, nullStr, message); \ + logMessage (LOG_LEVEL_INTERFACES, nullStr, message); \ } \ } while (false) #ifndef DEBUG_LOGGING_DISABLED -#define LOG_DEBUG(message) \ +#define LOG_TIMING(message) \ + do \ + { \ + if (logLevel >= LOG_LEVEL_TIMING) \ + { \ + logMessage (LOG_LEVEL_TIMING, nullStr, message); \ + } \ + } while (false) + +#define LOG_DATA(message) \ do \ { \ - if (logLevel >= 3) \ + if (logLevel >= LOG_LEVEL_DATA) \ { \ - logMessage (3, nullStr, message); \ + logMessage (LOG_LEVEL_DATA, nullStr, message); \ } \ } while (false) #else -#define LOG_DEBUG(message) +#define LOG_TIMING(message) +#define LOG_DATA(message) #endif #ifndef TRACE_LOGGING_DISABLED #define LOG_TRACE(message) \ do \ { \ - if (logLevel >= 4) \ + if (logLevel >= LOG_LEVEL_TRACE) \ { \ - logMessage (4, nullStr, message); \ + logMessage (LOG_LEVEL_TRACE, nullStr, message); \ } \ } while (false) #else #define LOG_TRACE(message) ((void)0) #endif #else // LOGGING_DISABLED -#define LOG_NORMAL(message) ((void)0) -#define LOG_DEBUG(message) ((void)0) +#define LOG_SUMMARY(message) ((void)0) +#define LOG_INTERFACES(message) ((void)0) +#define LOG_TIMING(message) ((void)0) +#define LOG_DATA(message) ((void)0) #define LOG_TRACE(message) ((void)0) #endif // LOGGING_DISABLED @@ -778,7 +800,7 @@ message_processing_result FederateState::processActionMessage (ActionMessage &cm if (state == HELICS_CREATED) { setState (HELICS_INITIALIZING); - LOG_DEBUG ("Granting Initialization"); + LOG_TIMING ("Granting Initialization"); timeGranted_mode = true; return message_processing_result::next_step; } @@ -833,7 +855,7 @@ message_processing_result FederateState::processActionMessage (ActionMessage &cm return grant; case message_processing_result::next_step: setState (HELICS_EXECUTING); - LOG_DEBUG ("Granting Execution"); + LOG_TIMING ("Granting Execution"); timeGranted_mode = true; return grant; case message_processing_result::continue_processing: @@ -847,11 +869,12 @@ message_processing_result FederateState::processActionMessage (ActionMessage &cm break; case CMD_TERMINATE_IMMEDIATELY: setState (HELICS_FINISHED); - LOG_DEBUG ("Terminating"); + LOG_TIMING ("Terminating"); return message_processing_result::halted; case CMD_STOP: setState (HELICS_FINISHED); - LOG_DEBUG ("Terminating"); + LOG_TIMING ("Terminating"); + timeCoord->disconnect (); return message_processing_result::halted; case CMD_DISCONNECT: if (cmd.source_id == global_id) @@ -944,7 +967,7 @@ message_processing_result FederateState::processActionMessage (ActionMessage &cm { time_granted = timeCoord->getGrantedTime (); allowed_send_time = timeCoord->allowedSendTime (); - LOG_DEBUG (std::string ("Granted Time=") + std::to_string (time_granted)); + LOG_TIMING (std::string ("Granted Time=") + std::to_string (time_granted)); timeGranted_mode = true; return ret; } @@ -970,7 +993,7 @@ message_processing_result FederateState::processActionMessage (ActionMessage &cm if (epi != nullptr) { timeCoord->updateMessageTime (cmd.actionTime); - LOG_DEBUG ("receive_message " + prettyPrintString (cmd)); + LOG_DATA ("receive_message " + prettyPrintString (cmd)); epi->addMessage (createMessageFromCommand (std::move (cmd))); } } @@ -987,7 +1010,7 @@ message_processing_result FederateState::processActionMessage (ActionMessage &cm subI->addData (cmd.actionTime, cmd.counter, std::make_shared (std::move (cmd.payload))); timeCoord->updateValueTime (cmd.actionTime); - LOG_DEBUG ("receive publication " + prettyPrintString (cmd)); + LOG_DATA ("receive publication " + prettyPrintString (cmd)); LOG_TRACE (timeCoord->printTimeStatus ()); } } diff --git a/src/helics/core/ipc/IpcComms.cpp b/src/helics/core/ipc/IpcComms.cpp index 68cd49cf4d..94f8bc9eba 100644 --- a/src/helics/core/ipc/IpcComms.cpp +++ b/src/helics/core/ipc/IpcComms.cpp @@ -1,11 +1,11 @@ /* - Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE file and DISCLAIMER for more details. */ -#include "IpcComms.h" +#include "../../common/fmt_format.h" #include "../ActionMessage.hpp" +#include "IpcComms.h" #include "IpcQueueHelper.h" #include #include @@ -111,7 +111,8 @@ void IpcComms::queue_rx_function () } catch (boost::interprocess::interprocess_exception const &ipe) { - std::cerr << "error changing states" << std::endl; + logError("error changing states"); + } setRxStatus (connection_status::terminated); } @@ -129,9 +130,9 @@ void IpcComms::queue_tx_function () if (!conn) { ActionMessage err (CMD_ERROR); - err.payload = std::string ("Unable to open broker connection ->") + brokerQueue.getError (); + err.payload = fmt::format("Unable to open broker connection -> {}",brokerQueue.getError ()); ActionCallback (std::move (err)); - setTxStatus(connection_status::error); + setTxStatus (connection_status::error); return; } hasBroker = true; @@ -139,13 +140,13 @@ void IpcComms::queue_tx_function () // wait for the receiver to startup if (!rxTrigger.wait_forActivation (std::chrono::milliseconds (3000))) { - ActionMessage err (CMD_ERROR); - err.payload = "Unable to link with receiver"; - ActionCallback (std::move (err)); - setTxStatus (connection_status::error); - return; + ActionMessage err (CMD_ERROR); + err.payload = "Unable to link with receiver"; + ActionCallback (std::move (err)); + setTxStatus (connection_status::error); + return; } - if (getRxStatus() == connection_status::error) + if (getRxStatus () == connection_status::error) { setTxStatus (connection_status::error); return; @@ -157,7 +158,7 @@ void IpcComms::queue_tx_function () ipcbackchannel = IPC_BACKCHANNEL_TRY_RESET; while (ipcbackchannel != 0) { - if (getRxStatus() != connection_status::connected) + if (getRxStatus () != connection_status::connected) { break; } @@ -170,14 +171,14 @@ void IpcComms::queue_tx_function () if (!conn) { ActionMessage err (CMD_ERROR); - err.payload = std::string ("Unable to open receiver connection ->") + brokerQueue.getError (); + err.payload = fmt::format ("Unable to open receiver connection -> {}", rxQueue.getError ()); ActionCallback (std::move (err)); - setRxStatus(connection_status::error); + setRxStatus (connection_status::error); return; } } - setTxStatus(connection_status::connected); + setTxStatus (connection_status::connected); bool operating = false; while (true) { @@ -249,13 +250,13 @@ void IpcComms::queue_tx_function () void IpcComms::closeReceiver () { - if ((getRxStatus() == connection_status::error) || (getRxStatus() == connection_status::terminated)) + if ((getRxStatus () == connection_status::error) || (getRxStatus () == connection_status::terminated)) { return; } ActionMessage cmd (CMD_PROTOCOL); cmd.index = CLOSE_RECEIVER; - if (getTxStatus() == connection_status::connected) + if (getTxStatus () == connection_status::connected) { transmit (-1, cmd); } diff --git a/src/helics/core/loggingHelper.hpp b/src/helics/core/loggingHelper.hpp index 34fc882cb4..d246766dc7 100644 --- a/src/helics/core/loggingHelper.hpp +++ b/src/helics/core/loggingHelper.hpp @@ -6,55 +6,81 @@ All rights reserved. See LICENSE file and DISCLAIMER for more details. #pragma once #include "helics/helics-config.h" +#include "helics/flag-definitions.h" + /** @file this file is meant to be included in the commonCore.cpp and coreBroker.cpp and inherited class files it assumes some knowledge of the internals of those programs via MACROS -using elsewhere is probably not going to work. Someday this will be made more generic +using elsewhere is probably not going to work. */ /** enumeration of defined print levels*/ enum log_level : int { - no_print = -1, //!< never print - error = 0, //!< only print errors - warning = 1, //!< print/log warning and errors - normal = 2, //!< default print level - debug = 3, //!< debug level prints - trace = 4, //!< trace level printing + no_print = LOG_LEVEL_NO_PRINT, //!< never print + error = LOG_LEVEL_ERROR, //!< only print errors + warning = LOG_LEVEL_WARNING, //!< print/log warning and errors + summary = LOG_LEVEL_SUMMARY, //!< print/log summary information + connections = LOG_LEVEL_CONNECTIONS, //!< print summary+ federate level connection information + interfaces = LOG_LEVEL_INTERFACES, //!< print connections +interface level connection information + timing = LOG_LEVEL_TIMING, //!< print interfaces+ timing(exec/grant/disconnect) + data = LOG_LEVEL_DATA, //!< print timing+data transmissions + trace = LOG_LEVEL_TRACE, //!< trace level printing (all processed messages) }; #define LOG_ERROR(id, ident, message) sendToLogger (id, log_level::error, ident, message); #define LOG_WARNING(id, ident, message) sendToLogger (id, log_level::warning, ident, message); #ifndef LOGGING_DISABLED -#define LOG_NORMAL(id, ident, message) \ - if (maxLogLevel >= log_level::normal) \ +#define LOG_SUMMARY(id, ident, message) \ + if (maxLogLevel >= log_level::summary) \ { \ - sendToLogger (id, log_level::normal, ident, message); \ + sendToLogger (id, log_level::summary, ident, message); \ + } + +#define LOG_CONNECTIONS(id, ident, message) \ + if (maxLogLevel >= log_level::connections) \ + { \ + sendToLogger (id, log_level::connections, ident, message); \ + } + +#define LOG_INTERFACES(id, ident, message) \ + if (maxLogLevel >= log_level::interfaces) \ + { \ + sendToLogger (id, log_level::interfaces, ident, message); \ } #ifndef DEBUG_LOGGING_DISABLED -#define LOG_DEBUG(id, ident, message) \ - if (maxLogLevel >= log_level::debug) \ +#define LOG_TIMING(id, ident, message) \ + if (maxLogLevel >= log_level::timing) \ + { \ + sendToLogger (id, log_level::timing, ident, message); \ + } +#define LOG_DATA_MESSAGES(id, ident, message) \ + if (maxLogLevel >= log_level::data) \ { \ - sendToLogger (id, log_level::debug, ident, message); \ + sendToLogger (id, log_level::data, ident, message); \ } #else -#define LOG_DEBUG(id, ident, message) +#define LOG_TIMING(id, ident, message) +#define LOG_DATA_MESSAGES(id, ident, message) #endif #ifndef TRACE_LOGGING_DISABLED #define LOG_TRACE(id, ident, message) \ if (maxLogLevel >= log_level::trace) \ { \ - sendToLogger (id, log_level::debug, ident, message); \ + sendToLogger (id, log_level::trace, ident, message); \ } #else #define LOG_TRACE(id, ident, message) #endif #else -#define LOG_NORMAL(id, ident, message) -#define LOG_DEBUG(id, ident, message) +#define LOG_SUMMARY(id, ident, message) +#define LOG_CONNECTIONS(id, ident, message) +#define LOG_INTERFACES(id, ident, message) +#define LOG_TIMING(id, ident, message) +#define LOG_DATA_MESSAGES(id, ident, message) #define LOG_TRACE(id, ident, message) #endif diff --git a/src/helics/core/tcp/TcpComms.cpp b/src/helics/core/tcp/TcpComms.cpp index 0c8aac270b..dc8cde6a0a 100644 --- a/src/helics/core/tcp/TcpComms.cpp +++ b/src/helics/core/tcp/TcpComms.cpp @@ -263,8 +263,8 @@ bool TcpComms::commErrorHandler (std::shared_ptr /*connection*/ { if (error != boost::asio::error::connection_reset) { - std::cerr << "error message while connected " << error.message () << "code " << error.value () - << std::endl; + logError (std::string ("error message while connected ") + error.message () + " code " + + std::to_string (error.value ())); } } } @@ -330,12 +330,12 @@ void TcpComms::queue_rx_function () } else { - std::cerr << "retrying tcp bind\n"; + logWarning("retrying tcp bind"); std::this_thread::sleep_for (std::chrono::milliseconds (150)); auto connected = server->reConnect (connectionTimeout); if (!connected) { - std::cerr << "unable to bind to tcp connection socket\n"; + logError("unable to bind to tcp connection socket"); server->close (); setRxStatus (connection_status::error); return; @@ -420,7 +420,7 @@ void TcpComms::queue_tx_function () cumsleep += 100; if (cumsleep >= connectionTimeout) { - std::cerr << "initial connection to broker timed out\n" << std::endl; + logError("initial connection to broker timed out"); setTxStatus (connection_status::terminated); return; } @@ -436,7 +436,7 @@ void TcpComms::queue_tx_function () } catch (const boost::system::system_error &error) { - std::cerr << "error in initial send to broker " << error.what () << '\n'; + logError(std::string("error in initial send to broker ")+ error.what ()); setTxStatus (connection_status::terminated); return; } @@ -482,7 +482,7 @@ void TcpComms::queue_tx_function () if (cumsleep >= connectionTimeout) { brokerConnection->cancel (); - std::cerr << "port number query to broker timed out\n" << std::endl; + logError("port number query to broker timed out"); setTxStatus (connection_status::terminated); return; } @@ -491,7 +491,7 @@ void TcpComms::queue_tx_function () } catch (std::exception &e) { - std::cerr << e.what () << std::endl; + logError(e.what ()); } } else @@ -577,8 +577,8 @@ void TcpComms::queue_tx_function () { if (!isDisconnectCommand (cmd)) { - std::cerr << "broker send 0 " << actionMessageType (cmd.action ()) << ':' << se.what () - << '\n'; + logError (std::string ("broker send 0 ") + actionMessageType (cmd.action ()) + ':' + + se.what ()); } } } @@ -617,7 +617,7 @@ void TcpComms::queue_tx_function () { if (!isDisconnectCommand (cmd)) { - std::cerr << "rt send " << route_id << "::" << se.what () << '\n'; + logError(std::string("rt send ")+std::to_string(route_id)+"::"+se.what ()); } } } @@ -644,7 +644,7 @@ void TcpComms::queue_tx_function () { if (!isDisconnectCommand (cmd)) { - std::cerr << "broker send" << route_id << " ::" << se.what () << '\n'; + logError(std::string("broker send")+std::to_string(route_id)+ " ::" + se.what ()); } } } diff --git a/src/helics/core/udp/UdpComms.cpp b/src/helics/core/udp/UdpComms.cpp index 59d4bf769b..3359646826 100644 --- a/src/helics/core/udp/UdpComms.cpp +++ b/src/helics/core/udp/UdpComms.cpp @@ -10,6 +10,7 @@ All rights reserved. See LICENSE file and DISCLAIMER for more details. #include "../NetworkBrokerData.hpp" #include #include +#include "../../common/fmt_format.h" static const int BEGIN_OPEN_PORT_RANGE = 23964; static const int BEGIN_OPEN_PORT_RANGE_SUBBROKER = 24053; @@ -240,8 +241,8 @@ void UdpComms::queue_rx_function () else { disconnecting = true; - std::cerr << "Unable to bind socket " << makePortAddress (localTarget_, PortNumber) << " " - << error.what () << std::endl; + logError (fmt::format ("unable to bind socket {} :{}", + makePortAddress (localTarget_, PortNumber), error.what ())); socket.close (); setRxStatus( connection_status::error); return; @@ -250,15 +251,16 @@ void UdpComms::queue_rx_function () } if (t_cnt == 0) { - std::cerr << "bind error on UDP socket " << error.what () << std::endl; + logWarning (fmt::format ("bind error on UDP socket {} :{}", makePortAddress (localTarget_, PortNumber), + error.what ())); } std::this_thread::sleep_for (std::chrono::milliseconds (200)); t_cnt += 200; if (t_cnt > connectionTimeout) { disconnecting = true; - std::cerr << "Unable to bind socket " << makePortAddress (localTarget_, PortNumber) << " " - << error.what () << std::endl; + logError (fmt::format ("unable to bind socket {} :{}", makePortAddress (localTarget_, PortNumber), + error.what ())); socket.close (); setRxStatus( connection_status::error); return; @@ -290,7 +292,7 @@ void UdpComms::queue_rx_function () ActionMessage M (data.data (), len); if (!isValidCommand (M)) { - std::cerr << "invalid command received udp" << std::endl; + logWarning ("invalid command received udp"); continue; } if (isProtocolCommand (M)) @@ -366,7 +368,8 @@ void UdpComms::queue_tx_function () transmitSocket.send_to (boost::asio::buffer (m.to_string ()), broker_endpoint, 0, error); if (error) { - std::cerr << "error in initial send to broker " << error.message () << '\n'; + logError (fmt::format ("error in initial send to broker {}", + error.message ())); } std::vector rx (128); udp::endpoint brk; @@ -457,7 +460,7 @@ void UdpComms::queue_tx_function () transmitSocket.send_to (boost::asio::buffer (cmd.to_string ()), rxEndpoint, 0, error); if (error) { - std::cerr << "transmit failure to receiver " << error.message () << '\n'; + logError (fmt::format ("transmit failure on sending 'close' to receiver {}", error.message ())); } closingRx = true; processed = true; @@ -479,7 +482,8 @@ void UdpComms::queue_tx_function () transmitSocket.send_to (boost::asio::buffer (cmd.to_string ()), broker_endpoint, 0, error); if (error) { - std::cerr << "transmit failure to broker " << error.message () << '\n'; + logWarning ( + fmt::format ("transmit failure sending to broker {}", error.message ())); } } } @@ -488,7 +492,7 @@ void UdpComms::queue_tx_function () transmitSocket.send_to (boost::asio::buffer (cmd.to_string ()), rxEndpoint, 0, error); if (error) { - std::cerr << "transmit failure to receiver " << error.message () << '\n'; + logWarning (fmt::format ("transmit failure sending control message to receiver {}", error.message ())); } } else @@ -499,7 +503,7 @@ void UdpComms::queue_tx_function () transmitSocket.send_to (boost::asio::buffer (cmd.to_string ()), rt_find->second, 0, error); if (error) { - std::cerr << "transmit failure to route to " << route_id << " " << error.message () << '\n'; + logWarning (fmt::format ("transmit failure sending to route {}:{}", route_id,error.message ())); } } else @@ -509,7 +513,7 @@ void UdpComms::queue_tx_function () transmitSocket.send_to (boost::asio::buffer (cmd.to_string ()), broker_endpoint, 0, error); if (error) { - std::cerr << "transmit failure to broker " << error.message () << '\n'; + logWarning (fmt::format ("transmit failure sending to broker {}", error.message ())); } } } @@ -533,7 +537,7 @@ void UdpComms::queue_tx_function () transmitSocket.send_to (boost::asio::buffer (cls), rxEndpoint, 0, error); if (error) { - std::cerr << "transmit failure II to receiver" << error.message () << '\n'; + logWarning (fmt::format ("transmit failure sending close to receiver III:{}", error.message ())); } } if (cnt > 60) @@ -548,7 +552,7 @@ void UdpComms::queue_tx_function () transmitSocket.send_to (boost::asio::buffer (cls), rxEndpoint, 0, error); if (error) { - std::cerr << "transmit failure to receiver" << error.message () << '\n'; + logWarning (fmt::format ("transmit failure sending close to receiver II:{}", error.message ())); } } } @@ -583,13 +587,14 @@ void UdpComms::closeReceiver () transmitter.send_to (boost::asio::buffer (cls), rxEndpoint, 0, error); if (error) { - std::cerr << "transmit failure on disconnect " << error.message () << '\n'; + logWarning ( + fmt::format ("transmit failure on disconnect:{}", error.message ())); } } } catch (...) { - // ignore error here + // ignore error here since we are already disconnecting } } } diff --git a/src/helics/flag-definitions.h b/src/helics/flag-definitions.h index ec7e7a4bf9..0fedf83872 100644 --- a/src/helics/flag-definitions.h +++ b/src/helics/flag-definitions.h @@ -22,7 +22,8 @@ All rights reserved. See LICENSE file and DISCLAIMER for more details. #define ONLY_TRANSMIT_ON_CHANGE_FLAG 3 /** flag indicating a federate should only trigger an update if a value has changed (binary equivalence)*/ #define ONLY_UPDATE_ON_CHANGE_FLAG 4 -/** flag indicating a federate should only grant time if all other federates have already passed the requested time*/ +/** flag indicating a federate should only grant time if all other federates have already passed the requested + * time*/ #define WAIT_FOR_CURRENT_TIME_UPDATE_FLAG 5 /** flag indicating that a federate has rollback capability*/ @@ -47,5 +48,13 @@ All rights reserved. See LICENSE file and DISCLAIMER for more details. #define ERROR_CODE_INVALID_STATE_TRANSITION 12 #define ERROR_CODE_INVALID_FUNCTION_CALL 15 +#define LOG_LEVEL_NO_PRINT (-1) +#define LOG_LEVEL_ERROR 0 +#define LOG_LEVEL_WARNING 1 +#define LOG_LEVEL_SUMMARY 2 +#define LOG_LEVEL_CONNECTIONS 3 +#define LOG_LEVEL_INTERFACES 4 +#define LOG_LEVEL_TIMING 5 +#define LOG_LEVEL_DATA 6 +#define LOG_LEVEL_TRACE 7 #endif - diff --git a/swig/matlab/+helics/HELICS_CORE_TYPE_DEFAULT.m b/swig/matlab/+helics/HELICS_CORE_TYPE_DEFAULT.m index 68c45d8d2b..710ab20d50 100644 --- a/swig/matlab/+helics/HELICS_CORE_TYPE_DEFAULT.m +++ b/swig/matlab/+helics/HELICS_CORE_TYPE_DEFAULT.m @@ -1,7 +1,7 @@ function v = HELICS_CORE_TYPE_DEFAULT() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783868); + vInitialized = helicsMEX(0, 1432107619); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_CORE_TYPE_INTERPROCESS.m b/swig/matlab/+helics/HELICS_CORE_TYPE_INTERPROCESS.m index fb27e1d006..2e5c51244c 100644 --- a/swig/matlab/+helics/HELICS_CORE_TYPE_INTERPROCESS.m +++ b/swig/matlab/+helics/HELICS_CORE_TYPE_INTERPROCESS.m @@ -1,7 +1,7 @@ function v = HELICS_CORE_TYPE_INTERPROCESS() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783872); + vInitialized = helicsMEX(0, 1432107623); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_CORE_TYPE_IPC.m b/swig/matlab/+helics/HELICS_CORE_TYPE_IPC.m index 9f0406e02f..622ff5b65d 100644 --- a/swig/matlab/+helics/HELICS_CORE_TYPE_IPC.m +++ b/swig/matlab/+helics/HELICS_CORE_TYPE_IPC.m @@ -1,7 +1,7 @@ function v = HELICS_CORE_TYPE_IPC() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783873); + vInitialized = helicsMEX(0, 1432107624); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_CORE_TYPE_MPI.m b/swig/matlab/+helics/HELICS_CORE_TYPE_MPI.m index cf3bc6fd28..6c3cfb2d7e 100644 --- a/swig/matlab/+helics/HELICS_CORE_TYPE_MPI.m +++ b/swig/matlab/+helics/HELICS_CORE_TYPE_MPI.m @@ -1,7 +1,7 @@ function v = HELICS_CORE_TYPE_MPI() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783870); + vInitialized = helicsMEX(0, 1432107621); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_CORE_TYPE_TCP.m b/swig/matlab/+helics/HELICS_CORE_TYPE_TCP.m index 0aeff179f5..5ca499f896 100644 --- a/swig/matlab/+helics/HELICS_CORE_TYPE_TCP.m +++ b/swig/matlab/+helics/HELICS_CORE_TYPE_TCP.m @@ -1,7 +1,7 @@ function v = HELICS_CORE_TYPE_TCP() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783874); + vInitialized = helicsMEX(0, 1432107625); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_CORE_TYPE_TEST.m b/swig/matlab/+helics/HELICS_CORE_TYPE_TEST.m index 1e1188d323..7d901c21b0 100644 --- a/swig/matlab/+helics/HELICS_CORE_TYPE_TEST.m +++ b/swig/matlab/+helics/HELICS_CORE_TYPE_TEST.m @@ -1,7 +1,7 @@ function v = HELICS_CORE_TYPE_TEST() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783871); + vInitialized = helicsMEX(0, 1432107622); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_CORE_TYPE_UDP.m b/swig/matlab/+helics/HELICS_CORE_TYPE_UDP.m index b4e3152403..df09d0ca3e 100644 --- a/swig/matlab/+helics/HELICS_CORE_TYPE_UDP.m +++ b/swig/matlab/+helics/HELICS_CORE_TYPE_UDP.m @@ -1,7 +1,7 @@ function v = HELICS_CORE_TYPE_UDP() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783875); + vInitialized = helicsMEX(0, 1432107626); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_CORE_TYPE_ZMQ.m b/swig/matlab/+helics/HELICS_CORE_TYPE_ZMQ.m index 59666575f8..3bbaab6066 100644 --- a/swig/matlab/+helics/HELICS_CORE_TYPE_ZMQ.m +++ b/swig/matlab/+helics/HELICS_CORE_TYPE_ZMQ.m @@ -1,7 +1,7 @@ function v = HELICS_CORE_TYPE_ZMQ() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783869); + vInitialized = helicsMEX(0, 1432107620); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_DATA_TYPE_BOOLEAN.m b/swig/matlab/+helics/HELICS_DATA_TYPE_BOOLEAN.m index dd5857df72..4870d90b18 100644 --- a/swig/matlab/+helics/HELICS_DATA_TYPE_BOOLEAN.m +++ b/swig/matlab/+helics/HELICS_DATA_TYPE_BOOLEAN.m @@ -1,7 +1,7 @@ function v = HELICS_DATA_TYPE_BOOLEAN() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783882); + vInitialized = helicsMEX(0, 1432107633); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_DATA_TYPE_COMPLEX.m b/swig/matlab/+helics/HELICS_DATA_TYPE_COMPLEX.m index d4599eba3b..f3c1b1bd9c 100644 --- a/swig/matlab/+helics/HELICS_DATA_TYPE_COMPLEX.m +++ b/swig/matlab/+helics/HELICS_DATA_TYPE_COMPLEX.m @@ -1,7 +1,7 @@ function v = HELICS_DATA_TYPE_COMPLEX() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783879); + vInitialized = helicsMEX(0, 1432107630); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_DATA_TYPE_DOUBLE.m b/swig/matlab/+helics/HELICS_DATA_TYPE_DOUBLE.m index 69a1d79fbe..0589ca9107 100644 --- a/swig/matlab/+helics/HELICS_DATA_TYPE_DOUBLE.m +++ b/swig/matlab/+helics/HELICS_DATA_TYPE_DOUBLE.m @@ -1,7 +1,7 @@ function v = HELICS_DATA_TYPE_DOUBLE() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783877); + vInitialized = helicsMEX(0, 1432107628); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_DATA_TYPE_INT.m b/swig/matlab/+helics/HELICS_DATA_TYPE_INT.m index 13105f4c03..d0a34d38f0 100644 --- a/swig/matlab/+helics/HELICS_DATA_TYPE_INT.m +++ b/swig/matlab/+helics/HELICS_DATA_TYPE_INT.m @@ -1,7 +1,7 @@ function v = HELICS_DATA_TYPE_INT() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783878); + vInitialized = helicsMEX(0, 1432107629); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_DATA_TYPE_NAMEDPOINT.m b/swig/matlab/+helics/HELICS_DATA_TYPE_NAMEDPOINT.m index 3f9b7abd15..32dc677ccc 100644 --- a/swig/matlab/+helics/HELICS_DATA_TYPE_NAMEDPOINT.m +++ b/swig/matlab/+helics/HELICS_DATA_TYPE_NAMEDPOINT.m @@ -1,7 +1,7 @@ function v = HELICS_DATA_TYPE_NAMEDPOINT() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783881); + vInitialized = helicsMEX(0, 1432107632); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_DATA_TYPE_RAW.m b/swig/matlab/+helics/HELICS_DATA_TYPE_RAW.m index 077a0a0ec8..8d7a1f71d1 100644 --- a/swig/matlab/+helics/HELICS_DATA_TYPE_RAW.m +++ b/swig/matlab/+helics/HELICS_DATA_TYPE_RAW.m @@ -1,7 +1,7 @@ function v = HELICS_DATA_TYPE_RAW() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783883); + vInitialized = helicsMEX(0, 1432107634); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_DATA_TYPE_STRING.m b/swig/matlab/+helics/HELICS_DATA_TYPE_STRING.m index c67ed8e270..17d21e4b3a 100644 --- a/swig/matlab/+helics/HELICS_DATA_TYPE_STRING.m +++ b/swig/matlab/+helics/HELICS_DATA_TYPE_STRING.m @@ -1,7 +1,7 @@ function v = HELICS_DATA_TYPE_STRING() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783876); + vInitialized = helicsMEX(0, 1432107627); end v = vInitialized; end diff --git a/swig/matlab/+helics/HELICS_DATA_TYPE_VECTOR.m b/swig/matlab/+helics/HELICS_DATA_TYPE_VECTOR.m index 4eba313f87..280bb21607 100644 --- a/swig/matlab/+helics/HELICS_DATA_TYPE_VECTOR.m +++ b/swig/matlab/+helics/HELICS_DATA_TYPE_VECTOR.m @@ -1,7 +1,7 @@ function v = HELICS_DATA_TYPE_VECTOR() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783880); + vInitialized = helicsMEX(0, 1432107631); end v = vInitialized; end diff --git a/swig/matlab/+helics/force_iteration.m b/swig/matlab/+helics/force_iteration.m index a95dd71cb0..0dc9c8d14b 100644 --- a/swig/matlab/+helics/force_iteration.m +++ b/swig/matlab/+helics/force_iteration.m @@ -1,7 +1,7 @@ function v = force_iteration() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783847); + vInitialized = helicsMEX(0, 1432107598); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_clone_filter.m b/swig/matlab/+helics/helics_clone_filter.m index 9d0ff77ec6..86d157f8e0 100644 --- a/swig/matlab/+helics/helics_clone_filter.m +++ b/swig/matlab/+helics/helics_clone_filter.m @@ -1,7 +1,7 @@ function v = helics_clone_filter() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783867); + vInitialized = helicsMEX(0, 1432107618); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_custom_filter.m b/swig/matlab/+helics/helics_custom_filter.m index f0317fde3c..e1d1fb23b3 100644 --- a/swig/matlab/+helics/helics_custom_filter.m +++ b/swig/matlab/+helics/helics_custom_filter.m @@ -1,7 +1,7 @@ function v = helics_custom_filter() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783862); + vInitialized = helicsMEX(0, 1432107613); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_delay_filter.m b/swig/matlab/+helics/helics_delay_filter.m index 4aaf364013..84ef0d948f 100644 --- a/swig/matlab/+helics/helics_delay_filter.m +++ b/swig/matlab/+helics/helics_delay_filter.m @@ -1,7 +1,7 @@ function v = helics_delay_filter() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783863); + vInitialized = helicsMEX(0, 1432107614); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_discard.m b/swig/matlab/+helics/helics_discard.m index 30456d4077..edf602ca2f 100644 --- a/swig/matlab/+helics/helics_discard.m +++ b/swig/matlab/+helics/helics_discard.m @@ -1,7 +1,7 @@ function v = helics_discard() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783840); + vInitialized = helicsMEX(0, 1432107591); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_error.m b/swig/matlab/+helics/helics_error.m index ce72e773ba..76106976fa 100644 --- a/swig/matlab/+helics/helics_error.m +++ b/swig/matlab/+helics/helics_error.m @@ -1,7 +1,7 @@ function v = helics_error() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783845); + vInitialized = helicsMEX(0, 1432107596); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_error_state.m b/swig/matlab/+helics/helics_error_state.m index 90d7466a2e..0438434731 100644 --- a/swig/matlab/+helics/helics_error_state.m +++ b/swig/matlab/+helics/helics_error_state.m @@ -1,7 +1,7 @@ function v = helics_error_state() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783857); + vInitialized = helicsMEX(0, 1432107608); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_execution_state.m b/swig/matlab/+helics/helics_execution_state.m index b260846b66..855d63507e 100644 --- a/swig/matlab/+helics/helics_execution_state.m +++ b/swig/matlab/+helics/helics_execution_state.m @@ -1,7 +1,7 @@ function v = helics_execution_state() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783855); + vInitialized = helicsMEX(0, 1432107606); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_finalize_state.m b/swig/matlab/+helics/helics_finalize_state.m index 177f1b51b5..575d68c1c3 100644 --- a/swig/matlab/+helics/helics_finalize_state.m +++ b/swig/matlab/+helics/helics_finalize_state.m @@ -1,7 +1,7 @@ function v = helics_finalize_state() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783856); + vInitialized = helicsMEX(0, 1432107607); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_initialization_state.m b/swig/matlab/+helics/helics_initialization_state.m index 20831153c5..450146f43b 100644 --- a/swig/matlab/+helics/helics_initialization_state.m +++ b/swig/matlab/+helics/helics_initialization_state.m @@ -1,7 +1,7 @@ function v = helics_initialization_state() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783854); + vInitialized = helicsMEX(0, 1432107605); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_invalid_argument.m b/swig/matlab/+helics/helics_invalid_argument.m index a8d3cd356c..1e66bf05ed 100644 --- a/swig/matlab/+helics/helics_invalid_argument.m +++ b/swig/matlab/+helics/helics_invalid_argument.m @@ -1,7 +1,7 @@ function v = helics_invalid_argument() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783839); + vInitialized = helicsMEX(0, 1432107590); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_invalid_function_call.m b/swig/matlab/+helics/helics_invalid_function_call.m index bef9f8915e..92cea1feb5 100644 --- a/swig/matlab/+helics/helics_invalid_function_call.m +++ b/swig/matlab/+helics/helics_invalid_function_call.m @@ -1,7 +1,7 @@ function v = helics_invalid_function_call() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783844); + vInitialized = helicsMEX(0, 1432107595); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_invalid_object.m b/swig/matlab/+helics/helics_invalid_object.m index 621b3032f3..c5a4473604 100644 --- a/swig/matlab/+helics/helics_invalid_object.m +++ b/swig/matlab/+helics/helics_invalid_object.m @@ -1,7 +1,7 @@ function v = helics_invalid_object() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783838); + vInitialized = helicsMEX(0, 1432107589); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_invalid_state_transition.m b/swig/matlab/+helics/helics_invalid_state_transition.m index c70285945a..ab4adaba0e 100644 --- a/swig/matlab/+helics/helics_invalid_state_transition.m +++ b/swig/matlab/+helics/helics_invalid_state_transition.m @@ -1,7 +1,7 @@ function v = helics_invalid_state_transition() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783843); + vInitialized = helicsMEX(0, 1432107594); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_ok.m b/swig/matlab/+helics/helics_ok.m index ad2f439a9e..065a81b4a5 100644 --- a/swig/matlab/+helics/helics_ok.m +++ b/swig/matlab/+helics/helics_ok.m @@ -1,7 +1,7 @@ function v = helics_ok() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783836); + vInitialized = helicsMEX(0, 1432107587); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_pending_exec_state.m b/swig/matlab/+helics/helics_pending_exec_state.m index cc24e11274..6177a59dec 100644 --- a/swig/matlab/+helics/helics_pending_exec_state.m +++ b/swig/matlab/+helics/helics_pending_exec_state.m @@ -1,7 +1,7 @@ function v = helics_pending_exec_state() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783859); + vInitialized = helicsMEX(0, 1432107610); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_pending_init_state.m b/swig/matlab/+helics/helics_pending_init_state.m index 33c7021f9e..3fce1b177a 100644 --- a/swig/matlab/+helics/helics_pending_init_state.m +++ b/swig/matlab/+helics/helics_pending_init_state.m @@ -1,7 +1,7 @@ function v = helics_pending_init_state() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783858); + vInitialized = helicsMEX(0, 1432107609); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_pending_iterative_time_state.m b/swig/matlab/+helics/helics_pending_iterative_time_state.m index b15f41c265..ea0ff6dcc0 100644 --- a/swig/matlab/+helics/helics_pending_iterative_time_state.m +++ b/swig/matlab/+helics/helics_pending_iterative_time_state.m @@ -1,7 +1,7 @@ function v = helics_pending_iterative_time_state() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783861); + vInitialized = helicsMEX(0, 1432107612); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_pending_time_state.m b/swig/matlab/+helics/helics_pending_time_state.m index d9eb825c01..5d9f9413e3 100644 --- a/swig/matlab/+helics/helics_pending_time_state.m +++ b/swig/matlab/+helics/helics_pending_time_state.m @@ -1,7 +1,7 @@ function v = helics_pending_time_state() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783860); + vInitialized = helicsMEX(0, 1432107611); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_randomDelay_filter.m b/swig/matlab/+helics/helics_randomDelay_filter.m index 88003d1079..691c18dda6 100644 --- a/swig/matlab/+helics/helics_randomDelay_filter.m +++ b/swig/matlab/+helics/helics_randomDelay_filter.m @@ -1,7 +1,7 @@ function v = helics_randomDelay_filter() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783864); + vInitialized = helicsMEX(0, 1432107615); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_randomDrop_filter.m b/swig/matlab/+helics/helics_randomDrop_filter.m index a5f775f6b7..f407262fe6 100644 --- a/swig/matlab/+helics/helics_randomDrop_filter.m +++ b/swig/matlab/+helics/helics_randomDrop_filter.m @@ -1,7 +1,7 @@ function v = helics_randomDrop_filter() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783865); + vInitialized = helicsMEX(0, 1432107616); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_registration_failure.m b/swig/matlab/+helics/helics_registration_failure.m index 1d1b5cb359..286d0eb731 100644 --- a/swig/matlab/+helics/helics_registration_failure.m +++ b/swig/matlab/+helics/helics_registration_failure.m @@ -1,7 +1,7 @@ function v = helics_registration_failure() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783837); + vInitialized = helicsMEX(0, 1432107588); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_reroute_filter.m b/swig/matlab/+helics/helics_reroute_filter.m index db96103548..9b7d9d7e6b 100644 --- a/swig/matlab/+helics/helics_reroute_filter.m +++ b/swig/matlab/+helics/helics_reroute_filter.m @@ -1,7 +1,7 @@ function v = helics_reroute_filter() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783866); + vInitialized = helicsMEX(0, 1432107617); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_startup_state.m b/swig/matlab/+helics/helics_startup_state.m index 09a4fa9475..5258dcf278 100644 --- a/swig/matlab/+helics/helics_startup_state.m +++ b/swig/matlab/+helics/helics_startup_state.m @@ -1,7 +1,7 @@ function v = helics_startup_state() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783853); + vInitialized = helicsMEX(0, 1432107604); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_terminated.m b/swig/matlab/+helics/helics_terminated.m index 0b363b7214..4fd942e825 100644 --- a/swig/matlab/+helics/helics_terminated.m +++ b/swig/matlab/+helics/helics_terminated.m @@ -1,7 +1,7 @@ function v = helics_terminated() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783841); + vInitialized = helicsMEX(0, 1432107592); end v = vInitialized; end diff --git a/swig/matlab/+helics/helics_warning.m b/swig/matlab/+helics/helics_warning.m index fc317e6c8a..85792afa65 100644 --- a/swig/matlab/+helics/helics_warning.m +++ b/swig/matlab/+helics/helics_warning.m @@ -1,7 +1,7 @@ function v = helics_warning() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783842); + vInitialized = helicsMEX(0, 1432107593); end v = vInitialized; end diff --git a/swig/matlab/+helics/iterate_if_needed.m b/swig/matlab/+helics/iterate_if_needed.m index 0ce5e2f4c8..6427ee9740 100644 --- a/swig/matlab/+helics/iterate_if_needed.m +++ b/swig/matlab/+helics/iterate_if_needed.m @@ -1,7 +1,7 @@ function v = iterate_if_needed() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783848); + vInitialized = helicsMEX(0, 1432107599); end v = vInitialized; end diff --git a/swig/matlab/+helics/iterating.m b/swig/matlab/+helics/iterating.m index 2aef58297b..a647bf7a4d 100644 --- a/swig/matlab/+helics/iterating.m +++ b/swig/matlab/+helics/iterating.m @@ -1,7 +1,7 @@ function v = iterating() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783852); + vInitialized = helicsMEX(0, 1432107603); end v = vInitialized; end diff --git a/swig/matlab/+helics/iteration_error.m b/swig/matlab/+helics/iteration_error.m index fc72f90cde..fe888bdf84 100644 --- a/swig/matlab/+helics/iteration_error.m +++ b/swig/matlab/+helics/iteration_error.m @@ -1,7 +1,7 @@ function v = iteration_error() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783850); + vInitialized = helicsMEX(0, 1432107601); end v = vInitialized; end diff --git a/swig/matlab/+helics/iteration_halted.m b/swig/matlab/+helics/iteration_halted.m index e82be64491..770bc7826f 100644 --- a/swig/matlab/+helics/iteration_halted.m +++ b/swig/matlab/+helics/iteration_halted.m @@ -1,7 +1,7 @@ function v = iteration_halted() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783851); + vInitialized = helicsMEX(0, 1432107602); end v = vInitialized; end diff --git a/swig/matlab/+helics/next_step.m b/swig/matlab/+helics/next_step.m index ba732d8720..7d838e7ecc 100644 --- a/swig/matlab/+helics/next_step.m +++ b/swig/matlab/+helics/next_step.m @@ -1,7 +1,7 @@ function v = next_step() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783849); + vInitialized = helicsMEX(0, 1432107600); end v = vInitialized; end diff --git a/swig/matlab/+helics/no_iteration.m b/swig/matlab/+helics/no_iteration.m index 7f7259ebcd..8a38614485 100644 --- a/swig/matlab/+helics/no_iteration.m +++ b/swig/matlab/+helics/no_iteration.m @@ -1,7 +1,7 @@ function v = no_iteration() persistent vInitialized; if isempty(vInitialized) - vInitialized = helicsMEX(0, 1818783846); + vInitialized = helicsMEX(0, 1432107597); end v = vInitialized; end diff --git a/swig/matlab/helicsMEX.cpp b/swig/matlab/helicsMEX.cpp index 704bc217d8..894e3afcc5 100644 --- a/swig/matlab/helicsMEX.cpp +++ b/swig/matlab/helicsMEX.cpp @@ -7974,54 +7974,54 @@ SWIGINTERN int swigConstant(int SWIGUNUSEDPARM(resc), mxArray *resv[], int argc, } int con_id = (int)mxGetScalar(*argv++); switch (con_id) { - case 1818783836: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_ok",SWIG_From_int(static_cast< int >(helics_ok)));; break; - case 1818783837: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_registration_failure",SWIG_From_int(static_cast< int >(helics_registration_failure)));; break; - case 1818783838: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_invalid_object",SWIG_From_int(static_cast< int >(helics_invalid_object)));; break; - case 1818783839: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_invalid_argument",SWIG_From_int(static_cast< int >(helics_invalid_argument)));; break; - case 1818783840: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_discard",SWIG_From_int(static_cast< int >(helics_discard)));; break; - case 1818783841: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_terminated",SWIG_From_int(static_cast< int >(helics_terminated)));; break; - case 1818783842: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_warning",SWIG_From_int(static_cast< int >(helics_warning)));; break; - case 1818783843: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_invalid_state_transition",SWIG_From_int(static_cast< int >(helics_invalid_state_transition)));; break; - case 1818783844: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_invalid_function_call",SWIG_From_int(static_cast< int >(helics_invalid_function_call)));; break; - case 1818783845: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_error",SWIG_From_int(static_cast< int >(helics_error)));; break; - case 1818783846: *resv = SWIG_Matlab_SetConstant(module_ns,"no_iteration",SWIG_From_int(static_cast< int >(no_iteration)));; break; - case 1818783847: *resv = SWIG_Matlab_SetConstant(module_ns,"force_iteration",SWIG_From_int(static_cast< int >(force_iteration)));; break; - case 1818783848: *resv = SWIG_Matlab_SetConstant(module_ns,"iterate_if_needed",SWIG_From_int(static_cast< int >(iterate_if_needed)));; break; - case 1818783849: *resv = SWIG_Matlab_SetConstant(module_ns,"next_step",SWIG_From_int(static_cast< int >(next_step)));; break; - case 1818783850: *resv = SWIG_Matlab_SetConstant(module_ns,"iteration_error",SWIG_From_int(static_cast< int >(iteration_error)));; break; - case 1818783851: *resv = SWIG_Matlab_SetConstant(module_ns,"iteration_halted",SWIG_From_int(static_cast< int >(iteration_halted)));; break; - case 1818783852: *resv = SWIG_Matlab_SetConstant(module_ns,"iterating",SWIG_From_int(static_cast< int >(iterating)));; break; - case 1818783853: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_startup_state",SWIG_From_int(static_cast< int >(helics_startup_state)));; break; - case 1818783854: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_initialization_state",SWIG_From_int(static_cast< int >(helics_initialization_state)));; break; - case 1818783855: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_execution_state",SWIG_From_int(static_cast< int >(helics_execution_state)));; break; - case 1818783856: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_finalize_state",SWIG_From_int(static_cast< int >(helics_finalize_state)));; break; - case 1818783857: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_error_state",SWIG_From_int(static_cast< int >(helics_error_state)));; break; - case 1818783858: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_pending_init_state",SWIG_From_int(static_cast< int >(helics_pending_init_state)));; break; - case 1818783859: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_pending_exec_state",SWIG_From_int(static_cast< int >(helics_pending_exec_state)));; break; - case 1818783860: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_pending_time_state",SWIG_From_int(static_cast< int >(helics_pending_time_state)));; break; - case 1818783861: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_pending_iterative_time_state",SWIG_From_int(static_cast< int >(helics_pending_iterative_time_state)));; break; - case 1818783862: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_custom_filter",SWIG_From_int(static_cast< int >(helics_custom_filter)));; break; - case 1818783863: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_delay_filter",SWIG_From_int(static_cast< int >(helics_delay_filter)));; break; - case 1818783864: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_randomDelay_filter",SWIG_From_int(static_cast< int >(helics_randomDelay_filter)));; break; - case 1818783865: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_randomDrop_filter",SWIG_From_int(static_cast< int >(helics_randomDrop_filter)));; break; - case 1818783866: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_reroute_filter",SWIG_From_int(static_cast< int >(helics_reroute_filter)));; break; - case 1818783867: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_clone_filter",SWIG_From_int(static_cast< int >(helics_clone_filter)));; break; - case 1818783868: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_DEFAULT",SWIG_From_int(static_cast< int >(0)));; break; - case 1818783869: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_ZMQ",SWIG_From_int(static_cast< int >(1)));; break; - case 1818783870: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_MPI",SWIG_From_int(static_cast< int >(2)));; break; - case 1818783871: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_TEST",SWIG_From_int(static_cast< int >(3)));; break; - case 1818783872: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_INTERPROCESS",SWIG_From_int(static_cast< int >(4)));; break; - case 1818783873: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_IPC",SWIG_From_int(static_cast< int >(5)));; break; - case 1818783874: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_TCP",SWIG_From_int(static_cast< int >(6)));; break; - case 1818783875: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_UDP",SWIG_From_int(static_cast< int >(7)));; break; - case 1818783876: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_STRING",SWIG_From_int(static_cast< int >(0)));; break; - case 1818783877: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_DOUBLE",SWIG_From_int(static_cast< int >(1)));; break; - case 1818783878: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_INT",SWIG_From_int(static_cast< int >(2)));; break; - case 1818783879: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_COMPLEX",SWIG_From_int(static_cast< int >(3)));; break; - case 1818783880: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_VECTOR",SWIG_From_int(static_cast< int >(4)));; break; - case 1818783881: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_NAMEDPOINT",SWIG_From_int(static_cast< int >(6)));; break; - case 1818783882: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_BOOLEAN",SWIG_From_int(static_cast< int >(7)));; break; - case 1818783883: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_RAW",SWIG_From_int(static_cast< int >(25)));; break; + case 1432107587: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_ok",SWIG_From_int(static_cast< int >(helics_ok)));; break; + case 1432107588: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_registration_failure",SWIG_From_int(static_cast< int >(helics_registration_failure)));; break; + case 1432107589: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_invalid_object",SWIG_From_int(static_cast< int >(helics_invalid_object)));; break; + case 1432107590: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_invalid_argument",SWIG_From_int(static_cast< int >(helics_invalid_argument)));; break; + case 1432107591: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_discard",SWIG_From_int(static_cast< int >(helics_discard)));; break; + case 1432107592: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_terminated",SWIG_From_int(static_cast< int >(helics_terminated)));; break; + case 1432107593: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_warning",SWIG_From_int(static_cast< int >(helics_warning)));; break; + case 1432107594: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_invalid_state_transition",SWIG_From_int(static_cast< int >(helics_invalid_state_transition)));; break; + case 1432107595: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_invalid_function_call",SWIG_From_int(static_cast< int >(helics_invalid_function_call)));; break; + case 1432107596: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_error",SWIG_From_int(static_cast< int >(helics_error)));; break; + case 1432107597: *resv = SWIG_Matlab_SetConstant(module_ns,"no_iteration",SWIG_From_int(static_cast< int >(no_iteration)));; break; + case 1432107598: *resv = SWIG_Matlab_SetConstant(module_ns,"force_iteration",SWIG_From_int(static_cast< int >(force_iteration)));; break; + case 1432107599: *resv = SWIG_Matlab_SetConstant(module_ns,"iterate_if_needed",SWIG_From_int(static_cast< int >(iterate_if_needed)));; break; + case 1432107600: *resv = SWIG_Matlab_SetConstant(module_ns,"next_step",SWIG_From_int(static_cast< int >(next_step)));; break; + case 1432107601: *resv = SWIG_Matlab_SetConstant(module_ns,"iteration_error",SWIG_From_int(static_cast< int >(iteration_error)));; break; + case 1432107602: *resv = SWIG_Matlab_SetConstant(module_ns,"iteration_halted",SWIG_From_int(static_cast< int >(iteration_halted)));; break; + case 1432107603: *resv = SWIG_Matlab_SetConstant(module_ns,"iterating",SWIG_From_int(static_cast< int >(iterating)));; break; + case 1432107604: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_startup_state",SWIG_From_int(static_cast< int >(helics_startup_state)));; break; + case 1432107605: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_initialization_state",SWIG_From_int(static_cast< int >(helics_initialization_state)));; break; + case 1432107606: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_execution_state",SWIG_From_int(static_cast< int >(helics_execution_state)));; break; + case 1432107607: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_finalize_state",SWIG_From_int(static_cast< int >(helics_finalize_state)));; break; + case 1432107608: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_error_state",SWIG_From_int(static_cast< int >(helics_error_state)));; break; + case 1432107609: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_pending_init_state",SWIG_From_int(static_cast< int >(helics_pending_init_state)));; break; + case 1432107610: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_pending_exec_state",SWIG_From_int(static_cast< int >(helics_pending_exec_state)));; break; + case 1432107611: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_pending_time_state",SWIG_From_int(static_cast< int >(helics_pending_time_state)));; break; + case 1432107612: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_pending_iterative_time_state",SWIG_From_int(static_cast< int >(helics_pending_iterative_time_state)));; break; + case 1432107613: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_custom_filter",SWIG_From_int(static_cast< int >(helics_custom_filter)));; break; + case 1432107614: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_delay_filter",SWIG_From_int(static_cast< int >(helics_delay_filter)));; break; + case 1432107615: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_randomDelay_filter",SWIG_From_int(static_cast< int >(helics_randomDelay_filter)));; break; + case 1432107616: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_randomDrop_filter",SWIG_From_int(static_cast< int >(helics_randomDrop_filter)));; break; + case 1432107617: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_reroute_filter",SWIG_From_int(static_cast< int >(helics_reroute_filter)));; break; + case 1432107618: *resv = SWIG_Matlab_SetConstant(module_ns,"helics_clone_filter",SWIG_From_int(static_cast< int >(helics_clone_filter)));; break; + case 1432107619: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_DEFAULT",SWIG_From_int(static_cast< int >(0)));; break; + case 1432107620: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_ZMQ",SWIG_From_int(static_cast< int >(1)));; break; + case 1432107621: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_MPI",SWIG_From_int(static_cast< int >(2)));; break; + case 1432107622: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_TEST",SWIG_From_int(static_cast< int >(3)));; break; + case 1432107623: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_INTERPROCESS",SWIG_From_int(static_cast< int >(4)));; break; + case 1432107624: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_IPC",SWIG_From_int(static_cast< int >(5)));; break; + case 1432107625: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_TCP",SWIG_From_int(static_cast< int >(6)));; break; + case 1432107626: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_UDP",SWIG_From_int(static_cast< int >(7)));; break; + case 1432107627: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_STRING",SWIG_From_int(static_cast< int >(0)));; break; + case 1432107628: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_DOUBLE",SWIG_From_int(static_cast< int >(1)));; break; + case 1432107629: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_INT",SWIG_From_int(static_cast< int >(2)));; break; + case 1432107630: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_COMPLEX",SWIG_From_int(static_cast< int >(3)));; break; + case 1432107631: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_VECTOR",SWIG_From_int(static_cast< int >(4)));; break; + case 1432107632: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_NAMEDPOINT",SWIG_From_int(static_cast< int >(6)));; break; + case 1432107633: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_BOOLEAN",SWIG_From_int(static_cast< int >(7)));; break; + case 1432107634: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_RAW",SWIG_From_int(static_cast< int >(25)));; break; default: SWIG_Error(SWIG_RuntimeError, "No such constant."); return 1; diff --git a/tests/helics/application_api/FilterAdditionalTests.cpp b/tests/helics/application_api/FilterAdditionalTests.cpp index ff12543bc9..969acb226b 100644 --- a/tests/helics/application_api/FilterAdditionalTests.cpp +++ b/tests/helics/application_api/FilterAdditionalTests.cpp @@ -24,7 +24,7 @@ namespace utf = boost::unit_test; /** Test rerouter filter -This test case sets reroute filter on a source endpoint. Ths means message +This test case sets reroute filter on a source endpoint. This means message sent from this endpoint will be rerouted to a new destination endpoint. */ @@ -32,6 +32,7 @@ BOOST_TEST_DECORATOR(*utf::label("ci")) BOOST_DATA_TEST_CASE(message_reroute_filter_object1, bdata::make (core_types), core_type) { auto broker = AddBroker (core_type, 2); + AddFederates (core_type, 1, broker, 1.0, "filter"); AddFederates (core_type, 1, broker, 1.0, "message"); @@ -79,7 +80,7 @@ BOOST_DATA_TEST_CASE(message_reroute_filter_object1, bdata::make (core_types), c /** Test rerouter filter under condition This test case sets reroute filter on a source endpoint with a condition parameter. -Ths means message sent from this endpoint will be rerouted to a new destination +This means message sent from this endpoint will be rerouted to a new destination endpoint only if condition matches. */ BOOST_TEST_DECORATOR(*utf::label("ci")) @@ -133,7 +134,7 @@ BOOST_DATA_TEST_CASE(message_reroute_filter_condition, bdata::make (core_types), /** Test rerouter filter -This test case sets reroute filter on a destination endpoint. Ths means message +This test case sets reroute filter on a destination endpoint. This means message sent to this endpoint will be rerouted to a new destination endpoint. */ From c0cf5f123d84943484f6ee71f8149ce000af2179 Mon Sep 17 00:00:00 2001 From: Andy Fisher Date: Fri, 21 Sep 2018 17:33:59 -0700 Subject: [PATCH 13/16] MSYS2 Build Instructions (#457) * Adding instructions on how to compile HELICS from source using MSYS2 on Windows. --- docs/installation/windows.md | 388 ++++++++++++++++++++--------------- 1 file changed, 227 insertions(+), 161 deletions(-) diff --git a/docs/installation/windows.md b/docs/installation/windows.md index 33c93d2afc..85c4903eea 100644 --- a/docs/installation/windows.md +++ b/docs/installation/windows.md @@ -1,161 +1,227 @@ -# Windows Installation - - -## Requirements - -- Microsoft Visual C++ 2015 or newer (MS Build Tools also works) -- CMake 3.4 or newer -- git -- Boost 1.58 or newer -- ZeroMQ 4.2.0 or newer (if ZeroMQ support is needed) -- MS-MPI v8 or newer (if MPI support is needed) - -## Setup - -To set up your environment: - -1. Install Microsoft Visual C++ 2015 or newer -2. Install - [Boost](http://www.boost.org/doc/libs/1_64_0/more/getting_started/windows.html) - [Windows downloads](https://dl.bintray.com/boostorg/release/1.66.0/binaries/) - 1.61 or later recommended (core library should build with 1.58, - but tests will not). For CMake to detect it automatically either - extract Boost to the root of your drive, or set the BOOST\_INSTALL\_PATH - environment variable to the install location. The cmake will only automatically find - boost 1.61 or newer. - Building with Visual Studio 2017 will require boost 1.65.1 or newer and cmake 3.9 - or newer. Use 14.0 versions for Visual Studio 2015, 14.1 files for Visual studio 2017. - Boost 1.66 with cmake 3.11 is the current recommended configuration. -3. *Optional* Install [ZeroMQ](http://zeromq.org/build:_start) if you - need ZeroMQ support and need a copy in a global system location. - We recommend skipping this step and running cmake with the - `AUTOBUILD_ZMQ=ON` option to automatically set up a project-only - copy of ZeroMQ later on. The ZeroMQ Windows installer is **very** - outdated and will not work with new versions of Visual Studio. -4. *Optional* Install - [MS-MPI](https://msdn.microsoft.com/en-us/library/bb524831(v=vs.85).aspx) - if you need MPI support. -5. *Optional* Install - [SWIG](http://www.swig.org/download.html) - if you wish to generate the interface libraries, appropriate build files are - included in the repository so it shouldn't be necessary to regenerate unless the libraries are modified -6. Open a Visual Studio Command Prompt, and go to your working - directory. -7. Make sure *cmake* and *git* are available in the Command Prompt. - If they aren't, add them to the system PATH variable. - -Getting and building from source: - -1. Set up your environment. -2. Open a command prompt. Use git clone to check out a copy of - HELICS. - -```bash -git clone https://github.com/GMLC-TDC/HELICS-src.git -``` - -3. Go to the checkedout HELICS project folder (the default folder - name is HELICS-src). Create a build folder and open the build - folder. Alternatively, cmake-gui can be used. - -```bash -cd HELICS-src -mkdir build -cd build -``` - -4. Run cmake. It should automatically detect where MPI is installed - if the system path variables are set up correctly, otherwise you - will have to set the cmake path manually. The AUTOBUILD_ZMQ is set to ON - so ZeroMQ will automatically be built unless the option is changed. - -```bash -cmake .. -``` - -If you need cmake to use a generator other than the default (ex: -selecting between a 32-bit or 64-bit project), the -G option can be -used to specify one of the generators listed by cmake --help. For -Visual Studio 2017, the generator name would be -`Visual Studio 15 2017 [arch]`, where \[arch\] is optional and can be -either Win64 for a 64-bit project, or left out to generate a 32-bit -project. To avoid problems when building later, this should match the -version of the Boost libraries you are using. - -If you installed boost into the root of the C or D drives with the -default localtion (or the BOOST\_INSTALL\_PATH environment variable has been set), -cmake should automatically detect their location. Otherwise the -location will need to be manually given to cmake. - -5. Open the Visual Studio solution generated by CMake. Under the - *Build* menu, select *Build the Solution*. Alternatively, in the - MSBuild command prompt, run the command msbuild HELICS.sln from - the build folder to compile the entire solution. HELICS.sln can be - replaced with the name of one of the projects to build only that - part of HELICS. - -## Windows Installers - -Windows installers are available with the different [releases](https://github.com/GMLC-TDC/HELICS-src/releases). The release includes installers for the Debug version and Release version. As well as a zip file of the install directory. The static libraries included with the installer will work with Visual Studio 2017. - -## Testing - -A quick test is to double check the versions of the HELICS player and -recorder (located in the 'build\src\helics\apps\player\Debug' folder): - -```bash -> cd C:\Path\To\build\src\helics\apps\Debug - -> helics_player.exe --version -1.0.2 04-28-2018 - -> helics_recorder.exe --version -1.0.2 04-28-2018 -``` - -## Building HELICS with python support - -Setting `-DBUILD_PYTHON_INTERFACE=ON` will generate a project to build the python interface, if python is installed to a system -path then the appropriate libraries and flags will be automatically found. If SWIG is available and you wish to regenerate the interface -set SWIG\_EXECUTABLE to the location of swig.exe. Otherwise DISABLE\_SWIG can be set to ON to build using repo sources for the interface. -We highly recommend using Anaconda3/Miniconda3 for the Python distribution. -Additionally, you will need to ensure that the Python distribution used is built using the same compiler architecture (x86/x64) as the one you are using to build HELICS, as well as the one that was used to build Boost (as mentioned above). -ZeroMQ will be built using the CMake build process. - -![](../img/windows-command-line-install.png) - - -```bash -cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="C:\local\helics-v1.0.0" -DBUILD_PYTHON_INTERFACE=ON -G "Visual Studio 14 2015 Win64" .. -cmake --build . --config Release --target install -``` -otherwise they can be set through CMAKE flags -```bash -cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="C:\local\helics-v1.0.0" -DBUILD_PYTHON_INTERFACE=ON -G "Visual Studio 14 2015 Win64" -DPYTHON_INCLUDE_DIR=$(python3-config --prefix)\include\python3.6m\ -DPYTHON_LIBRARY=$(python3-config --prefix)\lib\python3.6m\libpython3.6m.dll .. -cmake --build . --config Release --target install -``` - -![](../img/windows-command-line-success.png) - -Add the following to the Windows PYTHONPATH environment variable or run the following in the command line. - -```bash -set PYTHONPATH=C:\local\helics-v1.0.2\python;%PYTHONPATH% -``` - -If you open a interactive Python session and import helics, you should be able to get the version of `helics` and an output that is similar to the following. - -```bash -$ ipython -Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 12:04:33) -Type 'copyright', 'credits' or 'license' for more information -IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help. - -In [1]: import helics - -In [2]: helics.helicsGetVersion() -Out[2]: '1.0.2 (04-28-18)' - -``` - -![](../img/windows-python-success.png) +# Windows Installation + + +## Requirements + +- Microsoft Visual C++ 2015 or newer (MS Build Tools also works) +- CMake 3.4 or newer +- git +- Boost 1.58 or newer +- ZeroMQ 4.2.0 or newer (if ZeroMQ support is needed) +- MS-MPI v8 or newer (if MPI support is needed) + +## Setup + +To set up your environment: + +1. Install Microsoft Visual C++ 2015 or newer +2. Install + [Boost](http://www.boost.org/doc/libs/1_64_0/more/getting_started/windows.html) + [Windows downloads](https://dl.bintray.com/boostorg/release/1.66.0/binaries/) + 1.61 or later recommended (core library should build with 1.58, + but tests will not). For CMake to detect it automatically either + extract Boost to the root of your drive, or set the BOOST\_INSTALL\_PATH + environment variable to the install location. The cmake will only automatically find + boost 1.61 or newer. + Building with Visual Studio 2017 will require boost 1.65.1 or newer and cmake 3.9 + or newer. Use 14.0 versions for Visual Studio 2015, 14.1 files for Visual studio 2017. + Boost 1.66 with cmake 3.11 is the current recommended configuration. +3. *Optional* Install [ZeroMQ](http://zeromq.org/build:_start) if you + need ZeroMQ support and need a copy in a global system location. + We recommend skipping this step and running cmake with the + `AUTOBUILD_ZMQ=ON` option to automatically set up a project-only + copy of ZeroMQ later on. The ZeroMQ Windows installer is **very** + outdated and will not work with new versions of Visual Studio. +4. *Optional* Install + [MS-MPI](https://msdn.microsoft.com/en-us/library/bb524831(v=vs.85).aspx) + if you need MPI support. +5. *Optional* Install + [SWIG](http://www.swig.org/download.html) + if you wish to generate the interface libraries, appropriate build files are + included in the repository so it shouldn't be necessary to regenerate unless the libraries are modified +6. Open a Visual Studio Command Prompt, and go to your working + directory. +7. Make sure *cmake* and *git* are available in the Command Prompt. + If they aren't, add them to the system PATH variable. + +Getting and building from source: + +1. Set up your environment. +2. Open a command prompt. Use git clone to check out a copy of + HELICS. + +```bash +git clone https://github.com/GMLC-TDC/HELICS-src.git +``` + +3. Go to the checkedout HELICS project folder (the default folder + name is HELICS-src). Create a build folder and open the build + folder. Alternatively, cmake-gui can be used. + +```bash +cd HELICS-src +mkdir build +cd build +``` + +4. Run cmake. It should automatically detect where MPI is installed + if the system path variables are set up correctly, otherwise you + will have to set the cmake path manually. The AUTOBUILD_ZMQ is set to ON + so ZeroMQ will automatically be built unless the option is changed. + +```bash +cmake .. +``` + +If you need cmake to use a generator other than the default (ex: +selecting between a 32-bit or 64-bit project), the -G option can be +used to specify one of the generators listed by cmake --help. For +Visual Studio 2017, the generator name would be +`Visual Studio 15 2017 [arch]`, where \[arch\] is optional and can be +either Win64 for a 64-bit project, or left out to generate a 32-bit +project. To avoid problems when building later, this should match the +version of the Boost libraries you are using. + +If you installed boost into the root of the C or D drives with the +default localtion (or the BOOST\_INSTALL\_PATH environment variable has been set), +cmake should automatically detect their location. Otherwise the +location will need to be manually given to cmake. + +5. Open the Visual Studio solution generated by CMake. Under the + *Build* menu, select *Build the Solution*. Alternatively, in the + MSBuild command prompt, run the command msbuild HELICS.sln from + the build folder to compile the entire solution. HELICS.sln can be + replaced with the name of one of the projects to build only that + part of HELICS. + +## Windows Installers + +Windows installers are available with the different [releases](https://github.com/GMLC-TDC/HELICS-src/releases). The release includes installers for the Debug version and Release version. As well as a zip file of the install directory. The static libraries included with the installer will work with Visual Studio 2017. + +## Testing + +A quick test is to double check the versions of the HELICS player and +recorder (located in the 'build\src\helics\apps\player\Debug' folder): + +```bash +> cd C:\Path\To\build\src\helics\apps\Debug + +> helics_player.exe --version +1.0.2 04-28-2018 + +> helics_recorder.exe --version +1.0.2 04-28-2018 +``` + +## Building HELICS with python support + +Setting `-DBUILD_PYTHON_INTERFACE=ON` will generate a project to build the python interface, if python is installed to a system +path then the appropriate libraries and flags will be automatically found. If SWIG is available and you wish to regenerate the interface +set SWIG\_EXECUTABLE to the location of swig.exe. Otherwise DISABLE\_SWIG can be set to ON to build using repo sources for the interface. +We highly recommend using Anaconda3/Miniconda3 for the Python distribution. +Additionally, you will need to ensure that the Python distribution used is built using the same compiler architecture (x86/x64) as the one you are using to build HELICS, as well as the one that was used to build Boost (as mentioned above). +ZeroMQ will be built using the CMake build process. + +![](../img/windows-command-line-install.png) + + +```bash +cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="C:\local\helics-v1.0.0" -DBUILD_PYTHON_INTERFACE=ON -G "Visual Studio 14 2015 Win64" .. +cmake --build . --config Release --target install +``` +otherwise they can be set through CMAKE flags +```bash +cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="C:\local\helics-v1.0.0" -DBUILD_PYTHON_INTERFACE=ON -G "Visual Studio 14 2015 Win64" -DPYTHON_INCLUDE_DIR=$(python3-config --prefix)\include\python3.6m\ -DPYTHON_LIBRARY=$(python3-config --prefix)\lib\python3.6m\libpython3.6m.dll .. +cmake --build . --config Release --target install +``` + +![](../img/windows-command-line-success.png) + +Add the following to the Windows PYTHONPATH environment variable or run the following in the command line. + +```bash +set PYTHONPATH=C:\local\helics-v1.0.2\python;%PYTHONPATH% +``` + +If you open a interactive Python session and import helics, you should be able to get the version of `helics` and an output that is similar to the following. + +```bash +$ ipython +Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 12:04:33) +Type 'copyright', 'credits' or 'license' for more information +IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help. + +In [1]: import helics + +In [2]: helics.helicsGetVersion() +Out[2]: '1.0.2 (04-28-18)' + +``` + +![](../img/windows-python-success.png) + +## Building HELICS From Source on Windows with MSYS2 ## +### Overview ### +This section will layout the setting up of MSYS2 to compile and install HELICS. This guide will describe all the packages and install instructions for a 64bit build. + +### Setting up MSYS2 ### +MSYS2 provides a linux like terminal environment on your Windows system. MSYS2 can be installed from [here](https://www.msys2.org/). Once MSYS2 has been installed start up msys2.exe. Follow first time updates as described on the MSYS2 website. After MSYS2 has been successfully updated Some packages need to be installed in order to configure and build HELICS. The following packages need to be installed: +- base-devel +- mingw-w64-x86_64-toolchain +- git +- mingw-w64-x86_64-cmake +- mingw-w64-x86_64-boost +- mingw-w64-x86_64-qt5 (only if you want to be able to run cmake-gui which this guide recommends.) +- mingw-w64-x86_64-zeromq + +All packages can be installed by typing the following: +```bash +$ pacman -S --needed base-devel mingw-w64_x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-boost mingw-w64-x86_64-qt5 +``` +After all this has been done /mingw64/bin must be in the PATH environment variable. If it isn't then it must be added. Please note that this is only necessary if you are compiling in MSYS2 shell. If you are compiling in the MSYS2 MINGW-64bit shell then /ming64/bin will be automatically added to the PATH environment variable. +```bash +$ export PATH=$PATH:/mingw64/bin +``` + +### Download HELICS Source Code ### +Now that the MSYS2 environment has been setup and all prerequisite packages have been installed the source code can be compiled and installed. The HELICS source code can be cloned from GitHub by performing the following: +```bash +$ git clone https://github.com/GMLC-TDC/HELICS-src.git +``` +git will clone the source code into a folder in the current working directory called HELICS-src. This path will be refered to by this guide as HELICS_ROOT_DIR. + +### Compiling HELICS From Source ### +Change directories to HELICS_ROOT_DIR. Create a directory called helics-build. This can be accomplished by using the mkdir command. cd into this directory. Now type the following: +```bash +$ cmake-gui ../ +``` +If this failes that is because mingw-w64-x86_64-qt5 was not installed. If you did install it the cmake gui window should pop up. click the Advanced check box next to the search bar. Then click Configure. A window will pop up asking you to specify the generator for this project. Select MSYS Makesfiles from the dropdown menu. Then click the Specify native compilers check box and click next. Enter C:/msys64/mingw64/bin/gcc.exe for the C compiler and C:/msys64/mingw64/bin/g++.exe for the C++ compiler and click finish. Once the Configure process finished several variables will show up highlighted in red. Since this is the first time setup the Boost and ZeroMQ library. Below are the following cmake variables that need to be verified. + +* BUILD_CXX_SHARED_LIB should be checked as GridLAB-D dynamically links with the shared c++ library of HELICS +* Boost_CHRONO_LIBRARY_DEBUG/RELEASE C:/msys64/mingw64/bin/libboost_chrono-mt.dll +* Boost_DATE_TIME_LIBRARY_DEBUG/RELEASE C:/msys64/mingw64/bin/libboost_date_time-mt.dll +* Boost_FILESYSTEM_LIBRARY_DEBUG/RELEASE C:/msys64/mingw64/bin/libboost_filesystem-mt.dll +* Boost_INCLUDE_DIR C:/msys64/mingw64/include +* Boost_LIBRARY_DIR_DEBUG/RELEASE C:/msys64/mingw64/bin +* Boost_PROGRAM_OPTIONS_LIBRARY_DEBUG/RELEASE C:/msys64/mingw64/bin/libboost_program_options-mt.dll +* Boost_SYSTEM_LIBRARY_DEBUG/RELEASE C:/msys64/mingw64/bin/libboost_system-mt.dll +* Boost_TIMER_LIBRARY_DEBUG/RELEASE C:/msys64/mingw64/bin/libboost_timer-mt.dll +* Boost_UNIT_TEST_FRAMEWORK_LIBRARY_DEBUG/RELEASE C:/msys64/mingw64/bin/libboost_unit_test_framework-mt.dll +* CMAKE_CXX_FLAGS -std=gnu++14 +* CMAKE_INSTALL_PREFIX /usr/local or location of your choice +* ZeroMQ_INCLUDE_DIR C:/msys64/mingw64/include +* ZeroMQ_INSTALL_PATH C:/msys64/mingw64 +* ZeroMQ_LIBRARY C:/msys64/mingw64/bin/libzmq.dll +* ZeroMQ_ROOT_DIR C:/msys64/mingw64 + +Once these cmake variables have been correctly varified click Configure. Once that is complete click Generate then once that is complete the CMake gui can be closed. + +Back in the MSYS2 command window type: +```bash +$ make -j x +``` +where x is the number of threads you can give the make process to speed up the build. Then once that is complete type: +```bash +$ make install +``` +unless you changed the value of CMAKE_INSTALL_PREFIX everything the default install location /usr/local/helics_1_3_0. This install path will be refered to as HELICS_INSTALL for the next section. \ No newline at end of file From fb09bf3ebbf8e721ed888f9096f29681a7ce15c6 Mon Sep 17 00:00:00 2001 From: Philip Top Date: Wed, 26 Sep 2018 13:19:56 -0700 Subject: [PATCH 14/16] 131 doc updates (#468) * update version number and some cmake fixes and tweaks * update the changelog and contributors with new updates * move some github docs to the .github folder and update the changelog and roadmap * add PULL_REQUEST_TEMPLATE and support file * add simple test for #441 * fix roadmap link * Update PULL_REQUEST_TEMPLATE.md --- .../CODE_OF_CONDUCT.md | 0 ...stion.md => support-or-design-question.md} | 2 +- .github/PULL_REQUEST_TEMPLATE.md | 24 ++++++++++++ .github/SUPPORT.md | 6 +++ CHANGELOG.md | 18 ++++++++- CMakeLists.txt | 21 +++++++--- CONTRIBUTORS.md | 4 +- ROADMAP.md | 38 ++++++++++++------- config/cmake/compiler_flags.cmake | 8 +++- config/cmake/configGenerator.cmake | 2 +- src/helics/core/CMakeLists.txt | 4 +- .../MessageFederateKeyTests.cpp | 3 ++ 12 files changed, 103 insertions(+), 27 deletions(-) rename code-of-conduct.md => .github/CODE_OF_CONDUCT.md (100%) rename .github/ISSUE_TEMPLATE/{support-of-design-question.md => support-or-design-question.md} (84%) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/SUPPORT.md diff --git a/code-of-conduct.md b/.github/CODE_OF_CONDUCT.md similarity index 100% rename from code-of-conduct.md rename to .github/CODE_OF_CONDUCT.md diff --git a/.github/ISSUE_TEMPLATE/support-of-design-question.md b/.github/ISSUE_TEMPLATE/support-or-design-question.md similarity index 84% rename from .github/ISSUE_TEMPLATE/support-of-design-question.md rename to .github/ISSUE_TEMPLATE/support-or-design-question.md index 677a3811ed..23524e722e 100644 --- a/.github/ISSUE_TEMPLATE/support-of-design-question.md +++ b/.github/ISSUE_TEMPLATE/support-or-design-question.md @@ -1,5 +1,5 @@ --- -name: Support of design question +name: Support or design question about: Ask a detailed question or start a design discussion --- diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000000..eaf332f0d0 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,24 @@ + + +- [ ] I have reviewed the [Contributing Guidelines](../CONTRIBUTING.md) +- [ ] I agree to license my contributions under the same license as in this repository +- [ ] I have verified that the tests pass + +# Description + + + +# Proposed changes + + + +- +- +- + diff --git a/.github/SUPPORT.md b/.github/SUPPORT.md new file mode 100644 index 0000000000..697889e8a7 --- /dev/null +++ b/.github/SUPPORT.md @@ -0,0 +1,6 @@ +# Support resources + +We have an active [Gitter]((https://gitter.im/GMLC-TDC/HELICS-src) channel +Our GitHub pages provides a rich set of [documentation](https://gmlc-tdc.github.io/HELICS-src/index.html) including a set of introductory [examples](https://gmlc-tdc.github.io/HELICS-src/introduction/index.html), a [developers guide](https://gmlc-tdc.github.io/HELICS-src/developer-guide/index.html), complete doxygen-auto-produced [API documentation](https://gmlc-tdc.github.io/HELICS-src/doxygen/), and more. + +We've created a series of roughly 10-minute mini-tutorial videos that discuss various design topics, concepts, and interfaces, including how to use the tool. They can be found on our [YouTube channel](https://www.youtube.com/channel/UCPa81c4BVXEYXt2EShTzbcg). diff --git a/CHANGELOG.md b/CHANGELOG.md index fd2780b1bf..cb3e59d0ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project after the 1.0.0 release will be documented i The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.3.1] - 2018-09-23 +### Changed + - wait for Broker now uses a condition variable instead of sleep and checking repeatedly + +### Fixed + - some race conditions in a few test cases and in user disconnection calls for brokers + - certain types of federates would occasionally hang during off nominal shutdown call sequences. Fixing this led to a substantial rewrite of the tcp comms + +### Added + - federate, broker, and core destroy functions to the C api + - tcp cores have a --reuse-address flag to allow multiple brokers on the same port, mostly useful for the test suite to prevent spurious failures due to the OS not releasing tcp ports in a timely manner. + +### Changed + - changed the logging levels to be error, warning, summary, connections, interfaces, timing, data, and trace to better match debugging levels used in development and make the purpose of each level clearer + - comm objects now can use the same logging system as the rest of HELICS + ## [1.3.0] - 2018-07-31 ### Changed @@ -30,7 +46,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Environment variables are recognized in CMAKE find options - split API tests from system wide tests - added options on MSVC to build with embedded system libraries and embedded debug info. - + ### Removed - Most examples are now located in [HELICS-Examples](https://github.com/GMLC-TDC/HELICS-Examples) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4335ce40c5..fe8a121700 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,13 +7,13 @@ cmake_minimum_required(VERSION 3.4) cmake_policy(VERSION 3.4) -project (HELICS VERSION 1.3.0) +project (HELICS VERSION 1.3.1) # ----------------------------------------------------------------------------- # HELICS Version number # ----------------------------------------------------------------------------- set(HELICS_VERSION_BUILD) -set (HELICS_DATE "07-31-18") +set (HELICS_DATE "09-23-18") set( HELICS_VERSION_UNDERSCORE @@ -64,7 +64,7 @@ mark_as_advanced(AUTOBUILD_INSTALL_PATH) file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/logs) -option(BUILD_HELICS_TESTS "Enable the test Executables to be built" ON) +option(BUILD_HELICS_TESTS "Enable the test executables to be built" ON) # enable testing if(BUILD_HELICS_TESTS) include(CTest) @@ -72,7 +72,7 @@ endif(BUILD_HELICS_TESTS) set_property(GLOBAL PROPERTY USE_FOLDERS ON) -option(BUILD_HELICS_EXAMPLES "Enable the example Executables to be built" ON) +option(BUILD_HELICS_EXAMPLES "Enable the example executables to be built" ON) option(BUILD_PYTHON_INTERFACE "Build Python extension" OFF) option( @@ -331,7 +331,7 @@ endif(MSYS) # Enable ZeroMQ # ------------------------------------------------------------- -# just check some intenal options +# just check some internal options if(BUILD_DEBUG_ONLY AND BUILD_RELEASE_ONLY) message( fatal @@ -462,6 +462,17 @@ option( ) file(GLOB KEY_LIBRARY_FILES ${AUTOBUILD_INSTALL_PATH}/bin/*) +if (ZMQ_USE_STATIC_LIBRARY) + #remove the zmq libraries from the key files list if we are using static zeromq libraries + set(NEW_LIST ) + foreach(keyfile IN LISTS KEY_LIBRARY_FILES) + if (keyfile MATCHES "zmq") + else() + list(APPEND NEW_LIST ${keyfile}) + endif() + endforeach() + set(KEY_LIBRARY_FILES ${NEW_LIST}) +endif() # message(STATUS "key files ${KEY_LIBRARY_FILES}") option(DISABLE_LOGGING "disable all normal, debug, and trace logging in HELICS" OFF) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index e970f28ac8..97cdb2a984 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -18,11 +18,13 @@ If you would like to contribute to the HELICS project see [CONTRIBUTING](CONTRIB - Himanshu Jain* - Dheepak Krishnamurthy* - Bryan Palmintier* + - Bryan Richardson** ### Argonne National Lab - Shrirang Abhyankar* `*` currently active + `**` subcontractor ## Used Libraries or Code @@ -33,7 +35,7 @@ If you would like to contribute to the HELICS project see [CONTRIBUTING](CONTRIB ZeroMQ message passing is used in the ZMQ core networking. The autobuild currently uses version 4.2.5. No zmq library code is included in the HELICS source. Helics installers include ZeroMQ binary libraries. ZeroMQ is licensed under [LGPL](https://github.com/zeromq/libzmq/blob/master/COPYING.LESSER) with a modification to allow for linking and in various forms and distribution of the binary under different terms if the library was not modified. No modification of the ZMQ library or any of the ZeroMQ source files is included in the HELICS source code. ### [cppzmq](https://github.com/zeromq/cppzmq) - The header only bindings for the zmq library are used to interact with the ZeroMQ library the header files are modified to include some string operations and are included in HELICS source. Cppzmp is licensed under the [MIT](https://github.com/zeromq/cppzmq/blob/master/LICENSE) license. + The header only bindings for the ZeroMQ library are used to interact with the ZeroMQ library the header files are modified to include some string operations and are included in HELICS source. Cppzmp is licensed under the [MIT](https://github.com/zeromq/cppzmq/blob/master/LICENSE) license. ### [jsoncpp](https://github.com/open-source-parsers/jsoncpp) JsonCPP is used for parsing json files, it was chosen for easy inclusion the project and its support for comments. Jsoncpp is licensed under public domain or MIT in case public domain is not recognized [LICENSE](https://github.com/open-source-parsers/jsoncpp/blob/master/LICENSE) diff --git a/ROADMAP.md b/ROADMAP.md index 16fc3b2cb2..0af72ac824 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,30 +2,40 @@ This document contains tentative plans for changes and improvements of note in upcoming versions of the HELICS library. All dates are approximate and subject to change. see the [projects](https://github.com/GMLC-TDC/HELICS-src/projects) for additional details -## [2.0 Alpha] ~ 2018-08-29 -- see [HELICS 2.0 Alpha](https://github.com/GMLC-TDC/HELICS-src/projects/7) for up to date information +## [2.0 Beta] ~ 2018-10-02 +- see [HELICS 2.0](https://github.com/GMLC-TDC/HELICS-src/projects/7) for up to date information ### Features - - targeted integration with package managers for 2.0 so alpha version will start that process - - a routing broker to connect different communication types and brokers together in the same federation + - will be released when the 2.0 branch is passing all tests - add input interface which will be a more general named version of the Subscriptions - - change filters so they can link to multiple endpoints - - exploration of more general convergence algorithms - - C# interface + - change filters so they can link to multiple endpoint - Pythonic API wrapper - - Matlab wrapper API ### Improvements - Major API changes based on feedback and initial broader usage - Change C interface to use an error object instead of return code and corresponding updates to the Interface API's - - Initial performance and scalability testing - - relaxed interface registration requirements - - additional tests of language API's and timing -## [2.0 Beta] ~ 2018-09-30 - - see [HELICS 2.0 Beta](https://github.com/GMLC-TDC/HELICS-src/projects/11) for up to date information + +## [2.0] ~ 2018-10-31 + - see [HELICS 2.0](https://github.com/GMLC-TDC/HELICS-src/projects/11) for up to date information ### Features - package manager integration + - C# interface + - Matlab wrapper API + - a routing broker to connect different communication types and brokers together in the same federation + - targeted integration with package managers for 2.0 so alpha version will start that process + - a single socket tcp broker ### Improvements - - composable type system for data transfer + - additional tests of language API's and timing for new features and capabilities - Additional performance and scalability testing + +## [2.1] ~ 2018-11-21 +- see [HELICS 2.X](https://github.com/GMLC-TDC/HELICS-src/projects/10) for up to date information +- all features here are tentative and subject to change +### Features + - additional package manager integration + - Julia interface + - convergence app for helping with convergence issues between multiple federates + +### Improvements + - Additional performance and scalability testing and improvements diff --git a/config/cmake/compiler_flags.cmake b/config/cmake/compiler_flags.cmake index 3b66d805d1..9e8b7d3755 100644 --- a/config/cmake/compiler_flags.cmake +++ b/config/cmake/compiler_flags.cmake @@ -1,4 +1,8 @@ - +# +# Copyright © 2017-2018, Battelle Memorial Institute; Lawrence Livermore National +# Security, LLC; Alliance for Sustainable Energy, LLC All rights reserved. See LICENSE +# file and DISCLAIMER for more details. +# option(ENABLE_EXTRA_COMPILER_WARNINGS "disable compiler warning for ${CMAKE_PROJECT_NAME} build" ON) option(ENABLE_ERROR_ON_WARNINGS "generate a compiler error for any warning encountered" OFF) @@ -73,7 +77,7 @@ else(UNIX) add_compile_options($<$:-Wshadow>) add_compile_options($<$:-Wstrict-aliasing=1>) add_compile_options($<$:-Wunreachable-code>) - add_compile_options($<$:-Wstrict-overflow=5>) + #add_compile_options($<$:-Wstrict-overflow=5>) add_compile_options($<$:-Woverloaded-virtual>) #add_compile_options($<$:-Wredundant-decls>) add_compile_options($<$:-Wcast-align>) diff --git a/config/cmake/configGenerator.cmake b/config/cmake/configGenerator.cmake index fbef56b88a..5f4a5a349f 100644 --- a/config/cmake/configGenerator.cmake +++ b/config/cmake/configGenerator.cmake @@ -1,5 +1,5 @@ # LLNS Copyright Start -# Copyright (c) 2017, Lawrence Livermore National Security +# Copyright (c) 2018, Lawrence Livermore National Security # This work was performed under the auspices of the U.S. Department # of Energy by Lawrence Livermore National Laboratory in part under # Contract W-7405-Eng-48 and in part under Contract DE-AC52-07NA27344. diff --git a/src/helics/core/CMakeLists.txt b/src/helics/core/CMakeLists.txt index a027afa631..9b81290d24 100644 --- a/src/helics/core/CMakeLists.txt +++ b/src/helics/core/CMakeLists.txt @@ -188,9 +188,9 @@ target_compile_definitions( helics_core PRIVATE $ ) -if(APPLE) +if(NOT ENABLE_CXX_17) target_compile_definitions(helics_core PUBLIC "-DSTX_NO_STD_ANY=1") -endif(APPLE) +endif() if(HELICS_HAVE_MPI) source_group("mpi" FILES ${MPI_SOURCE_FILES} ${MPI_HEADER_FILES}) diff --git a/tests/helics/application_api/MessageFederateKeyTests.cpp b/tests/helics/application_api/MessageFederateKeyTests.cpp index 1896269eb5..f27cf9dfdd 100644 --- a/tests/helics/application_api/MessageFederateKeyTests.cpp +++ b/tests/helics/application_api/MessageFederateKeyTests.cpp @@ -403,6 +403,9 @@ BOOST_DATA_TEST_CASE (test_time_interruptions, bdata::make (core_types_all), cor BOOST_CHECK (mFed1->hasMessage () == false); mFed1->finalize (); + + gtime=mFed2->requestTime (2.0); + BOOST_CHECK_EQUAL (gtime, 2.0); mFed2->finalize (); BOOST_CHECK (mFed1->getCurrentState () == helics::Federate::op_states::finalize); From 8e5513a90e51b298a2a9d90a8979631ef3a163cb Mon Sep 17 00:00:00 2001 From: Ryan Mast Date: Fri, 28 Sep 2018 14:10:41 -0700 Subject: [PATCH 15/16] Fix zerocounters flag for code coverage setup (#472) --- scripts/lcov-helper.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/lcov-helper.sh b/scripts/lcov-helper.sh index 5a918ad2a7..499336c2ab 100755 --- a/scripts/lcov-helper.sh +++ b/scripts/lcov-helper.sh @@ -4,7 +4,7 @@ if [[ "$1" ]]; then subcmd=$(tr '[:upper:]' '[:lower:]' <<< $1) case "${subcmd}" in setup-counters) - lcov --directory . -- zerocounters > /dev/null + lcov --directory . --zerocounters > /dev/null lcov --no-external --capture --initial --directory . --output-file coverage.base > /dev/null ;; gather-coverage-info) From 91076e1f9c854ac934ab216c6ef8bc2bfb05cbd5 Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Mon, 1 Oct 2018 12:33:40 -0700 Subject: [PATCH 16/16] Fix docs (#473) * Update hello-world.md * Update python.md * Update matlab.md * Update installation and introduction * Update configuration/Federate.md * Change 1.x.x to x.x.x * Update language.md --- docs/configuration/Federate.md | 4 ++-- docs/installation/language.md | 20 ++++++++++---------- docs/installation/linux.md | 6 +++--- docs/installation/mac.md | 6 +++--- docs/installation/windows.md | 6 +++--- docs/introduction/hello-world.md | 8 ++++---- docs/introduction/java.md | 8 ++++---- docs/introduction/matlab.md | 4 ++-- docs/introduction/python.md | 6 +++--- 9 files changed, 34 insertions(+), 34 deletions(-) diff --git a/docs/configuration/Federate.md b/docs/configuration/Federate.md index 25ff4f0ced..6279c2d7a0 100644 --- a/docs/configuration/Federate.md +++ b/docs/configuration/Federate.md @@ -32,7 +32,7 @@ Json files can also contain information for the FederateInfo structure including The specific different kinds of Federates define the patterns for different elements. ValueFederates define the interfaces for publish and Subscribe mechanisms. MessageFederates define interfaces for endpoints and the basic Federate contains API's for interacting with Filters -Filters can be configured via files the following is an example of a JSON file. TOML configuration files are also supported. [Examples](https://github.com/GMLC-TDC/HELICS-src/tree/master/examples/example_files) +Filters can be configured via files the following is an example of a JSON file. TOML configuration files are also supported. [Examples](https://github.com/GMLC-TDC/HELICS-Examples/tree/bdbdf4/example_files) ``` "filters":[ { @@ -65,7 +65,7 @@ Filters can be configured via files the following is an example of a JSON file. "mode":"clone", //specify that this is cloning filter //"operation":"clone", //cloning filters don't really need an operation since clone is all they do if one is specified it must be "clone" or "cloning" "properties": //additional properties for filters are specified in a property array or object if there is just a single one - [{ + [{ "name":"destination", //destination adds a cloning filter for all messages delivered to a particular "value":"ept1" //the value here the endpoint that will have its messages cloned }, diff --git a/docs/installation/language.md b/docs/installation/language.md index 65008d1f5e..72ee7d8adb 100644 --- a/docs/installation/language.md +++ b/docs/installation/language.md @@ -27,7 +27,7 @@ IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help. In [1]: import helics In [2]: helics.helicsGetVersion() -Out[2]: '1.0.2 (04-28-18)' +Out[2]: 'x.x.x (XX-XX-XX)' ``` @@ -58,7 +58,7 @@ IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help. In [1]: import helics In [2]: helics.helicsGetVersion() -Out[2]: '1.0.2 (04-28-18)' +Out[2]: 'x.x.x (XX-XX-XX)' ``` @@ -109,14 +109,14 @@ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="C:\local\helics-develop cmake --build . --config Release --target INSTALL ``` -Cmake will search for the MATLAB executable and execute a mex command inside MATLAB to build the interface. +Cmake will search for the MATLAB executable and execute a mex command inside MATLAB to build the interface. For this operation to succeed MATLAB must be available and mex must be setup to use an appropriate C compiler. The setup is only required once for each MATLAB installation and does not need to repeated unless the compiler changes. From within MATLAB run ``` >>mex -setup ``` -and follow the prompted instructions. +and follow the prompted instructions. -Reconstructing the files requires a specific version of SWIG with MATLAB support. IF swig is not used then adding `-DDISABLE_SWIG=ON` to the cmake command will bypass swig and use the included interface files directly. If any modifications to the C library were made then swig must be used to regenerate the files appropriately, otherwise the existing files can be used. The CMAKE scripts will detect if the swig is the appropriate version and act accordingly. +Reconstructing the files requires a specific version of SWIG with MATLAB support. If swig is not used then adding `-DDISABLE_SWIG=ON` to the cmake command will bypass swig and use the included interface files directly. If any modifications to the C library were made then swig must be used to regenerate the files appropriately, otherwise the existing files can be used. The CMAKE scripts will detect if the swig is the appropriate version and act accordingly. Add the install directory path to the MATLAB files to your PATH. This can be the system path, or the MATLAB path through the addpath command or the graphical equivalent ``` @@ -152,7 +152,7 @@ To do that, you can follow the following instructions. - Install [SWIG with MATLAB](https://github.com/jaeandersson/swig/) - `./configure --prefix=/Users/$USER/local/swig_install; make; make install;` -- Ensure that SWIG and MATLAB are in the PATH or specify them through the cmake-gui or ccmake. Then make sure swig is enabled and the Matlab files will be generated by SWIG and compiled through MATLAB. +- Ensure that SWIG and MATLAB are in the PATH or specify them through the cmake-gui or ccmake. Then make sure swig is enabled and the Matlab files will be generated by SWIG and compiled through MATLAB. Alternatively, you wish to build the MATLAB interface without using CMake, and you can do the following. @@ -163,7 +163,7 @@ mex -I../src/helics/shared_api_library ./matlab/helics_wrap.cxx -lhelicsSharedLi mv helicsMEX.* matlab/ ``` -The above instructions will have to be modified slightly to support Windows, CMAKE is the recommended process for creating the MATLAB interface. +The above instructions will have to be modified slightly to support Windows, CMAKE is the recommended process for creating the MATLAB interface. ## HELICS with Octave @@ -183,10 +183,10 @@ add the octave folder in the install directory to the octave path ``` >>helics >> helicsGetVersion() -ans = 1.3.0 (07-31-18) +ans = x.x.x (XX-XX-XX) ``` #### Notes -At present the interface to octave is experimental, the testing is limited and not all functions are likely to have a clean interface, this will improve over time. -Octave 4.2 will require swig 3.0.12, Octave 4.4 will require the develop branch of swig. The Octave interface has built and run smoothly on Linux systems, and run through some limited trials. +At present the interface to octave is experimental, the testing is limited and not all functions are likely to have a clean interface, this will improve over time. +Octave 4.2 will require swig 3.0.12, Octave 4.4 will require the develop branch of swig. The Octave interface has built and run smoothly on Linux systems, and run through some limited trials. On windows system the octave interface is not that reliable to build, while it has worked it hasn't been that smooth of process and has required some hacks to get it to work. More work is likely needed. diff --git a/docs/installation/linux.md b/docs/installation/linux.md index b191099396..7463aff8fb 100644 --- a/docs/installation/linux.md +++ b/docs/installation/linux.md @@ -86,7 +86,7 @@ IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help. In [1]: import helics In [2]: helics.helicsGetVersion() -Out[2]: '1.3.0 (07-31-18)' +Out[2]: 'x.x.x (XX-XX-XX)' ``` @@ -100,8 +100,8 @@ A quick test is to double check the versions of the HELICS player and recorder: cd /path/to/helics_install/bin $ helics_player --version -1.3.0 (07-31-18) +x.x.x (XX-XX-XX) $ helics_recorder --version -1.3.0 (07-31-18) +x.x.x (XX-XX-XX) ``` diff --git a/docs/installation/mac.md b/docs/installation/mac.md index 217741afd2..eb6a2994c3 100644 --- a/docs/installation/mac.md +++ b/docs/installation/mac.md @@ -124,10 +124,10 @@ recorder: cd /path/to/helics_install/bin $ helics_player --version -1.0.2 (04-28-18) +x.x.x (XX-XX-XX) $ helics_recorder --version -1.0.2 (04-28-18) +x.x.x (XX-XX-XX) ``` Building HELICS with python support @@ -159,7 +159,7 @@ IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help. In [1]: import helics In [2]: helics.helicsGetVersion() -Out[2]: '1.0.2 (04-28-18)' +Out[2]: 'x.x.x (XX-XX-XX)' ``` diff --git a/docs/installation/windows.md b/docs/installation/windows.md index 85c4903eea..6914551282 100644 --- a/docs/installation/windows.md +++ b/docs/installation/windows.md @@ -96,7 +96,7 @@ location will need to be manually given to cmake. ## Windows Installers -Windows installers are available with the different [releases](https://github.com/GMLC-TDC/HELICS-src/releases). The release includes installers for the Debug version and Release version. As well as a zip file of the install directory. The static libraries included with the installer will work with Visual Studio 2017. +Windows installers are available with the different [releases](https://github.com/GMLC-TDC/HELICS-src/releases). The release includes installers for the Debug version and Release version. As well as a zip file of the install directory. The static libraries included with the installer will work with Visual Studio 2017. ## Testing @@ -154,7 +154,7 @@ IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help. In [1]: import helics In [2]: helics.helicsGetVersion() -Out[2]: '1.0.2 (04-28-18)' +Out[2]: 'x.x.x (XX-XX-XX)' ``` @@ -224,4 +224,4 @@ where x is the number of threads you can give the make process to speed up the b ```bash $ make install ``` -unless you changed the value of CMAKE_INSTALL_PREFIX everything the default install location /usr/local/helics_1_3_0. This install path will be refered to as HELICS_INSTALL for the next section. \ No newline at end of file +unless you changed the value of CMAKE_INSTALL_PREFIX everything the default install location /usr/local/helics_1_3_0. This install path will be refered to as HELICS_INSTALL for the next section. diff --git a/docs/introduction/hello-world.md b/docs/introduction/hello-world.md index 1d741e38fa..01953f44fd 100644 --- a/docs/introduction/hello-world.md +++ b/docs/introduction/hello-world.md @@ -35,12 +35,12 @@ Windows CMD: Next, make a new source file and call it `hello_world_sender.c`. Copy the contents from -[hello\_world\_sender.c](https://github.com/GMLC-TDC/HELICS-src/blob/master/examples/CInterface/hello_world_sender.c) +[hello\_world\_sender.c](https://github.com/GMLC-TDC/HELICS-Examples/blob/bdbdf4e/c/hello_world/hello_world_sender.c) and paste it into the file. Next, create a new source file and call it `hello_world_receiver.c`. Copy the contents from -[hello\_world\_receiver.c](https://github.com/GMLC-TDC/HELICS-src/blob/master/examples/CInterface/hello_world_receiver.c) +[hello\_world\_receiver.c](https://github.com/GMLC-TDC/HELICS-Examples/blob/bdbdf4e/c/hello_world/hello_world_receiver.c) and paste it into the file. We will go through in more detail the contents of these files. For now, @@ -119,7 +119,7 @@ helicsFederateEnterInitializationMode(vfed); helicsFederateEnterExecutionMode(vfed); ``` -These functions publish a String and make a RequestTime function call to +These functions publish a String and make a RequestTime function call to advance time in the simulation ```c @@ -150,7 +150,7 @@ sub = helicsFederateRegisterSubscription (vfed, "hello", "string", ""); helicsFederateEnterInitializationMode (vfed); helicsFederateEnterExecutionMode (vfed); - + /** request that helics grant the federate a time of 1.0 the new time will be returned in currentime*/ helicsFederateRequestTime (vfed, 1.0, ¤ttime); diff --git a/docs/introduction/java.md b/docs/introduction/java.md index ed64f0cd5b..bc662c7552 100644 --- a/docs/introduction/java.md +++ b/docs/introduction/java.md @@ -9,10 +9,10 @@ import com.java.helics.helics; public class HelloWorld { public static void main(String[] args) { - System.loadLibrary("JNIhelics"); + System.loadLibrary("JNIhelics"); - System.out.println("HELICS Version: " + helics.helicsGetVersion()); - } + System.out.println("HELICS Version: " + helics.helicsGetVersion()); + } } ``` @@ -28,7 +28,7 @@ java -Djava.library.path="/Library/Java/Extensions:/Network/Library/Java/Extensi You should see the output that is similar to the following. ``` -HELICS Version: 1.0.2 (04-28-18) +HELICS Version: x.x.x (XX-XX-XX) ``` creating a jar file. diff --git a/docs/introduction/matlab.md b/docs/introduction/matlab.md index 81957ab481..8c1c8dfd38 100644 --- a/docs/introduction/matlab.md +++ b/docs/introduction/matlab.md @@ -36,14 +36,14 @@ mv helicsMEX.* matlab/ Run the following in two separate windows. ```bash matlab -nodesktop -nosplash -cd ~/GitRepos/GMLC-TDC/HELICS-src/swig/matlab +cd ~/GitRepos/GMLC-TDC/HELICS-examples/matlab/pi-exchange pisender ``` The pisender starts a broker so it may work slightly better to start that process first ```bash matlab -nodesktop -nosplash -cd ~/GitRepos/GMLC-TDC/HELICS-src/swig/matlab +cd ~/GitRepos/GMLC-TDC/HELICS-examples/matlab/pi-exchange pireceiver ``` diff --git a/docs/introduction/python.md b/docs/introduction/python.md index 3d3a865003..b1d7423466 100644 --- a/docs/introduction/python.md +++ b/docs/introduction/python.md @@ -38,12 +38,12 @@ Windows CMD: Next, make a new source file and call it `pisender.py`. Copy the contents from -[pisender.py](https://github.com/GMLC-TDC/HELICS-src/blob/develop/examples/python/pi-exchange/pisender.py) +[pisender.py](https://github.com/GMLC-TDC/HELICS-Examples/blob/master/python/pi-exchange/pisender.py) and paste it into the file. Next, create a new source file and call it `hello_world_receiver.c`. Copy the contents from -[pireceiver.py](https://github.com/GMLC-TDC/HELICS-src/blob/develop/examples/python/pi-exchange/pireceiver.py) +[pireceiver.py](https://github.com/GMLC-TDC/HELICS-Examples/blob/master/python/pi-exchange/pireceiver.py) and paste it into the file. Save the files. @@ -73,7 +73,7 @@ You should see something like the following in the PI RECEIVER window (2nd one i ``` $ python pireceiver.py -PI RECEIVER: Helics version = 1.0.0.alpha (01-18-18) +PI RECEIVER: Helics version = x.x.x (XX-XX-XX) PI RECEIVER: Creating Federate Info PI RECEIVER: Setting Federate Info Name PI RECEIVER: Setting Federate Info Core Type