I'm a bit confused then. The following tests three get_view() with
IndexSets : your example (slightly modified), the example from the doc
of get_view(), and then a slight modification of it. Your example
returns 0-based indices, but the one from the doc returns 11 as first
index, which is 1-based. The last example throws an error. Is it just a
bug or am I missing something obvious?
Thanks,
Arthur
{
IndexSet A(10);
A.add_index(1);
A.add_index(2);
A.add_index(5);
std::cout << "A :";
A.print(std::cout);
IndexSet B(10);
B.add_index(0);
B.add_index(1);
B.add_index(4);
B.add_index(5);
B.add_index(6);
B.add_index(7);
B.add_index(8);
B.add_index(9);
std::cout << "B :";
B.print(std::cout);
IndexSet view = A.get_view(B);
std::cout << "View :";
view.print(std::cout);
}
{
const unsigned int N = 100;
IndexSet A(N);
A.add_range(20, 40);
std::cout << "A :";
A.print(std::cout);
// Odd numbers in [0,N)
IndexSet B(N);
for (unsigned int i = 1; i < N; i += 2)
B.add_index(i);
std::cout << "B :";
B.print(std::cout);
{
IndexSet view = A.get_view(B);
std::cout << "View B:";
view.print(std::cout);
}
IndexSet C(N);
C.add_index(22);
C.add_index(26);
std::cout << "C :";
C.print(std::cout);
{
IndexSet view = A.get_view(C);
std::cout << "View C :";
view.print(std::cout);
}
}
On 11/19/25 17:06, 'Wolfgang Bangerth' via deal.II User Group wrote:
On 11/19/25 14:05, Arthur Bawin wrote:
Then I try to re-create the constraints using get_view() and merge()
as indicated in affine_constraints.h :
You don't show the whole code, so it's difficult to say. But
get_view() doesn't just remove constraints outside the "viewed"
subset, but it re-enumerates. For example, if you have 10 DoFs and
your AffineConstraint stores constraints for indices 1, 2, 5. Then
let's say you call get_view() with an index (sub)set 4...8 inclusive,
then the result is not an AffineConstraint of size 10 that stores a
constraint for index 5. Rather, it is an AffineConstraint of size 5
that stores a constraint for index 1 (the second index within the
range 4...8).
Does that make sense as perhaps the cause for your issue?
Best
W.
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see
https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/dealii/739f2c68-17ec-43dd-bb23-8a64fc8ae0fc%40gmail.com.