* inequality.
*/
bool operator != (const TableIndicesBase<N> &other) const;
+
+ /**
+ * Sort the indices in ascending
+ * order. While this operation is not
+ * very useful for Table objects, it is
+ * used for the SymmetricTensor class.
+ */
+ void sort ();
protected:
/**
+template <>
+inline
+void
+TableIndicesBase<1>::sort ()
+{}
+
+
+
+template <>
+inline
+void
+TableIndicesBase<2>::sort ()
+{
+ if (indices[1] < indices[0])
+ std::swap (indices[0], indices[1]);
+}
+
+
+
+template <>
+inline
+void
+TableIndicesBase<3>::sort ()
+{
+ // bubble sort for 3 elements
+ if (indices[1] < indices[0])
+ std::swap (indices[0], indices[1]);
+ if (indices[2] < indices[1])
+ std::swap (indices[1], indices[2]);
+ if (indices[1] < indices[0])
+ std::swap (indices[0], indices[1]);
+}
+
+
+
+
inline
TableIndices<1>::TableIndices ()
{
<h3>base</h3>
<ol>
+ <li> <p>
+ New: The new function <code
+ class="member">TableIndicesBase::sort</code> allows to sort the indices
+ in ascending order. This is useful for cases where the order of indices
+ is irrelevant (for example in symmetric tables).
+ <br>
+ (WB, 2005/03/29)
+ </p>
+
<li> <p>
New: There is a new class <code class="class">SymmetricTensor</code>
that provides storage and operations for symmetric tensors.