> However, I am interested in using continuous densities.  I thought of
> using the user_index property of the TriaAccessor class to create a map
> between the integer index and the real density but could not really
> figure out how to do it.  I could not find examples on how to use the
> user_index property in the tutorials or the e-mail list, and wanted to
> ask for guidance on using it (or otherwise, if you think that there is a
> better solution than this, I would greatly appreciate it).

A simpler way to deal with continuous data may be if you have a vector of 
material densities, say
  std::vector<double> densities (tria.n_active_cells());
and then let the user pointer of each cell point to the corresponding 
element of the vector:
  unsigned int index = 0;
  for (cell = tria.begin_active(); cell != tria.end(); ++cell, ++index)
    cell->set_user_pointer (&densities[index]);

You can then access the density on a given cell by
  *reinterpret_cast<double*>(cell->user_pointer())

Does that help?
 W.

-------------------------------------------------------------------------
Wolfgang Bangerth                email:            [email protected]
                                 www: http://www.math.tamu.edu/~bangerth/

_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii

Reply via email to