-
Notifications
You must be signed in to change notification settings - Fork 707
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
Introduce ParticleAccessor::set_properties() taking a Tensor. #12684
Conversation
@gassmoeller -- FYI. But there are no places in ASPECT where we use the |
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.
Looks good to me.
// A Tensor object is not an array, so we cannot just create an | ||
// ArrayView object for it. Rather, copy the data into a true | ||
// array and make the ArrayView from that. | ||
double array[dim]; | ||
for (unsigned int d = 0; d < dim; ++d) | ||
array[d] = new_properties[d]; | ||
|
||
set_properties(make_array_view(array)); |
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.
This is where I would like to do
// A Tensor object is not an array, so we cannot just create an | |
// ArrayView object for it. Rather, copy the data into a true | |
// array and make the ArrayView from that. | |
double array[dim]; | |
for (unsigned int d = 0; d < dim; ++d) | |
array[d] = new_properties[d]; | |
set_properties(make_array_view(array)); | |
set_properties(make_array_view(new_properties.to_array())); |
as mentioned in the issue.
In fact, if the ArrayView
constructor is not explicit
, we can even skip make_array_view()
.
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.
Come to think of it - if we do implement to_array()
then we don't need this extra function at all, so we should just implement to_array()
:)
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 constructor is not explicit
:
template <std::size_t N>
ArrayView(value_type (&array)[N]);
I can't quite figure out from your comments where you are asking me to make changes?
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.
I'll put up a PR with what I want in it.
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.
How about we merge this now and then do what you suggest as a follow-up? It doesn't become easier/less work for anyone when we try to interleave patches from different people :-)
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.
I meant to respond to this, sorry!
Yes, lets just merge this as-is and I'll deal with what I would like to happen next in my own PR.
@bangerth can you rebase? |
dd9bde7
to
d65a586
Compare
Rebased. |
The resolution in #12624 was that we don't want to allow
ArrayView
pointing to aTensor
object. This removes one of two uses of this by providing a different overload when setting tensors as properties for particles./rebuild