helics  3.3.0
CoreTypes.hpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2017-2022,
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>
19 namespace helics {
21 enum class FederateStates : std::uint8_t {
22  CREATED,
23  INITIALIZING,
24  EXECUTING,
26  TERMINATING,
27  ERRORED,
28  FINISHED,
29  UNKNOWN,
30 };
31 
33 const std::string& fedStateString(FederateStates state);
34 
36 enum class CoreType : int {
59  UNRECOGNIZED = 22,
60  MULTI = 45
61 };
62 
64 enum class MessageProcessingResult : std::int8_t {
65 
66  CONTINUE_PROCESSING = -2,
67  DELAY_MESSAGE = -1,
68  NEXT_STEP = 0,
69  ITERATING = 2,
70  HALTED = 3,
71  USER_RETURN =
72  5,
73  ERROR_RESULT = 7,
74  REPROCESS_MESSAGE = 8, // indicator that the message needs to be processed again
75  BUSY = 10, // indicator that processing could not be done since the resource was busy
76 };
79 {
80  return (result >= MessageProcessingResult::NEXT_STEP);
81 }
83 enum class IterationResult : signed char {
84  NEXT_STEP = 0,
85  ITERATING = 2,
87  HALTED = 3,
88  ERROR_RESULT = 7
89 };
90 
92 enum class IterationRequest : signed char {
93  NO_ITERATIONS = 0,
94  FORCE_ITERATION = 1,
96 };
97 
99 enum class InterfaceType : char {
100  UNKNOWN = 'u',
101  PUBLICATION = 'p',
102  INPUT = 'i',
103  ENDPOINT = 'e',
104  FILTER = 'f',
105  TRANSLATOR = 't'
106 };
107 
108 } // namespace helics
117 
118 #endif
helics::CoreType::TCP_SS
@ TCP_SS
helics::CoreType::NNG
@ NNG
reserved for future Nanomsg implementation
HELICS_CORE_TYPE_DEFAULT
@ HELICS_CORE_TYPE_DEFAULT
Definition: helics_enums.h:24
HELICS_CORE_TYPE_NULL
@ HELICS_CORE_TYPE_NULL
Definition: helics_enums.h:58
NO_ITERATION
constexpr auto NO_ITERATION
simplified alias to indicate that no iterations are needed
Definition: CoreTypes.hpp:112
helics::CoreType::UDP
@ UDP
use UDP packets to send the data
helics::IterationResult::HALTED
@ HALTED
indicator that the simulation has been halted
helics::CoreType::MULTI
@ MULTI
use the multi-broker
helics::MessageProcessingResult::USER_RETURN
@ USER_RETURN
indicator that there was a return request but no other conditions or issues
helics::CoreType::WEBSOCKET
@ WEBSOCKET
core/broker using web sockets
helics::returnableResult
bool returnableResult(MessageProcessingResult result)
Definition: CoreTypes.hpp:78
HELICS_CORE_TYPE_ZMQ
@ HELICS_CORE_TYPE_ZMQ
Definition: helics_enums.h:26
helics::CoreType
CoreType
Definition: CoreTypes.hpp:36
helics::CoreType::ZMQ
@ ZMQ
use the Zero MQ networking protocol
helics::InterfaceType
InterfaceType
Definition: CoreTypes.hpp:99
helics::CoreType::INPROC
@ INPROC
core/broker using a stripped down in process core type
helics::FederateStates::TERMINATING
@ TERMINATING
the federate is in the process of shutting down
helics::IterationResult::ERROR_RESULT
@ ERROR_RESULT
indicator that an error has occurred
HELICS_CORE_TYPE_INTERPROCESS
@ HELICS_CORE_TYPE_INTERPROCESS
Definition: helics_enums.h:33
FORCE_ITERATION
constexpr auto FORCE_ITERATION
simplified alias to force an iteration
Definition: CoreTypes.hpp:114
HELICS_CORE_TYPE_NNG
@ HELICS_CORE_TYPE_NNG
Definition: helics_enums.h:45
HELICS_CORE_TYPE_ZMQ_SS
@ HELICS_CORE_TYPE_ZMQ_SS
Definition: helics_enums.h:43
helics::CoreType::ZMQ_SS
@ ZMQ_SS
helics::InterfaceType::FILTER
@ FILTER
handle to a filter
HELICS_CORE_TYPE_HTTP
@ HELICS_CORE_TYPE_HTTP
Definition: helics_enums.h:49
HELICS_CORE_TYPE_UDP
@ HELICS_CORE_TYPE_UDP
Definition: helics_enums.h:41
helics::InterfaceType::INPUT
@ INPUT
handle to a input interface
helics::CoreType::DEFAULT
@ DEFAULT
ZMQ if available or UDP.
helics::IterationRequest::FORCE_ITERATION
@ FORCE_ITERATION
force an iteration whether it is needed or not
ITERATE_IF_NEEDED
constexpr auto ITERATE_IF_NEEDED
simplified alias to indicate that helics should iterate if warranted
Definition: CoreTypes.hpp:116
helics::CoreType::UNRECOGNIZED
@ UNRECOGNIZED
unknown
helics::MessageProcessingResult::HALTED
@ HALTED
indicator that the simulation has been halted
HELICS_CORE_TYPE_WEBSOCKET
@ HELICS_CORE_TYPE_WEBSOCKET
Definition: helics_enums.h:51
helics::IterationRequest
IterationRequest
Definition: CoreTypes.hpp:92
helics::MessageProcessingResult::ITERATING
@ ITERATING
indicator that the iterations need to continue
helics::CoreType::MPI
@ MPI
use MPI for operation on a parallel cluster
HELICS_CORE_TYPE_INPROC
@ HELICS_CORE_TYPE_INPROC
Definition: helics_enums.h:55
helics::IterationResult
IterationResult
Definition: CoreTypes.hpp:83
helics::CoreType::INTERPROCESS
@ INTERPROCESS
use when all federates are on the same machine
helics::FederateStates::INITIALIZING
@ INITIALIZING
helics::IterationRequest::ITERATE_IF_NEEDED
@ ITERATE_IF_NEEDED
indicator that the iterations need to continue
helics::InterfaceType::TRANSLATOR
@ TRANSLATOR
handle to a translator object
HELICS_CORE_TYPE_TEST
@ HELICS_CORE_TYPE_TEST
Definition: helics_enums.h:30
HELICS_CORE_TYPE_TCP_SS
@ HELICS_CORE_TYPE_TCP_SS
Definition: helics_enums.h:47
helics::MessageProcessingResult::ERROR_RESULT
@ ERROR_RESULT
indicator that an error has occurred
helics::MessageProcessingResult::CONTINUE_PROCESSING
@ CONTINUE_PROCESSING
the current loop should continue
ITERATION_COMPLETE
constexpr auto ITERATION_COMPLETE
simplified alias to indicate that iterations have concluded
Definition: CoreTypes.hpp:110
helics::MessageProcessingResult
MessageProcessingResult
Definition: CoreTypes.hpp:64
helics::CoreType::TEST
@ TEST
use the Test core if all federates are in the same process
helics
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14
helics::InterfaceType::ENDPOINT
@ ENDPOINT
handle to an endpoint
helics::IterationResult::NEXT_STEP
@ NEXT_STEP
HELICS_CORE_TYPE_IPC
@ HELICS_CORE_TYPE_IPC
Definition: helics_enums.h:37
helics::MessageProcessingResult::NEXT_STEP
@ NEXT_STEP
indicator that the iterations have completed
helics::FederateStates::EXECUTING
@ EXECUTING
the federation has entered execution state and it now advancing in time
helics::IterationResult::ITERATING
@ ITERATING
indicator that the iterations need to continue
helics::FederateStates::FINISHED
@ FINISHED
the federation has finished its execution
helics::CoreType::EMPTY
@ EMPTY
core type that does nothing and can't communicate
helics::CoreType::HTTP
@ HTTP
core/broker using web traffic
helics::CoreType::IPC
@ IPC
same as INTERPROCESS
helics::CoreType::TCP
@ TCP
use a generic TCP protocol message stream to send messages
helics::MessageProcessingResult::DELAY_MESSAGE
@ DELAY_MESSAGE
delay the current message and continue processing
HELICS_CORE_TYPE_TCP
@ HELICS_CORE_TYPE_TCP
Definition: helics_enums.h:39
helics::IterationRequest::NO_ITERATIONS
@ NO_ITERATIONS
indicator that the iterations have completed
HELICS_CORE_TYPE_EMPTY
@ HELICS_CORE_TYPE_EMPTY
Definition: helics_enums.h:61
HELICS_CORE_TYPE_MPI
@ HELICS_CORE_TYPE_MPI
Definition: helics_enums.h:28
helics::FederateStates::ERRORED
@ ERRORED
the federation has encountered an error
helics::FederateStates
FederateStates
Definition: CoreTypes.hpp:21
helics::fedStateString
const std::string & fedStateString(FederateStates state)
Definition: FederateState.cpp:2035
helics::InterfaceType::PUBLICATION
@ PUBLICATION
handle to output interface
helics::FederateStates::UNKNOWN
@ UNKNOWN
unknown state
helics::CoreType::NULLCORE
@ NULLCORE
explicit core type that doesn't exist