OOF2: The Manual

Name

SymTensorIndex — Index a symmetric 3×3 tensor

Synopses

C++ Synopsis

#include "engine/fieldindex.h"
	    
class SymTensorIndex: , public FieldIndex {
  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 oof2.SWIG.engine.fieldindex import SymTensorIndex
	    
class SymTensorIndex(FieldIndex):
  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 IndexP wrapper class.

The argument to SymTensorIndex::set function and the value returned by SymTensorIndex::components are both pointers to std::vector<int>s of length 2. The two ints are the row and column numbers of the matrix component, with x=0, y=1, and z=2.

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

Table 8.1. 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

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 8.1.

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 8.1.