diff --git a/simpegEM/Utils/Solver/Mumps.py b/simpegEM/Utils/Solver/Mumps.py new file mode 100644 index 00000000..5acd07ea --- /dev/null +++ b/simpegEM/Utils/Solver/Mumps.py @@ -0,0 +1,28 @@ +from mumps import DMumpsContext + +class Mumps(): + A = None + ctx = None + x = None + + def __init__(self, A, **kwagrs): + + self.ctx = DMumpsContext(sym=0, par=1) + + if self.ctx.myid ==0: + self.A = A + self.ctx.set_icntl(14, 60) + self.ctx.set_centralized_sparse(A) + + self.ctx.set_silent() + self.ctx.run(job=4) # Factorization + + def solve(self,b): + self.x = b.copy() + self.ctx.set_rhs(self.x) + self.ctx.run(job=3) # Solve + + return self.x + + def clean(self): + self.ctx.destroy() \ No newline at end of file diff --git a/simpegEM/Utils/Solver/__init__.py b/simpegEM/Utils/Solver/__init__.py new file mode 100644 index 00000000..041fdbf5 --- /dev/null +++ b/simpegEM/Utils/Solver/__init__.py @@ -0,0 +1 @@ +from Mumps import Mumps \ No newline at end of file