From a0b80e07da0dbdc452c70fa9a2ca66d6458afce2 Mon Sep 17 00:00:00 2001 From: Matthew Collins <m.t.collins@warwick.ac.uk> Date: Mon, 19 Feb 2018 16:18:54 +0000 Subject: [PATCH] demos all working at defulat constuctor implemented bcrsMatrix() --- __init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/__init__.py b/__init__.py index e80498887..35bee3592 100644 --- a/__init__.py +++ b/__init__.py @@ -31,7 +31,7 @@ def MatrixIndexSet(rows, cols): typeName = "Dune::MatrixIndexSet" return loadmatrixindexset(includes, typeName).MatrixIndexSet(rows,cols) -def BCRSMatrix(blockSize=(1,1)): +def BCRSMatrix(blockSize): includes = ["dune/istl/bcrsmatrix.hh"] try: typeName = "Dune::BCRSMatrix<Dune::" + blockSize._typeName + " >" @@ -47,9 +47,12 @@ def BCRSMatrix(blockSize=(1,1)): # todo: provide other constructors return load(includes, typeName).BCRSMatrix -def bcrsMatrix(size, *args, **kwargs): +def bcrsMatrix(size=0, *args, **kwargs): blockSize = kwargs.get("blockSize",[1,1]) - return BCRSMatrix(blockSize)(size,*args) + if size != 0 : + return BCRSMatrix(blockSize)(size,*args) + return BCRSMatrix(blockSize)() + def BlockVector(blockSize): if blockSize == 1: -- GitLab