enum Similarity
{
none,
- translation
+ translation,
+ invalid_next_cell
};
}
virtual void
fill_fe_values (const typename Triangulation<dim,spacedim>::cell_iterator &cell,
const Quadrature<dim> &quadrature,
- const enum CellSimilarity::Similarity cell_similarity,
+ enum CellSimilarity::Similarity &cell_similarity,
InternalDataBase &internal,
std::vector<Point<spacedim> > &quadrature_points,
std::vector<double> &JxW_values,
virtual void
fill_fe_values (const typename Triangulation<dim,spacedim>::cell_iterator &cell,
const Quadrature<dim> &quadrature,
- const enum CellSimilarity::Similarity cell_similarity,
+ enum CellSimilarity::Similarity &cell_similarity,
typename Mapping<dim, spacedim>::InternalDataBase &mapping_data,
std::vector<Point<spacedim> > &quadrature_points,
std::vector<double> &JxW_values,
virtual void
fill_fe_values (const typename Triangulation<dim,spacedim>::cell_iterator &cell,
const Quadrature<dim> &quadrature,
- enum CellSimilarity::Similarity cell_similarity,
+ enum CellSimilarity::Similarity &cell_similarity,
typename Mapping<dim,spacedim>::InternalDataBase &mapping_data,
typename std::vector<Point<spacedim> > &quadrature_points,
std::vector<double> &JxW_values,
virtual void
fill_fe_values (const typename Triangulation<dim,spacedim>::cell_iterator &cell,
const Quadrature<dim> &quadrature,
- const enum CellSimilarity::Similarity cell_similarity,
+ enum CellSimilarity::Similarity &cell_similarity,
typename Mapping<dim,spacedim>::InternalDataBase &mapping_data,
typename std::vector<Point<spacedim> > &quadrature_points,
std::vector<double> &JxW_values,
virtual void
fill_fe_values (const typename Triangulation<dim,spacedim>::cell_iterator &cell,
const Quadrature<dim> &quadrature,
- enum CellSimilarity::Similarity cell_similarity,
+ enum CellSimilarity::Similarity &cell_similarity,
typename Mapping<dim,spacedim>::InternalDataBase &mapping_data,
typename std::vector<Point<spacedim> > &quadrature_points,
std::vector<double> &JxW_values,
virtual void
fill_fe_values (const typename Triangulation<dim,spacedim>::cell_iterator &cell,
const Quadrature<dim> &quadrature,
- enum CellSimilarity::Similarity cell_similarity,
+ enum CellSimilarity::Similarity &cell_similarity,
typename Mapping<dim,spacedim>::InternalDataBase &mapping_data,
typename std::vector<Point<spacedim> > &quadrature_points,
std::vector<double> &JxW_values,
// case that there has not been any cell
// before
if (&*this->present_cell == 0)
+ {
+ cell_similarity = CellSimilarity::none;
+ return;
+ }
+
+ // in MappingQ, data can have been
+ // modified during the last call. Then,
+ // we can't use that data on the new
+ // cell.
+ if (cell_similarity == CellSimilarity::invalid_next_cell)
{
cell_similarity = CellSimilarity::none;
return;
for (unsigned int i=1; i<GeometryInfo<dim>::vertices_per_cell; ++i)
{
Point<spacedim> dist_new = cell->vertex(i) - present_cell->vertex(i) - dist;
- if (dist_new.norm_square() > 1e-28)
+ if (dist_new.norm_square() > 1e-30)
{
is_translation = false;
break;
// along axes. Strange vertex
// numbering makes this complicated
// again.
- switch (dim)
+ if (cell_similarity != CellSimilarity::translation)
{
- case 1:
- data.length[0] = cell->vertex(1)(0) - start(0);
- break;
- case 2:
- data.length[0] = cell->vertex(1)(0) - start(0);
- data.length[1] = cell->vertex(2)(1) - start(1);
- break;
- case 3:
- data.length[0] = cell->vertex(1)(0) - start(0);
- data.length[1] = cell->vertex(2)(1) - start(1);
- data.length[2] = cell->vertex(4)(2) - start(2);
- break;
- default:
- Assert(false, ExcNotImplemented());
+ switch (dim)
+ {
+ case 1:
+ data.length[0] = cell->vertex(1)(0) - start(0);
+ break;
+ case 2:
+ data.length[0] = cell->vertex(1)(0) - start(0);
+ data.length[1] = cell->vertex(2)(1) - start(1);
+ break;
+ case 3:
+ data.length[0] = cell->vertex(1)(0) - start(0);
+ data.length[1] = cell->vertex(2)(1) - start(1);
+ data.length[2] = cell->vertex(4)(2) - start(2);
+ break;
+ default:
+ Assert(false, ExcNotImplemented());
+ }
}
MappingCartesian<dim, spacedim>::
fill_fe_values (const typename Triangulation<dim,spacedim>::cell_iterator& cell,
const Quadrature<dim>& q,
- const enum CellSimilarity::Similarity cell_similarity,
+ enum CellSimilarity::Similarity& cell_similarity,
typename Mapping<dim,spacedim>::InternalDataBase& mapping_data,
std::vector<Point<spacedim> >& quadrature_points,
std::vector<double>& JxW_values,
{
jacobians[i]=Tensor<2,dim>();
for (unsigned int j=0; j<dim; ++j)
- jacobians[j][j]=data.length[j];
+ jacobians[i][j][j]=data.length[j];
}
// "compute" the derivative of the Jacobian
// at the quadrature points, which are all
MappingQ<dim,spacedim>::fill_fe_values (
const typename Triangulation<dim,spacedim>::cell_iterator &cell,
const Quadrature<dim> &q,
- enum CellSimilarity::Similarity cell_similarity,
+ enum CellSimilarity::Similarity &cell_similarity,
typename Mapping<dim,spacedim>::InternalDataBase &mapping_data,
std::vector<Point<spacedim> > &quadrature_points,
std::vector<double> &JxW_values,
// recomputed anyway since then the
// mapping changes the data. this needs
// to be known also for later operations,
- // so modify the variable here. TODO:
- // still need to check how this will work
- // when the previous cell disabled this
- // flag.
+ // so modify the variable here. this also
+ // affects the calculation of the next
+ // cell -- if we use Q1 data on the next
+ // cell, the data will still be invalid.
typename MappingQ1<dim,spacedim>::InternalData *p_data=0;
if (data.use_mapping_q1_on_current_cell)
p_data=&data.mapping_q1_data;
else
{
p_data=&data;
- cell_similarity = CellSimilarity::none;
+ cell_similarity = CellSimilarity::invalid_next_cell;
}
MappingQ1<dim,spacedim>::fill_fe_values(cell, q, cell_similarity, *p_data,
MappingQ1<dim,spacedim>::fill_fe_values (
const typename Triangulation<dim,spacedim>::cell_iterator &cell,
const Quadrature<dim> &q,
- const enum CellSimilarity::Similarity cell_similarity,
+ enum CellSimilarity::Similarity &cell_similarity,
typename Mapping<dim,spacedim>::InternalDataBase &mapping_data,
std::vector<Point<spacedim> > &quadrature_points,
std::vector<double> &JxW_values,
MappingQ1Eulerian<dim,EulerVectorType,spacedim>::fill_fe_values (
const typename Triangulation<dim,spacedim>::cell_iterator &cell,
const Quadrature<dim> &q,
- enum CellSimilarity::Similarity cell_similarity,
+ enum CellSimilarity::Similarity &cell_similarity,
typename Mapping<dim,spacedim>::InternalDataBase &mapping_data,
std::vector<Point<spacedim> > &quadrature_points,
std::vector<double> &JxW_values,
// disable any previously detected
// similarity and hand on to the
// respective function of the base class.
- cell_similarity = CellSimilarity::none;
+ cell_similarity = CellSimilarity::invalid_next_cell;
MappingQ1<dim,spacedim>::fill_fe_values (cell, q, cell_similarity, mapping_data,
quadrature_points, JxW_values, jacobians,
jacobian_grads, inverse_jacobians,
MappingQEulerian<dim,EulerVectorType,spacedim>::fill_fe_values (
const typename Triangulation<dim,spacedim>::cell_iterator &cell,
const Quadrature<dim> &q,
- enum CellSimilarity::Similarity cell_similarity,
+ enum CellSimilarity::Similarity &cell_similarity,
typename Mapping<dim,spacedim>::InternalDataBase &mapping_data,
std::vector<Point<spacedim> > &quadrature_points,
std::vector<double> &JxW_values,
// disable any previously detected
// similarity and hand on to the respective
// function of the base class.
- cell_similarity = CellSimilarity::none;
+ cell_similarity = CellSimilarity::invalid_next_cell;
MappingQ<dim,spacedim>::fill_fe_values (cell, q, cell_similarity, mapping_data,
quadrature_points, JxW_values, jacobians,
jacobian_grads, inverse_jacobians,