Esempio n. 1
0
Tools for n-dimensional linear algebra

Vectors are just numpy arrays, as are dense matrices. Sparse matrices
are CSR matrices. Parallel vector and matrix are built on top of those
representations using PETSc.

\todo LinearAlgebraTools: make better use of numpy.linalg and petsc4py to provide the needed functionality and add test suite
"""
import numpy
from superluWrappers import *
import flcbdfWrappers
from Profiling import logEvent
#PETSc import, forces comm init if not already done
from petsc4py import PETSc as p4pyPETSc
import Comm
Comm.set_isInitialized()
#end PETSc import

class ParVec:
    """
    A parallel vector built on top of daetk's wrappers for petsc
    """
    def __init__(self,array,blockSize,n,N,nghosts=None,subdomain2global=None,blockVecType="simple"):#"block"
        import flcbdfWrappers
        self.dim_proc=n*blockSize
        if nghosts==None:
            if blockVecType=="simple":
                self.cparVec=flcbdfWrappers.ParVec(blockSize,n,N,-1,None,array,0)
            else:
                self.cparVec=flcbdfWrappers.ParVec(blockSize,n,N,-1,None,array,1)
        else: