Loading...
Searching...
No Matches
hydrocouple.h
Go to the documentation of this file.
1
19
20#ifndef HYDROCOUPLE_H
21#define HYDROCOUPLE_H
22
23#include <string>
24#include <array>
25#include <vector>
26#include <span>
27#include <cstdint>
28#include <functional>
29#include <list>
30#include <set>
31#include <memory>
32#include <typeinfo>
33#include <unordered_map>
34
35
49#if defined(__GNUC__) || defined(__clang__)
50#pragma GCC visibility push(default)
51#endif
52
53namespace HydroCouple
54{
71 constexpr int HYDROCOUPLE_ABI_VERSION = 5;
72
76 enum class ByteOrder : uint8_t
77 {
78
83
88 };
89
162
164 template <typename... Args>
165 class ISignal;
166 class IComponentDataItem;
167 class IModelComponent;
168 class IAdaptedOutputFactory;
169 class IArgument;
170 class IInput;
171 class IOutput;
172 class IExchangeItem;
173 class IAdaptedOutput;
174 class IAdaptedOutputFactoryComponent;
175 class IUnit;
176 class IComponentDataItemValueChanged;
177 class IComponentStatusChangeEventArgs;
178 class IWorkflowComponent;
179 class IWorkflowComponentStatusChangeEventArgs;
180
215
222 enum class MemorySpace : uint8_t
223 {
224 Host = 0,
228 };
229
247
279 {
280 void *data = nullptr;
282 int32_t rank = 0;
283 const int64_t *shape = nullptr;
284 const int64_t *stridesBytes = nullptr;
285 int64_t itemSizeBytes = 0;
288 int32_t deviceId = 0;
289 void *queue = nullptr;
290 };
291
322
330 {
334 enum class Severity : uint8_t
335 {
340 };
341
343 int32_t code = 0;
344 std::string source;
345 std::string message;
346 };
347
354 template <typename... Args>
355 class ISlot
356 {
357 public:
361 virtual ~ISlot() = default;
362
368 virtual void operator()(const ISignal<Args...> &sender, Args... args) = 0;
369 };
370
377 template <typename... Args>
379 {
380 public:
384 virtual ~ISignal() = default;
385
390 virtual void connect(const std::shared_ptr<ISlot<Args...>> &slot) = 0;
391
396 virtual void disconnect(const std::shared_ptr<ISlot<Args...>> &slot) = 0;
397
402 virtual void blockSignals(bool block) = 0;
403
404 protected:
409 virtual void emit(Args... args) = 0;
410 };
411
416 class IPropertyChanged : public virtual ISignal<std::string>
417 {
418
419 public:
423 virtual ~IPropertyChanged() = default;
424 };
425
433 class IDescription : public virtual IPropertyChanged
434 {
435
436 public:
440 virtual ~IDescription() = default;
441
447 [[nodiscard]] virtual const std::string &caption() const = 0;
448
454 virtual void setCaption(const std::string &caption) = 0;
455
461 [[nodiscard]] virtual const std::string &description() const = 0;
462
468 virtual void setDescription(const std::string &description) = 0;
469 };
470
475 class IIdentity : public virtual IDescription
476 {
477 public:
481 virtual ~IIdentity() = default;
482
493 [[nodiscard]] virtual const std::string &id() const = 0;
494 };
495
504 class IComponentInfo : public virtual IIdentity
505 {
506
507 public:
511 virtual ~IComponentInfo() = default;
512
518 [[nodiscard]] virtual std::string libraryFilePath() const = 0;
519
525 virtual void setLibraryFilePath(const std::string &filePath) = 0;
526
533 [[nodiscard]] virtual std::string iconFilePath() const = 0;
534
539 [[nodiscard]] virtual std::string developer() const = 0;
540
545 [[nodiscard]] virtual std::vector<std::string> documentation() const = 0;
546
551 [[nodiscard]] virtual std::string license() const = 0;
552
557 [[nodiscard]] virtual std::string copyright() const = 0;
558
563 [[nodiscard]] virtual std::string url() const = 0;
564
569 [[nodiscard]] virtual std::string email() const = 0;
570
575 [[nodiscard]] virtual std::string version() const = 0;
576
582 [[nodiscard]] virtual std::set<std::string> tags() const = 0;
583 };
584
593 {
594 public:
598 virtual ~ILicensedComponent() = default;
599
607 [[nodiscard]] virtual bool validateLicense(const std::string &licenseInfo, std::string &validationMessage) = 0;
608
614 [[nodiscard]] virtual bool validateLicense(std::string &validationMessage) = 0;
615 };
616
625 {
626 public:
630 virtual ~IUIProvider() = default;
631
636 [[nodiscard]] virtual bool hasEditor() const = 0;
637
642 virtual void showEditor(void *opaqueUIPointer = nullptr) = 0;
643
648 [[nodiscard]] virtual bool hasViewer() const = 0;
649
654 virtual void showViewer(void *opaqueUIPointer = nullptr) = 0;
655 };
656
664 class IModelComponentInfo : public virtual IComponentInfo
665 {
666
667 public:
671 virtual ~IModelComponentInfo() = default;
672
677 [[nodiscard]] virtual std::unique_ptr<IModelComponent> createComponentInstance() = 0;
678
689 [[nodiscard]] virtual std::vector<IAdaptedOutputFactory *> adaptedOutputFactories() const = 0;
690 };
691
695 class IModelComponent : public virtual IIdentity, public virtual ISignal<const std::shared_ptr<IComponentStatusChangeEventArgs> &>
696 {
697
698 public:
706 enum class ComponentStatus : uint8_t
707 {
713
719
727
738
744 Valid = 4,
745
752
762
771
780
785
793
798 Done = 11,
799
808
825
833 Failed = 14,
834 };
835
836 // The legal lifecycle transitions form a normative state machine, encoded by
837 // isValidComponentStatusTransition() in hydrocouplehelpers.h (the one normative
838 // part of that header); implementations must not perform transitions that
839 // table rejects. In summary:
840 //
841 // Created ─► Initializing ─► Initialized ─► Validating ─► Valid ─► Preparing ─► Updated
842 // Updated ⇄ Updating ─► Done Updating ⇄ WaitingForData
843 // Updated | Done ⇄ Checkpointing (returns to the state it was entered from;
844 // a successful restoreState() lands in Updated)
845 // Initialized | Valid | Invalid | Updated | Done | Failed ─► Finishing ─► Finished | Created
846 // every status except Finished ─► Failed (a failure can be detected while resting:
847 // a proxy's peer can die while it is Updated)
848 // Failed ─► Initializing Invalid ─► Validating Valid ─► Validating
849 //
850 // There is no separate "Prepared" status: Updated immediately after prepare()
851 // means "ready to update, nothing computed yet".
852
856 virtual ~IModelComponent() = default;
857
861 using ISignal<const std::shared_ptr<IComponentStatusChangeEventArgs> &>::connect;
862 using ISignal<const std::shared_ptr<IComponentStatusChangeEventArgs> &>::disconnect;
863 using ISignal<const std::shared_ptr<IComponentStatusChangeEventArgs> &>::blockSignals;
864
869 [[nodiscard]] virtual IModelComponentInfo *componentInfo() const = 0;
870
882 [[nodiscard]] virtual ComponentStatus status() const = 0;
883
898 [[nodiscard]] virtual std::vector<IArgument *> arguments() const = 0;
899
913 [[nodiscard]] virtual std::vector<IInput *> inputs() const = 0;
914
929 [[nodiscard]] virtual std::vector<IOutput *> outputs() const = 0;
930
935 [[nodiscard]] virtual std::vector<IComponentDataItem *> results() const = 0;
936
951 [[nodiscard]] virtual std::vector<IComponentDataItem *> states() const = 0;
952
975 virtual void initialize() = 0;
976
996 [[nodiscard]] virtual std::vector<std::string> validate() = 0;
997
1014 virtual void prepare() = 0;
1015
1045 virtual void update(const std::vector<IOutput *> &requiredOutputs = {}) = 0;
1046
1062 virtual void finish() = 0;
1063
1068 [[nodiscard]] virtual const IWorkflowComponent *workflow() const = 0;
1069
1074 virtual void setWorkflow(const IWorkflowComponent *workflow) = 0;
1075
1085 [[nodiscard]] virtual std::set<Capability> capabilities() const = 0;
1086
1100 [[nodiscard]] virtual std::vector<ErrorEntry> errors(bool clearAfterRead = false) = 0;
1101
1110 [[nodiscard]] virtual std::string referenceDirectory() const = 0;
1111
1116 virtual void setReferenceDirectory(const std::string &referenceDirectory) = 0;
1117 };
1118
1125 {
1126 public:
1131
1136 [[nodiscard]] virtual IModelComponent *component() const = 0;
1137
1142 [[nodiscard]] virtual IModelComponent::ComponentStatus previousStatus() const = 0;
1143
1148 [[nodiscard]] virtual IModelComponent::ComponentStatus status() const = 0;
1149
1154 [[nodiscard]] virtual std::string message() const = 0;
1155
1160 [[nodiscard]] virtual bool hasProgressMonitor() const = 0;
1161
1166 [[nodiscard]] virtual float percentProgress() const = 0;
1167 };
1168
1174 {
1175 public:
1179 virtual ~ICloneableModelComponent() = default;
1180
1187 [[nodiscard]] virtual ICloneableModelComponent *parent() const = 0;
1188
1200 [[nodiscard]] virtual std::unique_ptr<ICloneableModelComponent> clone(const std::unordered_map<std::string, std::string> &clone_optional_arguments = std::unordered_map<std::string, std::string>()) = 0;
1201
1208 [[nodiscard]] virtual std::vector<ICloneableModelComponent *> clones() const = 0;
1209 };
1210
1231 {
1232 public:
1237
1249 [[nodiscard]] virtual bool saveState(std::string &token, std::string &message) = 0;
1250
1260 [[nodiscard]] virtual bool restoreState(const std::string &token, std::string &message) = 0;
1261
1277 [[nodiscard]] virtual bool releaseState(const std::string &token, std::string &message) = 0;
1278 };
1279
1295
1311
1315 using DifferentialSet = std::span<const DifferentialEntry>;
1316
1351 {
1352 public:
1357
1361 [[nodiscard]] virtual std::vector<IInput *> differentiableInputs() const = 0;
1362
1366 [[nodiscard]] virtual std::vector<IArgument *> differentiableArguments() const = 0;
1367
1371 [[nodiscard]] virtual std::vector<IOutput *> differentiableOutputs() const = 0;
1372
1377 [[nodiscard]] virtual std::vector<IComponentDataItem *> differentiableStates() const = 0;
1378
1387 [[nodiscard]] virtual bool vjp(DifferentialSet seeds, DifferentialSet results,
1388 std::string *message = nullptr) = 0;
1389
1398 [[nodiscard]] virtual bool jvp(DifferentialSet seeds, DifferentialSet results,
1399 std::string *message = nullptr) = 0;
1400 };
1401
1412 enum class ValueKind : uint8_t
1413 {
1419 };
1420
1430 class IValueDefinition : public virtual IDescription
1431 {
1432 public:
1436 virtual ~IValueDefinition() = default;
1437
1443 [[nodiscard]] virtual ValueKind valueKind() const = 0;
1444
1453 [[nodiscard]] virtual std::string standardName() const = 0;
1454
1467 [[nodiscard]] virtual std::string conceptURI() const = 0;
1468
1474 [[nodiscard]] virtual double missingValue() const = 0;
1475
1481 [[nodiscard]] virtual double defaultValue() const = 0;
1482 };
1483
1493 class IDimension : public virtual IIdentity
1494 {
1495 public:
1499 enum class LengthType
1500 {
1505
1510 };
1511
1529
1533 virtual ~IDimension() = default;
1534
1538 [[nodiscard]] virtual LengthType lengthType() const = 0;
1539
1546 [[nodiscard]] virtual DimensionRole role() const = 0;
1547 };
1548
1565 class IQuality : public virtual IValueDefinition
1566 {
1567 public:
1571 virtual ~IQuality() = default;
1572
1583 [[nodiscard]] virtual std::vector<std::string> categories() const = 0;
1584
1588 [[nodiscard]] virtual bool isOrdered() const = 0;
1589 };
1590
1594 class IUnitDimensions : public virtual IDescription
1595 {
1596 public:
1657
1661 virtual ~IUnitDimensions() = default;
1662
1683 [[nodiscard]] virtual double power(HydroCouple::IUnitDimensions::FundamentalUnitDimension dimension) const = 0;
1684 };
1685
1689 class IUnit : public virtual IDescription
1690 {
1691 public:
1753
1757 virtual ~IUnit() = default;
1758
1762 [[nodiscard]] virtual IUnitDimensions *dimensions() const = 0;
1763
1767 [[nodiscard]] virtual double conversionFactorToSI() const = 0;
1768
1772 [[nodiscard]] virtual double offsetToSI() const = 0;
1773
1780 [[nodiscard]] virtual std::string symbol() const = 0;
1781
1787 [[nodiscard]] virtual std::string ucumCode() const = 0;
1788 };
1789
1794 class IQuantity : public virtual IValueDefinition
1795 {
1796 public:
1800 virtual ~IQuantity() = default;
1801
1805 [[nodiscard]] virtual IUnit *unit() const = 0;
1806
1811 [[nodiscard]] virtual double minValue() const = 0;
1812
1817 [[nodiscard]] virtual double maxValue() const = 0;
1818 };
1819
1843 class IComponentDataItem : public virtual IIdentity, public virtual ISignal<const std::shared_ptr<IComponentDataItemValueChanged> &>
1844 {
1845 public:
1849 virtual ~IComponentDataItem() = default;
1850
1854 using ISignal<const std::shared_ptr<IComponentDataItemValueChanged> &>::connect;
1855 using ISignal<const std::shared_ptr<IComponentDataItemValueChanged> &>::disconnect;
1856 using ISignal<const std::shared_ptr<IComponentDataItemValueChanged> &>::blockSignals;
1857
1867 [[nodiscard]] virtual IModelComponent *modelComponent() const = 0;
1868
1878 [[nodiscard]] virtual std::vector<IDimension *> dimensions() const = 0;
1879
1886 [[nodiscard]] virtual std::vector<int64_t> shape() const = 0;
1887
1892 [[nodiscard]] virtual DataKind dataKind() const = 0;
1893
1898 [[nodiscard]] virtual IValueDefinition *valueDefinition() const = 0;
1899
1920 [[nodiscard]] virtual bool getValuesInto(
1921 const BufferDescriptor &destination,
1922 std::span<const int64_t> start,
1923 std::span<const int64_t> count,
1924 std::string *message = nullptr) const = 0;
1925
1935 [[nodiscard]] virtual bool setValuesFrom(
1936 const BufferDescriptor &source,
1937 std::span<const int64_t> start,
1938 std::span<const int64_t> count,
1939 std::string *message = nullptr) = 0;
1940
1941 // Typed convenience wrappers over getValuesInto()/setValuesFrom() (scalar reads,
1942 // flat-span hyperslab reads/writes) are provided as non-normative free function
1943 // templates in hydrocouplehelpers.h; the interface itself carries no executable code.
1944 };
1945
1950 {
1951 public:
1956
1961 [[nodiscard]] virtual IComponentDataItem *componentDataItem() const = 0;
1962
1967 [[nodiscard]] virtual std::vector<int64_t> start() const = 0;
1968
1973 [[nodiscard]] virtual std::vector<int64_t> count() const = 0;
1974 };
1975
1982 class IArgument : public virtual IComponentDataItem
1983 {
1984
1985 public:
1990 {
1995
2000
2005
2010
2015
2020
2025 };
2026
2041
2045 virtual ~IArgument() = default;
2046
2050 [[nodiscard]] virtual ArgumentRole role() const = 0;
2051
2058 [[nodiscard]] virtual bool isOptional() const = 0;
2059
2068 [[nodiscard]] virtual bool isReadOnly() const = 0;
2069
2074 [[nodiscard]] virtual std::string toString() const = 0;
2075
2079 virtual void saveData() = 0;
2080
2087 [[nodiscard]] virtual std::vector<std::string> fileFilters() const = 0;
2088
2093 [[nodiscard]] virtual std::vector<const std::type_info *> validComponentDataItemTypes() const = 0;
2094
2100 [[nodiscard]] virtual bool isValidArgType(ArgumentInputType argType) const = 0;
2101
2106 [[nodiscard]] virtual ArgumentInputType currentArgumentInputType() const = 0;
2107
2116 [[nodiscard]] virtual bool initialize(const std::string &value, ArgumentInputType argType, std::string &message) = 0;
2117
2125 [[nodiscard]] virtual bool initialize(const IComponentDataItem &componentDataItem, std::string &message) = 0;
2126
2142 [[nodiscard]] virtual bool serialize(ArgumentInputType argType, std::string &value, std::string &message) const = 0;
2143 };
2144
2150 class IExchangeItem : public virtual IComponentDataItem
2151 {
2152
2153 public:
2157 virtual ~IExchangeItem() = default;
2158 };
2159
2168 class IOutput : public virtual IExchangeItem
2169 {
2170 public:
2174 virtual ~IOutput() = default;
2175
2185 [[nodiscard]] virtual std::vector<IInput *> consumers() const = 0;
2186
2208 virtual void addConsumer(IInput *consumer, const IIdentity *providerRole = nullptr) = 0;
2209
2220 [[nodiscard]] virtual bool removeConsumer(IInput *consumer) = 0;
2221
2231 [[nodiscard]] virtual std::vector<IAdaptedOutput *> adaptedOutputs() const = 0;
2232
2251 virtual void addAdaptedOutput(IAdaptedOutput *adaptedOutput) = 0;
2252
2262 [[nodiscard]] virtual bool removeAdaptedOutput(IAdaptedOutput *adaptedOutput) = 0;
2263
2290 virtual void updateValues(const IInput *querySpecifier) = 0;
2291 };
2292
2305 class IAdaptedOutput : public virtual IOutput
2306 {
2307 public:
2311 virtual ~IAdaptedOutput() = default;
2312
2320 [[nodiscard]] virtual IAdaptedOutputFactory *adaptedOutputFactory() const = 0;
2321
2330 [[nodiscard]] virtual std::vector<IArgument *> arguments() const = 0;
2331
2342 virtual void initialize() = 0;
2343
2351 [[nodiscard]] virtual IOutput *adaptee() const = 0;
2352
2364 virtual void refresh() = 0;
2365
2383 [[nodiscard]] virtual std::vector<IComponentDataItem *> states() const = 0;
2384 };
2385
2421 {
2422 public:
2427
2431 [[nodiscard]] virtual std::vector<IArgument *> differentiableArguments() const = 0;
2432
2439 [[nodiscard]] virtual std::vector<IComponentDataItem *> differentiableStates() const = 0;
2440
2451 [[nodiscard]] virtual bool vjp(DifferentialSet seeds, DifferentialSet results,
2452 std::string *message = nullptr) = 0;
2453
2464 [[nodiscard]] virtual bool jvp(DifferentialSet seeds, DifferentialSet results,
2465 std::string *message = nullptr) = 0;
2466 };
2467
2491 {
2492 public:
2497
2504 [[nodiscard]] virtual bool saveState(std::string &token, std::string &message) = 0;
2505
2514 [[nodiscard]] virtual bool restoreState(const std::string &token, std::string &message) = 0;
2515
2525 [[nodiscard]] virtual bool releaseState(const std::string &token, std::string &message) = 0;
2526 };
2527
2536 class IAdaptedOutputFactory : public virtual IIdentity
2537 {
2538 public:
2542 virtual ~IAdaptedOutputFactory() = default;
2543
2555 [[nodiscard]] virtual std::vector<IIdentity *> getAvailableAdaptedOutputIds(const IOutput *provider, const IInput *consumer = nullptr) = 0;
2556
2573 [[nodiscard]] virtual std::unique_ptr<IAdaptedOutput> createAdaptedOutput(IIdentity *adaptedProviderId, IOutput *provider, IInput *consumer = nullptr) = 0;
2574 };
2575
2585 {
2586 public:
2591
2598 [[nodiscard]] virtual std::unique_ptr<IAdaptedOutputFactoryComponent> createComponentInstance() = 0;
2599 };
2600
2607 {
2608 public:
2613
2619 [[nodiscard]] virtual IAdaptedOutputFactoryComponentInfo *componentInfo() const = 0;
2620 };
2621
2625 class IInput : public virtual IExchangeItem
2626 {
2627 public:
2631 virtual ~IInput() = default;
2632
2639 [[nodiscard]] virtual IOutput *provider() const = 0;
2640
2654 [[nodiscard]] virtual bool setProvider(IOutput *provider) = 0;
2655
2662 [[nodiscard]] virtual bool canConsume(IOutput *provider, std::string &message) const = 0;
2663 };
2664
2668 class IMultiInput : public virtual IInput
2669 {
2670 public:
2674 virtual ~IMultiInput() = default;
2675
2677 using IInput::canConsume;
2678
2683 [[nodiscard]] virtual std::vector<IIdentity *> providerLabels() const = 0;
2684
2690 [[nodiscard]] virtual bool isRequiredProvider(const IIdentity *providerLabel) const = 0;
2691
2696 [[nodiscard]] virtual std::vector<IOutput *> providers() const = 0;
2697
2705 [[nodiscard]] virtual bool canConsume(IOutput *provider, std::string &message, const IIdentity *providerRoleIdentifier = nullptr) const = 0;
2706
2719 [[nodiscard]] virtual bool addProvider(IOutput *provider, const IIdentity *providerRoleIdentifier = nullptr) = 0;
2720
2728 [[nodiscard]] virtual bool removeProvider(IOutput *provider) = 0;
2729 };
2730
2738 {
2739
2740 public:
2744 virtual ~IIdBasedComponentDataItem() = default;
2745
2750 [[nodiscard]] virtual std::vector<std::string> identifiers() const = 0;
2751
2759 [[nodiscard]] virtual IDimension *identifierDimension() const = 0;
2760 };
2761
2767 {
2768
2769 public:
2773 virtual ~IWorkflowComponentInfo() = default;
2774
2781 [[nodiscard]] virtual std::unique_ptr<IWorkflowComponent> createComponentInstance() = 0;
2782 };
2783
2790 class IWorkflowComponent : public virtual IIdentity, public virtual ISignal<const std::shared_ptr<IWorkflowComponentStatusChangeEventArgs> &>
2791 {
2792
2793 public:
2833
2834 // The legal workflow transitions form a normative state machine, encoded by
2835 // isValidWorkflowStatusTransition() in hydrocouplehelpers.h:
2836 //
2837 // Created ─► Initializing ─► Initialized ─► Validating ─► Validated | Invalid
2838 // Validated ─► Preparing ─► Prepared Invalid | Validated ─► Validating
2839 // Prepared | Updated ─► Updating ─► Updated | Paused | Done Paused ─► Updated (resume)
2840 // Initialized | Validated | Invalid | Prepared | Updated | Paused | Done | Failed ─► Finishing ─► Finished
2841 // every status except Finished ─► Failed Failed ─► Initializing
2842
2846 virtual ~IWorkflowComponent() = default;
2847
2851 using ISignal<const std::shared_ptr<IWorkflowComponentStatusChangeEventArgs> &>::connect;
2852 using ISignal<const std::shared_ptr<IWorkflowComponentStatusChangeEventArgs> &>::disconnect;
2853 using ISignal<const std::shared_ptr<IWorkflowComponentStatusChangeEventArgs> &>::blockSignals;
2854
2859 [[nodiscard]] virtual IWorkflowComponentInfo *componentInfo() const = 0;
2860
2865 [[nodiscard]] virtual std::vector<IIdentity *> modelComponentLabels() const = 0;
2866
2872 [[nodiscard]] virtual bool isRequiredModelComponent(const IIdentity *modelComponentLabel) const = 0;
2873
2877 virtual void initialize() = 0;
2878
2900 [[nodiscard]] virtual std::vector<std::string> validate() = 0;
2901
2912 virtual void prepare() = 0;
2913
2926 virtual void update() = 0;
2927
2931 virtual void finish() = 0;
2932
2944 virtual void requestStop() = 0;
2945
2956 virtual void requestPause() = 0;
2957
2965 virtual void resume() = 0;
2966
2978 [[nodiscard]] virtual std::vector<ErrorEntry> errors(bool clearAfterRead = false) = 0;
2979
2984 [[nodiscard]] virtual WorkflowStatus status() const = 0;
2985
2990 [[nodiscard]] virtual std::vector<IModelComponent *> modelComponents() const = 0;
2991
3001 [[nodiscard]] virtual bool addModelComponent(IModelComponent *component, const IIdentity *modelRoleIdentifier = nullptr, std::string *message = nullptr) = 0;
3002
3008 [[nodiscard]] virtual bool removeModelComponent(IModelComponent *component) = 0;
3009 };
3010
3016 {
3017 public:
3022
3027 [[nodiscard]] virtual IWorkflowComponent *workflowComponent() const = 0;
3028
3033 [[nodiscard]] virtual IWorkflowComponent::WorkflowStatus previousStatus() const = 0;
3034
3039 [[nodiscard]] virtual IWorkflowComponent::WorkflowStatus status() const = 0;
3040
3045 [[nodiscard]] virtual std::string message() const = 0;
3046
3051 [[nodiscard]] virtual bool hasProgressMonitor() const = 0;
3052
3057 [[nodiscard]] virtual float percentProgress() const = 0;
3058 };
3059
3060}
3061
3062#if defined(__GNUC__) || defined(__clang__)
3063#pragma GCC visibility pop
3064#endif
3065
3066#endif // HYDROCOUPLE_H
3067
IAdaptedOutputFactoryComponent is an IAdaptedOutputFactory generated from an IAdaptedOutputFactoryCom...
Definition hydrocouple.h:2607
virtual ~IAdaptedOutputFactoryComponent()=default
IAdaptedOutputFactoryComponent::~IAdaptedOutputFactoryComponent is a virtual destructor.
virtual IAdaptedOutputFactoryComponentInfo * componentInfo() const =0
Contains the metadata about this IAdaptedOutputFactoryComponent.
IAdaptedOutputFactoryComponentInfo interface class provides information about an IAdaptedOutputFactor...
Definition hydrocouple.h:2585
virtual ~IAdaptedOutputFactoryComponentInfo()=default
IAdaptedOutputFactoryComponentInfo::~IAdaptedOutputFactoryComponentInfo is a virtual destructor.
virtual std::unique_ptr< IAdaptedOutputFactoryComponent > createComponentInstance()=0
New IAdaptedOutputFactoryComponent instance.
IAdaptedOutputFactory is used to create instances of IAdaptedOutput.
Definition hydrocouple.h:2537
virtual std::unique_ptr< IAdaptedOutput > createAdaptedOutput(IIdentity *adaptedProviderId, IOutput *provider, IInput *consumer=nullptr)=0
Creates a IAdaptedOutput that adapts the producer so that it fits the consumer.
virtual ~IAdaptedOutputFactory()=default
IAdaptedOutputFactory::~IAdaptedOutputFactory is a virtual destructor.
virtual std::vector< IIdentity * > getAvailableAdaptedOutputIds(const IOutput *provider, const IInput *consumer=nullptr)=0
Get a vector of IIdentity objects representing the vector of IAdaptedOutput instances that can be cre...
An IAdaptedOutput adds one or more data operations on top of an IOutput.
Definition hydrocouple.h:2306
virtual IOutput * adaptee() const =0
IOutput that this IAdaptedOutput extracts content from.
virtual IAdaptedOutputFactory * adaptedOutputFactory() const =0
IAdaptedOutputFactory that generated this IAdaptedOutput.
virtual ~IAdaptedOutput()=default
IAdaptedOutput::~IAdaptedOutput is a virtual destructor.
virtual void initialize()=0
Lets this IAdaptedOutput initialize() itself, based on the current values specified by the arguments.
virtual void refresh()=0
Requests the IAdaptedOutput to refresh itself and perform any necessary calculations.
virtual std::vector< IArgument * > arguments() const =0
IArgument represents input parameters needed for this IAdaptedOutput.
virtual std::vector< IComponentDataItem * > states() const =0
The data items that make up the state carried from one refresh() to the next.
IArgument interface class used to set the arguments for components.
Definition hydrocouple.h:1983
ArgumentRole
What kind of thing an argument is to the model that owns it.
Definition hydrocouple.h:2034
@ InitialCondition
The state at the start of the simulation.
Definition hydrocouple.h:2037
@ Configuration
How the model runs: paths, options, solver settings, output selection.
Definition hydrocouple.h:2035
@ Forcing
A prescribed time-varying input that is not supplied through an IInput (a boundary time series read f...
Definition hydrocouple.h:2038
@ Parameter
A coefficient of the process equations (roughness, conductivity, rate constants).
Definition hydrocouple.h:2036
@ Geometry
The spatial discretization itself (a mesh, a network, a raster grid).
Definition hydrocouple.h:2039
virtual bool isValidArgType(ArgumentInputType argType) const =0
Whether this argument can be initialized from, and serialized to, the given representation.
virtual void saveData()=0
Writes data to files associated with this argument if they exist.
virtual ArgumentRole role() const =0
What this argument is to the model.
virtual ArgumentInputType currentArgumentInputType() const =0
Gets the current input type used for this argument.
virtual bool isReadOnly() const =0
Whether the argument's values may be changed (through initialize() or setValuesFrom()).
virtual std::vector< const std::type_info * > validComponentDataItemTypes() const =0
Gets the valid IComponentDataItem instance types that can be read by this argument.
ArgumentInputType
Enumeration indicating the type of input for the argument.
Definition hydrocouple.h:1990
@ File
Enumeration indicating that the argument was read from a file.
Definition hydrocouple.h:1999
@ JSON
Enumeration indicating that the argument input is in JSON format.
Definition hydrocouple.h:2004
@ String
Enumeration indicating that the argument was read from string.
Definition hydrocouple.h:1994
@ XML
Enumeration indicating that the argument input is in XML format.
Definition hydrocouple.h:2014
@ YAML
Enumeration indicating that the argument input is in YAML format.
Definition hydrocouple.h:2009
@ URL
Enumeration indicating that the argument was read from a URL.
Definition hydrocouple.h:2019
@ MEMORY_OBJECT
Enumeration indicating that the argument was read from a memory object.
Definition hydrocouple.h:2024
virtual bool serialize(ArgumentInputType argType, std::string &value, std::string &message) const =0
Serializes this argument's current value to the requested representation.
virtual bool initialize(const std::string &value, ArgumentInputType argType, std::string &message)=0
Reads values from a string in the given representation (a JSON/YAML/XML document, a file path,...
virtual std::vector< std::string > fileFilters() const =0
File type extensions that can be read by this IArgument.
virtual bool initialize(const IComponentDataItem &componentDataItem, std::string &message)=0
Reads values from an equivalent IComponentDataItem.
virtual ~IArgument()=default
IArgument::~IArgument is a virtual destructor.
virtual std::string toString() const =0
A human-readable rendering of this argument's current value, for display and logs.
virtual bool isOptional() const =0
Specifies whether the argument is optional or not.
ICheckpointableAdaptedOutput is an adapted output that can save and restore the state it carries betw...
Definition hydrocouple.h:2491
virtual bool saveState(std::string &token, std::string &message)=0
Saves the adapter's complete state.
virtual bool restoreState(const std::string &token, std::string &message)=0
Restores state previously saved by saveState().
virtual bool releaseState(const std::string &token, std::string &message)=0
Releases a state saved by saveState() that will not be restored.
virtual ~ICheckpointableAdaptedOutput()=default
~ICheckpointableAdaptedOutput destructor.
ICheckpointableModelComponent is an IModelComponent that can save and restore its complete simulation...
Definition hydrocouple.h:1231
virtual bool releaseState(const std::string &token, std::string &message)=0
Releases a state saved by saveState() that will not be restored.
virtual bool restoreState(const std::string &token, std::string &message)=0
Restores state previously saved by saveState().
virtual bool saveState(std::string &token, std::string &message)=0
Saves the component's complete state.
virtual ~ICheckpointableModelComponent()=default
~ICheckpointableModelComponent destructor.
The ICloneableModelComponent class is an IModelComponent that supports deep cloning of itself and its...
Definition hydrocouple.h:1174
virtual std::unique_ptr< ICloneableModelComponent > clone(const std::unordered_map< std::string, std::string > &clone_optional_arguments=std::unordered_map< std::string, std::string >())=0
Deep clones itself including cloning its IArgument instances.
virtual std::vector< ICloneableModelComponent * > clones() const =0
The ICloneableModelComponent instances cloned from this instance that are still alive.
virtual ICloneableModelComponent * parent() const =0
Parent ICloneableModelComponent object from which current component was cloned from.
virtual ~ICloneableModelComponent()=default
~ICloneableModelComponent destructor
IComponentDataItem is a fundamental unit of data for a component.
Definition hydrocouple.h:1844
virtual std::vector< int64_t > shape() const =0
The extent of each dimension of this data item's index space.
virtual IModelComponent * modelComponent() const =0
Gets the owner IModelComponent of this IComponentItem.
virtual std::vector< IDimension * > dimensions() const =0
The axes of this item's index space, in storage order.
virtual ~IComponentDataItem()=default
IComponentDataItem::~IComponentDataItem is a virtual destructor.
virtual bool getValuesInto(const BufferDescriptor &destination, std::span< const int64_t > start, std::span< const int64_t > count, std::string *message=nullptr) const =0
Copies a hyperslab of this item's values into a caller-described buffer.
virtual DataKind dataKind() const =0
The element type of this data item's values.
virtual bool setValuesFrom(const BufferDescriptor &source, std::span< const int64_t > start, std::span< const int64_t > count, std::string *message=nullptr)=0
Copies values from a caller-described buffer into a hyperslab of this item.
virtual IValueDefinition * valueDefinition() const =0
IValueDefinition for this IComponentDataItem defines the variable type associated with this object.
IComponentDataItemValueChanged interface class used to notify when the values of a IComponentDataItem...
Definition hydrocouple.h:1950
virtual std::vector< int64_t > start() const =0
Gets the start index of the hyperslab that changed.
virtual ~IComponentDataItemValueChanged()=default
IComponentDataItemValueChanged::~IComponentDataItemValueChanged is a virtual destructor.
virtual IComponentDataItem * componentDataItem() const =0
Gets the IComponentDataItem that fired the event.
virtual std::vector< int64_t > count() const =0
Gets the extent of the hyperslab that changed.
IComponentInfo interface class is a factory that provides detailed metadata about a component and cre...
Definition hydrocouple.h:505
virtual std::string license() const =0
Component license info.
virtual std::string email() const =0
Component developer email.
virtual std::string developer() const =0
Component developer information.
virtual std::string url() const =0
Component developer url.
virtual std::string copyright() const =0
Component copyright info.
virtual std::vector< std::string > documentation() const =0
Documentation associated with this component.
virtual std::string iconFilePath() const =0
File path to Component icon.
virtual std::set< std::string > tags() const =0
tags used to classify this component.
virtual ~IComponentInfo()=default
IComponentInfo::~IComponentInfo is a virtual destructor.
virtual void setLibraryFilePath(const std::string &filePath)=0
Sets file path to Component library.
virtual std::string libraryFilePath() const =0
File path to Component library.
virtual std::string version() const =0
Component version info.
The IComponentStatusChangeEventArgs contains the information that will be passed when the IModelCompo...
Definition hydrocouple.h:1125
virtual IModelComponent * component() const =0
Gets the IModelComponent that fired the event.
virtual IModelComponent::ComponentStatus status() const =0
Gets the IModelComponent's status after the status change.
virtual float percentProgress() const =0
Number between 0 and 100 indicating the progress made by a component in its simulation.
virtual std::string message() const =0
Gets additional information about the status change.
virtual IModelComponent::ComponentStatus previousStatus() const =0
Gets the IModelComponent's status before the status change.
virtual ~IComponentStatusChangeEventArgs()=default
~IComponentStatusChangeEventArgs destructor
virtual bool hasProgressMonitor() const =0
Indicates whether this event has a progress monitor.
IDescription interface class provides descriptive information on a HydroCouple object.
Definition hydrocouple.h:434
virtual void setCaption(const std::string &caption)=0
Sets caption for the entity.
virtual ~IDescription()=default
IDescription::~IDescription is a virtual destructor.
virtual const std::string & caption() const =0
Gets caption for the entity.
virtual void setDescription(const std::string &description)=0
Gets additional descriptive information for the entity.
virtual const std::string & description() const =0
Gets additional descriptive information for the entity.
IDifferentiableAdaptedOutput is an adapted output that can report the derivative of its most recent r...
Definition hydrocouple.h:2421
virtual std::vector< IArgument * > differentiableArguments() const =0
The arguments of this adapter a derivative reaches (may be empty).
virtual std::vector< IComponentDataItem * > differentiableStates() const =0
The data items that carry state from one refresh() to the next and that the derivative follows; a sub...
virtual ~IDifferentiableAdaptedOutput()=default
~IDifferentiableAdaptedOutput destructor.
virtual bool jvp(DifferentialSet seeds, DifferentialSet results, std::string *message=nullptr)=0
Jacobian-vector product of the most recent refresh().
virtual bool vjp(DifferentialSet seeds, DifferentialSet results, std::string *message=nullptr)=0
Vector-Jacobian product of the most recent refresh().
IDifferentiableModelComponent is a model component that can report the derivative of its most recent ...
Definition hydrocouple.h:1351
virtual bool vjp(DifferentialSet seeds, DifferentialSet results, std::string *message=nullptr)=0
Vector-Jacobian product of the most recent step (reverse mode).
virtual std::vector< IArgument * > differentiableArguments() const =0
The arguments (parameters) a derivative reaches.
virtual std::vector< IOutput * > differentiableOutputs() const =0
The outputs whose derivative the component can report.
virtual std::vector< IComponentDataItem * > differentiableStates() const =0
The data items that make up the state carried from one step to the next.
virtual ~IDifferentiableModelComponent()=default
~IDifferentiableModelComponent destructor.
virtual std::vector< IInput * > differentiableInputs() const =0
The inputs a derivative reaches.
virtual bool jvp(DifferentialSet seeds, DifferentialSet results, std::string *message=nullptr)=0
Jacobian-vector product of the most recent step (forward mode).
IDimension provides the properties of one axis of a data item's index space.
Definition hydrocouple.h:1494
virtual ~IDimension()=default
~IDimension destructor
LengthType
IDimension::LengthType dimension length type.
Definition hydrocouple.h:1500
@ Static
Static length type.
Definition hydrocouple.h:1504
@ Dynamic
Dynamic length type.
Definition hydrocouple.h:1509
virtual DimensionRole role() const =0
What this axis means.
DimensionRole
What an axis of the index space means.
Definition hydrocouple.h:1516
@ Column
Raster columns / structured-grid x index.
Definition hydrocouple.h:1523
@ Entity
Spatial entities: geometries, mesh nodes/edges/faces, network nodes/edges, or the identifiers of an i...
Definition hydrocouple.h:1519
@ Component
Vector or tensor components (Spatial::SpatialDataType).
Definition hydrocouple.h:1525
@ Layer
Vertical layers (Spatial::ILayering), top first.
Definition hydrocouple.h:1520
@ Other
Declared but none of the above.
Definition hydrocouple.h:1527
@ Depth
Structured-grid z index (IRegularGrid3D).
Definition hydrocouple.h:1524
@ Band
Raster bands.
Definition hydrocouple.h:1521
@ Unknown
Not declared.
Definition hydrocouple.h:1517
@ Row
Raster rows / structured-grid y index.
Definition hydrocouple.h:1522
@ Time
Time steps (Temporal::ITimeSeriesComponentDataItem::times()).
Definition hydrocouple.h:1518
@ Realization
Ensemble members.
Definition hydrocouple.h:1526
virtual LengthType lengthType() const =0
Gets the length type of the dimension.
IExchangeItem the base data item the can be exchanged between components at runtime.
Definition hydrocouple.h:2151
virtual ~IExchangeItem()=default
IExchangeItem::~IExchangeItem is a virtual destructor.
IIdBasedComponentDataItem is an IComponentDataItem whose data is indexed by string identifiers.
Definition hydrocouple.h:2738
virtual std::vector< std::string > identifiers() const =0
Gets the identifiers associated with this id-based component data item.
virtual ~IIdBasedComponentDataItem()=default
IIdBasedComponentItem::~IIdBasedComponentItem is a virtual destructor.
virtual IDimension * identifierDimension() const =0
identifierDimension returns the identifier dimension of the id based component item.
IIdentity interface class defines a method to get the Id of an HydroCouple entity.
Definition hydrocouple.h:476
virtual ~IIdentity()=default
IIdentity::~IIdentity is a virtual destructor.
virtual const std::string & id() const =0
Gets a unique identifier for the entity.
An IInput item that can accept values for an IModelComponent.
Definition hydrocouple.h:2626
virtual bool canConsume(IOutput *provider, std::string &message) const =0
Returns true if this IInput can consume this producer.
virtual ~IInput()=default
IInput::~IInput is a virtual destructor.
virtual IOutput * provider() const =0
Gets the producer this consumer should get its values from.
virtual bool setProvider(IOutput *provider)=0
Records the producer this consumer gets its values from.
ILicensedComponent is an optional side interface for components that require license validation.
Definition hydrocouple.h:593
virtual bool validateLicense(std::string &validationMessage)=0
validateLicense Checks if component is licensed and returns.
virtual bool validateLicense(const std::string &licenseInfo, std::string &validationMessage)=0
Checks if license is valid and persists license information.
virtual ~ILicensedComponent()=default
ILicensedComponent::~ILicensedComponent is a virtual destructor.
IModelComponent interface is the core interface in the HydroCouple standard defining a model componen...
Definition hydrocouple.h:696
virtual void setWorkflow(const IWorkflowComponent *workflow)=0
Sets the workflow that this component is part of.
virtual std::vector< IComponentDataItem * > states() const =0
The data items that make up the state carried from one update() to the next.
virtual void finish()=0
finish() must be invoked as the last of any methods in the IModelComponent interface.
virtual std::vector< IComponentDataItem * > results() const =0
List of the model's output results.
virtual void initialize()=0
Initializes the current IModelComponent.
virtual std::vector< ErrorEntry > errors(bool clearAfterRead=false)=0
Drains this component's diagnostic queue.
virtual std::string referenceDirectory() const =0
Gets the reference directory for this component instance.
virtual IModelComponentInfo * componentInfo() const =0
Contains the metadata about this IModelComponent instance.
virtual void setReferenceDirectory(const std::string &referenceDirectory)=0
setReferenceDirectory Sets the reference directory for this component instance.
virtual void update(const std::vector< IOutput * > &requiredOutputs={})=0
This method is called to let the component update itself, thus reaching its next state.
virtual void prepare()=0
Prepares the IModelComponent for calls to the update() method.
virtual std::vector< IArgument * > arguments() const =0
Arguments needed to let the component do its work.
ComponentStatus
HydroCouple::ComponentStatus is an enumerator that describes the status of a component over the cours...
Definition hydrocouple.h:707
@ Checkpointing
The IModelComponent is saving or restoring a checkpoint of its state (see ICheckpointableModelCompone...
Definition hydrocouple.h:792
@ Created
The IModelComponent instance has just been created.
Definition hydrocouple.h:712
@ Finishing
The IModelComponent was requested to perform the actions to be performed before it will either be dis...
Definition hydrocouple.h:807
@ WaitingForData
The IModelComponent wants to update itself, but is not yet able to perform the actual computation,...
Definition hydrocouple.h:751
@ Initializing
The IModelComponent is initializing itself.
Definition hydrocouple.h:718
@ Valid
The IModelComponent is in a HydroCouple::Valid state.
Definition hydrocouple.h:744
@ Invalid
The IModelComponent is in an HydroCouple::Invalid state.
Definition hydrocouple.h:761
@ Initialized
The IModelComponent has successfully initialized itself by calling IModelComponent::initialize().
Definition hydrocouple.h:726
@ Updating
The IModelComponent is updating itself.
Definition hydrocouple.h:779
@ Finished
The IModelComponent has successfully performed its finalization actions.
Definition hydrocouple.h:824
@ Preparing
The IModelComponent is preparing itself for the first update() and the first IComponentDataItem::getV...
Definition hydrocouple.h:770
@ Validating
After links between an IModelComponent's inputs/outputs and those of other components have been estab...
Definition hydrocouple.h:737
@ Failed
The IModelComponent has encountered an unrecoverable error.
Definition hydrocouple.h:833
@ Done
The last update process that the IModelComponent performed was the final one.
Definition hydrocouple.h:798
@ Updated
The IModelComponent has successfully updated itself.
Definition hydrocouple.h:784
virtual std::vector< std::string > validate()=0
Validates the populated instance of the IModelComponent.
virtual std::set< Capability > capabilities() const =0
The set of optional capabilities this component supports.
virtual const IWorkflowComponent * workflow() const =0
Gets the workflow that this component is part of.
virtual ComponentStatus status() const =0
Defines current status of the IModelComponent.
virtual ~IModelComponent()=default
IModelComponent::~IModelComponent destructor.
virtual std::vector< IInput * > inputs() const =0
The list of consumer items for which a component can receive values.
virtual std::vector< IOutput * > outputs() const =0
The list of IOutputs for which a component can produce results.
IModelComponentInfo interface inherits from the IComponentInfo interface which provides detailed meta...
Definition hydrocouple.h:665
virtual ~IModelComponentInfo()=default
IModelComponentInfo::~IModelComponentInfo is a virtual destructor.
virtual std::unique_ptr< IModelComponent > createComponentInstance()=0
Creates a new IModelComponent instance.
virtual std::vector< IAdaptedOutputFactory * > adaptedOutputFactories() const =0
Gets a list of IAdaptedOutputFactories, each allowing to create IAdaptedOutput item for making output...
The IMultiInput class is an IInput class that has multiple outputs supplying data to it.
Definition hydrocouple.h:2669
virtual bool isRequiredProvider(const IIdentity *providerLabel) const =0
isRequiredProvider checks if the provider is required by the consumer.
virtual bool canConsume(IOutput *provider, std::string &message, const IIdentity *providerRoleIdentifier=nullptr) const =0
canConsume checks if the provider can supply data to this consumer.
virtual bool addProvider(IOutput *provider, const IIdentity *providerRoleIdentifier=nullptr)=0
Records a provider in a role.
virtual bool removeProvider(IOutput *provider)=0
Removes a provider from the list of providers.
virtual std::vector< IOutput * > providers() const =0
Gets the list of providers supplying data to this multi-input.
virtual std::vector< IIdentity * > providerLabels() const =0
The roles this multi-input's providers fill (empty when it names none).
virtual ~IMultiInput()=default
IMultiInput::~IMultiInput is a virtual destructor.
An output exchange item that can deliver values from an IModelComponent.
Definition hydrocouple.h:2169
virtual ~IOutput()=default
IOutput::~IOutput is a virtual destructor.
virtual void updateValues(const IInput *querySpecifier)=0
Brings this output's values up to what the querySpecifier requires.
virtual std::vector< IInput * > consumers() const =0
Input items that will consume the values by calling the IOutput::updateValues() method.
virtual bool removeConsumer(IInput *consumer)=0
Disconnects a consumer.
virtual void addConsumer(IInput *consumer, const IIdentity *providerRole=nullptr)=0
Connects a consumer to this output item.
virtual bool removeAdaptedOutput(IAdaptedOutput *adaptedOutput)=0
Removes an IAdaptedOutput.
virtual std::vector< IAdaptedOutput * > adaptedOutputs() const =0
The adaptedOutputs that have this current output item as adaptee.
virtual void addAdaptedOutput(IAdaptedOutput *adaptedOutput)=0
Add a IAdaptedOutput to this output item.
IPropertyChanged interface is used to emit signal/event when a property of an object changes.
Definition hydrocouple.h:417
virtual ~IPropertyChanged()=default
IPropertyChanged::~IPropertyChanged is a virtual destructor.
IQuality describes qualitative data, where a value is specified as one category within a number of pr...
Definition hydrocouple.h:1566
virtual bool isOrdered() const =0
Whether categories() has a defined order (ordinal) or not (nominal).
virtual std::vector< std::string > categories() const =0
The possible category labels allowed for this IQuality.
virtual ~IQuality()=default
IQuality::~IQuality is a virtual destructor.
IQuantity specifies values as an amount of some unit, usually as a floating point number.
Definition hydrocouple.h:1795
virtual double minValue() const =0
Gets the minimum allowed value for this quantity.
virtual ~IQuantity()=default
IQuantity::~IQuantity is a virtual destructor.
virtual IUnit * unit() const =0
Unit of quantity.
virtual double maxValue() const =0
Gets the maximum allowed value for this quantity.
Forward declarations.
Definition hydrocouple.h:379
virtual void connect(const std::shared_ptr< ISlot< Args... > > &slot)=0
connect is used to connect a slot to the signal.
virtual void disconnect(const std::shared_ptr< ISlot< Args... > > &slot)=0
disconnect is used to disconnect a slot from the signal.
virtual void blockSignals(bool block)=0
blockSignals is used to block signals from being emitted.
virtual ~ISignal()=default
ISignal::~ISignal is a virtual destructor.
virtual void emit(Args... args)=0
emit is used to emit the signal.
ISlot interface class must be implemented by classes that want to listen to signals.
Definition hydrocouple.h:356
virtual void operator()(const ISignal< Args... > &sender, Args... args)=0
operator() is the function call operator that is called when a signal is emitted.
virtual ~ISlot()=default
ISlot::~ISlot is a virtual destructor.
IUIProvider is an optional side interface for entities that can present a graphical editor and/or vie...
Definition hydrocouple.h:625
virtual void showEditor(void *opaqueUIPointer=nullptr)=0
showEditor shows the editor for this entity.
virtual bool hasViewer() const =0
hasViewer indicates whether this entity has a UI viewer.
virtual void showViewer(void *opaqueUIPointer=nullptr)=0
showViewer shows the viewer for this entity.
virtual bool hasEditor() const =0
hasEditor indicates whether this entity has a UI editor.
virtual ~IUIProvider()=default
IUIProvider::~IUIProvider is a virtual destructor.
Defines the order of dimension in each FundamentalDimension for a unit.
Definition hydrocouple.h:1595
virtual ~IUnitDimensions()=default
IUnitDimensions::~IUnitDimensions is a virtual destructor.
virtual double power(HydroCouple::IUnitDimensions::FundamentalUnitDimension dimension) const =0
Returns the power for the requested dimension.
FundamentalUnitDimension
HydroCouple::FundamentalUnitDimension are the fundamental units that can be combined to form all type...
Definition hydrocouple.h:1601
@ Currency
Fundamental dimension for currency.
Definition hydrocouple.h:1640
@ Unitless
Fundamental dimension for unitless quantities (all powers zero).
Definition hydrocouple.h:1647
@ ElectricCurrent
Fundamental dimension for electric current.
Definition hydrocouple.h:1620
@ Time
Fundamental dimension for time.
Definition hydrocouple.h:1615
@ Length
Fundamental dimension for length.
Definition hydrocouple.h:1605
@ AmountOfSubstance
Fundamental dimension for amount of substance.
Definition hydrocouple.h:1630
@ LuminousIntensity
Fundamental dimension for luminous intensity.
Definition hydrocouple.h:1635
@ Temperature
Fundamental dimension for temperature.
Definition hydrocouple.h:1625
@ PlaneAngle
Fundamental dimension for plane angle (radian).
Definition hydrocouple.h:1655
@ Mass
Fundamental dimension for mass.
Definition hydrocouple.h:1610
IUnit interface, describing the physical unit of a IQuantity.
Definition hydrocouple.h:1690
virtual std::string symbol() const =0
The unit as a UDUNITS-2 string, e.g.
DistanceUnits
HydroCouple::DistanceUnits are the types of units that can be used to measure distance.
Definition hydrocouple.h:1696
@ Feet
Feet.
Definition hydrocouple.h:1711
@ Centimeters
Centimeters.
Definition hydrocouple.h:1736
@ Millimeters
Millimeters.
Definition hydrocouple.h:1741
@ Miles
Miles.
Definition hydrocouple.h:1726
@ Meters
Meters.
Definition hydrocouple.h:1701
@ Unknown
Unknown.
Definition hydrocouple.h:1751
@ Yards
Yards.
Definition hydrocouple.h:1721
@ Degrees
Degrees (angular; only meaningful for geographic reference systems).
Definition hydrocouple.h:1731
@ Inches
Inches.
Definition hydrocouple.h:1746
@ NauticalMiles
NauticalMiles.
Definition hydrocouple.h:1716
@ Kilometers
Kilometers.
Definition hydrocouple.h:1706
virtual double offsetToSI() const =0
OffSet to SI ('B' in: SI-value = A * quant-value + B).
virtual IUnitDimensions * dimensions() const =0
Fundamental dimensions of the unit.
virtual std::string ucumCode() const =0
The unit as a case-sensitive UCUM code, e.g.
virtual double conversionFactorToSI() const =0
Conversion factor to SI ('A' in: SI-value = A * quant-value + B)
virtual ~IUnit()=default
IUnit::~IUnit is a virtual destructor.
IValueDefinition describes the type and properties of values held by an IComponentDataItem.
Definition hydrocouple.h:1431
virtual ValueKind valueKind() const =0
How values of this definition behave under regridding and aggregation.
virtual std::string standardName() const =0
The CF standard name of the quantity these values measure.
virtual double defaultValue() const =0
Gets the default value for this value definition.
virtual std::string conceptURI() const =0
An absolute URI naming the quantity in a published vocabulary.
virtual double missingValue() const =0
The value representing that data is missing.
virtual ~IValueDefinition()=default
~IValueDefinition destructor
IWorkflowComponent manages the execution workflow for a set of coupled IModelComponent instances.
Definition hydrocouple.h:2791
virtual ~IWorkflowComponent()=default
~IWorkflowComponent destructor for IWorkflowComponent class.
virtual std::vector< IModelComponent * > modelComponents() const =0
Gets the model components managed by this workflow.
virtual void update()=0
Performs one orchestration step.
virtual bool addModelComponent(IModelComponent *component, const IIdentity *modelRoleIdentifier=nullptr, std::string *message=nullptr)=0
addModelComponent Adds model component instance to workflow
virtual WorkflowStatus status() const =0
Gets the current status of the workflow component.
virtual std::vector< IIdentity * > modelComponentLabels() const =0
requiredModelComponentIdentifiers returns the vector of IModelComponent identifiers that are required...
virtual void resume()=0
Resumes a paused workflow.
virtual void initialize()=0
Initializes the workflow component.
virtual void requestPause()=0
Requests a cooperative pause of the workflow.
virtual std::vector< ErrorEntry > errors(bool clearAfterRead=false)=0
Drains this workflow's diagnostic queue.
virtual IWorkflowComponentInfo * componentInfo() const =0
Gets the metadata information about this workflow component.
virtual void prepare()=0
Prepares the composition for computation.
virtual bool removeModelComponent(IModelComponent *component)=0
removeModelComponent Removes model component instance from workflow
WorkflowStatus
The WorkflowStatus enum describes the status of a workflow component over the course of its lifetime.
Definition hydrocouple.h:2801
@ Created
The workflow component has just been created.
Definition hydrocouple.h:2803
@ Finishing
The workflow component is finalizing and releasing resources.
Definition hydrocouple.h:2825
@ Initializing
The workflow component is initializing itself.
Definition hydrocouple.h:2805
@ Invalid
The workflow component found problems in the composition; fix the composition and validate() again.
Definition hydrocouple.h:2831
@ Prepared
The workflow component has prepared the composition and can begin updating.
Definition hydrocouple.h:2815
@ Validated
The workflow component found the composition valid and ready to prepare.
Definition hydrocouple.h:2811
@ Initialized
The workflow component has successfully initialized.
Definition hydrocouple.h:2807
@ Updating
The workflow component is performing an update step.
Definition hydrocouple.h:2817
@ Finished
The workflow component has finished and cannot be restarted.
Definition hydrocouple.h:2827
@ Preparing
The workflow component is preparing the composition for computation (e.g., driving IModelComponent::p...
Definition hydrocouple.h:2813
@ Validating
The workflow component is validating the composition (cross-component links, required roles).
Definition hydrocouple.h:2809
@ Failed
The workflow component encountered an unrecoverable error.
Definition hydrocouple.h:2829
@ Paused
The workflow component is paused at a synchronization point (see requestPause()) and can be resumed.
Definition hydrocouple.h:2821
@ Done
The workflow component has completed all update steps.
Definition hydrocouple.h:2823
@ Updated
The workflow component has successfully updated.
Definition hydrocouple.h:2819
virtual void finish()=0
Finalizes the workflow component and releases resources.
virtual void requestStop()=0
Requests a cooperative stop of the workflow.
virtual bool isRequiredModelComponent(const IIdentity *modelComponentLabel) const =0
isRequiredModelComponent checks if the model component is required by this component.
virtual std::vector< std::string > validate()=0
Validates the composition as a whole before computation begins.
IWorkflowComponentInfo provides metadata about an IWorkflowComponent and creates new instances of it.
Definition hydrocouple.h:2767
virtual std::unique_ptr< IWorkflowComponent > createComponentInstance()=0
Creates a new IWorkflowComponent instance.
virtual ~IWorkflowComponentInfo()=default
~IWorkflowComponentInfo
The IWorkflowComponentStatusChangeEventArgs contains the information that will be passed when the IWo...
Definition hydrocouple.h:3016
virtual IWorkflowComponent::WorkflowStatus status() const =0
Gets the IWorkflowComponent's status after the status change.
virtual IWorkflowComponent * workflowComponent() const =0
Gets the IWorkflowComponent that fired the event.
virtual ~IWorkflowComponentStatusChangeEventArgs()=default
~IWorkflowComponentStatusChangeEventArgs destructor
virtual IWorkflowComponent::WorkflowStatus previousStatus() const =0
Gets the IWorkflowComponent's status before the status change.
virtual float percentProgress() const =0
Number between 0 and 100 indicating the progress made by the workflow component.
virtual bool hasProgressMonitor() const =0
Indicates whether this event has a progress monitor.
virtual std::string message() const =0
Gets additional information about the status change.
HydroCouple namespace contains the core interface specifications for the HydroCouple component-based ...
Definition hydrocouple.h:54
constexpr int HYDROCOUPLE_ABI_VERSION
ABI version for the HydroCouple interface.
Definition hydrocouple.h:71
DataKind
DataKind identifies the element type of a typed data buffer.
Definition hydrocouple.h:199
@ Float32
float
Definition hydrocouple.h:209
@ String
std::string (host memory only)
Definition hydrocouple.h:212
@ Boolean
bool (stored one element per byte)
Definition hydrocouple.h:211
@ Int16
int16_t
Definition hydrocouple.h:203
@ Int8
int8_t
Definition hydrocouple.h:201
@ Unknown
No/unknown element type.
Definition hydrocouple.h:200
@ UInt16
uint16_t
Definition hydrocouple.h:204
@ UInt64
uint64_t
Definition hydrocouple.h:208
@ UInt8
uint8_t
Definition hydrocouple.h:202
@ Int32
int32_t
Definition hydrocouple.h:205
@ Float64
double
Definition hydrocouple.h:210
@ UInt32
uint32_t
Definition hydrocouple.h:206
@ Opaque
Implementation-defined bytes; meaning agreed out of band, size in BufferDescriptor::itemSizeBytes.
Definition hydrocouple.h:213
@ Int64
int64_t
Definition hydrocouple.h:207
std::span< const DifferentialEntry > DifferentialSet
DifferentialSet is a non-owning view of DifferentialEntry records.
Definition hydrocouple.h:1315
MemorySpace
MemorySpace identifies where a buffer's bytes physically live.
Definition hydrocouple.h:223
@ Unified
Unified/managed memory accessible from host and device.
Definition hydrocouple.h:227
@ HostPinned
Page-locked host memory (fast staging to/from devices).
Definition hydrocouple.h:225
@ Host
Ordinary pageable host memory.
Definition hydrocouple.h:224
@ Device
Accelerator-resident memory addressed by (backend, deviceId).
Definition hydrocouple.h:226
ValueKind
How a value behaves when it is regridded or aggregated.
Definition hydrocouple.h:1413
@ Flux
Per unit area and time.
Definition hydrocouple.h:1417
@ Extensive
Proportional to extent — mass, volume, heat content.
Definition hydrocouple.h:1416
@ Density
Per unit volume.
Definition hydrocouple.h:1418
@ Intensive
Independent of extent — temperature, concentration, elevation.
Definition hydrocouple.h:1415
ByteOrder
The ByteOrder enum class indicates the byte order of serialized data.
Definition hydrocouple.h:77
@ BigEndian
BigEndian serialized data byte order (most significant byte first).
Definition hydrocouple.h:82
@ LittleEndian
LittleEndian serialized data byte order (least significant byte first).
Definition hydrocouple.h:87
DifferentialRole
DifferentialRole says which side of a component's step a derivative buffer belongs to.
Definition hydrocouple.h:1288
@ Argument
An IArgument of the component (a parameter of the step).
Definition hydrocouple.h:1290
@ Output
An IOutput of the component, as produced by the step.
Definition hydrocouple.h:1291
@ Input
An IInput of the component, as consumed by the step.
Definition hydrocouple.h:1289
@ StateAfter
The same state item's value at the end of the step.
Definition hydrocouple.h:1293
@ StateBefore
A state item's value at the start of the step.
Definition hydrocouple.h:1292
DeviceBackend
DeviceBackend identifies the runtime that owns a device-resident buffer.
Definition hydrocouple.h:238
@ SYCL
SYCL (any implementation).
Definition hydrocouple.h:242
@ HIP
AMD HIP/ROCm runtime.
Definition hydrocouple.h:241
@ Other
An implementation-defined runtime both endpoints agree on.
Definition hydrocouple.h:245
@ None
Host memory; no device runtime involved.
Definition hydrocouple.h:239
@ OpenCL
OpenCL.
Definition hydrocouple.h:244
@ CUDA
NVIDIA CUDA runtime.
Definition hydrocouple.h:240
@ LevelZero
Intel oneAPI Level Zero.
Definition hydrocouple.h:243
Capability
Capability identifies an optional behavior a component may support.
Definition hydrocouple.h:310
@ Checkpointing
Component implements ICheckpointableModelComponent.
Definition hydrocouple.h:314
@ Licensing
Component implements ILicensedComponent.
Definition hydrocouple.h:317
@ DeviceBuffers
Data items can produce/accept Device/Unified BufferDescriptors.
Definition hydrocouple.h:311
@ PartitionedData
Component exposes IPartitionedComponentDataItem items (see hydrocoupledistributed....
Definition hydrocouple.h:312
@ Cloneable
Component implements ICloneableModelComponent.
Definition hydrocouple.h:315
@ LayeredData
Component exposes data items implementing Spatial::ILayering.
Definition hydrocouple.h:319
@ DistributedExecution
Component implements IDistributedModelComponent.
Definition hydrocouple.h:313
@ UserInterface
Component implements IUIProvider.
Definition hydrocouple.h:316
@ Differentiable
Component implements IDifferentiableModelComponent.
Definition hydrocouple.h:318
@ VendorBase
First value of the vendor-reserved range (0x80000000).
Definition hydrocouple.h:320
BufferDescriptor describes a typed, possibly strided, possibly device-resident multi-dimensional arra...
Definition hydrocouple.h:279
void * queue
Opaque backend stream/queue for asynchronous transfers; nullptr => default stream,...
Definition hydrocouple.h:289
MemorySpace space
Memory space holding the bytes.
Definition hydrocouple.h:286
int32_t deviceId
Device ordinal within the backend when space is Device/Unified.
Definition hydrocouple.h:288
DataKind kind
Element type.
Definition hydrocouple.h:281
const int64_t * stridesBytes
Byte step per dimension; nullptr => C-contiguous.
Definition hydrocouple.h:284
int64_t itemSizeBytes
Size of one element; 0 => the kind's natural size (illegal for Opaque).
Definition hydrocouple.h:285
int32_t rank
Number of dimensions; 0 denotes a scalar.
Definition hydrocouple.h:282
const int64_t * shape
Extent per dimension; length == rank.
Definition hydrocouple.h:283
DeviceBackend backend
Runtime owning the device memory when space is Device/Unified.
Definition hydrocouple.h:287
void * data
Base address of element (0, 0, ..., 0).
Definition hydrocouple.h:280
DifferentialEntry pairs one data item, in one role, with a buffer holding its tangent (forward mode) ...
Definition hydrocouple.h:1306
DifferentialRole role
Which side of the step.
Definition hydrocouple.h:1308
BufferDescriptor value
The tangent or cotangent buffer.
Definition hydrocouple.h:1309
const IComponentDataItem * item
The item this derivative belongs to.
Definition hydrocouple.h:1307
ErrorEntry is one diagnostic record in a component's error queue.
Definition hydrocouple.h:330
std::string message
Human-readable description.
Definition hydrocouple.h:345
Severity severity
Severity of this record.
Definition hydrocouple.h:342
std::string source
Id of the originating entity.
Definition hydrocouple.h:344
Severity
Severity of an ErrorEntry.
Definition hydrocouple.h:335
@ Warning
Recoverable anomaly.
Definition hydrocouple.h:337
@ Fatal
Component is in the Failed state.
Definition hydrocouple.h:339
@ Error
Operation failed; component may continue.
Definition hydrocouple.h:338
@ Information
Informational message.
Definition hydrocouple.h:336
int32_t code
Implementation-defined error code.
Definition hydrocouple.h:343