-
Notifications
You must be signed in to change notification settings - Fork 197
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
#4007 - Model objects returned in inconsistent order #4010
Conversation
… Hoping to be able to quickly do benchmarks in ruby.
…fined in the block for the define_method
@@ -311,6 +311,9 @@ class MODEL_API Model : public openstudio::Workspace { | |||
std::shared_ptr<typename T::ImplType> p = it->getImpl<typename T::ImplType>(); | |||
if (p) { result.push_back(T(p)); } | |||
} | |||
if (sorted) { | |||
std::sort(result.begin(), result.end()); | |||
} |
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.
add an optional argument to sort stuff in getConcreteModelObjects, defaults to false like it was before.
@@ -72,7 +72,7 @@ | |||
%init %{ | |||
rb_eval_string("OpenStudio::IdfObject.class_eval { define_method(:to_" #_name ") { OpenStudio::Model::to" #_name "(self); } }"); | |||
rb_eval_string("OpenStudio::Model::Model.class_eval { define_method(:get" #_name ") { |handle| OpenStudio::Model::get" #_name "(self, handle); } }"); | |||
rb_eval_string("OpenStudio::Model::Model.class_eval { define_method(:get" #_name "s) { OpenStudio::Model::get" #_name "s(self); } }"); | |||
rb_eval_string("OpenStudio::Model::Model.class_eval { define_method(:get" #_name "s) { | sorted = false | OpenStudio::Model::get" #_name "s(self, sorted); } }"); |
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.
Modify the ruby wrapper to provide getXXXXs(sorted=false), so that if you call getXXXs it sill does what it used to (unsorted for ConcreteModelObjects and ModelObjects alike)
(These code changes are very simple to see, but it took me a surprising amount of effort to get right)
example:
As you can see, the sort order within the bowels of Model/Workspace ( |
Pull request overview
Please read OpenStudio Pull Requests to better understand the OpenStudio Pull Request protocol.
Pull Request Author
Add to this list or remove from it as applicable. This is a simple templated set of guidelines.
src/model/test
)src/energyplus/Test
)src/osversion/VersionTranslator.cpp
)src/openstudio_lib/library/OpenStudioPolicy.xml
)Labels:
IDDChange
APIChange
Pull Request - Ready for CI
so that CI builds your PRReview Checklist
This will not be exhaustively relevant to every PR.