helics  2.8.1
core-types.hpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2017-2021,
3 Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable
4 Energy, LLC. See the top-level NOTICE for additional details. All rights reserved.
5 SPDX-License-Identifier: BSD-3-Clause
6 */
7 #pragma once
8 
9 #ifndef HELICS_CORE_TYPES_HEADER
10 # define HELICS_CORE_TYPES_HEADER
11 
12 # include "../helics_enums.h"
13 
14 # include <string>
15 
20 namespace helics {
23  HELICS_CREATED,
31 };
32 
34 const std::string& fedStateString(federate_state state);
35 
37 enum class core_type : int {
59  UNRECOGNIZED = 22,
60  MULTI = 45
61 
62 };
63 
65 enum class message_processing_result : signed char {
66  continue_processing = -2,
67  delay_message = -1,
68  next_step = 0,
69  error = 1,
70  halted = 2,
71  iterating = 3,
72  reprocess_message = 8 // indicator that the message needs to be processed again
73 };
76 {
77  return (result >= message_processing_result::next_step);
78 }
79 
81 enum class iteration_result : signed char {
82  next_step = 0,
83  error = 1,
85  halted = 2,
86  iterating = 3,
87 };
88 
90 enum class iteration_request : signed char {
91  no_iterations = 0,
92  force_iteration = 1,
93  iterate_if_needed = 2,
94 };
95 
96 } // namespace helics
97 
98 constexpr auto ITERATION_COMPLETE =
100 constexpr auto NO_ITERATION =
103 constexpr auto FORCE_ITERATION =
106 constexpr auto ITERATE_IF_NEEDED =
108 
111 // #TOBEDEPRECTATED The use of the core-types header for the functions contained in
112 // ../application_api/typeOperations.hpp is deprecated and will be removed in HELICS 3.0 please use
113 // ../application_api/typeOperations.hpp directory for those functions.
114 // This next section should be removed in HELICS 3.0 but is needed to prevent breaking changes
115 # if defined HELICS_SHARED_LIBRARY || !defined HELICS_STATIC_CORE_LIBRARY
116 # include "../application_api/typeOperations.hpp"
117 # endif
118 #endif
helics::core_type::UDP
@ UDP
use UDP packets to send the data
ITERATE_IF_NEEDED
constexpr auto ITERATE_IF_NEEDED
warranted
Definition: core-types.hpp:106
helics::HELICS_INITIALIZING
@ HELICS_INITIALIZING
Definition: core-types.hpp:24
helics::core_type
core_type
Definition: core-types.hpp:37
helics::iteration_result::next_step
@ next_step
helics_core_type_zmq
@ helics_core_type_zmq
Definition: helics_enums.h:25
helics::iteration_result::iterating
@ iterating
indicator that the iterations need to continue
helics_core_type_tcp
@ helics_core_type_tcp
Definition: helics_enums.h:34
helics::iteration_request
iteration_request
Definition: core-types.hpp:90
helics::core_type::TCP
@ TCP
use a generic TCP protocol message stream to send messages
helics::iteration_result
iteration_result
Definition: core-types.hpp:81
helics_core_type_mpi
@ helics_core_type_mpi
Definition: helics_enums.h:26
helics::federate_state
federate_state
Definition: core-types.hpp:22
helics::message_processing_result::error
@ error
indicator that an error has occurred
helics_core_type_nng
@ helics_core_type_nng
Definition: helics_enums.h:38
helics::returnableResult
bool returnableResult(message_processing_result result)
Definition: core-types.hpp:75
helics::iteration_request::force_iteration
@ force_iteration
force an iteration whether it is needed or not
helics_core_type_udp
@ helics_core_type_udp
Definition: helics_enums.h:35
helics::core_type::UNRECOGNIZED
@ UNRECOGNIZED
unknown
helics::core_type::WEBSOCKET
@ WEBSOCKET
core/broker using web sockets
helics_core_type_zmq_test
@ helics_core_type_zmq_test
Definition: helics_enums.h:36
helics::message_processing_result
message_processing_result
Definition: core-types.hpp:65
helics_core_type_ipc
@ helics_core_type_ipc
Definition: helics_enums.h:33
helics::message_processing_result::halted
@ halted
indicator that the simulation has been halted
helics::core_type::DEFAULT
@ DEFAULT
ZMQ if available or UDP.
helics::message_processing_result::continue_processing
@ continue_processing
the current loop should continue
helics_core_type_test
@ helics_core_type_test
Definition: helics_enums.h:27
helics::core_type::ZMQ
@ ZMQ
use the Zero MQ networking protocol
helics::iteration_request::iterate_if_needed
@ iterate_if_needed
indicator that the iterations need to continue
helics::iteration_result::halted
@ halted
indicator that the simulation has been halted
helics::core_type::INPROC
@ INPROC
core/broker using a stripped down in process core type
helics::core_type::ZMQ_SS
@ ZMQ_SS
helics::iteration_request::no_iterations
@ no_iterations
indicator that the iterations have completed
FORCE_ITERATION
constexpr auto FORCE_ITERATION
simplified alias to force an iteration
Definition: core-types.hpp:104
helics::core_type::NNG
@ NNG
reserved for future Nanomsg implementation
helics::HELICS_ERROR
@ HELICS_ERROR
the federation has encountered an error
Definition: core-types.hpp:28
helics_core_type_tcp_ss
@ helics_core_type_tcp_ss
Definition: helics_enums.h:39
helics_core_type_null
@ helics_core_type_null
Definition: helics_enums.h:46
helics::fedStateString
const std::string & fedStateString(federate_state state)
Definition: FederateState.cpp:1645
NO_ITERATION
constexpr auto NO_ITERATION
Definition: core-types.hpp:101
helics::core_type::IPC
@ IPC
same as INTERPROCESS
helics::HELICS_TERMINATING
@ HELICS_TERMINATING
the federate is in the process of shutting down
Definition: core-types.hpp:27
helics::core_type::MULTI
@ MULTI
use the multi-broker
helics::iteration_result::error
@ error
indicator that an error has occurred
helics::core_type::INTERPROCESS
@ INTERPROCESS
use when all federates are on the same machine
helics::HELICS_EXECUTING
@ HELICS_EXECUTING
the federation has entered execution state and it now advancing in time
Definition: core-types.hpp:26
helics_core_type_inproc
@ helics_core_type_inproc
Definition: helics_enums.h:43
helics
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14
helics::core_type::TCP_SS
@ TCP_SS
helics_core_type_websocket
@ helics_core_type_websocket
Definition: helics_enums.h:42
helics::core_type::HTTP
@ HTTP
core/broker using web traffic
helics_core_type_default
@ helics_core_type_default
Definition: helics_enums.h:23
helics::HELICS_FINISHED
@ HELICS_FINISHED
the federation has finished its execution
Definition: core-types.hpp:29
helics::core_type::NULLCORE
@ NULLCORE
explicit core type that doesn't exist
ITERATION_COMPLETE
constexpr auto ITERATION_COMPLETE
Definition: core-types.hpp:98
helics::message_processing_result::next_step
@ next_step
indicator that the iterations have completed
helics::HELICS_UNKNOWN
@ HELICS_UNKNOWN
unknown state
Definition: core-types.hpp:30
helics::core_type::MPI
@ MPI
use MPI for operation on a parallel cluster
helics_core_type_http
@ helics_core_type_http
Definition: helics_enums.h:41
helics::message_processing_result::iterating
@ iterating
indicator that the iterations need to continue
helics::message_processing_result::delay_message
@ delay_message
delay the current message and continue processing
helics::core_type::TEST
@ TEST
use the Test core if all federates are in the same process
helics_core_type_interprocess
@ helics_core_type_interprocess
Definition: helics_enums.h:30