-
Notifications
You must be signed in to change notification settings - Fork 16
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
FluidGrid: proposed dimensions output to the fitTransform method #32
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -32,6 +32,7 @@ class GridClient : public FluidBaseClient, OfflineIn, OfflineOut, ModelObject | |||||||
using string = std::string; | ||||||||
using BufferPtr = std::shared_ptr<BufferAdaptor>; | ||||||||
using StringVector = FluidTensor<string, 1>; | ||||||||
using IndexPair = std::tuple<index,index>; | ||||||||
|
||||||||
template <typename T> | ||||||||
Result process(FluidContext&) | ||||||||
|
@@ -56,21 +57,22 @@ class GridClient : public FluidBaseClient, OfflineIn, OfflineOut, ModelObject | |||||||
|
||||||||
GridClient(ParamSetViewType& p) : mParams(p) {} | ||||||||
|
||||||||
MessageResult<void> fitTransform(DataSetClientRef sourceClient, | ||||||||
MessageResult<IndexPair> fitTransform(DataSetClientRef sourceClient, | ||||||||
DataSetClientRef destClient) | ||||||||
{ | ||||||||
auto srcPtr = sourceClient.get().lock(); | ||||||||
auto destPtr = destClient.get().lock(); | ||||||||
if (!srcPtr || !destPtr) return Error(NoDataSet); | ||||||||
if (!srcPtr || !destPtr) return Error<IndexPair>(NoDataSet); | ||||||||
auto src = srcPtr->getDataSet(); | ||||||||
auto dest = destPtr->getDataSet(); | ||||||||
if (src.dims() != 2) return Error("Dataset should be 2D"); | ||||||||
if (src.size() == 0) return Error(EmptyDataSet); | ||||||||
if (src.dims() != 2) return Error<IndexPair>("Dataset should be 2D"); | ||||||||
if (src.size() == 0) return Error<IndexPair>(EmptyDataSet); | ||||||||
FluidDataSet<string, double, 1> result; | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like that as it frees |
||||||||
result = mAlgorithm.process(src, | ||||||||
get<kResample>(), get<kExtent>(), get<kAxis>()); | ||||||||
destPtr->setDataSet(result); | ||||||||
return OK(); | ||||||||
IndexPair casted = mAlgorithm.getGridMax(); | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and I would then call this
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried without the tuple and it moaned. I can retry now that everything else is working. |
||||||||
return {casted}; | ||||||||
} | ||||||||
|
||||||||
static auto getMessageDescriptors() | ||||||||
|
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.
Note to other reviewers: this needs to be
std::tuple
here because the CCE wrappers can handle that as a message return, but not (yet)std::pair
. If / when the wrappers are updated to account for pair, then this slight inconsistency w/r/t the algorithm could be ironed outThere 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.
Credits should be given: with @weefuzzy I would have never been able to do this and his patience was infinite as usual.
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.
another question, meta, to all reviewer: did I get the dependencies right? I put the PR here in core, and did only feature branches in the two CCE wrapper repos. I think it is clear enough and doesn't clutter the PR of the other 2 but I know @weefuzzy did differently for another one (the new rolling stat object).