ExcDimensionMismatch(normal_vectors.size(), n_q_points));
if (cell_similarity != CellSimilarity::translation)
- for (unsigned int point=0; point<n_q_points; ++point)
- {
-
- if (dim==spacedim)
- JxW_values[point]
- = determinant(data.contravariant[point])*weights[point];
- else if ( (dim==1) && (spacedim==2) )
- {
- data.contravariant[point]=transpose(data.contravariant[point]);
+ for (unsigned int point=0; point<n_q_points; ++point) {
+
+ if (dim==spacedim)
+ JxW_values[point]
+ = determinant(data.contravariant[point])*weights[point];
+
+ else {
+ if (cell_similarity == CellSimilarity::inverted_translation) {
+ // we only need to flip the normal
+ if(update_flags & update_normal_vectors)
+ normal_vectors[point] *= -1.;
+ }
+ else {
+ if ( (dim==1) && (spacedim==2) ) {
+ data.contravariant[point]=transpose(data.contravariant[point]);
JxW_values[point]
= data.contravariant[point][0].norm()*weights[point];
- if(update_flags & update_normal_vectors)
- {
- normal_vectors[point][0]
- = -(data.contravariant[point][0][1]
- /
- data.contravariant[point][0].norm());
- normal_vectors[point][1]
- = (data.contravariant[point][0][0]
- /
- data.contravariant[point][0].norm());
- }
+ if(update_flags & update_normal_vectors) {
+ normal_vectors[point][0]
+ = -(data.contravariant[point][0][1]
+ /
+ data.contravariant[point][0].norm());
+ normal_vectors[point][1]
+ = (data.contravariant[point][0][0]
+ /
+ data.contravariant[point][0].norm());
+ if (!cell->direction_flag())
+ normal_vectors[point] *= -1.;
+ }
}
- else if ( (dim==2) && (spacedim==3) )
- {
- data.contravariant[point]=transpose(data.contravariant[point]);
- cross_product(data.contravariant[point][2],
- data.contravariant[point][0],
- data.contravariant[point][1]);
- JxW_values[point]
- = data.contravariant[point][2].norm()*weights[point];
- //the cell normal vector
- //(normal to the surface)
- //is stored in the 3d
- //subtensor of the contravariant tensor
- data.contravariant[point][2] /= data.contravariant[point][2].norm();
- if(update_flags & update_normal_vectors)
- normal_vectors[point]=data.contravariant[point][2];
+ else {
+ if ( (dim==2) && (spacedim==3) ) {
+ data.contravariant[point]=transpose(data.contravariant[point]);
+ cross_product(data.contravariant[point][2],
+ data.contravariant[point][0],
+ data.contravariant[point][1]);
+ JxW_values[point]
+ = data.contravariant[point][2].norm()*weights[point];
+ //the cell normal vector
+ //(normal to the surface)
+ //is stored in the 3d
+ //subtensor of the contravariant tensor
+ data.contravariant[point][2] /= data.contravariant[point][2].norm();
+ if(update_flags & update_normal_vectors){
+ normal_vectors[point]=data.contravariant[point][2];
+ if (!cell->direction_flag())
+ normal_vectors[point] *= -1.;
+ }
+ }
}
-
+ }
}
+ }
}
-
// copy values from InternalData to vector
// given by reference
if (update_flags & update_jacobians)