const MappingType type) const = 0;
/**
- * Transform a field of covariant
- * vectors. The covariant
- * transformation multiplies a
- * vector from the right with the
- * inverse of the Jacobian matrix
- * of the transformation from
- * unit to real space
- * cell. Alternatively, this is
- * equivalent to a multiplication
- * from the left with the
- * transpose of the inverse
- * matrix.
- *
- * The list of arguments is as follows:
- * we transform as many elements in the
- * @p input field, starting from @p offset,
- * as there are elements in @p
- * output. The @p input array may hold
- * more elements than are needed (some
- * finite element classes use this for a
- * denser storage of data), but it needs
- * to have at least
- * <tt>output.size()</tt> elements
- * starting with element @p offset.
+ * @deprecated Use transform() instead.
*/
virtual
void
const InternalDataBase &internal) const = 0;
/**
- * Transform a set of matrices
- * covariantly, i.e. multiply
- * each function in the input
- * range by the Jacobian matrices
- * at the different quadrature
- * points from the left.
- *
- * The same applies as to the
- * function above regarding input
- * and output arguments.
+ * @deprecated Use transform() instead.
*/
virtual
void
VectorSlice<std::vector<Tensor<2,spacedim> > > output,
const InternalDataBase &internal) const = 0;
-//TODO: The argument list here seems wrong
-
/**
- * Transform a field of
- * contravariant vectors. The
- * contravariant transformation
- * multiplies a vector from the
- * left with the Jacobian matrix
- * of the transformation from
- * unit to real space cell.
- *
- * The list of arguments is as follows:
- * we transform as many elements in the
- * @p input field, starting from @p offset,
- * as there are elements in @p
- * output. The @p input array may hold
- * more elements than are needed (some
- * finite element classes use this for a
- * denser storage of data), but it needs
- * to have at least
- * <tt>output.size()</tt> elements
- * starting with element @p offset.
+ * @deprecated Use transform() instead.
*/
virtual
void
- transform_contravariant (const VectorSlice<const std::vector<Tensor<1,spacedim> > > input,
+ transform_contravariant (const VectorSlice<const std::vector<Tensor<1,dim> > > input,
const unsigned int offset,
VectorSlice<std::vector<Tensor<1,spacedim> > > output,
const typename Mapping<dim,spacedim>::InternalDataBase &internal) const = 0;
/**
- * Transform a set of matrices
- * contravariantly, i.e. multiply
- * each function in the input
- * range by the inverse Jacobian
- * matrices at the different
- * quadrature points from the
- * right. Note that here it is no
- * more equivalent to
- * multiplication with the
- * transpose of the inverse
- * matrices from the left, unless
- * the matrices to be multiplied
- * with are symmetric.
- *
- * The same applies as to the
- * function above regarding input
- * and output arguments.
+ * @deprecated Use transform() instead.
*/
virtual void
- transform_contravariant (const VectorSlice<const std::vector<Tensor<2,spacedim> > > intput,
+ transform_contravariant (const VectorSlice<const std::vector<Tensor<2,dim> > > intput,
const unsigned int offset,
const VectorSlice<std::vector<Tensor<2,spacedim> > > output,
const typename Mapping<dim,spacedim>::InternalDataBase &internal) const = 0;
virtual void
- transform_covariant (const VectorSlice<const std::vector<Tensor<1,spacedim> > > input,
+ transform_covariant (const VectorSlice<const std::vector<Tensor<1,dim> > > input,
const unsigned int offset,
VectorSlice<std::vector<Tensor<1,spacedim> > > output,
const typename Mapping<dim, spacedim>::InternalDataBase &internal) const;
virtual void
- transform_covariant (const VectorSlice<const std::vector<Tensor<2,spacedim> > > input,
+ transform_covariant (const VectorSlice<const std::vector<Tensor<2,dim> > > input,
const unsigned int offset,
VectorSlice<std::vector<Tensor<2,spacedim> > > output,
const typename Mapping<dim, spacedim>::InternalDataBase &internal) const;
virtual void
- transform_contravariant (const VectorSlice<const std::vector<Tensor<1,spacedim> > > input,
+ transform_contravariant (const VectorSlice<const std::vector<Tensor<1,dim> > > input,
const unsigned int offset,
VectorSlice<std::vector<Tensor<1,spacedim> > > output,
const typename Mapping<dim, spacedim>::InternalDataBase &internal) const;
virtual void
- transform_contravariant (const VectorSlice<const std::vector<Tensor<2,spacedim> > > input,
+ transform_contravariant (const VectorSlice<const std::vector<Tensor<2,dim> > > input,
const unsigned int offset,
VectorSlice<std::vector<Tensor<2,spacedim> > > output,
const typename Mapping<dim, spacedim>::InternalDataBase &internal) const;
* interface in Mapping.
*/
virtual void
- transform_contravariant (const VectorSlice<const std::vector<Tensor<1,spacedim> > > input,
+ transform_contravariant (const VectorSlice<const std::vector<Tensor<1,dim> > > input,
const unsigned int offset,
VectorSlice<std::vector<Tensor<1,spacedim> > > output,
const typename Mapping<dim,spacedim>::InternalDataBase &internal) const;
* interface in Mapping.
*/
virtual void
- transform_contravariant (const VectorSlice<const std::vector<Tensor<2,spacedim> > > input,
+ transform_contravariant (const VectorSlice<const std::vector<Tensor<2,dim> > > input,
const unsigned int offset,
VectorSlice<std::vector<Tensor<2,spacedim> > > output,
const typename Mapping<dim,spacedim>::InternalDataBase &internal) const;
const typename Mapping<dim,spacedim>::InternalDataBase &internal) const;
virtual void
- transform_contravariant (const VectorSlice<const std::vector<Tensor<1,spacedim> > > input,
+ transform_contravariant (const VectorSlice<const std::vector<Tensor<1,dim> > > input,
const unsigned int offset,
VectorSlice<std::vector<Tensor<1,spacedim> > > output,
const typename Mapping<dim,spacedim>::InternalDataBase &internal) const;
virtual void
- transform_contravariant (const VectorSlice<const std::vector<Tensor<2,spacedim> > > input,
+ transform_contravariant (const VectorSlice<const std::vector<Tensor<2,dim> > > input,
const unsigned int offset,
VectorSlice<std::vector<Tensor<2,spacedim> > > output,
const typename Mapping<dim,spacedim>::InternalDataBase &internal) const;
MappingCartesian<dim,spacedim>::transform (
const VectorSlice<const std::vector<Tensor<1,dim> > > input,
VectorSlice<std::vector<Tensor<1,spacedim> > > output,
- const typename Mapping<dim,spacedim>::InternalDataBase &internal,
+ const typename Mapping<dim,spacedim>::InternalDataBase &mapping_data,
const MappingType mapping_type) const
{
+ AssertDimension (input.size(), output.size());
+ Assert (dynamic_cast<const InternalData *>(&mapping_data) != 0,
+ ExcInternalError());
+ const InternalData &data = dynamic_cast<const InternalData&> (mapping_data);
+
switch (mapping_type)
{
case mapping_covariant:
- transform_covariant(input, 0, output, internal);
- return;
-// case mapping_contravariant:
-// transform_contravariant(input, 0, output, internal);
-// return;
+ if (true)
+ {
+ Assert (data.update_flags & update_covariant_transformation,
+ typename FEValuesBase<dim>::ExcAccessToUninitializedField());
+
+ for (unsigned int i=0; i<output.size(); ++i)
+ for (unsigned int d=0;d<dim;++d)
+ output[i][d] = input[i][d]/data.length[d];
+ return;
+ }
+ case mapping_contravariant:
+ if (true)
+ {
+ Assert (data.update_flags & update_contravariant_transformation,
+ typename FEValuesBase<dim>::ExcAccessToUninitializedField());
+
+ for (unsigned int i=0; i<output.size(); ++i)
+ for (unsigned int d=0;d<dim;++d)
+ output[i][d] = input[i][d]*data.length[d];
+ return;
+ }
default:
Assert(false, ExcNotImplemented());
}
case mapping_covariant:
transform_covariant(input, 0, output, internal);
return;
-// case mapping_contravariant:
-// transform_contravariant(input, 0, output, internal);
-// return;
+ case mapping_contravariant:
+ transform_contravariant(input, 0, output, internal);
+ return;
default:
Assert(false, ExcNotImplemented());
}
template<int dim, int spacedim>
void
MappingCartesian<dim, spacedim>::transform_covariant (
- const VectorSlice<const std::vector<Tensor<1,spacedim> > > input,
+ const VectorSlice<const std::vector<Tensor<1,dim> > > input,
const unsigned int offset,
VectorSlice<std::vector<Tensor<1,spacedim> > > output,
const typename Mapping<dim, spacedim>::InternalDataBase &mapping_data) const
Assert (data.update_flags & update_covariant_transformation,
typename FEValuesBase<dim>::ExcAccessToUninitializedField());
-
- Assert (output.size() + offset <= input.size(), ExcInternalError());
// simply scale by inverse Jacobian
// (which is diagonal here)
template<int dim, int spacedim>
void
MappingCartesian<dim, spacedim>::transform_covariant (
- const VectorSlice<const std::vector<Tensor<2,spacedim> > > input,
+ const VectorSlice<const std::vector<Tensor<2,dim> > > input,
const unsigned int offset,
VectorSlice<std::vector<Tensor<2,spacedim> > > output,
const typename Mapping<dim, spacedim>::InternalDataBase &mapping_data) const
template<int dim, int spacedim>
void
MappingCartesian<dim, spacedim>::transform_contravariant (
- const VectorSlice<const std::vector<Tensor<1,spacedim> > > input,
+ const VectorSlice<const std::vector<Tensor<1,dim> > > input,
const unsigned int offset,
VectorSlice<std::vector<Tensor<1,spacedim> > > output,
const typename Mapping<dim, spacedim>::InternalDataBase &mapping_data) const
template<int dim, int spacedim>
void
MappingCartesian<dim, spacedim>::transform_contravariant (
- const VectorSlice<const std::vector<Tensor<2,spacedim> > > input,
+ const VectorSlice<const std::vector<Tensor<2,dim> > > input,
const unsigned int offset,
VectorSlice<std::vector<Tensor<2,spacedim> > > output,
const typename Mapping<dim, spacedim>::InternalDataBase &mapping_data) const
template<int dim, int spacedim>
void
MappingQ<dim,spacedim>::fill_fe_values (
- const typename Triangulation<dim,spacedim>::cell_iterator &cell,
- const Quadrature<dim> &q,
- typename Mapping<dim,spacedim>::InternalDataBase &mapping_data,
- std::vector<Point<spacedim> > &quadrature_points,
- std::vector<double> &JxW_values,
- std::vector<Tensor<2,spacedim> > &jacobians,
- std::vector<Tensor<3,spacedim> > &jacobian_grads,
- std::vector<Tensor<2,spacedim> > &inverse_jacobians,
- std::vector<Point<spacedim> > &cell_normal_vectors) const
+ const typename Triangulation<dim,spacedim>::cell_iterator &cell,
+ const Quadrature<dim> &q,
+ typename Mapping<dim,spacedim>::InternalDataBase &mapping_data,
+ std::vector<Point<spacedim> > &quadrature_points,
+ std::vector<double> &JxW_values,
+ std::vector<Tensor<2,spacedim> > &jacobians,
+ std::vector<Tensor<3,spacedim> > &jacobian_grads,
+ std::vector<Tensor<2,spacedim> > &inverse_jacobians,
+ std::vector<Point<spacedim> > &cell_normal_vectors) const
{
// convert data object to internal
// data for this class. fails with
template<int dim, int spacedim>
void
-MappingQ<dim,spacedim>::fill_fe_face_values (const typename Triangulation<dim,spacedim>::cell_iterator &cell,
- const unsigned int face_no,
- const Quadrature<dim-1> &q,
- typename Mapping<dim,spacedim>::InternalDataBase &mapping_data,
- std::vector<Point<dim> > &quadrature_points,
- std::vector<double> &JxW_values,
- std::vector<Tensor<1,dim> > &exterior_forms,
- std::vector<Point<dim> > &normal_vectors,
- std::vector<double> &cell_JxW_values) const
+MappingQ<dim,spacedim>::fill_fe_face_values (
+ const typename Triangulation<dim,spacedim>::cell_iterator &cell,
+ const unsigned int face_no,
+ const Quadrature<dim-1> &q,
+ typename Mapping<dim,spacedim>::InternalDataBase &mapping_data,
+ std::vector<Point<dim> > &quadrature_points,
+ std::vector<double> &JxW_values,
+ std::vector<Tensor<1,dim> > &exterior_forms,
+ std::vector<Point<dim> > &normal_vectors,
+ std::vector<double> &cell_JxW_values) const
{
// convert data object to internal
// data for this class. fails with
case mapping_covariant:
transform_covariant(input, 0, output, internal);
return;
-// case mapping_contravariant:
-// transform_contravariant(input, 0, output, internal);
-// return;
+ case mapping_contravariant:
+ transform_contravariant(input, 0, output, internal);
+ return;
default:
Assert(false, ExcNotImplemented());
}
case mapping_covariant:
transform_covariant(input, 0, output, internal);
return;
-// case mapping_contravariant:
-// transform_contravariant(input, 0, output, internal);
-// return;
+ case mapping_contravariant:
+ transform_contravariant(input, 0, output, internal);
+ return;
default:
Assert(false, ExcNotImplemented());
}
else
tensor = data->covariant.begin();
}
-
+
+ Tensor<1, spacedim> auxiliary;
+
for (unsigned int i=0; i<output.size(); ++i)
- contract (output[i], input[i+offset], *(tensor++));
+ {
+ for (unsigned int d=0;d<dim;++d)
+ auxiliary[d] = input[i][d];
+ contract (output[i], auxiliary, *(tensor++));
+ }
}
template<int dim, int spacedim>
void
MappingQ<dim,spacedim>::transform_contravariant (
- const VectorSlice<const std::vector<Tensor<1,spacedim> > > input,
+ const VectorSlice<const std::vector<Tensor<1,dim> > > input,
const unsigned int offset,
VectorSlice<std::vector<Tensor<1,spacedim> > > output,
const typename Mapping<dim,spacedim>::InternalDataBase &mapping_data) const
tensor = data->contravariant.begin();
}
+ Tensor<1, spacedim> auxiliary;
+
for (unsigned int i=0; i<output.size(); ++i)
- contract (output[i], *(tensor++), input[i+offset]);
+ {
+ for (unsigned int d=0;d<dim;++d)
+ auxiliary[d] = input[i][d];
+ contract (output[i], *(tensor++), auxiliary);
+ }
}
template<int dim, int spacedim>
void
MappingQ<dim,spacedim>::transform_contravariant (
- const VectorSlice<const std::vector<Tensor<2,spacedim> > > input,
+ const VectorSlice<const std::vector<Tensor<2,dim> > > input,
const unsigned int offset,
VectorSlice<std::vector<Tensor<2,spacedim> > > output,
const typename Mapping<dim,spacedim>::InternalDataBase &mapping_data) const
template<int dim, int spacedim>
void
MappingQ1<dim,spacedim>::transform (
- const VectorSlice<const std::vector<Tensor<1,dim> > > input,
- VectorSlice<std::vector<Tensor<1,spacedim> > > output,
- const typename Mapping<dim,spacedim>::InternalDataBase &internal,
+ const VectorSlice<const std::vector<Tensor<1, dim> > > input,
+ VectorSlice<std::vector<Tensor<1, spacedim> > > output,
+ const typename Mapping<dim,spacedim>::InternalDataBase &mapping_data,
const MappingType mapping_type) const
{
+ AssertDimension (input.size(), output.size());
+ Assert (dynamic_cast<const InternalData *>(&mapping_data) != 0,
+ ExcInternalError());
+ const InternalData &data = static_cast<const InternalData&>(mapping_data);
+
+ Tensor<1, spacedim> auxiliary;
+
switch (mapping_type)
{
case mapping_covariant:
- transform_covariant(input, 0, output, internal);
- return;
-// case mapping_contravariant:
-// transform_contravariant(input, 0, output, internal);
-// return;
+ if (true)
+ {
+ Assert (data.update_flags & update_covariant_transformation,
+ typename FEValuesBase<dim>::ExcAccessToUninitializedField());
+
+ for (unsigned int i=0; i<output.size(); ++i)
+ {
+ for (unsigned int d=0;d<dim;++d)
+ auxiliary[d] = input[i][d];
+ contract (output[i], auxiliary, data.covariant[i]);
+ }
+ return;
+ }
+ case mapping_contravariant:
+ if (true)
+ {
+ Assert (data.update_flags & update_contravariant_transformation,
+ typename FEValuesBase<dim>::ExcAccessToUninitializedField());
+
+ for (unsigned int i=0; i<output.size(); ++i)
+ {
+ for (unsigned int d=0;d<dim;++d)
+ auxiliary[d] = input[i][d];
+ contract (output[i], data.contravariant[i], auxiliary);
+ }
+ return;
+ }
default:
Assert(false, ExcNotImplemented());
}
}
+
template<int dim, int spacedim>
void
MappingQ1<dim,spacedim>::transform (
- const VectorSlice<const std::vector<Tensor<2,dim> > > input,
- VectorSlice<std::vector<Tensor<2,spacedim> > > output,
+ const VectorSlice<const std::vector<Tensor<2, dim> > > input,
+ VectorSlice<std::vector<Tensor<2, spacedim> > > output,
const typename Mapping<dim,spacedim>::InternalDataBase &internal,
const MappingType mapping_type) const
{
+ AssertDimension (input.size(), output.size());
+
switch (mapping_type)
{
case mapping_covariant:
transform_covariant(input, 0, output, internal);
return;
-// case mapping_contravariant:
-// transform_contravariant(input, 0, output, internal);
-// return;
+ case mapping_contravariant:
+ transform_contravariant(input, 0, output, internal);
+ return;
default:
Assert(false, ExcNotImplemented());
}
Assert (data.update_flags & update_covariant_transformation,
typename FEValuesBase<dim>::ExcAccessToUninitializedField());
- Assert (output.size() + offset <= input.size(), ExcInternalError());
-
- for (unsigned int i=0; i<output.size(); ++i)
- contract (output[i], input[i+offset], data.covariant[i]);
-}
-
-
-#if deal_II_dimension == 1
-
-template<>
-void
-MappingQ1<1,2>::transform_covariant (
- const VectorSlice<const std::vector<Tensor<1,1> > > input,
- const unsigned int offset,
- VectorSlice<std::vector<Tensor<1,2> > > output,
- const Mapping<1,2>::InternalDataBase &mapping_data) const
-{
- Assert (offset == 0, ExcInternalError());
- AssertDimension (input.size(), output.size());
-
- // ensure that the following cast is really correct:
- Assert (dynamic_cast<const InternalData *>(&mapping_data) != 0,
- ExcInternalError());
- const InternalData &data = static_cast<const InternalData&>(mapping_data);
-
- Assert (data.update_flags & update_covariant_transformation,
- FEValuesBase<1>::ExcAccessToUninitializedField());
-
- Assert (output.size() + offset <= input.size(), ExcInternalError());
-
- Tensor<1,2> auxiliary;
- auxiliary[1]=0.;
-
- for (unsigned int i=0; i<output.size(); ++i)
- {
- auxiliary[0]=input[i+offset][0];
- contract (output[i], auxiliary, data.covariant[i]);
- }
-}
-
-#endif
-
-#if deal_II_dimension == 2
-
-template<>
-void
-MappingQ1<2,3>::transform_covariant (
- const VectorSlice<const std::vector<Tensor<1,2> > > input,
- const unsigned int offset,
- VectorSlice<std::vector<Tensor<1,3> > > output,
- const Mapping<2,3>::InternalDataBase &mapping_data) const
-{
- Assert (offset == 0, ExcInternalError());
- AssertDimension (input.size(), output.size());
- // ensure that the following cast is really correct:
- Assert (dynamic_cast<const InternalData *>(&mapping_data) != 0,
- ExcInternalError());
- const InternalData &data = static_cast<const InternalData&>(mapping_data);
-
- Assert (data.update_flags & update_covariant_transformation,
- FEValuesBase<2>::ExcAccessToUninitializedField());
-
- Assert (output.size() + offset <= input.size(), ExcInternalError());
-
- Tensor<1,3> auxiliary;
- auxiliary[2]=0.;
-
+ Tensor<1, spacedim> auxiliary;
+
for (unsigned int i=0; i<output.size(); ++i)
- {
- auxiliary[0]=input[i+offset][0];
- auxiliary[1]=input[i+offset][1];
- contract (output[i], auxiliary, data.covariant[i]);
- }
+ {
+ for (unsigned int d=0;d<dim;++d)
+ auxiliary[d] = input[i][d];
+ contract (output[i], auxiliary, data.covariant[i]);
+ }
}
-#endif
template <int dim, int spacedim>
{
Assert (offset == 0, ExcInternalError());
AssertDimension (input.size(), output.size());
- // ensure that the following cast is really correct:
+
+ // ensure that the following cast
+ // is really correct:
Assert (dynamic_cast<const InternalData *>(&mapping_data) != 0,
ExcInternalError());
const InternalData &data = static_cast<const InternalData&>(mapping_data);
Assert (data.update_flags & update_covariant_transformation,
typename FEValuesBase<dim>::ExcAccessToUninitializedField());
-
- Assert (output.size() + offset <= input.size(), ExcInternalError());
-
+
for (unsigned int i=0; i<output.size(); ++i)
contract (output[i], input[i+offset], data.covariant[i]);
}
void
MappingQ1<dim,spacedim>::
transform_contravariant (
- const VectorSlice<const std::vector<Tensor<1,spacedim> > > input,
+ const VectorSlice<const std::vector<Tensor<1,dim> > > input,
const unsigned int offset,
VectorSlice<std::vector<Tensor<1,spacedim> > > output,
const typename Mapping<dim,spacedim>::InternalDataBase &mapping_data) const
typename FEValuesBase<dim>::ExcAccessToUninitializedField());
Assert (output.size() + offset <= input.size(), ExcInternalError());
-
+
+ Tensor<1, spacedim> auxiliary;
+
for (unsigned int i=0; i<output.size(); ++i)
- contract (output[i], data.contravariant[i], input[i+offset]);
+ {
+ for (unsigned int d=0;d<dim;++d)
+ auxiliary[d] = input[i][d];
+ contract (output[i], data.contravariant[i], auxiliary);
+ }
}
template<int dim, int spacedim>
void
MappingQ1<dim,spacedim>::transform_contravariant (
- const VectorSlice<const std::vector<Tensor<2,spacedim> > > input,
+ const VectorSlice<const std::vector<Tensor<2,dim> > > input,
const unsigned int offset,
VectorSlice<std::vector<Tensor<2,spacedim> > > output,
const typename Mapping<dim,spacedim>::InternalDataBase &mapping_data) const
}
+#if deal_II_dimension == 1
+
+template <>
+void
+MappingQ1<1, 2>::transform_contravariant (
+ const VectorSlice<const std::vector<Tensor<2,1> > > ,
+ const unsigned int,
+ VectorSlice<std::vector<Tensor<2,2> > > ,
+ const Mapping<1,2>::InternalDataBase &) const
+{
+ Assert(false, ExcNotImplemented());
+}
+
+#endif
+
+#if deal_II_dimension == 2
+
+template <>
+void
+MappingQ1<2, 3>::transform_contravariant (
+ const VectorSlice<const std::vector<Tensor<2,2> > > ,
+ const unsigned int,
+ VectorSlice<std::vector<Tensor<2,3> > > ,
+ const Mapping<2,3>::InternalDataBase &) const
+{
+ Assert(false, ExcNotImplemented());
+}
+
+#endif
+
+
template<int dim, int spacedim>
Point<spacedim>
-MappingQ1<dim,spacedim>::
-transform_unit_to_real_cell (const typename Triangulation<dim,spacedim>::cell_iterator &cell,
- const Point<dim> &p) const
+MappingQ1<dim,spacedim>::transform_unit_to_real_cell (
+ const typename Triangulation<dim,spacedim>::cell_iterator& cell,
+ const Point<dim>& p) const
{
// Use the get_data function to
// create an InternalData with data