17 #include <deal.II/base/derivative_form.h> 18 #include <deal.II/base/quadrature.h> 19 #include <deal.II/base/qprojector.h> 20 #include <deal.II/base/quadrature_lib.h> 21 #include <deal.II/base/tensor_product_polynomials.h> 22 #include <deal.II/base/memory_consumption.h> 23 #include <deal.II/base/std_cxx11/array.h> 24 #include <deal.II/base/std_cxx11/unique_ptr.h> 25 #include <deal.II/lac/full_matrix.h> 26 #include <deal.II/grid/tria.h> 27 #include <deal.II/grid/tria_iterator.h> 28 #include <deal.II/grid/tria_boundary.h> 29 #include <deal.II/dofs/dof_accessor.h> 30 #include <deal.II/grid/manifold.h> 31 #include <deal.II/fe/fe_tools.h> 32 #include <deal.II/fe/fe.h> 33 #include <deal.II/fe/fe_values.h> 34 #include <deal.II/fe/mapping_manifold.h> 35 #include <deal.II/fe/mapping_q1.h> 42 DEAL_II_NAMESPACE_OPEN
44 template<
int dim,
int spacedim>
49 template<
int dim,
int spacedim>
68 template <
int dim,
int spacedim>
73 const unsigned int n_original_q_points)
77 this->update_each = update_flags;
88 compute_manifold_quadrature_weights(q);
91 covariant.resize(n_original_q_points);
94 contravariant.resize(n_original_q_points);
97 volume_elements.resize(n_original_q_points);
101 template <
int dim,
int spacedim>
106 const unsigned int n_original_q_points)
108 initialize (update_flags, q, n_original_q_points);
117 for (
unsigned int i=0; i<unit_tangentials.size(); ++i)
118 unit_tangentials[i].resize (n_original_q_points);
125 static const int tangential_orientation[4]= {-1,1,1,-1};
126 for (
unsigned int i=0; i<GeometryInfo<dim>::faces_per_cell; ++i)
129 tang[1-i/2]=tangential_orientation[i];
130 std::fill (unit_tangentials[i].begin(),
131 unit_tangentials[i].end(),
138 for (
unsigned int i=0; i<GeometryInfo<dim>::faces_per_cell; ++i)
142 const unsigned int nd=
154 tang2[(nd+2)%dim]=1.;
159 std::fill (unit_tangentials[i].begin(),
160 unit_tangentials[i].end(), tang1);
176 template<
int dim,
int spacedim>
182 template<
int dim,
int spacedim>
188 template<
int dim,
int spacedim>
197 template<
int dim,
int spacedim>
209 template<
int dim,
int spacedim>
215 std::vector<Point<spacedim> > vertices;
216 std::vector<double> weights;
217 for (
unsigned int v=0; v<GeometryInfo<dim>::vertices_per_cell; ++v)
219 vertices.push_back(cell->vertex(v));
222 return cell->get_manifold().get_new_point(vertices, weights);
240 template<
int dim,
int spacedim>
251 for (
unsigned int i=0; i<5; ++i)
307 template<
int dim,
int spacedim>
320 template<
int dim,
int spacedim>
335 template<
int dim,
int spacedim>
359 template<
int spacedim>
360 const ::Manifold<1, spacedim> &
362 const typename ::Triangulation<1,spacedim>::cell_iterator &cell,
363 const unsigned int &)
365 return cell->get_manifold();
374 template<
int dim,
int spacedim>
375 const ::Manifold<dim,spacedim> &
377 const typename ::Triangulation<dim,spacedim>::cell_iterator &cell,
378 const unsigned int face_no)
380 return cell->face(face_no)->get_manifold();
391 template <
int dim,
int spacedim>
394 const typename ::MappingManifold<dim,spacedim>::InternalData &data,
403 for (
unsigned int point=0;
point<quadrature_points.size(); ++
point)
405 quadrature_points[
point] = data.manifold->
406 get_new_point(data.vertices,
407 data.cell_manifold_quadrature_weights[point+data_set]);
419 template <
int dim,
int spacedim>
421 maybe_update_Jacobians (
const typename ::QProjector<dim>::DataSetDescriptor data_set,
422 const typename ::MappingManifold<dim,spacedim>::InternalData &data)
428 const unsigned int n_q_points = data.contravariant.size();
430 std::fill(data.contravariant.begin(), data.contravariant.end(),
434 data.vertices.size());
435 for (
unsigned int point=0;
point<n_q_points; ++
point)
439 const Point<dim> &p = data.quad.point(point+data_set);
443 get_new_point(data.vertices,
444 data.cell_manifold_quadrature_weights[point+data_set]);
453 for (
unsigned int i=0; i<dim; ++i)
456 const double pi = p[i];
457 Assert(pi >=0 && pi <= 1.0,
459 "inside the unit reference element."));
463 const double L = pi > .5 ? -pi: 1-pi;
468 for (
unsigned int j=0; j<GeometryInfo<dim>::vertices_per_cell; ++j)
472 data.manifold->get_new_point(data.vertices,
473 data.vertex_weights);
477 for (
unsigned int d=0;
d<spacedim; ++
d)
478 data.contravariant[point][d][i] = T[d]/L;
484 const unsigned int n_q_points = data.contravariant.size();
485 for (
unsigned int point=0;
point<n_q_points; ++
point)
487 data.covariant[
point] = (data.contravariant[
point]).covariant_form();
493 const unsigned int n_q_points = data.contravariant.size();
494 for (
unsigned int point=0;
point<n_q_points; ++
point)
495 data.volume_elements[point] = data.contravariant[point].
determinant();
504 template<
int dim,
int spacedim>
514 Assert (dynamic_cast<const InternalData *>(&internal_data) != 0,
518 const unsigned int n_q_points=quadrature.
size();
521 data.
manifold = &(cell->get_manifold());
531 const std::vector<double> &weights=quadrature.
get_weights();
546 for (
unsigned int point=0; point<n_q_points; ++point)
551 const double det = data.contravariant[point].determinant();
558 Assert (det > 1e-12*Utilities::fixed_power<dim>(cell->diameter()/
559 std::sqrt(
double(dim))),
562 output_data.
JxW_values[point] = weights[point] * det;
570 for (
unsigned int i=0; i<spacedim; ++i)
571 for (
unsigned int j=0; j<dim; ++j)
572 DX_t[j][i] = data.contravariant[point][i][j];
575 for (
unsigned int i=0; i<dim; ++i)
576 for (
unsigned int j=0; j<dim; ++j)
577 G[i][j] = DX_t[i] * DX_t[j];
580 = std::sqrt(determinant(G)) * weights[point];
593 ExcMessage(
"There is no (unique) cell normal for " 595 "-dimensional cells in " 597 "-dimensional space. This only works if the " 598 "space dimension is one greater than the " 599 "dimensionality of the mesh cells."));
603 cross_product_2d(-DX_t[0]);
606 cross_product_3d(DX_t[0], DX_t[1]);
610 if (cell->direction_flag() ==
false)
627 for (
unsigned int point=0; point<n_q_points; ++point)
628 output_data.
jacobians[point] = data.contravariant[point];
636 for (
unsigned int point=0; point<n_q_points; ++point)
640 return cell_similarity;
661 template <
int dim,
int spacedim>
663 maybe_compute_face_data (const ::MappingManifold<dim,spacedim> &mapping,
664 const typename ::Triangulation<dim,spacedim>::cell_iterator &cell,
665 const unsigned int face_no,
666 const unsigned int subface_no,
667 const unsigned int n_q_points,
668 const std::vector<double> &weights,
669 const typename ::MappingManifold<dim,spacedim>::InternalData &data,
685 for (
unsigned int d=0; d!=dim-1; ++d)
688 data.unit_tangentials.size(),
690 Assert (data.aux[d].size() <=
697 make_array_view(data.aux[d]));
704 for (
unsigned int i=0; i<n_q_points; ++i)
717 cross_product_2d(data.aux[0][i]);
721 cross_product_3d(data.aux[0][i], data.aux[1][i]);
737 for (
unsigned int point=0;
point<n_q_points; ++
point)
757 cross_product_3d(DX_t[0], DX_t[1]);
758 cell_normal /= cell_normal.
norm();
763 cross_product_3d(data.aux[0][point], cell_normal);
796 for (
unsigned int point=0;
point<n_q_points; ++
point)
797 output_data.
jacobians[point] = data.contravariant[point];
800 for (
unsigned int point=0;
point<n_q_points; ++
point)
812 template<
int dim,
int spacedim>
815 const typename ::Triangulation<dim,spacedim>::cell_iterator &cell,
816 const unsigned int face_no,
817 const unsigned int subface_no,
820 const typename ::MappingManifold<dim,spacedim>::InternalData &data,
823 data.store_vertices(cell);
825 data.manifold = &get_face_manifold(mapping, cell, face_no);
827 maybe_compute_q_points<dim,spacedim> (data_set,
830 maybe_update_Jacobians<dim,spacedim> (data_set,
834 cell, face_no, subface_no, quadrature.
size(),
843 template<
int dim,
int spacedim>
847 const unsigned int face_no,
853 Assert ((dynamic_cast<const InternalData *>(&internal_data) != 0),
861 cell->face_orientation(face_no),
862 cell->face_flip(face_no),
863 cell->face_rotation(face_no),
872 template<
int dim,
int spacedim>
876 const unsigned int face_no,
877 const unsigned int subface_no,
883 Assert ((dynamic_cast<const InternalData *>(&internal_data) != 0),
889 cell, face_no, subface_no,
891 cell->face_orientation(face_no),
892 cell->face_flip(face_no),
893 cell->face_rotation(face_no),
895 cell->subface_case(face_no)),
905 template <
int dim,
int spacedim,
int rank>
918 switch (mapping_type)
925 for (
unsigned int i=0; i<output.size(); ++i)
926 output[i] = apply_transformation(data.
contravariant[i], input[i]);
941 for (
unsigned int i=0; i<output.size(); ++i)
943 output[i] = apply_transformation(data.
contravariant[i], input[i]);
956 for (
unsigned int i=0; i<output.size(); ++i)
957 output[i] = apply_transformation(data.
covariant[i], input[i]);
968 template <
int dim,
int spacedim,
int rank>
981 switch (mapping_type)
991 for (
unsigned int i=0; i<output.size(); ++i)
994 apply_transformation(data.
contravariant[i], transpose(input[i]) );
1007 for (
unsigned int i=0; i<output.size(); ++i)
1010 apply_transformation(data.
covariant[i], transpose(input[i]) );
1027 for (
unsigned int i=0; i<output.size(); ++i)
1030 apply_transformation(data.
covariant[i], input[i] );
1034 output[i] = transpose(T);
1049 template <
int dim,
int spacedim>
1062 switch (mapping_type)
1071 for (
unsigned int q=0; q<output.size(); ++q)
1072 for (
unsigned int i=0; i<spacedim; ++i)
1074 double tmp1[dim][dim];
1075 for (
unsigned int J=0; J<dim; ++J)
1076 for (
unsigned int K=0; K<dim; ++K)
1078 tmp1[J][K] = data.
contravariant[q][i][0] * input[q][0][J][K];
1079 for (
unsigned int I=1; I<dim; ++I)
1080 tmp1[J][K] += data.
contravariant[q][i][I] * input[q][I][J][K];
1082 for (
unsigned int j=0; j<spacedim; ++j)
1085 for (
unsigned int K=0; K<dim; ++K)
1087 tmp2[K] = data.
covariant[q][j][0] * tmp1[0][K];
1088 for (
unsigned int J=1; J<dim; ++J)
1089 tmp2[K] += data.
covariant[q][j][J] * tmp1[J][K];
1091 for (
unsigned int k=0; k<spacedim; ++k)
1093 output[q][i][j][k] = data.
covariant[q][k][0] * tmp2[0];
1094 for (
unsigned int K=1; K<dim; ++K)
1095 output[q][i][j][k] += data.
covariant[q][k][K] * tmp2[K];
1107 for (
unsigned int q=0; q<output.size(); ++q)
1108 for (
unsigned int i=0; i<spacedim; ++i)
1110 double tmp1[dim][dim];
1111 for (
unsigned int J=0; J<dim; ++J)
1112 for (
unsigned int K=0; K<dim; ++K)
1114 tmp1[J][K] = data.
covariant[q][i][0] * input[q][0][J][K];
1115 for (
unsigned int I=1; I<dim; ++I)
1116 tmp1[J][K] += data.
covariant[q][i][I] * input[q][I][J][K];
1118 for (
unsigned int j=0; j<spacedim; ++j)
1121 for (
unsigned int K=0; K<dim; ++K)
1123 tmp2[K] = data.
covariant[q][j][0] * tmp1[0][K];
1124 for (
unsigned int J=1; J<dim; ++J)
1125 tmp2[K] += data.
covariant[q][j][J] * tmp1[J][K];
1127 for (
unsigned int k=0; k<spacedim; ++k)
1129 output[q][i][j][k] = data.
covariant[q][k][0] * tmp2[0];
1130 for (
unsigned int K=1; K<dim; ++K)
1131 output[q][i][j][k] += data.
covariant[q][k][K] * tmp2[K];
1148 for (
unsigned int q=0; q<output.size(); ++q)
1149 for (
unsigned int i=0; i<spacedim; ++i)
1152 for (
unsigned int I=0; I<dim; ++I)
1154 double tmp1[dim][dim];
1155 for (
unsigned int J=0; J<dim; ++J)
1156 for (
unsigned int K=0; K<dim; ++K)
1158 tmp1[J][K] = factor[0] * input[q][0][J][K];
1159 for (
unsigned int I=1; I<dim; ++I)
1160 tmp1[J][K] += factor[I] * input[q][I][J][K];
1162 for (
unsigned int j=0; j<spacedim; ++j)
1165 for (
unsigned int K=0; K<dim; ++K)
1167 tmp2[K] = data.
covariant[q][j][0] * tmp1[0][K];
1168 for (
unsigned int J=1; J<dim; ++J)
1169 tmp2[K] += data.
covariant[q][j][J] * tmp1[J][K];
1171 for (
unsigned int k=0; k<spacedim; ++k)
1173 output[q][i][j][k] = data.
covariant[q][k][0] * tmp2[0];
1174 for (
unsigned int K=1; K<dim; ++K)
1175 output[q][i][j][k] += data.
covariant[q][k][K] * tmp2[K];
1191 template<
int dim,
int spacedim,
int rank>
1204 switch (mapping_type)
1211 for (
unsigned int i=0; i<output.size(); ++i)
1212 output[i] = apply_transformation(data.
covariant[i], input[i]);
1224 template<
int dim,
int spacedim>
1232 transform_fields(input, mapping_type, mapping_data, output);
1237 template<
int dim,
int spacedim>
1245 transform_differential_forms(input, mapping_type, mapping_data, output);
1250 template<
int dim,
int spacedim>
1258 switch (mapping_type)
1261 transform_fields(input, mapping_type, mapping_data, output);
1267 transform_gradients(input, mapping_type, mapping_data, output);
1276 template<
int dim,
int spacedim>
1286 Assert (dynamic_cast<const InternalData *>(&mapping_data) != 0,
1290 switch (mapping_type)
1297 for (
unsigned int q=0; q<output.size(); ++q)
1298 for (
unsigned int i=0; i<spacedim; ++i)
1299 for (
unsigned int j=0; j<spacedim; ++j)
1302 for (
unsigned int K=0; K<dim; ++K)
1304 tmp[K] = data.
covariant[q][j][0] * input[q][i][0][K];
1305 for (
unsigned int J=1; J<dim; ++J)
1306 tmp[K] += data.
covariant[q][j][J] * input[q][i][J][K];
1308 for (
unsigned int k=0; k<spacedim; ++k)
1310 output[q][i][j][k] = data.
covariant[q][k][0] * tmp[0];
1311 for (
unsigned int K=1; K<dim; ++K)
1312 output[q][i][j][k] += data.
covariant[q][k][K] * tmp[K];
1325 template<
int dim,
int spacedim>
1333 switch (mapping_type)
1338 transform_hessians(input, mapping_type, mapping_data, output);
1346 #include "mapping_manifold.inst" 1349 DEAL_II_NAMESPACE_CLOSE
Transformed quadrature weights.
virtual std::size_t memory_consumption() const
static const unsigned int invalid_unsigned_int
virtual Mapping< dim, spacedim > * clone() const
#define AssertDimension(dim1, dim2)
virtual InternalData * get_subface_data(const UpdateFlags flags, const Quadrature< dim-1 > &quadrature) const
Contravariant transformation.
virtual Point< spacedim > transform_unit_to_real_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< dim > &p) const
const std::vector< double > & get_weights() const
virtual CellSimilarity::Similarity fill_fe_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const CellSimilarity::Similarity cell_similarity, const Quadrature< dim > &quadrature, const typename Mapping< dim, spacedim >::InternalDataBase &internal_data, ::internal::FEValues::MappingRelatedData< dim, spacedim > &output_data) const
Outer normal vector, not normalized.
virtual UpdateFlags requires_update_flags(const UpdateFlags update_flags) const
Determinant of the Jacobian.
Transformed quadrature points.
void store_vertices(const typename Triangulation< dim, spacedim >::cell_iterator &cell) const
void maybe_compute_face_data(const ::Mapping< dim, spacedim > &mapping, const typename ::Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const unsigned int subface_no, const std::vector< double > &weights, const typename ::MappingFEField< dim, spacedim, VectorType, DoFHandlerType >::InternalData &data, internal::FEValues::MappingRelatedData< dim, spacedim > &output_data)
numbers::NumberTraits< Number >::real_type norm() const
static DataSetDescriptor cell()
virtual void fill_fe_subface_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const unsigned int subface_no, const Quadrature< dim-1 > &quadrature, const typename Mapping< dim, spacedim >::InternalDataBase &internal_data, ::internal::FEValues::MappingRelatedData< dim, spacedim > &output_data) const
static ::ExceptionBase & ExcMessage(std::string arg1)
virtual InternalData * get_face_data(const UpdateFlags flags, const Quadrature< dim-1 > &quadrature) const
virtual void transform(const ArrayView< const Tensor< 1, dim > > &input, const MappingType type, const typename Mapping< dim, spacedim >::InternalDataBase &internal, const ArrayView< Tensor< 1, spacedim > > &output) const
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static Point< dim, Number > unit_vector(const unsigned int i)
Abstract base class for mapping classes.
void initialize(const UpdateFlags update_flags, const Quadrature< dim > &quadrature, const unsigned int n_original_q_points)
void do_fill_fe_face_values(const ::Mapping< dim, spacedim > &mapping, const typename ::Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const unsigned int subface_no, const typename ::QProjector< dim >::DataSetDescriptor data_set, const Quadrature< dim-1 > &quadrature, const typename ::MappingFEField< dim, spacedim, VectorType, DoFHandlerType >::InternalData &data, const FiniteElement< dim, spacedim > &fe, const ComponentMask &fe_mask, const std::vector< unsigned int > &fe_to_real, internal::FEValues::MappingRelatedData< dim, spacedim > &output_data)
std::vector< DerivativeForm< 1, dim, spacedim > > covariant
Gradient of volume element.
std::string int_to_string(const unsigned int value, const unsigned int digits=numbers::invalid_unsigned_int)
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
std::vector< double > volume_elements
unsigned int size() const
std::vector< DerivativeForm< 1, dim, spacedim > > contravariant
virtual InternalData * get_data(const UpdateFlags, const Quadrature< dim > &quadrature) const
std_cxx11::enable_if< std_cxx11::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
SmartPointer< const Manifold< dim, spacedim > > manifold
Number determinant(const Tensor< 2, dim, Number > &t)
virtual void fill_fe_face_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const Quadrature< dim-1 > &quadrature, const typename Mapping< dim, spacedim >::InternalDataBase &internal_data, ::internal::FEValues::MappingRelatedData< dim, spacedim > &output_data) const
static ::ExceptionBase & ExcNotImplemented()
void initialize_face(const UpdateFlags update_flags, const Quadrature< dim > &quadrature, const unsigned int n_original_q_points)
Point< 3 > point(const gp_Pnt &p)
static double subface_ratio(const internal::SubfaceCase< dim > &subface_case, const unsigned int subface_no)
Covariant transformation.
virtual Point< dim > transform_real_to_unit_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< spacedim > &p) const
static ::ExceptionBase & ExcInternalError()