Thank you very much!

Best
John

> 在 2019年2月25日,下午3:01,Wolfgang Bangerth <bange...@colostate.edu> 写道:
> 
> On 2/23/19 7:16 PM, Yangshuai Wang wrote:
>> Thanks so much! I delete const, and the error says:
>> 
>> An error occurred in line <1105> of file 
>> </Applications/deal.II-9.0.0.app/Contents/Resources/include/deal.II/lac/vector.h>
>>  in function
>>     Number &dealii::Vector<double>::operator()(const 
>> dealii::Vector::size_type) [number = double]
>> The violated condition was:
>>     i<vec_size
>> Additional information:
>>     Index 289 is not in the half-open range [0,289).
> 
> So you sized the vector to have 289 elements (0...288) but then you try to 
> write into element 289 as you continue to read from a file. Apparently, your 
> file has more than 289 double precision numbers. (You also have to pay 
> attention that you could have been reading the first 289 elements already and 
> the 289th read fails -- but you only find out about it after the fact because 
> the statement 'while(!File.eof())' might only stop the iteration once the 
> last 
> read failed. This could happen if, for example, you have a space or a newline 
> after the 289th element: in that case, after reading the 289th element, you 
> are not yet at the end of the file, and so you attempt to read and write into 
> the 290th element, even though the read will have failed.)
> 
> 
>> By the way, I can read my "solution-txt" file to an array, but how to 
>> transfer the array to Vector<double> type since the solution in 
>> KellyErrorEstimator<dim>::estimate must be a Vector.
> 
> You could create a Vector of the correct size and simply copy the elements 
> one 
> by one from your array into the vector.
> 
> Best
>  W.
> 
> -- 
> ------------------------------------------------------------------------
> Wolfgang Bangerth          email:                 bange...@colostate.edu
>                            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 dealii+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to