helics  3.0.1
CoreTypes.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>
19 namespace helics {
22  HELICS_CREATED,
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 : signed char {
65 
66  CONTINUE_PROCESSING = -2,
67  DELAY_MESSAGE = -1,
68  NEXT_STEP = 0,
69  ITERATING = 2,
70  HALTED = 3,
71  ERROR_RESULT = 7,
72  REPROCESS_MESSAGE = 8 // indicator that the message needs to be processed again
73 };
76 {
77  return (result >= MessageProcessingResult::NEXT_STEP);
78 }
80 enum class IterationResult : signed char {
81  NEXT_STEP = 0,
82  ITERATING = 2,
84  HALTED = 3,
85  ERROR_RESULT = 7
86 };
87 
89 enum class IterationRequest : signed char {
90  NO_ITERATIONS = 0,
91  FORCE_ITERATION = 1,
93 };
94 
96 enum class InterfaceType : char {
97  UNKNOWN = 'u',
98  PUBLICATION = 'p',
99  INPUT = 'i',
100  ENDPOINT = 'e',
101  FILTER = 'f'
102 };
103 
104 } // namespace helics
105 
106 constexpr auto ITERATION_COMPLETE =
108 constexpr auto NO_ITERATION =
111 constexpr auto FORCE_ITERATION =
114 constexpr auto ITERATE_IF_NEEDED =
116 
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:57
NO_ITERATION
constexpr auto NO_ITERATION
Definition: CoreTypes.hpp:109
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::CoreType::WEBSOCKET
@ WEBSOCKET
core/broker using web sockets
helics::returnableResult
bool returnableResult(MessageProcessingResult result)
Definition: CoreTypes.hpp:75
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:96
helics::CoreType::INPROC
@ INPROC
core/broker using a stripped down in process core type
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:112
HELICS_CORE_TYPE_NNG
@ HELICS_CORE_TYPE_NNG
Definition: helics_enums.h:44
helics::HELICS_UNKNOWN
@ HELICS_UNKNOWN
unknown state
Definition: CoreTypes.hpp:29
HELICS_CORE_TYPE_ZMQ_SS
@ HELICS_CORE_TYPE_ZMQ_SS
Definition: helics_enums.h:42
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:48
HELICS_CORE_TYPE_UDP
@ HELICS_CORE_TYPE_UDP
Definition: helics_enums.h:40
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
helics::MessageProcessingResult::ITERATING
@ ITERATING
indicator that the iterations need to continue
ITERATE_IF_NEEDED
constexpr auto ITERATE_IF_NEEDED
Definition: CoreTypes.hpp:114
helics::CoreType::UNRECOGNIZED
@ UNRECOGNIZED
unknown
HELICS_CORE_TYPE_WEBSOCKET
@ HELICS_CORE_TYPE_WEBSOCKET
Definition: helics_enums.h:50
helics::IterationRequest
IterationRequest
Definition: CoreTypes.hpp:89
helics::MessageProcessingResult::DELAY_MESSAGE
@ DELAY_MESSAGE
delay the current message and continue processing
helics::CoreType::MPI
@ MPI
use MPI for operation on a parallel cluster
HELICS_CORE_TYPE_INPROC
@ HELICS_CORE_TYPE_INPROC
Definition: helics_enums.h:54
helics::IterationResult
IterationResult
Definition: CoreTypes.hpp:80
helics::CoreType::INTERPROCESS
@ INTERPROCESS
use when all federates are on the same machine
helics::IterationRequest::ITERATE_IF_NEEDED
@ ITERATE_IF_NEEDED
indicator that the iterations need to continue
helics::HELICS_EXECUTING
@ HELICS_EXECUTING
the federation has entered execution state and it now advancing in time
Definition: CoreTypes.hpp:25
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:46
helics::MessageProcessingResult::ERROR_RESULT
@ ERROR_RESULT
indicator that an error has occurred
ITERATION_COMPLETE
constexpr auto ITERATION_COMPLETE
Definition: CoreTypes.hpp:106
helics::CoreType::TEST
@ TEST
use the Test core if all federates are in the same process
helics::HELICS_TERMINATING
@ HELICS_TERMINATING
the federate is in the process of shutting down
Definition: CoreTypes.hpp:26
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::FederateStates
FederateStates
Definition: CoreTypes.hpp:21
HELICS_CORE_TYPE_IPC
@ HELICS_CORE_TYPE_IPC
Definition: helics_enums.h:36
helics::IterationResult::ITERATING
@ ITERATING
indicator that the iterations need to continue
helics::CoreType::EMPTY
@ EMPTY
core type that does nothing and can't communicate
helics::CoreType::HTTP
@ HTTP
core/broker using web traffic
helics::MessageProcessingResult::CONTINUE_PROCESSING
@ CONTINUE_PROCESSING
the current loop should continue
helics::CoreType::IPC
@ IPC
same as INTERPROCESS
helics::MessageProcessingResult::HALTED
@ HALTED
indicator that the simulation has been halted
helics::CoreType::TCP
@ TCP
use a generic TCP protocol message stream to send messages
HELICS_CORE_TYPE_TCP
@ HELICS_CORE_TYPE_TCP
Definition: helics_enums.h:38
helics::HELICS_ERROR
@ HELICS_ERROR
the federation has encountered an error
Definition: CoreTypes.hpp:27
helics::MessageProcessingResult
MessageProcessingResult
Definition: CoreTypes.hpp:64
helics::HELICS_INITIALIZING
@ HELICS_INITIALIZING
Definition: CoreTypes.hpp:23
helics::IterationRequest::NO_ITERATIONS
@ NO_ITERATIONS
indicator that the iterations have completed
helics::HELICS_FINISHED
@ HELICS_FINISHED
the federation has finished its execution
Definition: CoreTypes.hpp:28
HELICS_CORE_TYPE_EMPTY
@ HELICS_CORE_TYPE_EMPTY
Definition: helics_enums.h:59
HELICS_CORE_TYPE_MPI
@ HELICS_CORE_TYPE_MPI
Definition: helics_enums.h:28
helics::MessageProcessingResult::NEXT_STEP
@ NEXT_STEP
indicator that the iterations have completed
helics::fedStateString
const std::string & fedStateString(FederateStates state)
Definition: FederateState.cpp:1833
helics::InterfaceType::PUBLICATION
@ PUBLICATION
handle to output interface
helics::CoreType::NULLCORE
@ NULLCORE
explicit core type that doesn't exist