-
Notifications
You must be signed in to change notification settings - Fork 5
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
Create a SubDomain #438
Comments
I am thinking of defining a Accessing Do you think it would help you ? |
This sounds like it would cover our use cases as described in the issue. I'm not sure I have fully understood though. The I can see a use for 3 kinds of ranges:
@pauline987654321 has recently come across a use case for the generala case.
This sounds like a good idea in theory but I wonder if NewRangeType valid_indices(start_element, n_elements, stride_length);
Chunk my_chunk(valid_indices);
ddc::DiscreteVector step(3);
my_chunk(start_element + step) != my_chunk(step) // start_element + step != start_element + step * stride_length |
No I was thinking of only one parameter describing the
Yes, it seems more difficult but should be doable. However accessing it using
To me you would have to wonder if the element belongs to the range, which is not the case in your example |
Sounds good
Yes that makes sense
If stride_length is 3 then
So you would use |
Oh that is true, then it would be the second element in ddc::DiscreteVector range_stride(3);
StridedDomain valid_elements(start_element, n_elements, range_stride);
ddc::Chunk<int, StridedDomain> my_chunk(valid_elements);
EXPECT_EQUAL(my_chunk(ddc::DiscreteVector(0)), my_chunk(start_element));
EXPECT_EQUAL(my_chunk(ddc::DiscreteVector(1)), my_chunk(start_element + range_stride));
EXPECT_EQUAL(my_chunk(ddc::DiscreteVector(1)), my_chunk(valid_elements(ddc::DiscreteVector(1)))); Would this make sense ?
No I meant one of the two operators would allow to access the n-th element using a |
Then this looks good to me. Presumably an iterator would then use a |
Could be yes |
Then that all sounds ok to me. What would a ddc::DiscreteVector range_stride(2);
StridedDomain valid_elements(start_element, n_elements, range_stride);
ddc::Chunk<int, StridedDomain> my_chunk(valid_elements);
// Option 1
for_each (valid_elements, [&](ddc::DiscreteElement<IDim> idx) {
my_chunk(idx) = ddc::coordinate(idx);
}
// Option 2
for_each (valid_elements, [&](ddc::DiscreteVector<IDim> vec) {
my_chunk(valid_elements(vec)) = ddc::coordinate(start_element + vec);
}
// Option 3
for_each (valid_elements, [&](ChunkIterator iter) {
ddc::DiscreteElement idx = iter.element();
my_chunk(iter) = ddc::coordinate(idx);
} Something else? |
I think we can define algorithms for the options 1 and 2. |
Back to this comment, in 3. would it require storage or would there be an analytical formula ? |
It would require storage. We won't always have an analytical formula. |
@Paulinemoi Hello, as you may have seen we have a first proof of concept in #698. Feel free to have a look at it, especially the tests, and feel free to give us feedback on the feature. |
In the test
|
Thank you for taking time to look at it.
Because it seems there is a typo :) unfortunately I think the tests were passing :(
Actually the
No, only |
I would like to be able to create some kind of SubDomain. For example this could be achieved by adding a stride to the Domain. This would be useful in several places.
It can be used to iterate over a sliced domain. This can be useful for creating a Lagrange interpolation or calculating a quadrature (e.g. Simpson's quadrature).
E.g. currently a Simpson's quadrature is written as:
with a SubDomain it would be:
It can also be used to create a Chunk on a SubDomain. Eg when working with patches it is common to need values of a function over all the domain, but the derivatives only at certain points (usually the boundary). Currently this is only possible by explicitly choosing the number of points at the compilation, or creating a separate mesh for the derivatives (which then have different
DiscreteElements
)The text was updated successfully, but these errors were encountered: