-
Notifications
You must be signed in to change notification settings - Fork 448
Add "Spawn Helpers" #11239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Add "Spawn Helpers" #11239
Conversation
Release the wolves! I'm prepared to be eaten alive for this PR. :) |
You'd better be ready to talk this over on Wednesday's call. :)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main question I have about this is about the difference between this SpawnHelper
and the public API (C, and Python) we already provide.
- It seems that some functions are just duplicated here. I flagged a couple.
- Some of these functions could potentially benefit the public API and should be moved there
I guess one argument one could make would be that the public API is C, not C++, but this is a non-argument. We could just have the functionality implemented in a C++ method, and the C one would just reinterpret_cast/cast and forward to the C++ one.
If you look at runtime.h, we have a C++ and C function for the callbacks
C++
ENERGYPLUSLIB_API void callbackBeginNewEnvironment(EnergyPlusState state, std::function<void(EnergyPlusState)> f);
C
extern "C" {
ENERGYPLUSLIB_API void callbackBeginNewEnvironment(EnergyPlusState state, void (*f)(EnergyPlusState));
}
Here is a dumb demo: https://compiler-explorer.com/z/8951PYh6o
[[nodiscard]] int ActuatorHandle(EnergyPlus::EnergyPlusData &state, | ||
const std::string &componentType, | ||
const std::string &controlType, | ||
const std::string &componentName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EnergyPlus/src/EnergyPlus/api/datatransfer.h
Line 245 in 4ac1038
ENERGYPLUSLIB_API int getActuatorHandle(EnergyPlusState state, const char *componentType, const char *controlType, const char *uniqueKey); |
const std::string &controlType, | ||
const std::string &componentName); | ||
|
||
void SetActuatorValue(EnergyPlus::EnergyPlusData &state, int handle, Real64 value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EnergyPlus/src/EnergyPlus/api/datatransfer.h
Line 278 in 4ac1038
ENERGYPLUSLIB_API void setActuatorValue(EnergyPlusState state, int handle, Real64 value); |
|
||
void SetActuatorValue(EnergyPlus::EnergyPlusData &state, int handle, Real64 value); | ||
|
||
void ResetActuator(EnergyPlus::EnergyPlusData &state, int handle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EnergyPlus/src/EnergyPlus/api/datatransfer.h
Line 258 in 4ac1038
ENERGYPLUSLIB_API void resetActuator(EnergyPlusState state, int handle); |
I would like to see just an extension of the API to cover the additional functions that Spawn needs, rather than creating a special interface. |
Pull request overview
Description of the purpose of this PR
Pull Request Author
Reviewer