OOF2: The Manual

Name

SymTensorIndex — Index a symmetric 3×3 tensor

Synopses

C++ Synopsis

#include "engine/fieldindex.h"
class SymTensorIndex: , public FieldIndex {
  SymTensorIndex();
  SymTensorIndex(int i);
  SymTensorIndex(int i,
                 int j);

  int row() const;
  int col() const;
  bool diagonal() const;
  static int str2voigt(const std::string& str);
  static int ij2voigt(int i,
                      int j);

}

Python Synopsis

from ooflib.SWIG.engine.fieldindex import SymTensorIndex
class SymTensorIndex(FieldIndex):
  def __init__(self, i, j)
  def row(self)
  def col(self)
  def diagonal(self)

Source Files

  • SRC/engine/fieldindex.h: C++ header
  • SRC/engine/fieldindex.C: C++ source code
  • SRC/engine/fieldindex.swg: SWIG source code

Description

SymTensorIndex is a FieldIndex subclass used to refer to the components of a SymmMatrix3 (symmetric 3×3 matrix or tensor) object. Most of the functionality comes from the base class, and is documented in the FieldIndex wrapper class.

The integer method returns the Voigt representation of the SymTensorIndex, as shown in Table 6.

Table 6. Voigt Indices

str i j Voigt
xx 0 0 0
yy 1 1 1
zz 2 2 2
yz 1 2 3
xz 0 2 4
xy 0 1 5

Constructors

C++

SymTensorIndex();
SymTensorIndex(int i);
SymTensorIndex(int i, int j);
      

Python

SymTensorIndex.__init__(self, i, j) 

In the C++ and Python constructors that take two integer values, i and j are the row and column numbers of the tensor component. That is, a value of 0 means x , 1 means y , and 2 means z .

The constructor with a single integer argument expects it to be a Voigt index, as in Table 6.

The constructor with no arguments is identical to SymTensorIndex(0,0).

Methods

Methods that are not defined in the base classes are listed here.

int row() const

The matrix row referred to by the index.

int row() const

The matrix column referred to by the index.

bool diagonal() const

This function indicates whether or not the SymTensorIndex refers to one of the diagonal entries, xx, yy, or zz.

static int str2voigt(const std::string& str)

This is a utility function that returns the integer Voigt representation of a symmetric tensor index, given as a string. Because OOF2 is written in C++, Voigt indices start from 0. See Table 6.

static int ij2voigt(int i, int j)

This is a utility function that returns the integer Voigt representation of a symmetric tensor index, given as a pair of integers. Because OOF2 is written in C++, Voigt indices start from 0. See Table 6.