mirror of
https://github.com/wassname/simpeg.git
synced 2026-08-12 12:30:37 +08:00
Working for mumps
This commit is contained in:
@@ -2,9 +2,10 @@ import numpy as np
|
||||
from matutils import mkvc
|
||||
import warnings
|
||||
|
||||
def DSolverWrap(fun, factorize=True, checkAccuracy=True, accuracyTol=1e-6):
|
||||
def DSolverWrap(fun, factorize=True, destroy = False, checkAccuracy=True, accuracyTol=1e-6):
|
||||
|
||||
def __init__(self, A, **kwargs):
|
||||
|
||||
self.A = A.tocsc()
|
||||
self.kwargs = kwargs
|
||||
if factorize:
|
||||
@@ -34,7 +35,13 @@ def DSolverWrap(fun, factorize=True, checkAccuracy=True, accuracyTol=1e-6):
|
||||
warnings.warn(msg, RuntimeWarning)
|
||||
return X
|
||||
|
||||
return type(fun.__name__, (object,), {"__init__": __init__, "solve": solve})
|
||||
def clean(self):
|
||||
if destroy == True:
|
||||
return self.solver.clean()
|
||||
else:
|
||||
return True
|
||||
|
||||
return type(fun.__name__, (object,), {"__init__": __init__, "solve": solve, "clean": clean})
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -330,14 +330,3 @@ def invPropertyTensor(M, tensor, returnMatrix=False):
|
||||
return makePropertyTensor(M, T)
|
||||
|
||||
return T
|
||||
|
||||
|
||||
|
||||
from scipy.sparse.linalg import LinearOperator
|
||||
|
||||
class SimPEGLinearOperator(LinearOperator):
|
||||
"""Extends scipy.sparse.linalg.LinearOperator to have a .T function."""
|
||||
@property
|
||||
def T(self):
|
||||
return self.__class__((self.shape[1],self.shape[0]),self.rmatvec,rmatvec=self.matvec,matmat=self.matmat)
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ from scipy import sparse as sp
|
||||
from matutils import mkvc, ndgrid, sub2ind, sdiag
|
||||
from codeutils import asArray_N_x_Dim
|
||||
from codeutils import isScalar
|
||||
import SimPEG
|
||||
|
||||
|
||||
def exampleLrmGrid(nC, exType):
|
||||
assert type(nC) == list, "nC must be a list containing the number of nodes"
|
||||
@@ -131,8 +133,7 @@ def readUBCTensorMesh(fileName):
|
||||
y0 = mesh[1][1]
|
||||
z0 = -(hz.sum()-mesh[1][2])
|
||||
|
||||
from SimPEG import Mesh
|
||||
mesh3D = Mesh.TensorMesh([hx, hy, hz], np.r_[x0, y0, z0])
|
||||
mesh3D = SimPEG.Mesh.TensorMesh([hx, hy, hz], np.r_[x0, y0, z0])
|
||||
|
||||
return mesh3D
|
||||
|
||||
@@ -147,7 +148,7 @@ def readUBCTensorModel(fileName, mesh):
|
||||
model = np.reshape(model, (mesh.nCz, mesh.nCx, mesh.nCy), order = 'F')
|
||||
model = model[::-1,:,:]
|
||||
model = np.transpose(model, (1, 2, 0))
|
||||
model = mkvc(model)
|
||||
model = SimPEG.Utils.mkvc(model)
|
||||
|
||||
return model
|
||||
|
||||
|
||||
Reference in New Issue
Block a user