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).
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. Thanks for your time. Best John ----- 原始邮件 ----- 发件人: "Wolfgang Bangerth" <bange...@colostate.edu> 收件人: dealii@googlegroups.com 发送时间: 星期六, 2019年 2 月 23日 下午 11:25:42 主题: Re: [deal.II] Loading solution in step 6 > void Step6<dim>::read_solution (const unsigned int cycle) const > { > int n = 0; > > ifstream File; > File.open("solution-" + std::to_string(cycle) + ".txt"); > while(!File.eof()) > { > File >> solution[n]; In this line, you are trying to write into 'solution[n]', but the function you are in is marked as 'const' and consequently the 'solution' vector is 'const'. You can't write into const objects. 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. -- Best Regards 王阳帅 John 上海交通大学 自然科学研究院 计算数学 Computational mathematics , Institude of natural science, Shanghai Jiao tong University, Shanghai , China Tel:+86 18817288575 E-mail:yswang2...@sjtu.edu.cn / wys_m...@foxmail.com -- 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.