Hi all,

I am getting an exception that I don't understand.  I am trying to write a
function that, given a point in your domain, finds the active cell which
contains the point. I have included the (lightly edited for legibility)
code for this function.


find_cell(Triangulation<dim> &tria, Point<dim> &loc)
{
   //start at the lowest refinement level
   typename Triangulation<dim>::cell_iterator current_cell;

   typename Triangulation<dim>::cell_iterator
       cell = tria->begin(0),
       endc = tria->end(0);

   for(; cell!=endc; ++cell)
   {
      if(cell->point_inside(loc))
      {
         current_cell=cell;
         //cascade down the hierarchy until we find the cell
         while(true)
         {
            //If the current cell is active, we are good to go.
            if(current_cell->active()) return current_cell;
            for( int child_no = 0; child_no <
GeometryInfo<dim>::max_children_per_cell; child_no++)
               if(current_cell->child(child_no)->point_inside(loc))
               {
                  current_cell = current_cell->child(child_no);
                  break;
               }
         }
      }
   }
}

The error is fairly deep in the stacktrace, and is an exception of type
ExcAssignmentOfUnusedObject.  The code actually runs for a while
successfully before reaching this error, so it is clearly not every time
that the function is called this problem arises.  I am also including the
runtime error message:

An error occurred in line <206> of file
</home/ian.rose/dealii/deal.II-7.1.0/include/deal.II/grid/tria_iterator.templates.h>
in function
    dealii::TriaIterator<Accessor>::TriaIterator(const
dealii::Triangulation<Accessor::dimension, Accessor::space_dimension> *,
int, int, const Accessor::AccessorData *) [with Accessor =
dealii::TriaAccessor<1, 2, 2>]
The violated condition was:
    this->accessor.used()
The name and call sequence of the exception was:
    ExcAssignmentOfUnusedObject()
Additional Information:
(none)

Stacktrace:
-----------
#0  /home/ian.rose/dealii/tracer/./source/step-31:
_ZN6dealii12TriaIteratorINS_12TriaAccessorILi1ELi2ELi2EEEEC9EPKNS_13TriangulationILi2ELi2EEEiiPKv
#1  /home/ian.rose/dealii/tracer/./source/step-31:
dealii::TriaIterator<dealii::TriaAccessor<1, 2, 2>
>::TriaIterator(dealii::Triangulation<2, 2> const*, int, int, void const*)
#2  /home/ian.rose/dealii/tracer/./source/step-31: dealii::TriaAccessor<2,
2, 2>::line(unsigned int) const
#3  /home/ian.rose/dealii/tracer/./source/step-31: unsigned int
dealii::internal::TriaAccessor::Implementation::vertex_index<2,
2>(dealii::TriaAccessor<2, 2, 2> const&, unsigned int)
#4  /home/ian.rose/dealii/tracer/./source/step-31: dealii::TriaAccessor<2,
2, 2>::vertex_index(unsigned int) const
#5  /home/ian.rose/dealii/tracer/./source/step-31: dealii::TriaAccessor<2,
2, 2>::vertex(unsigned int) const
#6  /home/ian.rose/dealii/deal.II-7.1.0/lib/libdeal_II.g.so.7.1.0:
dealii::CellAccessor<2, 2>::point_inside(dealii::Point<2, double> const&)
const
#7  /home/ian.rose/dealii/tracer/./source/step-31:
dealii::Tracer<2>::find_cell()
#8  /home/ian.rose/dealii/tracer/./source/step-31: void
dealii::ForwardEulerAdvector<2,
dealii::TrilinosWrappers::BlockVector>::advect<dealii::Tracer<2>
>(dealii::TrilinosWrappers::BlockVector const&, dealii::TracerUniverse<2,
dealii::Tracer<2> >&, double)
#9  /home/ian.rose/dealii/tracer/./source/step-31:
Step31::BoussinesqFlowProblem<2>::solve()
#10  /home/ian.rose/dealii/tracer/./source/step-31:
Step31::BoussinesqFlowProblem<2>::run()


Any insights as to why this is happening would be much appreciated,
Thanks,
Ian
_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii

Reply via email to