PyTrilinos Logo PyTrilinos.EpetraExt

PyTrilinos.EpetraExt

The EpetraExt package supports a wide variety of extensons to the Epetra package, only a handful of which have currently been given python wrappers. These wrappers can be categorized as follows:

Graph Coloring Classes

EpetraExt has two classes for aiding with creating color maps.

  • CrsGraph_MapColoring
  • CrsGraph_MapColoringIndex

The first is the functor CrsGraph_MapColoring. Note than only the default constructor is currently supported. Once such an object is created, you can call it with an Epetra.CrsGraph argument to call a coloring algorithm and obtain an Epetra.MapColoring object.

The second class is the CrsGraph_MapColoringIndex functor. Use an Epetra.MapColoring object in the constructor and an Epetra.CrsGraph object as the argument when you call it.

Input Functions

  • MatlabFileToCrsMatrix(str filename, Epetra.Comm) -> Epetra.CrsMatrix
  • MatrixMarketFileToBlockMap(str filename, Epetra.Comm) -> Epetra.BlockMap
  • MatrixMarketFileToBlockMaps(str filename, Epetra.Comm) -> (Epetra.BlockMap rowMap, Epetra.BlockMap colMap, Epetra.BlockMap rangeMap, Epetra.BlockMap domainMap)
  • MatrixMarketFileToCrsMatrix(str filename, Epetra.Map rowMap, Epetra.Map colMap=None, Epetra.Map rangeMap=None, Epetra.Map domainMap=None) -> Epetra.CrsMatrix
  • MatrixMarketFileToMap(str filename, Epetra.Comm) -> Epetra.Map
  • MatrixMarketFileToMultiVector(str filename, Epetra.BlockMap) -> Epetra.MultiVector

Output Functions

  • BlockMapToHandle(file handle, Epetra.BlockMap map) -> int
  • BlockMapToMatrixMarketFile(str filename, Epetra.BlockMap map, str mapName=None, str descr=None, bool writeHeader=True) -> int
  • MultiVectorToHandle(file handle, Epetra.MultiVector) -> int
  • MultiVectorToMatlabFile(str filename, Epetra.MultiVector) -> int
  • MultiVectorToMatlabHandle(file handle, Epetra.MultiVector) -> int
  • MultiVectorToMatrixMarketFile(str filename, Epetra.MultiVector) -> int
  • MultiVectorToMatrixMarketHandle(file handle, Epetra.MuiltiVector) -> int
  • RowMatrixToHandle(file handle, Epetra.RowMatrix) -> int
  • RowMatrixToMatlabFile(str filename, Epetra.RowMatrix) -> int
  • RowMatrixToMatrixMarketFile(str filename, Epetra.RowMatrix) -> int

Input/Output Classes

  • HDF5
  • XMLReader
  • XMLWriter

The HDF5 and XMLReader classes both support overloaded Read() methods in C++, but these cannot be type-disambiguated in python. Therefore, the Read() methods are ignored and replaced with python versions that have the type name in the method. Therefore, if obj is an HDF5 or XMLReader object, then, these methods are supported:

  • obj.ReadMap(str) -> Epetra.Map
  • obj.ReadMultiVector(str) -> Epetra.MultiVector
  • obj.ReadCrsGraph(str) -> Epetra.CrsGraph
  • obj.ReadCrsMatrix(str) -> Epetra.CrsMatrix

In addition, the HDF5 objects support the following additional methods:

  • obj.ReadBlockMap(str) -> Epetra.BlockMap
  • obj.ReadIntVector(str) -> Epetra.IntVector
  • obj.ReadParameterList(str) -> Teuchos.ParameterList

For each Read* method described above there is a corresponding Read*Properties method that is now more pythonic than the C++ version: output arguments are moved to the return argument, typically grouped together in a tuple.

Matrix-Matrix Functions

So far, only addition and multiplication are supported:

  • Add(Epetra.CrsMatrix A, bool flag, float valA, Epetra.CrsMatrix B, float valB) -> int

    Compute B <- valA * A + valB * B. If flag is True, use the transpose of A. B must either have the structure of A+B or not yet have FillComplete() called on it.

  • Multiply(Epetra.CrsMatrix A, bool transposeA, `` ``Epetra.CrsMatrix B, bool transposeB, Epetra.CrsMatrix C) -> int

    Compute C <- A * B, where transposeA and transposeB control the transposition of A and B respectively. C must have the structure of A * B, or not yet have FillComplete() called on it.

Model Evaluator Classes

  • InArgs

    A class that defines and encapsulates the input arguments to the model.

  • Evaluation

    A class that defines how derivatives are evaluated (exactly, approximately, or very approximately).

  • DerivativeSupport

    A class that encapsulates the linearity, multivector status and transpose status of a Derivative.

  • DerivativeProperties

    A class that encapsulates the linearity, rank, and adjoint support of a Derivative.

  • DerivativeMultiVector

    A class that encapsulates a MultiVector, its orientation and its parameter indexes.

  • Derivative

    A class that can represent a derivative object as either an operator or a vector.

  • OutArgs

    A class that defines and encapsulates the output arguments from the model.

  • ModelEvaluator

    The primary model evaluator class. It can be used to define its InArgs and OutArgs, as well as evaluate the model.

Note that in C++, the first seven classes listed above are nested within the ModelEvaluator class. This arrangements creates problems when attempting to wrap the outer class, so the nested classes have been pulled out instead.