rem: template<class ProblemResizable> int solve(ProblemResizable& prob, goal& g); int multi(laplace& lp); int main() { int I,J; I = J = 40; pair<double, double> x(-4,4); pair<double, double> y(-4,4); double arr_bound[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}; vector<double> vec_bound(arr_bound, arr_bound + 20); vec_bound.insert(vec_bound.end(),vec_bound.rbegin(),vec_bound.rend());  boundary bound_f(boundary::DIRICHLET, J, 0.0);  boundary bound_f_odd(boundary::DIRICHLET, J, 1.0); laplace fine(I, J, x, y, bound_f, bound_f, bound_f, bound_f_odd); residual_norm norm(fine, EPS);  double norm_c0 = residual_norm::norm(fine); int iter = solve(fine, norm);  double norm_c1 = residual_norm::norm(fine); double ratio = norm_c1/norm_c0;  cout.precision(3);  cout << "# iter: " << iter << endl; cout << "# ratio: " << ratio << endl;  cout << fine << endl;  return 0; }
context: template<class ProblemResizable> int solve(ProblemResizable& prob, goal& g);int multi(laplace& lp);int main(){  int I,J;  I = J = 40;  pair<double, double> x(-4,4);  pair<double, double> y(-4,4);  double arr_bound[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};  vector<double> vec_bound(arr_bound, arr_bound + 20);  vec_bound.insert(vec_bound.end(),vec_bound.rbegin(),vec_bound.rend());  boundary bound_f(boundary::DIRICHLET, J, 0.0);  //boundary bound_f_odd(boundary::DIRICHLET, vec_bound.begin(), vec_bound.end());  boundary bound_f_odd(boundary::DIRICHLET, J, 1.0);  laplace fine(I, J, x, y, bound_f, bound_f, bound_f, bound_f_odd);  residual_norm norm(fine, EPS);  double norm_c0 = residual_norm::norm(fine);  int iter = solve(fine, norm);  double norm_c1 = residual_norm::norm(fine);  double ratio = norm_c1/norm_c0;  cout.precision(3);  cout << "# iter: " << iter << endl;  cout << "# ratio: " << ratio << endl;  cout << fine << endl;  return 0;}// recursive templated versiontemplate<class ProblemResizable> int solve(ProblemResizable& prob, goal& g){  bilinear_interpolation bi;  half_weighting hw;  int iter = 0;  int this_iter = 0;  int cycle = 0;  int max_cycle = 3;  int min_grid = 5;  if(prob.I() == min_grid){    iter = smooth(prob, g);    cout << "# iter: " << iter << endl;    cout << "# size: " << prob.I() << endl;    cout << prob;  }  else{    ProblemResizable orig = prob.clone();    prob.shrink(hw);    iter = solve(prob, g);		// recurse    bi(prob, orig);    this_iter += smooth(orig, g);	// postsmoothing    prob = orig;    iter += this_iter;    cout << "# iter: " << this_iter << endl;    cout << "# size: " << prob.I() << endl;    cout << prob;  }  return iter;}