* multiplication with the
* Jacobian of the mapping.
*/
- Table<2,Tensor<1,dim> > shape_values;
+ std::vector<std::vector<Tensor<1,dim> > > shape_values;
/**
* Array with shape function
* multiplication) when
* visiting an actual cell.
*/
- Table<2,Tensor<2,dim> > shape_gradients;
+ std::vector<std::vector<Tensor<2,dim> > > shape_gradients;
};
/**
* them over when visiting a
* concrete cell.
*/
- Table<2,double> shape_values;
+ std::vector<std::vector<double> > shape_values;
/**
* Array with shape function
* multiplication) when
* visiting an actual cell.
*/
- Table<2,Tensor<1,dim> > shape_gradients;
+ std::vector<std::vector<Tensor<1,dim> > > shape_gradients;
};
/**
* multiplication with the
* Jacobian of the mapping.
*/
- Table<2,Tensor<1,dim> > shape_values;
+ std::vector<std::vector<Tensor<1,dim> > > shape_values;
/**
* Array with shape function
* multiplication) when
* visiting an actual cell.
*/
- Table<2,Tensor<2,dim> > shape_gradients;
+ std::vector<std::vector<Tensor<2,dim> > > shape_gradients;
};
/**
* is the same as for the
* ShapeVector data type.
*/
- typedef Table<2,Tensor<1,dim> > GradientVector;
+ typedef std::vector<std::vector<Tensor<1,dim> > > GradientVector;
/**
* Likewise for second order
* derivatives.
*/
- typedef Table<2,Tensor<2,dim> > GradGradVector;
+ typedef std::vector<std::vector<Tensor<2,dim> > > GradGradVector;
/**
* Store the values of the shape
ExcAccessToUninitializedField());
Assert (fe->is_primitive (i),
ExcShapeFunctionNotPrimitive(i));
- Assert (i<this->shape_gradients.n_rows(),
- ExcIndexRange (i, 0, this->shape_gradients.n_rows()));
- Assert (j<this->shape_gradients.n_cols(),
- ExcIndexRange (j, 0, this->shape_gradients.n_cols()));
+ Assert (i<this->shape_gradients.size(),
+ ExcIndexRange (i, 0, this->shape_gradients.size()));
+ Assert (j<this->shape_gradients[0].size(),
+ ExcIndexRange (j, 0, this->shape_gradients[0].size()));
// if the entire FE is primitive,
// then we can take a short-cut:
ExcAccessToUninitializedField());
Assert (fe->is_primitive (i),
ExcShapeFunctionNotPrimitive(i));
- Assert (i<this->shape_2nd_derivatives.n_rows(),
- ExcIndexRange (i, 0, this->shape_2nd_derivatives.n_rows()));
- Assert (j<this->shape_2nd_derivatives.n_cols(),
- ExcIndexRange (j, 0, this->shape_2nd_derivatives.n_cols()));
+ Assert (i<this->shape_2nd_derivatives.size(),
+ ExcIndexRange (i, 0, this->shape_2nd_derivatives.size()));
+ Assert (j<this->shape_2nd_derivatives[0].size(),
+ ExcIndexRange (j, 0, this->shape_2nd_derivatives[0].size()));
// if the entire FE is primitive,
// then we can take a short-cut:
// $Id$
// Version: $Name$
//
-// Copyright (C) 2000, 2001, 2002, 2003 by the deal.II authors
+// Copyright (C) 2000, 2001, 2002, 2003, 2004 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
* transpose if the inverse
* matrix.
*
- * The range of vectors spanned
- * by @p begin and @p end must
- * have as many elements as there
- * are quadrature points (not
- * tested inside the function).
- * Also note the different
- * convention for parameters
- * compared to the standard C++
- * @p transform function: here,
- * first destination, then source
- * are specified, and the number
- * of elements is determined by a
- * range of destination
- * vectors. This convention is
- * due to the way the function is
- * usually called.
- *
- * The vector @p src must
- * contain at least as many
- * elements as there are
- * quadrature points.
+ * The list of arguments is as follows:
+ * we transform as many elements in the
+ * @p input field, starting from @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.
*/
virtual
void
- transform_covariant (Tensor<1,dim> *begin,
- Tensor<1,dim> *end,
- const Tensor<1,dim> *src,
+ transform_covariant (const std::vector<Tensor<1,dim> > &input,
+ const unsigned int offset,
+ std::vector<Tensor<1,dim> > &output,
const InternalDataBase &internal) const = 0;
/**
*
* The same applies as to the
* function above regarding input
- * and output ranges.
+ * and output arguments.
*/
virtual
void
- transform_covariant (Tensor<2,dim> *begin,
- Tensor<2,dim> *end,
- const Tensor<2,dim> *src,
+ transform_covariant (const std::vector<Tensor<2,dim> > &input,
+ const unsigned int offset,
+ std::vector<Tensor<2,dim> > &output,
const InternalDataBase &internal) const = 0;
/**
* of the transformation from
* unit to real space cell.
*
- * The range of vectors spanned
- * by @p begin and @p end must
- * have as many elements as there
- * are quadrature points (not
- * tested inside the function).
- * Also note the different
- * convention for parameters
- * compared to the standard C++
- * @p transform function: here,
- * first destination, then source
- * are specified, and the number
- * of elements is determined by a
- * range of destination
- * vectors. This convention is
- * due to the way the function is
- * usually called.
- *
- * The vector @p src must
- * contain at least as many
- * elements as there are
- * quadrature points.
+ * The list of arguments is as follows:
+ * we transform as many elements in the
+ * @p input field, starting from @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.
*/
virtual
void
- transform_contravariant (Tensor<1,dim> *begin,
- Tensor<1,dim> *end,
- const Tensor<1,dim> *src,
- const InternalDataBase &internal) const = 0;
+ transform_contravariant (const std::vector<Tensor<1,dim> > &input,
+ const unsigned int offset,
+ std::vector<Tensor<1,dim> > &output,
+ const typename Mapping<dim>::InternalDataBase &internal) const = 0;
/**
* Transform a set of matrices
*
* The same applies as to the
* function above regarding input
- * and output ranges.
+ * and output arguments.
*/
- virtual
- void
- transform_contravariant (Tensor<2,dim> *begin,
- Tensor<2,dim> *end,
- const Tensor<2,dim> *src,
- const InternalDataBase &internal) const = 0;
+
+ virtual void
+ transform_contravariant (const std::vector<Tensor<2,dim> > &intput,
+ const unsigned int offset,
+ std::vector<Tensor<2,dim> > &output,
+ const typename Mapping<dim>::InternalDataBase &internal) const = 0;
/**
* Indicate fields to be updated
std::vector<Tensor<1,dim> > &boundary_form,
std::vector<Point<dim> > &normal_vectors) const ;
+ /**
+ * Implementation of the
+ * interface in Mapping.
+ */
virtual void
- transform_covariant (Tensor<1,dim> *begin,
- Tensor<1,dim> *end,
- const Tensor<1,dim> *src,
+ transform_covariant (const std::vector<Tensor<1,dim> > &input,
+ const unsigned int offset,
+ std::vector<Tensor<1,dim> > &output,
const typename Mapping<dim>::InternalDataBase &internal) const;
+ /**
+ * Implementation of the
+ * interface in Mapping.
+ */
virtual void
- transform_covariant (Tensor<2,dim> *begin,
- Tensor<2,dim> *end,
- const Tensor<2,dim> *src,
+ transform_covariant (const std::vector<Tensor<2,dim> > &input,
+ const unsigned int offset,
+ std::vector<Tensor<2,dim> > &output,
const typename Mapping<dim>::InternalDataBase &internal) const;
+ /**
+ * Implementation of the
+ * interface in Mapping.
+ */
virtual void
- transform_contravariant (Tensor<1,dim> *begin,
- Tensor<1,dim> *end,
- const Tensor<1,dim> *src,
+ transform_contravariant (const std::vector<Tensor<1,dim> > &input,
+ const unsigned int offset,
+ std::vector<Tensor<1,dim> > &output,
const typename Mapping<dim>::InternalDataBase &internal) const;
+ /**
+ * Implementation of the
+ * interface in Mapping.
+ */
virtual void
- transform_contravariant (Tensor<2,dim> *begin,
- Tensor<2,dim> *end,
- const Tensor<2,dim> *src,
+ transform_contravariant (const std::vector<Tensor<2,dim> > &input,
+ const unsigned int offset,
+ std::vector<Tensor<2,dim> > &output,
const typename Mapping<dim>::InternalDataBase &internal) const;
virtual Point<dim>
* interface in Mapping.
*/
virtual void
- transform_covariant (Tensor<1,dim> *begin,
- Tensor<1,dim> *end,
- const Tensor<1,dim> *src,
+ transform_covariant (const std::vector<Tensor<1,dim> > &input,
+ const unsigned int offset,
+ std::vector<Tensor<1,dim> > &output,
const typename Mapping<dim>::InternalDataBase &internal) const;
/**
* interface in Mapping.
*/
virtual void
- transform_covariant (Tensor<2,dim> *begin,
- Tensor<2,dim> *end,
- const Tensor<2,dim> *src,
+ transform_covariant (const std::vector<Tensor<2,dim> > &input,
+ const unsigned int offset,
+ std::vector<Tensor<2,dim> > &output,
const typename Mapping<dim>::InternalDataBase &internal) const;
/**
* interface in Mapping.
*/
virtual void
- transform_contravariant (Tensor<1,dim> *begin,
- Tensor<1,dim> *end,
- const Tensor<1,dim> *src,
+ transform_contravariant (const std::vector<Tensor<1,dim> > &input,
+ const unsigned int offset,
+ std::vector<Tensor<1,dim> > &output,
const typename Mapping<dim>::InternalDataBase &internal) const;
/**
* interface in Mapping.
*/
virtual void
- transform_contravariant (Tensor<2,dim> *begin,
- Tensor<2,dim> *end,
- const Tensor<2,dim> *src,
+ transform_contravariant (const std::vector<Tensor<2,dim> > &intput,
+ const unsigned int offset,
+ std::vector<Tensor<2,dim> > &output,
const typename Mapping<dim>::InternalDataBase &internal) const;
/**
* Mapping.
*/
virtual void
- transform_covariant (Tensor<1,dim> *begin,
- Tensor<1,dim> *end,
- const Tensor<1,dim> *src,
+ transform_covariant (const std::vector<Tensor<1,dim> > &input,
+ const unsigned int offset,
+ std::vector<Tensor<1,dim> > &output,
const typename Mapping<dim>::InternalDataBase &internal) const;
/**
* Mapping.
*/
virtual void
- transform_covariant (Tensor<2,dim> *begin,
- Tensor<2,dim> *end,
- const Tensor<2,dim> *src,
+ transform_covariant (const std::vector<Tensor<2,dim> > &input,
+ const unsigned int offset,
+ std::vector<Tensor<2,dim> > &output,
const typename Mapping<dim>::InternalDataBase &internal) const;
/**
* Mapping.
*/
virtual void
- transform_contravariant (Tensor<1,dim> *begin,
- Tensor<1,dim> *end,
- const Tensor<1,dim> *src,
+ transform_contravariant (const std::vector<Tensor<1,dim> > &input,
+ const unsigned int offset,
+ std::vector<Tensor<1,dim> > &output,
const typename Mapping<dim>::InternalDataBase &internal) const;
/**
* Mapping.
*/
virtual void
- transform_contravariant (Tensor<2,dim> *begin,
- Tensor<2,dim> *end,
- const Tensor<2,dim> *src,
+ transform_contravariant (const std::vector<Tensor<2,dim> > &intput,
+ const unsigned int offset,
+ std::vector<Tensor<2,dim> > &output,
const typename Mapping<dim>::InternalDataBase &internal) const;
/**
*
* Filled once.
*/
- Table<2,Tensor<1,dim> > unit_tangentials;
+ std::vector<std::vector<Tensor<1,dim> > > unit_tangentials;
/**
- * Auxuliary vectors for internal use.
+ * Auxiliary vectors for internal use.
*/
- Table<2,Tensor<1,dim> > aux;
+ std::vector<std::vector<Tensor<1,dim> > > aux;
/**
* Stores the support points of
n_nonzero_components_table.end(),
0U);
- Assert (data.shape_2nd_derivatives.n_rows() == total_nonzero_components,
+ Assert (data.shape_2nd_derivatives.size() == total_nonzero_components,
ExcInternalError());
// Number of quadrature points
- const unsigned int n_q_points = data.shape_2nd_derivatives.n_cols();
+ const unsigned int n_q_points = data.shape_2nd_derivatives[0].size();
// first reinit the fe_values
// objects used for the finite
// quotients of gradients in each
// direction (first index) and at
// all q-points (second index)
- Table<2,Tensor<1,dim> > diff_quot (dim, n_q_points);
+ std::vector<std::vector<Tensor<1,dim> > >
+ diff_quot (dim, std::vector<Tensor<1,dim> > (n_q_points));
std::vector<Tensor<1,dim> > diff_quot2 (n_q_points);
// for all nonzero components of
Assert (diff_quot2.size() <=
diff_quot[d].size(),
ExcInternalError());
- mapping.transform_covariant (&*diff_quot2.begin(), &*diff_quot2.end(),
- diff_quot[d].begin(),
+ mapping.transform_covariant (diff_quot[d], 0, diff_quot2,
mapping_internal);
for (unsigned int q=0; q<n_q_points; ++q)
for (unsigned int d1=0; d1<dim; ++d1)
- data.shape_2nd_derivatives[total_index][q][d][d1] = diff_quot2[q][d1];
+ data.shape_2nd_derivatives[total_index][q][d][d1]
+ = diff_quot2[q][d1];
}
}
}
// $Id$
// Version: $Name$
//
-// Copyright (C) 2002, 2003 by the deal.II authors
+// Copyright (C) 2002, 2003, 2004 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
// necessary. otherwise, don't
// allocate memory
if (flags & update_values)
- data->shape_values.reinit (this->dofs_per_cell, n_q_points);
+ data->shape_values.resize (this->dofs_per_cell,
+ std::vector<Tensor<1,dim> > (n_q_points));
if (flags & update_gradients)
- data->shape_gradients.reinit (this->dofs_per_cell, n_q_points);
+ data->shape_gradients.resize (this->dofs_per_cell,
+ std::vector<Tensor<2,dim> > (n_q_points));
// if second derivatives through
// finite differencing is required,
// values...
Assert (fe_data.shape_values[k].size() == n_q_points,
ExcInternalError());
- mapping.transform_covariant(&*shape_values.begin(),
- &*shape_values.end(),
- fe_data.shape_values[k].begin(),
+ mapping.transform_covariant(fe_data.shape_values[k], 0,
+ shape_values,
mapping_data);
// then copy over to target:
std::vector<Tensor<2,dim> > shape_grads1 (n_q_points);
std::vector<Tensor<2,dim> > shape_grads2 (n_q_points);
- Assert (data.shape_gradients.n_rows() == this->dofs_per_cell * dim,
+ Assert (data.shape_gradients.size() == this->dofs_per_cell * dim,
ExcInternalError());
- Assert (data.shape_gradients.n_cols() == n_q_points,
+ Assert (data.shape_gradients[0].size() == n_q_points,
ExcInternalError());
// loop over all shape
Assert (fe_data.shape_gradients[k].size() == n_q_points,
ExcInternalError());
// do first transformation
- mapping.transform_covariant(&*shape_grads1.begin(),
- &*shape_grads1.end(),
- fe_data.shape_gradients[k].begin(),
+ mapping.transform_covariant(fe_data.shape_gradients[k], 0,
+ shape_grads1,
mapping_data);
// transpose matrix
for (unsigned int q=0; q<n_q_points; ++q)
shape_grads2[q] = transpose(shape_grads1[q]);
// do second transformation
- mapping.transform_covariant(&*shape_grads1.begin(),
- &*shape_grads1.end(),
- &*shape_grads2.begin(),
+ mapping.transform_covariant(shape_grads2, 0, shape_grads1,
mapping_data);
// transpose back
for (unsigned int q=0; q<n_q_points; ++q)
// check size of array. in 3d,
// we have faces oriented both
// ways
- Assert (fe_data.shape_values.n_cols() ==
+ Assert (fe_data.shape_values[0].size() ==
GeometryInfo<dim>::faces_per_cell * n_q_points *
(dim == 3 ? 2 : 1),
ExcInternalError());
{
// first transform shape
// values...
- mapping.transform_covariant(&*shape_values.begin(),
- &*shape_values.end(),
- fe_data.shape_values[k].begin()+offset,
+ mapping.transform_covariant(fe_data.shape_values[k], offset,
+ shape_values,
mapping_data);
// then copy over to target:
// check size of array. in 3d,
// we have faces oriented both
// ways
- Assert (fe_data.shape_gradients.n_cols() ==
+ Assert (fe_data.shape_gradients[0].size() ==
GeometryInfo<dim>::faces_per_cell * n_q_points *
(dim == 3 ? 2 : 1),
ExcInternalError());
std::vector<Tensor<2,dim> > shape_grads1 (n_q_points);
std::vector<Tensor<2,dim> > shape_grads2 (n_q_points);
- Assert (data.shape_gradients.n_rows() == this->dofs_per_cell * dim,
+ Assert (data.shape_gradients.size() == this->dofs_per_cell * dim,
ExcInternalError());
- Assert (data.shape_gradients.n_cols() == n_q_points,
+ Assert (data.shape_gradients[0].size() == n_q_points,
ExcInternalError());
// loop over all shape
// little in between
//
// do first transformation
- mapping.transform_covariant(&*shape_grads1.begin(),
- &*shape_grads1.end(),
- fe_data.shape_gradients[k].begin()+offset,
+ mapping.transform_covariant(fe_data.shape_gradients[k], offset,
+ shape_grads1,
mapping_data);
// transpose matrix
for (unsigned int q=0; q<n_q_points; ++q)
shape_grads2[q] = transpose(shape_grads1[q]);
// do second transformation
- mapping.transform_covariant(&*shape_grads1.begin(),
- &*shape_grads1.end(),
- &*shape_grads2.begin(),
+ mapping.transform_covariant(shape_grads2, 0, shape_grads1,
mapping_data);
// transpose back
for (unsigned int q=0; q<n_q_points; ++q)
// number of conversions
if (flags & update_values)
{
- Assert (fe_data.shape_values.n_cols() ==
+ Assert (fe_data.shape_values[0].size() ==
GeometryInfo<dim>::subfaces_per_face *
GeometryInfo<dim>::faces_per_cell *
n_q_points,
{
// first transform shape
// values...
- mapping.transform_covariant(&*shape_values.begin(),
- &*shape_values.end(),
- fe_data.shape_values[k].begin()+offset,
+ mapping.transform_covariant(fe_data.shape_values[k], offset,
+ shape_values,
mapping_data);
// then copy over to target:
if (flags & update_gradients)
{
- Assert (fe_data.shape_gradients.n_cols() ==
+ Assert (fe_data.shape_gradients.size() ==
GeometryInfo<dim>::faces_per_cell *
GeometryInfo<dim>::subfaces_per_face *
n_q_points,
std::vector<Tensor<2,dim> > shape_grads1 (n_q_points);
std::vector<Tensor<2,dim> > shape_grads2 (n_q_points);
- Assert (data.shape_gradients.n_rows() == this->dofs_per_cell * dim,
+ Assert (data.shape_gradients.size() == this->dofs_per_cell * dim,
ExcInternalError());
- Assert (data.shape_gradients.n_cols() == n_q_points,
+ Assert (data.shape_gradients[0].size() == n_q_points,
ExcInternalError());
// loop over all shape
// little in between
//
// do first transformation
- mapping.transform_covariant(&*shape_grads1.begin(),
- &*shape_grads1.end(),
- fe_data.shape_gradients[k].begin()+offset,
+ mapping.transform_covariant(fe_data.shape_gradients[k], offset,
+ shape_grads1,
mapping_data);
// transpose matrix
for (unsigned int q=0; q<n_q_points; ++q)
shape_grads2[q] = transpose(shape_grads1[q]);
// do second transformation
- mapping.transform_covariant(&*shape_grads1.begin(),
- &*shape_grads1.end(),
- &*shape_grads2.begin(),
+ mapping.transform_covariant(shape_grads2, 0, shape_grads1,
mapping_data);
// transpose back
for (unsigned int q=0; q<n_q_points; ++q)
if (flags & update_values)
{
values.resize (this->dofs_per_cell);
- data->shape_values.reinit (this->dofs_per_cell,
- n_q_points);
+ data->shape_values.resize (this->dofs_per_cell,
+ std::vector<double> (n_q_points));
}
if (flags & update_gradients)
{
grads.resize (this->dofs_per_cell);
- data->shape_gradients.reinit (this->dofs_per_cell,
- n_q_points);
+ data->shape_gradients.resize (this->dofs_per_cell,
+ std::vector<Tensor<1,dim> > (n_q_points));
}
// if second derivatives through
template <class POLY, int dim>
void
FE_Poly<POLY,dim>::fill_fe_values (const Mapping<dim> &mapping,
- const typename DoFHandler<dim>::cell_iterator &cell,
- const Quadrature<dim> &quadrature,
- typename Mapping<dim>::InternalDataBase &mapping_data,
- typename Mapping<dim>::InternalDataBase &fedata,
- FEValuesData<dim> &data) const
+ const typename DoFHandler<dim>::cell_iterator &cell,
+ const Quadrature<dim> &quadrature,
+ typename Mapping<dim>::InternalDataBase &mapping_data,
+ typename Mapping<dim>::InternalDataBase &fedata,
+ FEValuesData<dim> &data) const
{
// convert data object to internal
// data for this class. fails with
Assert (data.shape_gradients[k].size() <=
fe_data.shape_gradients[k].size(),
ExcInternalError());
- mapping.transform_covariant(data.shape_gradients[k].begin(),
- data.shape_gradients[k].end(),
- fe_data.shape_gradients[k].begin(),
+ mapping.transform_covariant(fe_data.shape_gradients[k], 0,
+ data.shape_gradients[k],
mapping_data);
- };
+ }
}
const typename QProjector<dim>::DataSetDescriptor dsd;
Assert (data.shape_gradients[k].size() + offset <=
fe_data.shape_gradients[k].size(),
ExcInternalError());
- mapping.transform_covariant(data.shape_gradients[k].begin(),
- data.shape_gradients[k].end(),
- fe_data.shape_gradients[k].begin()+offset,
+ mapping.transform_covariant(fe_data.shape_gradients[k], offset,
+ data.shape_gradients[k],
mapping_data);
- };
+ }
}
if (flags & update_second_derivatives)
Assert (data.shape_gradients[k].size() + offset <=
fe_data.shape_gradients[k].size(),
ExcInternalError());
- mapping.transform_covariant(data.shape_gradients[k].begin(),
- data.shape_gradients[k].end(),
- fe_data.shape_gradients[k].begin()+offset,
+ mapping.transform_covariant(fe_data.shape_gradients[k], offset,
+ data.shape_gradients[k],
mapping_data);
- };
+ }
}
if (flags & update_second_derivatives)
// $Id$
// Version: $Name$
//
-// Copyright (C) 2003 by the deal.II authors
+// Copyright (C) 2003, 2004 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
// necessary. otherwise, don't
// allocate memory
if (flags & update_values)
- data->shape_values.reinit (this->dofs_per_cell, n_q_points);
+ data->shape_values.resize (this->dofs_per_cell,
+ std::vector<Tensor<1,dim> > (n_q_points));
if (flags & update_gradients)
- data->shape_gradients.reinit (this->dofs_per_cell, n_q_points);
+ data->shape_gradients.resize (this->dofs_per_cell,
+ std::vector<Tensor<2,dim> > (n_q_points));
// if second derivatives through
// finite differencing is required,
// values...
Assert (fe_data.shape_values[k].size() == n_q_points,
ExcInternalError());
- mapping.transform_covariant(&*shape_values.begin(),
- &*shape_values.end(),
- fe_data.shape_values[k].begin(),
+ mapping.transform_covariant(fe_data.shape_values[k], 0,
+ shape_values,
mapping_data);
// then copy over to target:
std::vector<Tensor<2,dim> > shape_grads1 (n_q_points);
std::vector<Tensor<2,dim> > shape_grads2 (n_q_points);
- Assert (data.shape_gradients.n_rows() == this->dofs_per_cell * dim,
+ Assert (data.shape_gradients.size() == this->dofs_per_cell * dim,
ExcInternalError());
- Assert (data.shape_gradients.n_cols() == n_q_points,
+ Assert (data.shape_gradients[0].size() == n_q_points,
ExcInternalError());
// loop over all shape
Assert (fe_data.shape_gradients[k].size() == n_q_points,
ExcInternalError());
// do first transformation
- mapping.transform_covariant(&*shape_grads1.begin(),
- &*shape_grads1.end(),
- fe_data.shape_gradients[k].begin(),
+ mapping.transform_covariant(fe_data.shape_gradients[k], 0,
+ shape_grads1,
mapping_data);
// transpose matrix
for (unsigned int q=0; q<n_q_points; ++q)
shape_grads2[q] = transpose(shape_grads1[q]);
// do second transformation
- mapping.transform_covariant(&*shape_grads1.begin(),
- &*shape_grads1.end(),
- &*shape_grads2.begin(),
+ mapping.transform_covariant(shape_grads2, 0, shape_grads1,
mapping_data);
// transpose back
for (unsigned int q=0; q<n_q_points; ++q)
// number of conversions
if (flags & update_values)
{
- Assert (fe_data.shape_values.n_cols() ==
+ Assert (fe_data.shape_values.size() ==
GeometryInfo<dim>::faces_per_cell * n_q_points,
ExcInternalError());
{
// first transform shape
// values...
- mapping.transform_covariant(&*shape_values.begin(),
- &*shape_values.end(),
- fe_data.shape_values[k].begin()+offset,
+ mapping.transform_covariant(fe_data.shape_values[k], offset,
+ shape_values,
mapping_data);
// then copy over to target:
if (flags & update_gradients)
{
- Assert (fe_data.shape_gradients.n_cols() ==
+ Assert (fe_data.shape_gradients.size() ==
GeometryInfo<dim>::faces_per_cell * n_q_points,
ExcInternalError());
std::vector<Tensor<2,dim> > shape_grads1 (n_q_points);
std::vector<Tensor<2,dim> > shape_grads2 (n_q_points);
- Assert (data.shape_gradients.n_rows() == this->dofs_per_cell * dim,
+ Assert (data.shape_gradients.size() == this->dofs_per_cell * dim,
ExcInternalError());
- Assert (data.shape_gradients.n_cols() == n_q_points,
+ Assert (data.shape_gradients[0].size() == n_q_points,
ExcInternalError());
// loop over all shape
// little in between
//
// do first transformation
- mapping.transform_covariant(&*shape_grads1.begin(),
- &*shape_grads1.end(),
- fe_data.shape_gradients[k].begin()+offset,
+ mapping.transform_covariant(fe_data.shape_gradients[k], offset,
+ shape_grads1,
mapping_data);
// transpose matrix
for (unsigned int q=0; q<n_q_points; ++q)
shape_grads2[q] = transpose(shape_grads1[q]);
// do second transformation
- mapping.transform_covariant(&*shape_grads1.begin(),
- &*shape_grads1.end(),
- &*shape_grads2.begin(),
+ mapping.transform_covariant(shape_grads2, 0, shape_grads1,
mapping_data);
// transpose back
for (unsigned int q=0; q<n_q_points; ++q)
// number of conversions
if (flags & update_values)
{
- Assert (fe_data.shape_values.n_cols() ==
+ Assert (fe_data.shape_values[0].size() ==
GeometryInfo<dim>::faces_per_cell *
GeometryInfo<dim>::subfaces_per_face *
n_q_points,
{
// first transform shape
// values...
- mapping.transform_covariant(&*shape_values.begin(),
- &*shape_values.end(),
- fe_data.shape_values[k].begin()+offset,
+ mapping.transform_covariant(fe_data.shape_values[k], offset,
+ shape_values,
mapping_data);
// then copy over to target:
if (flags & update_gradients)
{
- Assert (fe_data.shape_gradients.n_cols() ==
+ Assert (fe_data.shape_gradients.size() ==
GeometryInfo<dim>::faces_per_cell *
GeometryInfo<dim>::subfaces_per_face *
n_q_points,
std::vector<Tensor<2,dim> > shape_grads1 (n_q_points);
std::vector<Tensor<2,dim> > shape_grads2 (n_q_points);
- Assert (data.shape_gradients.n_rows() == this->dofs_per_cell * dim,
+ Assert (data.shape_gradients.size() == this->dofs_per_cell * dim,
ExcInternalError());
- Assert (data.shape_gradients.n_cols() == n_q_points,
+ Assert (data.shape_gradients[0].size() == n_q_points,
ExcInternalError());
// loop over all shape
// little in between
//
// do first transformation
- mapping.transform_covariant(&*shape_grads1.begin(),
- &*shape_grads1.end(),
- fe_data.shape_gradients[k].begin()+offset,
+ mapping.transform_covariant(fe_data.shape_gradients[k], offset,
+ shape_grads1,
mapping_data);
// transpose matrix
for (unsigned int q=0; q<n_q_points; ++q)
shape_grads2[q] = transpose(shape_grads1[q]);
// do second transformation
- mapping.transform_covariant(&*shape_grads1.begin(),
- &*shape_grads1.end(),
- &*shape_grads2.begin(),
+ mapping.transform_covariant(shape_grads2, 0, shape_grads1,
mapping_data);
// transpose back
for (unsigned int q=0; q<n_q_points; ++q)
n_quadrature_points);
if (flags & update_gradients)
- this->shape_gradients.reinit(n_nonzero_shape_components,
- n_quadrature_points);
+ this->shape_gradients.resize (n_nonzero_shape_components,
+ std::vector<Tensor<1,dim> > (n_quadrature_points));
if (flags & update_second_derivatives)
- this->shape_2nd_derivatives.reinit(n_nonzero_shape_components,
- n_quadrature_points);
+ this->shape_2nd_derivatives.resize (n_nonzero_shape_components,
+ std::vector<Tensor<2,dim> > (n_quadrature_points));
if (flags & update_q_points)
this->quadrature_points.resize(n_quadrature_points);
template <int dim>
void
-MappingCartesian<dim>::transform_covariant (Tensor<1,dim> *begin,
- Tensor<1,dim> *end,
- const Tensor<1,dim> *src,
- const typename Mapping<dim>::InternalDataBase &mapping_data) const
+MappingCartesian<dim>::
+transform_covariant (const std::vector<Tensor<1,dim> > &input,
+ const unsigned int offset,
+ std::vector<Tensor<1,dim> > &output,
+ const typename Mapping<dim>::InternalDataBase &mapping_data) const
{
const InternalData &data = dynamic_cast<const InternalData&> (mapping_data);
Assert (data.update_flags & update_covariant_transformation,
ExcAccessToUninitializedField());
+
+ Assert (output.size() + offset <= input.size(), ExcInternalError());
// simply scale by inverse Jacobian
// (which is diagonal here)
- while (begin!=end)
- {
- for (unsigned int d=0;d<dim;++d)
- (*begin)[d] = (*src)[d]/data.length[d];
- ++begin;
- ++src;
- }
+ for (unsigned int i=0; i<output.size(); ++i)
+ for (unsigned int d=0;d<dim;++d)
+ output[i][d] = input[i+offset][d]/data.length[d];
}
template <int dim>
void
-MappingCartesian<dim>::transform_covariant (Tensor<2,dim> *begin,
- Tensor<2,dim> *end,
- const Tensor<2,dim> *src,
+MappingCartesian<dim>::transform_covariant (const std::vector<Tensor<2,dim> > &input,
+ const unsigned int offset,
+ std::vector<Tensor<2,dim> > &output,
const typename Mapping<dim>::InternalDataBase &mapping_data) const
{
const InternalData &data = dynamic_cast<const InternalData&> (mapping_data);
Assert (data.update_flags & update_covariant_transformation,
ExcAccessToUninitializedField());
+ Assert (output.size() + offset <= input.size(), ExcInternalError());
+
// simply scale by inverse Jacobian
// (which is diagonal here)
- while (begin!=end)
- {
- for (unsigned int d=0; d<dim; ++d)
- for (unsigned int p=0; p<dim; ++p)
- (*begin)[d][p] = (*src)[d][p] / data.length[p];
- ++begin;
- ++src;
- }
+ for (unsigned int i=0; i<output.size(); ++i)
+ for (unsigned int d=0; d<dim; ++d)
+ for (unsigned int p=0; p<dim; ++p)
+ output[i][d][p] = input[i+offset][d][p]/data.length[p];
}
template <int dim>
void
-MappingCartesian<dim>::transform_contravariant (Tensor<1,dim> *begin,
- Tensor<1,dim> *end,
- const Tensor<1,dim> *src,
- const typename Mapping<dim>::InternalDataBase &mapping_data) const
+MappingCartesian<dim>::transform_contravariant (const std::vector<Tensor<1,dim> > &input,
+ const unsigned int offset,
+ std::vector<Tensor<1,dim> > &output,
+ const typename Mapping<dim>::InternalDataBase &mapping_data) const
{
// convert data object to internal
// data for this class. fails with
Assert (data.update_flags & update_contravariant_transformation,
ExcAccessToUninitializedField());
- // simply scale by Jacobian
+ Assert (output.size() + offset <= input.size(), ExcInternalError());
+
+ // simply scale by inverse Jacobian
// (which is diagonal here)
- while (begin!=end)
- {
- for (unsigned int d=0; d<dim; ++d)
- (*begin)[d] = (*src)[d]*data.length[d];
- ++begin;
- ++src;
- }
+ for (unsigned int i=0; i<output.size(); ++i)
+ for (unsigned int d=0;d<dim;++d)
+ output[i][d] = input[i+offset][d] * data.length[d];
}
template <int dim>
void
-MappingCartesian<dim>::transform_contravariant (Tensor<2,dim> *begin,
- Tensor<2,dim> *end,
- const Tensor<2,dim> *src,
- const typename Mapping<dim>::InternalDataBase &mapping_data) const
+MappingCartesian<dim>::transform_contravariant (const std::vector<Tensor<2,dim> > &input,
+ const unsigned int offset,
+ std::vector<Tensor<2,dim> > &output,
+ const typename Mapping<dim>::InternalDataBase &mapping_data) const
{
// convert data object to internal
// data for this class. fails with
Assert (data.update_flags & update_contravariant_transformation,
ExcAccessToUninitializedField());
- // simply scale by Jacobian
+ Assert (output.size() + offset <= input.size(), ExcInternalError());
+
+ // simply scale by inverse Jacobian
// (which is diagonal here)
- while (begin!=end)
- {
- for (unsigned int d=0; d<dim; ++d)
- for (unsigned int p=0; p<dim; ++p)
- (*begin)[d][p] = data.length[d] * (*src)[d][p];
- ++begin;
- ++src;
- }
+ for (unsigned int i=0; i<output.size(); ++i)
+ for (unsigned int d=0; d<dim; ++d)
+ for (unsigned int p=0; p<dim; ++p)
+ output[i][d][p] = input[i+offset][d][p] * data.length[p];
}
template <int dim>
void
MappingQ<dim>::
-transform_covariant (Tensor<1,dim> *begin,
- Tensor<1,dim> *end,
- const Tensor<1,dim> *src,
+transform_covariant (const std::vector<Tensor<1,dim> > &input,
+ const unsigned int offset,
+ std::vector<Tensor<1,dim> > &output,
const typename Mapping<dim>::InternalDataBase &mapping_data) const
{
const typename MappingQ1<dim>::InternalData *q1_data =
dynamic_cast<const typename MappingQ1<dim>::InternalData *> (&mapping_data);
Assert(q1_data!=0, ExcInternalError());
+
+ Assert (output.size() + offset <= input.size(), ExcInternalError());
typename std::vector<Tensor<2,dim> >::const_iterator tensor;
tensor = data->covariant.begin();
}
- while (begin!=end)
- contract (*(begin++), *(src++), *(tensor++));
+ for (unsigned int i=0; i<output.size(); ++i)
+ contract (output[i], input[i+offset], *(tensor++));
}
template <int dim>
void
-MappingQ<dim>::transform_covariant (Tensor<2,dim> *begin,
- Tensor<2,dim> *end,
- const Tensor<2,dim> *src,
- const typename Mapping<dim>::InternalDataBase &mapping_data) const
+MappingQ<dim>::transform_covariant (const std::vector<Tensor<2,dim> > &input,
+ const unsigned int offset,
+ std::vector<Tensor<2,dim> > &output,
+ const typename Mapping<dim>::InternalDataBase &mapping_data) const
{
const typename MappingQ1<dim>::InternalData *q1_data =
dynamic_cast<const typename MappingQ1<dim>::InternalData *> (&mapping_data);
Assert(q1_data!=0, ExcInternalError());
-
+
+ Assert (output.size() + offset <= input.size(), ExcInternalError());
+
typename std::vector<Tensor<2,dim> >::const_iterator tensor;
if (q1_data->is_mapping_q1_data)
tensor = data->covariant.begin();
}
- while (begin!=end)
- contract (*(begin++), *(src++), *(tensor++));
+ for (unsigned int i=0; i<output.size(); ++i)
+ contract (output[i], input[i+offset], *(tensor++));
}
template <int dim>
void
MappingQ<dim>::
-transform_contravariant (Tensor<1,dim> *begin,
- Tensor<1,dim> *end,
- const Tensor<1,dim> *src,
+transform_contravariant (const std::vector<Tensor<1,dim> > &input,
+ const unsigned int offset,
+ std::vector<Tensor<1,dim> > &output,
const typename Mapping<dim>::InternalDataBase &mapping_data) const
{
const typename MappingQ1<dim>::InternalData *q1_data =
dynamic_cast<const typename MappingQ1<dim>::InternalData *> (&mapping_data);
Assert(q1_data!=0, ExcInternalError());
+ Assert (output.size() + offset <= input.size(), ExcInternalError());
+
typename std::vector<Tensor<2,dim> >::const_iterator tensor;
if (q1_data->is_mapping_q1_data)
tensor = data->contravariant.begin();
}
- while (begin!=end)
- contract (*(begin++), *(tensor++), *(src++));
+ for (unsigned int i=0; i<output.size(); ++i)
+ contract (output[i], *(tensor++), input[i+offset]);
}
template <int dim>
void
-MappingQ<dim>::transform_contravariant (Tensor<2,dim> *begin,
- Tensor<2,dim> *end,
- const Tensor<2,dim> *src,
- const typename Mapping<dim>::InternalDataBase &mapping_data) const
+MappingQ<dim>::transform_contravariant (const std::vector<Tensor<2,dim> > &input,
+ const unsigned int offset,
+ std::vector<Tensor<2,dim> > &output,
+ const typename Mapping<dim>::InternalDataBase &mapping_data) const
{
const typename MappingQ1<dim>::InternalData *q1_data =
dynamic_cast<const typename MappingQ1<dim>::InternalData *> (&mapping_data);
Assert(q1_data!=0, ExcInternalError());
+ Assert (output.size() + offset <= input.size(), ExcInternalError());
+
typename std::vector<Tensor<2,dim> >::const_iterator tensor;
if (q1_data->is_mapping_q1_data)
tensor = data->contravariant.begin();
}
- while (begin!=end)
- contract (*(begin++), *(tensor++), *(src++));
+ for (unsigned int i=0; i<output.size(); ++i)
+ contract (output[i], *(tensor++), input[i+offset]);
}
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
if (data.update_flags & update_boundary_forms)
{
- data.aux.reinit(dim-1, n_original_q_points);
+ data.aux.resize (dim-1, std::vector<Tensor<1,dim> > (n_original_q_points));
// Compute tangentials to the
// unit cell.
const unsigned int nfaces = GeometryInfo<dim>::faces_per_cell;
- data.unit_tangentials.reinit(nfaces*(dim-1),
- n_original_q_points);
+ data.unit_tangentials.resize (nfaces*(dim-1),
+ std::vector<Tensor<1,dim> > (n_original_q_points));
for (unsigned int i=0; i<nfaces; ++i)
{
// Base index of the
Assert (data.aux[0].size() <= data.unit_tangentials[face_no].size(),
ExcInternalError());
- transform_contravariant(data.aux[0].begin(),
- data.aux[0].end(),
- data.unit_tangentials[face_no].begin(),
+ transform_contravariant(data.unit_tangentials[face_no], 0,
+ data.aux[0],
data);
typename std::vector<Tensor<1,dim> >::iterator
result = boundary_forms.begin();
const typename std::vector<Tensor<1,dim> >::iterator
end = boundary_forms.end();
- const Tensor<1,dim> *
- tang1 = data.aux[0].begin();
switch (dim)
{
case 2:
{
- for (; result != end; ++result, ++tang1)
- cross_product (*result, *tang1);
+ for (unsigned int i=0; result != end; ++result, ++i)
+ cross_product (*result, data.aux[0][i]);
break;
};
case 3:
{
Assert (face_no+GeometryInfo<dim>::faces_per_cell <
- data.unit_tangentials.n_rows(),
+ data.unit_tangentials.size(),
ExcInternalError());
Assert (data.aux[1].size() <=
data.unit_tangentials[face_no+GeometryInfo<dim>::faces_per_cell].size(),
ExcInternalError());
- transform_contravariant(data.aux[1].begin(),
- data.aux[1].end(),
- data.unit_tangentials[
- face_no+GeometryInfo<dim>::faces_per_cell].begin(),
+ transform_contravariant(data.unit_tangentials[
+ face_no+GeometryInfo<dim>::faces_per_cell], 0,
+ data.aux[1],
data);
- const Tensor<1,dim> *tang2 = data.aux[1].begin();
- for (;result != end; ++result, ++tang1, ++tang2)
- cross_product (*result, *tang1, *tang2);
+ for (unsigned int i=0; result != end; ++result, ++i)
+ cross_product (*result, data.aux[0][i], data.aux[1][i]);
+
break;
};
template <int dim>
void
-MappingQ1<dim>::transform_covariant (Tensor<1,dim> *begin,
- Tensor<1,dim> *end,
- const Tensor<1,dim> *src,
- const typename Mapping<dim>::InternalDataBase &mapping_data) const
+MappingQ1<dim>::transform_covariant (const std::vector<Tensor<1,dim> > &input,
+ const unsigned int offset,
+ std::vector<Tensor<1,dim> > &output,
+ const typename Mapping<dim>::InternalDataBase &mapping_data) const
{
const InternalData *data_ptr = dynamic_cast<const InternalData *> (&mapping_data);
Assert(data_ptr!=0, ExcInternalError());
Assert (data.update_flags & update_covariant_transformation,
ExcAccessToUninitializedField());
-//TODO: [GK] Can we do a similar assertion?
-// Assert (dst.size() == data.contravariant.size(),
-// ExcDimensionMismatch(dst.size() + src_offset, data.contravariant.size()));
+ Assert (output.size() + offset <= input.size(), ExcInternalError());
- typename std::vector<Tensor<2,dim> >::const_iterator
- tensor = data.covariant.begin();
-
- while (begin!=end)
- {
- contract (*(begin++), *(src++), *(tensor++));
- }
+ for (unsigned int i=0; i<output.size(); ++i)
+ contract (output[i], input[i+offset], data.covariant[i]);
}
template <int dim>
void
-MappingQ1<dim>::transform_covariant (Tensor<2,dim> *begin,
- Tensor<2,dim> *end,
- const Tensor<2,dim> *src,
- const typename Mapping<dim>::InternalDataBase &mapping_data) const
+MappingQ1<dim>::transform_covariant (const std::vector<Tensor<2,dim> > &input,
+ const unsigned int offset,
+ std::vector<Tensor<2,dim> > &output,
+ const typename Mapping<dim>::InternalDataBase &mapping_data) const
{
const InternalData *data_ptr = dynamic_cast<const InternalData *> (&mapping_data);
Assert(data_ptr!=0, ExcInternalError());
Assert (data.update_flags & update_covariant_transformation,
ExcAccessToUninitializedField());
-//TODO: [GK] Can we do a similar assertion?
-// Assert (dst.size() == data.contravariant.size(),
-// ExcDimensionMismatch(dst.size() + src_offset, data.contravariant.size()));
+ Assert (output.size() + offset <= input.size(), ExcInternalError());
- typename std::vector<Tensor<2,dim> >::const_iterator
- tensor = data.covariant.begin();
-
- while (begin!=end)
- {
- contract (*(begin++), *(src++), *(tensor++));
- }
+ for (unsigned int i=0; i<output.size(); ++i)
+ contract (output[i], input[i+offset], data.covariant[i]);
}
template <int dim>
void
MappingQ1<dim>::
-transform_contravariant (Tensor<1,dim> *begin,
- Tensor<1,dim> *end,
- const Tensor<1,dim> *src,
+transform_contravariant (const std::vector<Tensor<1,dim> > &input,
+ const unsigned int offset,
+ std::vector<Tensor<1,dim> > &output,
const typename Mapping<dim>::InternalDataBase &mapping_data) const
{
const InternalData* data_ptr = dynamic_cast<const InternalData *> (&mapping_data);
Assert (data.update_flags & update_contravariant_transformation,
ExcAccessToUninitializedField());
- typename std::vector<Tensor<2,dim> >::const_iterator
- tensor = data.contravariant.begin();
-
- while (begin!=end)
- contract (*(begin++), *(tensor++), *(src++));
+ Assert (output.size() + offset <= input.size(), ExcInternalError());
+
+ for (unsigned int i=0; i<output.size(); ++i)
+ contract (output[i], data.contravariant[i], input[i+offset]);
}
template <int dim>
void
MappingQ1<dim>::
-transform_contravariant (Tensor<2,dim> *begin,
- Tensor<2,dim> *end,
- const Tensor<2,dim> *src,
+transform_contravariant (const std::vector<Tensor<2,dim> > &input,
+ const unsigned int offset,
+ std::vector<Tensor<2,dim> > &output,
const typename Mapping<dim>::InternalDataBase &mapping_data) const
{
const InternalData* data_ptr = dynamic_cast<const InternalData *> (&mapping_data);
Assert (data.update_flags & update_contravariant_transformation,
ExcAccessToUninitializedField());
- typename std::vector<Tensor<2,dim> >::const_iterator
- tensor = data.contravariant.begin();
-
- while (begin!=end)
- contract (*(begin++), *(tensor++), *(src++));
+ Assert (output.size() + offset <= input.size(), ExcInternalError());
+
+ for (unsigned int i=0; i<output.size(); ++i)
+ contract (output[i], data.contravariant[i], input[i+offset]);
}