--- /dev/null
+New: Tensor::begin_raw, Tensor::end_raw, SymmetricTensor::begin_raw
+and SymmetricTensor::end_raw provide access to the underlying storage for Tensor
+and SymmetricTensor.
+<br>
+(Daniel Arndt, 2018/01/25)
explicit
SymmetricTensor (const SymmetricTensor<rank_,dim,OtherNumber> &initializer);
+ /**
+ * Return a pointer to the first element of the underlying storage.
+ */
+ Number *
+ begin_raw();
+
+ /**
+ * Return a const pointer to the first element of the underlying storage.
+ */
+ const Number *
+ begin_raw() const;
+
+ /**
+ * Return a pointer to the element past the end of the underlying storage.
+ */
+ Number *
+ end_raw();
+
+ /**
+ * Return a const pointer to the element past the end of the underlying
+ * storage.
+ */
+ const Number *
+ end_raw() const;
+
/**
* Assignment operator from symmetric tensors with different underlying scalar type.
* This obviously requires that the @p OtherNumber type is convertible to
Number &operator() (const TableIndices<rank_> &indices);
/**
- * Return an element by value.
+ * Return a @p const reference to the value referred to by the argument.
*/
- Number operator() (const TableIndices<rank_> &indices) const;
+ const Number &operator() (const TableIndices<rank_> &indices) const;
/**
* Access the elements of a row of this symmetric tensor. This function is
operator [] (const unsigned int row);
/**
- * Return an element by value.
+ * Return a @p const reference to the value referred to by the argument.
*
* Exactly the same as operator().
*/
- Number
+ const Number &
operator [] (const TableIndices<rank_> &indices) const;
/**
* <tt>s.access_raw_entry(unrolled_index)</tt> does the same as
* <tt>s[s.unrolled_to_component_indices(i)]</tt>, but more efficiently.
*/
- Number
+ const Number &
access_raw_entry (const unsigned int unrolled_index) const;
/**
template <int dim, typename Number>
inline
- Number
+ const Number &
symmetric_tensor_access (const TableIndices<2> &indices,
const typename SymmetricTensorAccessors::StorageType<2,dim,Number>::base_tensor_type &data)
{
template <int dim, typename Number>
inline
- Number
+ const Number &
symmetric_tensor_access (const TableIndices<4> &indices,
const typename SymmetricTensorAccessors::StorageType<4,dim,Number>::base_tensor_type &data)
{
template <int rank_, int dim, typename Number>
inline
-Number
+const Number &
SymmetricTensor<rank_,dim,Number>::operator ()
(const TableIndices<rank_> &indices) const
{
template <int rank_, int dim, typename Number>
inline
-Number
+const Number &
SymmetricTensor<rank_,dim,Number>::operator [] (const TableIndices<rank_> &indices) const
{
return operator()(indices);
+template <int rank_, int dim, typename Number>
+inline
+Number *
+SymmetricTensor<rank_,dim,Number>::begin_raw()
+{
+ return std::addressof(this->access_raw_entry(0));
+}
+
+
+
+template <int rank_, int dim, typename Number>
+inline
+const Number *
+SymmetricTensor<rank_,dim,Number>::begin_raw() const
+{
+ return std::addressof(this->access_raw_entry(0));
+}
+
+
+
+template <int rank_, int dim, typename Number>
+inline
+Number *
+SymmetricTensor<rank_,dim,Number>::end_raw()
+{
+ return begin_raw()+n_independent_components;
+}
+
+
+
+template <int rank_, int dim, typename Number>
+inline
+const Number *
+SymmetricTensor<rank_,dim,Number>::end_raw() const
+{
+ return begin_raw()+n_independent_components;
+}
+
+
namespace internal
{
template <int rank_, int dim, typename Number>
inline
-Number
+const Number &
SymmetricTensor<rank_,dim,Number>::access_raw_entry (const unsigned int index) const
{
AssertIndexRange (index, n_independent_components);
template <typename OtherNumber>
Tensor (const OtherNumber &initializer);
+ /**
+ * Return a pointer to the first element of the underlying storage.
+ */
+ Number *
+ begin_raw();
+
+ /**
+ * Return a const pointer to the first element of the underlying storage.
+ */
+ const Number *
+ begin_raw() const;
+
+ /**
+ * Return a pointer to the element past the end of the underlying storage.
+ */
+ Number *
+ end_raw();
+
+ /**
+ * Return a const pointer to the element past the end of the underlying
+ * storage.
+ */
+ const Number *
+ end_raw() const;
+
/**
* Return a reference to the encapsulated Number object. Since rank-0
* tensors are scalars, this is a natural operation.
*/
Number &operator [] (const TableIndices<rank_> &indices);
+ /**
+ * Return a pointer to the first element of the underlying storage.
+ */
+ Number *
+ begin_raw();
+
+ /**
+ * Return a const pointer to the first element of the underlying storage.
+ */
+ const Number *
+ begin_raw() const;
+
+ /**
+ * Return a pointer to the element past the end of the underlying storage.
+ */
+ Number *
+ end_raw();
+
+ /**
+ * Return a pointer to the element past the end of the underlying storage.
+ */
+ const Number *
+ end_raw() const;
+
/**
* Assignment operator from tensors with different underlying scalar type.
* This obviously requires that the @p OtherNumber type is convertible to @p
}
+
template <int dim, typename Number>
template <typename OtherNumber>
inline
}
+
template <int dim, typename Number>
template <typename OtherNumber>
inline
}
+
+template <int dim, typename Number>
+inline
+Number *
+Tensor<0,dim,Number>::begin_raw()
+{
+ return std::addressof(value);
+}
+
+
+
+template <int dim, typename Number>
+inline
+const Number *
+Tensor<0,dim,Number>::begin_raw() const
+{
+ return std::addressof(value);
+}
+
+
+
+template <int dim, typename Number>
+inline
+Number *
+Tensor<0,dim,Number>::end_raw()
+{
+ return begin_raw()+n_independent_components;
+}
+
+
+
+template <int dim, typename Number>
+inline
+const Number *
+Tensor<0,dim,Number>::end_raw() const
+{
+ return begin_raw()+n_independent_components;
+}
+
+
+
template <int dim, typename Number>
inline
DEAL_II_CUDA_HOST_DEV Tensor<0,dim,Number>::operator Number &()
}
+
template <int rank_, int dim, typename Number>
inline
Number &
}
+
+template <int rank_, int dim, typename Number>
+inline
+Number *
+Tensor<rank_,dim,Number>::begin_raw()
+{
+ return std::addressof(this->operator[](this->unrolled_to_component_indices(0)));
+}
+
+
+
+template <int rank_, int dim, typename Number>
+inline
+const Number *
+Tensor<rank_,dim,Number>::begin_raw() const
+{
+ return std::addressof(this->operator[](this->unrolled_to_component_indices(0)));
+}
+
+
+
+template <int rank_, int dim, typename Number>
+inline
+Number *
+Tensor<rank_,dim,Number>::end_raw()
+{
+ return begin_raw()+n_independent_components;
+}
+
+
+
+template <int rank_, int dim, typename Number>
+inline
+const Number *
+Tensor<rank_,dim,Number>::end_raw() const
+{
+ return begin_raw()+n_independent_components;
+}
+
+
+
template <int rank_, int dim, typename Number>
template <typename OtherNumber>
inline