From 014409aedf3da620da63c502ff039ee746cdfe6a Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Fri, 11 Sep 2015 14:38:56 -0500 Subject: [PATCH] Add a new namespace TensorAccessors This namespace will contain a collection of algorithms working on generic tensorial objects (of arbitrary rank). The rationale to implement such functionality in a generic fashion in a separate namespace is - to easy code reusability and therefore avoid code duplication. - to have a well-defined interface that allows to exchange the low level implementation. --- include/deal.II/base/tensor_accessors.h | 77 +++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 include/deal.II/base/tensor_accessors.h diff --git a/include/deal.II/base/tensor_accessors.h b/include/deal.II/base/tensor_accessors.h new file mode 100644 index 0000000000..22e9fcf6f3 --- /dev/null +++ b/include/deal.II/base/tensor_accessors.h @@ -0,0 +1,77 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 1998 - 2015 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + +#ifndef dealii__tensor_accessors_h +#define dealii__tensor_accessors_h + +#include +#include +#include + + +DEAL_II_NAMESPACE_OPEN + +/** + * This namespace is a collection of algorithms working on generic + * tensorial objects (of arbitrary rank). + * + * The rationale to implement such functionality in a generic fashion in a + * separate namespace is + * - to easy code reusability and therefore avoid code duplication. + * - to have a well-defined interface that allows to exchange the low + * level implementation. + * + * + * A tensorial object has the notion of a rank and allows a rank-times + * recursive application of the index operator, e.g., if t is + * a tensorial object of rank 4, the following access is valid: + * @code + * t[1][2][1][4] + * @endcode + * + * deal.II has its own implementation for tensorial objects such as + * dealii::Tensor and + * dealii::SymmetricTensor + * + * The methods and algorithms implemented in this namespace, however, are + * fully generic. More precisely, it can operate on nested c-style arrays, + * or on class types T with a minimal interface that provides + * a local typedef value_type and an index operator + * operator[](unsigned int) that returns a (const or + * non-const) reference of value_type: + * @code + * template<...> + * class T + * { + * typedef ... value_type; + * value_type & operator[](unsigned int); + * const value_type & operator[](unsigned int) const; + * }; + * @endcode + * + * This namespace provides primitves for access, reordering and contraction + * of such objects. + * + * @ingroup geomprimitives + */ +namespace TensorAccessors +{ + + +} /* namespace TensorAccessors */ + +DEAL_II_NAMESPACE_CLOSE + +#endif /* dealii__tensor_accessors_h */ -- 2.39.5