* the outside world.
*/
static const unsigned int rank = rank_;
-
+
/**
* Type of stored objects. This
* is a tensor of lower rank.
* to zero.
*/
Tensor ();
-
+
/**
* Copy constructor, where the data is
* copied from a C-style array.
*/
Tensor (const array_type &initializer);
-
+
/**
* Read-Write access operator.
*/
* Add another tensor.
*/
Tensor<rank_,dim> & operator += (const Tensor<rank_,dim> &);
-
+
/**
* Subtract another tensor.
*/
* contexts.
*/
double norm_square () const;
-
+
/**
* Fill a vector with all tensor elements.
*
<< "Invalid tensor index " << arg1);
/**
- * Read or write the data of this object to or
+ * Read or write the data of this object to or
* from a stream for the purpose of serialization
- */
+ */
template <class Archive>
void serialize(Archive & ar, const unsigned int version);
Tensor<rank_,dim>::operator[] (const unsigned int i)
{
Assert (i<dim, ExcIndexRange(i, 0, dim));
-
+
return subtensor[i];
}
Tensor<rank_,dim>::operator[] (const unsigned int i) const
{
Assert (i<dim, ExcIndexRange(i, 0, dim));
-
+
return subtensor[i];
}
Tensor<rank_,dim>::operator + (const Tensor<rank_,dim> &t) const
{
Tensor<rank_,dim> tmp(*this);
-
+
for (unsigned int i=0; i<dim; ++i)
tmp.subtensor[i] += t.subtensor[i];
Tensor<rank_,dim>::operator - (const Tensor<rank_,dim> &t) const
{
Tensor<rank_,dim> tmp(*this);
-
+
for (unsigned int i=0; i<dim; ++i)
tmp.subtensor[i] -= t.subtensor[i];
Tensor<rank_,dim>::operator - () const
{
Tensor<rank_,dim> tmp;
-
+
for (unsigned int i=0; i<dim; ++i)
tmp.subtensor[i] = -subtensor[i];
template <int rank_, int dim>
template <class Archive>
inline
-void
+void
Tensor<rank_,dim>::serialize(Archive & ar, const unsigned int)
{
ar & subtensor;
-}
+}
#endif // DOXYGEN
/* ----------------- Non-member functions operating on tensors. ------------ */
Assert (false,
(typename Tensor<2,dim>::ExcInvalidTensorIndex (index2)));
}
-
+
break;
case 2:
switch (index2)
Assert (false,
(typename Tensor<2,dim>::ExcInvalidTensorIndex (index2)));
}
-
+
break;
case 3:
switch (index2)
Assert (false,
(typename Tensor<2,dim>::ExcInvalidTensorIndex (index2)));
}
-
+
break;
default:
Assert (false,
}
}
-
+
/**
* Multiplication operator performing a contraction of the last index
* of the first argument and the first index of the second
const Tensor<1,dim> &src)
{
Assert (dim==2, ExcInternalError());
-
+
dst[0] = src[1];
dst[1] = -src[0];
}
const Tensor<1,dim> &src2)
{
Assert (dim==3, ExcInternalError());
-
+
dst[0] = src1[1]*src2[2] - src1[2]*src2[1];
dst[1] = src1[2]*src2[0] - src1[0]*src2[2];
dst[2] = src1[0]*src2[1] - src1[1]*src2[0];
// for some algorithmic simplicity, we use
// the expansion along the last row
double det = 0;
-
+
for (unsigned int k=0; k<dim; ++k)
{
Tensor<2,dim-1> minor;
det += t[dim-1][k] * cofactor;
}
-
+
return std::pow (-1., static_cast<double>(dim)) * det;
}
invert (const Tensor<2,dim> &t)
{
Tensor<2,dim> return_tensor;
- switch (dim)
+ switch (dim)
{
case 1:
return_tensor[0][0] = 1.0/t[0][0];
return_tensor[1][1] = t[0][0]*t4;
break;
}
-
+
case 3:
{
const double t4 = t[0][0]*t[1][1],
return_tensor[2][0] = -(-t[1][0]*t[2][1]+t[1][1]*t[2][0])*t07;
return_tensor[2][1] = -(t[0][0]*t[2][1]-t01)*t07;
return_tensor[2][2] = (t4-t8)*t07;
-
+
break;
}
// if desired, take over the
// inversion of a 4x4 tensor
// from the FullMatrix
-
+
default:
AssertThrow (false, ExcNotImplemented());
- }
+ }
return return_tensor;
}
# include <lac/trilinos_sparse_matrix.h>
# include <lac/trilinos_block_vector.h>
-# include <cmath>
# include <Epetra_Import.h>
# include <Epetra_Vector.h>
+# include <cmath>
+
DEAL_II_NAMESPACE_OPEN
Epetra_Map new_map (v.size(), n_elements, &global_ids[0], 0,
v.block(0).vector_partitioner().Comm());
- if (import_data == false)
- vector.reset (new Epetra_FEVector (new_map));
-
- Teuchos::RCP<Epetra_FEVector> actual_vec = (import_data == true) ?
- Teuchos::rcp (new Epetra_FEVector (new_map), true) :
- Teuchos::rcp (vector.get(), false);
+ std_cxx1x::shared_ptr<Epetra_FEVector> actual_vec;
+ if ( import_data == true )
+ actual_vec.reset (new Epetra_FEVector (new_map));
+ else
+ {
+ vector.reset (new Epetra_FEVector (new_map));
+ actual_vec = vector;
+ }
TrilinosScalar* entries = (*actual_vec)[0];
block_offset = 0;