From a057e4e38c3625a120fa4ae42addb86eb00ee443 Mon Sep 17 00:00:00 2001 From: pauletti Date: Thu, 9 Dec 2010 17:06:19 +0000 Subject: [PATCH] FEValues with mapping Q1, now uses direction_flag to return the oriented normal for meshes of dim::check_cell_similarity : CellSimilarity::none); + if ( (dim::cell_iterator &> + (*this->present_cell)->direction_flag() + != cell->direction_flag() ) + cell_similarity = CellSimilarity::inverted_translation; + } // TODO: here, one could implement other // checks for similarity, e.g. for // children of a parallelogram. diff --git a/deal.II/source/fe/mapping_q1.cc b/deal.II/source/fe/mapping_q1.cc index a842c3ecc7..5f13f7f0ad 100644 --- a/deal.II/source/fe/mapping_q1.cc +++ b/deal.II/source/fe/mapping_q1.cc @@ -774,49 +774,60 @@ MappingQ1::fill_fe_values ( ExcDimensionMismatch(normal_vectors.size(), n_q_points)); if (cell_similarity != CellSimilarity::translation) - for (unsigned int point=0; pointdirection_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) -- 2.39.5