Dear all,
How can I compute coefficient based on material ID? I tried:

template<int dim, int degree_u,  typename Number>
template<typename Number2>
inline void SymGradMass<dim, degree_u,Number>
::evaluate_coefficient(
std::map<unsigned int, Number2>& rho_map,
std::map<unsigned int, Number2>& miu_map) {
return;
  const unsigned int n_cells = this->data->n_macro_cells();
  rho.resize  (n_cells);
  mu.resize  (n_cells);
  for (unsigned int cell=0; cell<n_cells; ++cell)
    {
  for(unsigned int element=0; 
element<VectorizedArray<Number>::n_array_elements ; ++element){
  const unsigned int  ID=this->data->get_cell_iterator(cell,element,0 
)->material_id();
  rho[cell][element] = rho_map.at(ID) ;
  mu[cell][element]  = miu_map.at(ID) ;
  }
    }
}
But it triggers assertion in get_cell_iterator(..). If I understand it 
correctly, problem is that total number of cells is not divisible by 
VectorizedArray<Number>::n_array_elements and for one of  macro cells 
calling get_cell_iterator(cell,element,0 ) with element>1 makes no sense. 
However I have no idea how to avoid it.

Thanks for any help,
Michał

Error message:

--------------------------------------------------------
An error occurred in line <1302> of file 
</home/mwichro/lib/deal.II/include/deal.II/matrix_free/matrix_free.h> in 
function
    typename dealii::DoFHandler<dim>::cell_iterator dealii::MatrixFree<dim, 
number>::get_cell_iterator(unsigned int, unsigned int, unsigned int) const 
[with int dim = 2; Number = float; typename 
dealii::DoFHandler<dim>::cell_iterator = 
dealii::TriaIterator<dealii::DoFCellAccessor<dealii::DoFHandler<2, 2>, 
false> >]
The violated condition was: 
    (vector_number) < (irreg_filled)
Additional information: 
    Index 1 is not in the half-open range [0,1).

Stacktrace:
-----------
#0  ./StokesMatrixFree: dealii::MatrixFree<2, 
float>::get_cell_iterator(unsigned int, unsigned int, unsigned int) const
#1  ./StokesMatrixFree: void SymGradMass<2, 2, 
float>::evaluate_coefficient<double>(std::map<unsigned int, double, 
std::less<unsigned int>, std::allocator<std::pair<unsigned int const, 
double> > >&, std::map<unsigned int, double, std::less<unsigned int>, 
std::allocator<std::pair<unsigned int const, double> > >&)

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to