I do not know how to formulate it, but I can say what I expected:
Using std::vector I can write the vector-extraction in the following form:
//Using std::vector
    std::vector<double> std_vec_1(9);
    std::vector<double> std_vec_2(std_vec_1.size()/3);
    for(size_t i = 0; i < std_vec_1.size(); ++i)
        std_vec_1[i] = i+200;
    for(size_t i = 0; i < std_vec_2.size(); ++i)
        std_vec_2[i] = 0;
    std::cout << "Before: \n";
    for(size_t i = 0; i < std_vec_1.size(); ++i)
        std::cout << std_vec_1[i] << ' ';
    std::cout << '\n';
    for(size_t i = 0; i < std_vec_2.size(); ++i)
        std::cout << std_vec_2[i] << ' ';
    std::cout << '\n';
    std::cout << "After: \n";
    std_vec_2 = std::vector<double>(std_vec_1.begin()+std_vec_2.size(), 
std_vec_1.begin()+std_vec_2.size()*2);
    for(size_t i = 0; i < std_vec_1.size(); ++i)
        std::cout << std_vec_1[i] << ' ';
    std::cout << '\n';
    for(size_t i = 0; i < std_vec_2.size(); ++i)
        std::cout << std_vec_2[i] << ' ';
    std::cout << '\n';
i.e. begin() always points at the beginning of the vector, regardless of 
content. But with dealii::Vector I have to write it like 
   
 //Using dealII
    Vector<double> vec_1 = Vector<double>(9);
    Vector<double> vec_2 = Vector<double>(vec_1.size()/3);
    for(size_t i = 0; i < vec_1.size(); ++i)
        vec_1(i) = i+200;
    vec_2 = 0.;
    std::vector< int > indices(vec_2.size());
    for(size_t i = 0; i < vec_2.size(); ++i)
        indices[i] = i+vec_2.size();
    const std::vector<int> const_indices(indices);
    std::cout << "Before: \n";
    std::cout << vec_1 << '\n';
    std::cout << vec_2 << '\n';
    std::cout << "After: \n";
    vec_1.extract_subvector_to(const_indices.begin(), const_indices.end(), 
vec_2.begin());
    std::cout << vec_1 << '\n';
    std::cout << vec_2 << '\n';

i.e. the begin()-iterator of the dealii::Vector does not always point at 
the beginning of the Vector. That's what I found confusing. 
I hope that helps already!


Am Donnerstag, 20. Juli 2017 16:25:37 UTC+2 schrieb Wolfgang Bangerth:
>
> On 07/20/2017 05:42 AM, Jean-Paul Pelteret wrote: 
> >     (I would have expected something else) 
> > 
> > 
> > We're always happy to receive contributions 
> > <https://github.com/dealii/dealii/compare> that improve the 
> documentation! :-) 
>
> Indeed, seriously! The documentation for that function is in the file 
> include/deal.II/lac/vector.h. It would be great if you could use how you 
> misunderstood what it says to improve the documentation! 
>
> Best 
>   Wolfgang 
>
> -- 
> ------------------------------------------------------------------------ 
> 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.

Reply via email to