Hello,

I am running the following snippet of mesh refinement code:
 
  Vector<double> error_estimates (triangulation.n_active_cells());
unsigned int i=0;   for (typename Triangulation<dim>::active_cell_iterator cell 
= triangulation.begin_active();         cell != triangulation.end();++cell,++i) 
     
cell->set_user_index(i);

 //compute estimates....
 //refine only (no coarsening)
  GridRefinement::refine_and_coarsen_fixed_fraction (triangulation, 
error_estimates, 0.35, 0.);

  //save the current solution in a vector
  Vector<double> q = optimality_solution;

  SolutionTransfer<dim> solution_transfer(dof_handler);

  triangulation.prepare_coarsening_and_refinement();
  solution_transfer.prepare_for_pure_refinement();

  //go ahead and execute the actual coarsening and refinement
  triangulation.execute_coarsening_and_refinement ();

  //resize this to match... AND redistribute DoFs
  dof_handler.distribute_dofs(fe);
  optimality_solution.reinit(dof_handler.n_dofs());
  
  //interpolate the solution values to the new mesh
  solution_transfer.interpolate(q, optimality_solution);

When I run this code in debug mode, I get the following exception:

An error occurred in line <287> of file 
</Users/mihai/Utils/deal.II.svn/deal.II/source/numerics/solution_transfer.cc> 
in 
function
    void dealii::SolutionTransfer<dim, VECTOR, DH>::interpolate(const 
std::vector<T, std::allocator<_T2> >&, std::vector<T, std::allocator<_T2> >&) 
const [with int dim = 2, VECTOR = dealii::Vector<double>, DH = 
dealii::DoFHandler<2, 2>]
The violated condition was: 
    prepared_for==coarsening_and_refinement
The name and call sequence of the exception was:
    ExcNotPrepared()
Additional Information: 
(none)

Stacktrace:
-----------
#0  3   LbfgsbOptimizer                     0x000000010034ffd6 
_ZNK6dealii16SolutionTransferILi2ENS_6VectorIdEENS_10DoFHandlerILi2ELi2EEEE11interpolateERKSt6vectorIS2_SaIS2_EERS8_
 + 108: 3   LbfgsbOptimizer                     0x000000010034ffd6 
_ZNK6dealii16SolutionTransferILi2ENS_6VectorIdEENS_10DoFHandlerILi2ELi2EEEE11interpolateERKSt6vectorIS2_SaIS2_EERS8_
 

#1  4   LbfgsbOptimizer                     0x0000000100350d3d 
_ZNK6dealii16SolutionTransferILi2ENS_6VectorIdEENS_10DoFHandlerILi2ELi2EEEE11interpolateERKS2_RS2_
 + 785: 4   LbfgsbOptimizer                     0x0000000100350d3d 
_ZNK6dealii16SolutionTransferILi2ENS_6VectorIdEENS_10DoFHandlerILi2ELi2EEEE11interpolateERKS2_RS2_
 

#2  5   LbfgsbOptimizer                     0x0000000100063db5 
_ZN28NewtonOptimalitySystemSolverILi2EE11refine_meshEP18HessianInformation + 
467: 5   LbfgsbOptimizer                     0x0000000100063db5 
_ZN28NewtonOptimalitySystemSolverILi2EE11refine_meshEP18HessianInformation 
#3  6   LbfgsbOptimizer                     0x0000000100063e7a 
_ZN15LbfgsbOptimizerILi2EE24refine_optimization_meshEP18HessianInformation + 
36: 
6   LbfgsbOptimizer                     0x0000000100063e7a 
_ZN15LbfgsbOptimizerILi2EE24refine_optimization_meshEP18HessianInformation 
#4  7   LbfgsbOptimizer                     0x000000010001c8d8 main + 960: 7   
LbfgsbOptimizer                     0x000000010001c8d8 main 
#5  8   LbfgsbOptimizer                     0x000000010001a80c start + 52: 8   
LbfgsbOptimizer                     0x000000010001a80c start 
--------------------------------------------------------
make: *** [run] Abort trap

I am preparing the sol_transfer object for pure refinement only, since no cells 
are coarsened. the sol_transfer object seems not to like that.

When the debug mode is off, this exception does not show up (but I get a 
segmentation fault at a later point). Any idea what I am doing wrong? 

Best,
 --Mihai
_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii

Reply via email to