In [1]:
import scipy.io
from scipy2Trilinos import scipy_csr_matrix2CrsMatrix
from PyTrilinos import Epetra, ML, AztecOO
import TrilinosIO


System = scipy.io.loadmat("System.mat")


MLList = {
  "default values":"maxwell",
  "max levels":10,
  "prec type":"MGV",
  "increasing or decreasing":"decreasing",

  "aggregation: type":"Uncoupled-MIS",
  "aggregation: damping factor":1.333,
  "eigen-analysis: type":"cg",
  "eigen-analysis: iterations":10,
  "aggregation: edge prolongator drop threshold":0.0,

  "smoother: sweeps":1,
  "smoother: damping factor":1.0,
  "smoother: pre or post":"both",
  # "smoother: type":"Hiptmair",
  "smoother: Hiptmair efficient symmetric":True,
  "subsmoother: type": "Chebyshev",
  "subsmoother: Chebyshev alpha": 20.0,
  "subsmoother: node sweeps":4,
  "subsmoother: edge sweeps":4,

  "coarse: type":"Amesos-KLU",
  "coarse: max size":128,
  "coarse: pre or post":"post",
  "coarse: sweeps":1

}

comm = Epetra.PyComm()
C = scipy_csr_matrix2CrsMatrix(System["C"].tocsr(), comm)
CurlCurl = scipy_csr_matrix2CrsMatrix(System["CurlCurl"].tocsr(), comm)
node = scipy_csr_matrix2CrsMatrix(System["node"].tocsr(), comm)

In [3]:
ML_Hiptmair = ML.MultiLevelPreconditioner(CurlCurl,C,node,MLList)
ML_Hiptmair.ComputePreconditioner()


Out[3]:
0

In [4]:
x = System["rhs"][0]

In [6]:
x
b_epetra = TrilinosIO._numpyToTrilinosVector(x)


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-6-4f1f72fb39ba> in <module>()
      1 x
----> 2 b_epetra = TrilinosIO._numpyToTrilinosVector(x)

/Users/michaelwathen/Dropbox/MastersResearch/MHD/FEniCS/Classes/TrilinosIO.py in _numpyToTrilinosVector(v)
    508     across all processors as specified by the map.
    509     """
--> 510     map =Epetra.Map(x.shape[0], 0 , comm)
    511     if(map.Comm().NumProc() == 1):
    512         return Epetra.Vector(v)

NameError: global name 'x' is not defined