I tried the following:
std::cout << "Size of unified test vector: " << unified_test_vector.size()
<< '\n'; std::cout << "Size of scaled_solution: " << scaled_solution.size()
<< '\n';
std::cout << "Locally owned elements of scaled_solution: " <<
scaled_solution.locally_owned_elements().size() << '\n';
std::cout << "Size of mask: " << TE_value_mask.size() << '\n';
std::cout << "Number of local dofs: " << dof_handler.n_locally_owned_dofs()
<< '\n';
for(auto index : scaled_solution.locally_owned_elements())
{
if(TE_value_mask[index])
{
unified_test_vector(dof_handler.locally_owned_dofs().nth_index_in_set(index
)) = scaled_solution(dof_handler.locally_owned_dofs().nth_index_in_set(index
));
}
if(TL_value_mask[index])
{
unified_test_vector(dof_handler.locally_owned_dofs().nth_index_in_set(index
)) = scaled_solution(dof_handler.locally_owned_dofs().nth_index_in_set(index
));
}
}
but it fails with
The violated condition was:
n < n_elements()
Additional information:
Index 324 is not in the half-open range [0,288).
Which index should I try to access? I also tried with
for(auto index : scaled_solution.locally_owned_elements()) {
if(TE_value_mask[index])
{
unified_test_vector(scaled_solution.locally_owned_elements().nth_index_in_set(index))
=
scaled_solution(scaled_solution.locally_owned_elements().nth_index_in_set(index));//
* (unified_max_TE_value - unified_min_TE_value) * unified_TE_value +
unified_TE_value;
}
if(TL_value_mask[index])
{
unified_test_vector(scaled_solution.locally_owned_elements().nth_index_in_set(index))
=
scaled_solution(scaled_solution.locally_owned_elements().nth_index_in_set(index));//
* (unified_max_TL_value - unified_min_TL_value) * unified_TL_value +
unified_TL_value;
}
}
but it failed, too, with a similar error message.
Thanks!
Am Freitag, 20. April 2018 15:29:47 UTC+2 schrieb Wolfgang Bangerth:
>
> On 04/20/2018 02:22 AM, 'Maxi Miller' via deal.II User Group wrote:
> > Furthermore, the documentation for extract_dofs() states that
> > |
> > Thesize of selected_dofs must equal DoFHandler::n_dofs()
> > <
> http://www.dealii.org/developer/doxygen/deal.II/classDoFHandler.html#a54e7270f2ba6206604f794114b39a2aa>
>
>
> > |
> > while the error message tells me that the vector must have a size of
> > |
> > dof.n_locally_owned_dofs()
> > |
> > That is slightly confusing...
>
> Yes. I fixed this:
> https://github.com/dealii/dealii/pull/6273
>
>
> > I already suspected this. Do you have a suggestion how to solve it? Or
> a
> > suggestion for a better approach?
>
> The approach is generally fine, but you need to translate between the two
> sets
> of indices. In particular, you need to find the global index of the i'th
> "locally owned dof". This should be easy by asking the index set of
> locally
> owned dofs you can get from the dof handler.
>
> Best
> W.
>
> --
> ------------------------------------------------------------------------
> Wolfgang Bangerth email: [email protected]
> <javascript:>
> www: http://www.math.colostate.edu/~bangerth/
>
>
--
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].
For more options, visit https://groups.google.com/d/optout.