/[escript]/trunk/escriptcore/test/python/test_linearPDEs.py
ViewVC logotype

Diff of /trunk/escriptcore/test/python/test_linearPDEs.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2470 by gross, Thu Jun 11 08:32:32 2009 UTC revision 3103 by gross, Tue Aug 24 07:01:33 2010 UTC
# Line 1  Line 1 
1    # -*- coding: utf-8 -*-
2    
3  ########################################################  ########################################################
4  #  #
5  # Copyright (c) 2003-2008 by University of Queensland  # Copyright (c) 2003-2010 by University of Queensland
6  # Earth Systems Science Computational Center (ESSCC)  # Earth Systems Science Computational Center (ESSCC)
7  # http://www.uq.edu.au/esscc  # http://www.uq.edu.au/esscc
8  #  #
# Line 11  Line 12 
12  #  #
13  ########################################################  ########################################################
14    
15  __copyright__="""Copyright (c) 2003-2008 by University of Queensland  __copyright__="""Copyright (c) 2003-2010 by University of Queensland
16  Earth Systems Science Computational Center (ESSCC)  Earth Systems Science Computational Center (ESSCC)
17  http://www.uq.edu.au/esscc  http://www.uq.edu.au/esscc
18  Primary Business: Queensland, Australia"""  Primary Business: Queensland, Australia"""
# Line 34  The tests must be linked with a Domain c Line 35  The tests must be linked with a Domain c
35     suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinley))     suite.addTest(unittest.makeSuite(Test_LinearPDEOnFinley))
36     unittest.TextTestRunner(verbosity=2).run(suite)     unittest.TextTestRunner(verbosity=2).run(suite)
37    
38  @var __author__: name of author  :var __author__: name of author
39  @var __copyright__: copyrights  :var __copyright__: copyrights
40  @var __license__: licence agreement  :var __license__: licence agreement
41  @var __url__: url entry point on documentation  :var __url__: url entry point on documentation
42  @var __version__: version  :var __version__: version
43  @var __date__: date of the version  :var __date__: date of the version
44  """  """
45    
46  __author__="Lutz Gross, l.gross@uq.edu.au"  __author__="Lutz Gross, l.gross@uq.edu.au"
# Line 57  class Test_linearPDEs(unittest.TestCase) Line 58  class Test_linearPDEs(unittest.TestCase)
58      VERBOSE=False      VERBOSE=False
59      def check(self,arg,ref_arg,tol=None):      def check(self,arg,ref_arg,tol=None):
60          """          """
61          checks if arg and ref_arg are nearly identical using the L{Lsup<esys.escript.util.Lsup>}          checks if arg and ref_arg are nearly identical using the `Lsup`
62          """          """
63          if tol==None: tol=self.TOL          if tol==None: tol=self.TOL
64          return Lsup(arg-ref_arg)<=tol*Lsup(ref_arg)          return Lsup(arg-ref_arg)<=tol*Lsup(ref_arg)
# Line 67  class Test_LameEquation(Test_linearPDEs) Line 68  class Test_LameEquation(Test_linearPDEs)
68      def test_config(self):      def test_config(self):
69          mypde=LameEquation(self.domain,debug=self.DEBUG)          mypde=LameEquation(self.domain,debug=self.DEBUG)
70          d=self.domain.getDim()          d=self.domain.getDim()
71          self.failUnlessEqual((mypde.getNumEquations(),mypde.getNumSolutions(),mypde.isSymmetric()),(d,d,True),"set up incorrect")          self.failUnlessEqual((mypde.getNumEquations(), mypde.getNumSolutions(), mypde.getSolverOptions().isSymmetric()),(d,d,True),"set up incorrect")
72    
73      def test_setCoefficient_q(self):      def test_setCoefficient_q(self):
74          mypde=LameEquation(self.domain,debug=self.DEBUG)          mypde=LameEquation(self.domain,debug=self.DEBUG)
# Line 330  class Test_Helmholtz(Test_linearPDEs): Line 331  class Test_Helmholtz(Test_linearPDEs):
331    
332      def test_config(self):      def test_config(self):
333          mypde=Helmholtz(self.domain,debug=self.DEBUG)          mypde=Helmholtz(self.domain,debug=self.DEBUG)
334          self.failUnlessEqual((mypde.getNumEquations(),mypde.getNumSolutions(),mypde.isSymmetric()),(1,1,True),"set up incorrect")          self.failUnlessEqual((mypde.getNumEquations(), mypde.getNumSolutions(), mypde.getSolverOptions().isSymmetric()),(1,1,True),"set up incorrect")
335      def test_setCoefficient_q(self):      def test_setCoefficient_q(self):
336          mypde=Helmholtz(self.domain,debug=self.DEBUG)          mypde=Helmholtz(self.domain,debug=self.DEBUG)
337          x=self.domain.getX()          x=self.domain.getX()
# Line 526  class Test_Poisson(Test_linearPDEs): Line 527  class Test_Poisson(Test_linearPDEs):
527    
528      def test_config(self):      def test_config(self):
529          mypde=Poisson(self.domain,debug=self.DEBUG)          mypde=Poisson(self.domain,debug=self.DEBUG)
530          self.failUnlessEqual((mypde.getNumEquations(),mypde.getNumSolutions(),mypde.isSymmetric()),(1,1,True),"set up incorrect")          self.failUnlessEqual((mypde.getNumEquations(), mypde.getNumSolutions(), mypde.getSolverOptions().isSymmetric()),(1,1,True),"set up incorrect")
531      def test_setCoefficient_q(self):      def test_setCoefficient_q(self):
532          mypde=Poisson(self.domain,debug=self.DEBUG)          mypde=Poisson(self.domain,debug=self.DEBUG)
533          x=self.domain.getX()          x=self.domain.getX()
# Line 642  class Test_LinearPDE_noLumping(Test_line Line 643  class Test_LinearPDE_noLumping(Test_line
643      N=4      N=4
644      def test_SolverOptions(self):      def test_SolverOptions(self):
645          so=SolverOptions()          so=SolverOptions()
646            
647            self.failUnless(so.getSmoother() == 28, "initial Smoother is wrong.")
648            self.failUnlessRaises(ValueError,so.setSmoother,-1)
649            so.setSmoother(so.GAUSS_SEIDEL)
650            self.failUnless(so.getSmoother() == 28, "Gauss-Seidel smoother is not set.")
651            so.setSmoother(so.JACOBI)
652            self.failUnless(so.getSmoother() == 10, "Jacobi smoother is not set.")
653    
654          self.failUnless(so.getLevelMax() == 10, "initial  LevelMax is wrong.")          self.failUnless(so.getLevelMax() == 5, "initial  LevelMax is wrong.")
655          self.failUnlessRaises(ValueError,so.setLevelMax,-1)          self.failUnlessRaises(ValueError,so.setLevelMax,-1)
656          so.setLevelMax(3)          so.setLevelMax(20)
657          self.failUnless(so.getLevelMax() == 3, "LevelMax is wrong.")          self.failUnless(so.getLevelMax() == 20, "LevelMax is wrong.")
658    
659          self.failUnless(so.getCoarseningThreshold() == 0.05, "initial  CoarseningThreshold is wrong.")          self.failUnless(so.getCoarseningThreshold() == 0.25, "initial  CoarseningThreshold is wrong.")
660          self.failUnlessRaises(ValueError,so.setCoarseningThreshold,-1)          self.failUnlessRaises(ValueError,so.setCoarseningThreshold,-1)
661          so.setCoarseningThreshold(0.1)          so.setCoarseningThreshold(0.1)
662          self.failUnless(so.getCoarseningThreshold() == 0.1, "CoarseningThreshold is wrong.")          self.failUnless(so.getCoarseningThreshold() == 0.1, "CoarseningThreshold is wrong.")
663            
664            self.failUnless(so.getMinCoarseMatrixSize() == 500, "initial  Minimum Coarse Matrix Size is wrong.")
665            self.failUnlessRaises(ValueError,so.setMinCoarseMatrixSize,-1)
666            so.setMinCoarseMatrixSize(1000)
667            self.failUnless(so.getMinCoarseMatrixSize() == 1000, "Minimum Coarse Matrix Size is wrong.")
668    
669          self.failUnless(so.getNumSweeps() == 2, "initial  Sweeps is wrong.")          self.failUnless(so.getNumSweeps() == 2, "initial  Sweeps is wrong.")
670          self.failUnlessRaises(ValueError,so.setNumSweeps,-1)          self.failUnlessRaises(ValueError,so.setNumSweeps,-1)
# Line 699  class Test_LinearPDE_noLumping(Test_line Line 712  class Test_LinearPDE_noLumping(Test_line
712          self.failUnless(so.getRelaxationFactor() == 0.1, "Relaxation is wrong.")          self.failUnless(so.getRelaxationFactor() == 0.1, "Relaxation is wrong.")
713    
714    
715          self.failUnless(so.getIterMax() == 10000, "initial IterMax is wrong.")          self.failUnless(so.getIterMax() == 100000, "initial IterMax is wrong.")
716          self.failUnlessRaises(ValueError,so.setIterMax,0)          self.failUnlessRaises(ValueError,so.setIterMax,0)
717          so.setIterMax(11)          so.setIterMax(11)
718          self.failUnless(so.getIterMax() == 11, "IterMax is wrong.")          self.failUnless(so.getIterMax() == 11, "IterMax is wrong.")
# Line 720  class Test_LinearPDE_noLumping(Test_line Line 733  class Test_LinearPDE_noLumping(Test_line
733          self.failUnless(so.getRestart() == 14, "Truncation is wrong.")          self.failUnless(so.getRestart() == 14, "Truncation is wrong.")
734          so.setRestart(None)          so.setRestart(None)
735          self.failUnless(so.getRestart() == None, "Truncation is wrong.")          self.failUnless(so.getRestart() == None, "Truncation is wrong.")
736            
737            self.failUnless(not so.isVerbose(), "initial verbosity flag is wrong.")
738            so.setVerbosityOn()
739            self.failUnless(so.isVerbose(), "verbosity (1) flag is wrong.")
740            so.setVerbosityOff()
741            self.failUnless(not so.isVerbose(), "verbosity (2) flag is wrong.")
742            so.setVerbosity(verbose=True)
743            self.failUnless(so.isVerbose(), "verbosity (3) flag is wrong.")
744            so.setVerbosity(verbose=False)
745            self.failUnless(not so.isVerbose(), "verbosity (4) flag is wrong.")
746    
747          self.failUnless(not so.isSymmetric(), "initial symmetry flag is wrong.")          self.failUnless(not so.isSymmetric(), "initial symmetry flag is wrong.")
748          so.setSymmetryOn()          so.setSymmetryOn()
749          self.failUnless(so.isSymmetric(), "symmetry (1) flag is wrong.")          self.failUnless(so.isSymmetric(), "symmetry (1) flag is wrong.")
# Line 791  class Test_LinearPDE_noLumping(Test_line Line 814  class Test_LinearPDE_noLumping(Test_line
814          self.failUnless(so.getSolverMethod() == 5, "CGS is not set.")          self.failUnless(so.getSolverMethod() == 5, "CGS is not set.")
815          so.setSolverMethod(so.BICGSTAB)          so.setSolverMethod(so.BICGSTAB)
816          self.failUnless(so.getSolverMethod() == 6, "BICGSTAB is not set.")          self.failUnless(so.getSolverMethod() == 6, "BICGSTAB is not set.")
         so.setSolverMethod(so.SSOR)  
         self.failUnless(so.getSolverMethod() == 7, "SSOR is not set.")  
817          so.setSolverMethod(so.GMRES)          so.setSolverMethod(so.GMRES)
818          self.failUnless(so.getSolverMethod() == 11, "GMRES is not set.")          self.failUnless(so.getSolverMethod() == 11, "GMRES is not set.")
819          so.setSolverMethod(so.PRES20)          so.setSolverMethod(so.PRES20)
# Line 801  class Test_LinearPDE_noLumping(Test_line Line 822  class Test_LinearPDE_noLumping(Test_line
822          self.failUnless(so.getSolverMethod() == 13, "LUMPING is not set.")          self.failUnless(so.getSolverMethod() == 13, "LUMPING is not set.")
823          so.setSolverMethod(so.ITERATIVE)          so.setSolverMethod(so.ITERATIVE)
824          self.failUnless(so.getSolverMethod() == 20, "ITERATIVE is not set.")          self.failUnless(so.getSolverMethod() == 20, "ITERATIVE is not set.")
         so.setSolverMethod(so.AMG)  
         self.failUnless(so.getSolverMethod() == 22, "AMG is not set.")  
825          so.setSolverMethod(so.NONLINEAR_GMRES)          so.setSolverMethod(so.NONLINEAR_GMRES)
826          self.failUnless(so.getSolverMethod() == 25, "NONLINEAR_GMRES is not set.")          self.failUnless(so.getSolverMethod() == 25, "NONLINEAR_GMRES is not set.")
827          so.setSolverMethod(so.TFQMR)          so.setSolverMethod(so.TFQMR)
828          self.failUnless(so.getSolverMethod() == 26, "TFQMR is not set.")          self.failUnless(so.getSolverMethod() == 26, "TFQMR is not set.")
829          so.setSolverMethod(so.MINRES)          so.setSolverMethod(so.MINRES)
830          self.failUnless(so.getSolverMethod() == 27, "MINRES is not set.")          self.failUnless(so.getSolverMethod() == 27, "MINRES is not set.")
         so.setSolverMethod(so.GAUSS_SEIDEL)  
         self.failUnless(so.getSolverMethod() == 28, "GAUSS_SEIDEL is not set.")  
831          so.setSolverMethod(so.DEFAULT)          so.setSolverMethod(so.DEFAULT)
832          self.failUnless(so.getSolverMethod() == 0, "DEFAULT is not set.")          self.failUnless(so.getSolverMethod() == 0, "DEFAULT is not set.")
833    
# Line 818  class Test_LinearPDE_noLumping(Test_line Line 835  class Test_LinearPDE_noLumping(Test_line
835          self.failUnlessRaises(ValueError,so.setPreconditioner,-1)          self.failUnlessRaises(ValueError,so.setPreconditioner,-1)
836          so.setPreconditioner(so.ILU0)          so.setPreconditioner(so.ILU0)
837          self.failUnless(so.getPreconditioner() == 8, "ILU0 is not set.")          self.failUnless(so.getPreconditioner() == 8, "ILU0 is not set.")
         so.setPreconditioner(so.SSOR)  
         self.failUnless(so.getPreconditioner() == 7, "SSOR is not set.")  
838          so.setPreconditioner(so.ILUT)          so.setPreconditioner(so.ILUT)
839          self.failUnless(so.getPreconditioner() == 9, "ILUT is not set.")          self.failUnless(so.getPreconditioner() == 9, "ILUT is not set.")
840          so.setPreconditioner(so.JACOBI)          so.setPreconditioner(so.JACOBI)
# Line 832  class Test_LinearPDE_noLumping(Test_line Line 847  class Test_LinearPDE_noLumping(Test_line
847          self.failUnless(so.getPreconditioner() == 28, "GAUSS_SEIDEL is not set.")          self.failUnless(so.getPreconditioner() == 28, "GAUSS_SEIDEL is not set.")
848          so.setPreconditioner(so.RILU)          so.setPreconditioner(so.RILU)
849          self.failUnless(so.getPreconditioner() == 29, "RILU is not set.")          self.failUnless(so.getPreconditioner() == 29, "RILU is not set.")
850            so.setPreconditioner(so.AMLI)
851            self.failUnless(so.getPreconditioner() == 38, "AMLI is not set.")
852          so.setPreconditioner(so.NO_PRECONDITIONER)          so.setPreconditioner(so.NO_PRECONDITIONER)
853          self.failUnless(so.getPreconditioner() == 36, "NO_PRECONDITIONER is not set.")                  self.failUnless(so.getPreconditioner() == 36, "NO_PRECONDITIONER is not set.")        
854    
# Line 843  class Test_LinearPDE_noLumping(Test_line Line 860  class Test_LinearPDE_noLumping(Test_line
860          self.failUnless(so.getCoarsening() == 34, "RUGE_STUEBEN_COARSENING is not set.")          self.failUnless(so.getCoarsening() == 34, "RUGE_STUEBEN_COARSENING is not set.")
861          so.setCoarsening(so.AGGREGATION_COARSENING)          so.setCoarsening(so.AGGREGATION_COARSENING)
862          self.failUnless(so.getCoarsening() == 35, "AGREGATION_COARSENING is not set.")          self.failUnless(so.getCoarsening() == 35, "AGREGATION_COARSENING is not set.")
863            so.setCoarsening(so.STANDARD_COARSENING)
864            self.failUnless(so.getCoarsening() == 39, "STANDARD_COARSENING is not set.")
865          so.setCoarsening(so.DEFAULT)          so.setCoarsening(so.DEFAULT)
866          self.failUnless(so.getCoarsening() == 0, "DEFAULT is not set.")          self.failUnless(so.getCoarsening() == 0, "DEFAULT is not set.")
867    
# Line 924  class Test_LinearPDE_noLumping(Test_line Line 943  class Test_LinearPDE_noLumping(Test_line
943                    
944      def test_setCoefficient_WithIllegalFunctionSpace(self):      def test_setCoefficient_WithIllegalFunctionSpace(self):
945          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
946          self.failUnlessRaises(IllegalCoefficientFunctionSpace,mypde.setValue, C=Vector(0.,FunctionOnBoundary(self.domain)))          self.failUnlessRaises(IllegalCoefficientFunctionSpace, mypde.setValue, C=Vector(0.,FunctionOnBoundary(self.domain)))
947    
948      def test_setCoefficient_WithWrongName(self):      def test_setCoefficient_WithWrongName(self):
949          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 945  class Test_LinearPDE_noLumping(Test_line Line 964  class Test_LinearPDE_noLumping(Test_line
964      def test_attemptToChangeOrderAfterDefinedCoefficient(self):      def test_attemptToChangeOrderAfterDefinedCoefficient(self):
965          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
966          mypde.setValue(D=1.)          mypde.setValue(D=1.)
967          self.failUnlessRaises(RuntimeError,mypde.setReducedOrderOn)          self.failUnlessRaises(RuntimeError, mypde.setReducedOrderOn)
968    
969      def test_reducedOnConfig(self):      def test_reducedOnConfig(self):
970          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
971          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
972          self.failUnlessEqual((mypde.getFunctionSpaceForSolution(),mypde.getFunctionSpaceForEquation()),(ReducedSolution(self.domain),ReducedSolution(self.domain)),"reduced function spaces expected.")          self.failUnlessEqual((mypde.getFunctionSpaceForSolution(), mypde.getFunctionSpaceForEquation()),(ReducedSolution(self.domain),ReducedSolution(self.domain)),"reduced function spaces expected.")
973      #      #
974      #  set coefficients for scalars:      #  set coefficients for scalars:
975      #      #
# Line 959  class Test_LinearPDE_noLumping(Test_line Line 978  class Test_LinearPDE_noLumping(Test_line
978          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
979          mypde.setValue(A=numpy.ones((d,d)))          mypde.setValue(A=numpy.ones((d,d)))
980          coeff=mypde.getCoefficient("A")          coeff=mypde.getCoefficient("A")
981          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,d),Function(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,d),Function(self.domain),1,1))
982      def test_setCoefficient_B_Scalar(self):      def test_setCoefficient_B_Scalar(self):
983          d=self.domain.getDim()          d=self.domain.getDim()
984          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
985          mypde.setValue(B=numpy.ones((d,)))          mypde.setValue(B=numpy.ones((d,)))
986          coeff=mypde.getCoefficient("B")          coeff=mypde.getCoefficient("B")
987          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),Function(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,),Function(self.domain),1,1))
988      def test_setCoefficient_C_Scalar(self):      def test_setCoefficient_C_Scalar(self):
989          d=self.domain.getDim()          d=self.domain.getDim()
990          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
991          mypde.setValue(C=numpy.ones((d,)))          mypde.setValue(C=numpy.ones((d,)))
992          coeff=mypde.getCoefficient("C")          coeff=mypde.getCoefficient("C")
993          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),Function(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,),Function(self.domain),1,1))
994      def test_setCoefficient_D_Scalar(self):      def test_setCoefficient_D_Scalar(self):
995          d=self.domain.getDim()          d=self.domain.getDim()
996          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
997          mypde.setValue(D=1.)          mypde.setValue(D=1.)
998          coeff=mypde.getCoefficient("D")          coeff=mypde.getCoefficient("D")
999          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),Function(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),Function(self.domain),1,1))
1000      def test_setCoefficient_X_Scalar(self):      def test_setCoefficient_X_Scalar(self):
1001          d=self.domain.getDim()          d=self.domain.getDim()
1002          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1003          mypde.setValue(X=numpy.ones((d,)))          mypde.setValue(X=numpy.ones((d,)))
1004          coeff=mypde.getCoefficient("X")          coeff=mypde.getCoefficient("X")
1005          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((d,),Function(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((d,),Function(self.domain),1))
1006      def test_setCoefficient_Y_Scalar(self):      def test_setCoefficient_Y_Scalar(self):
1007          d=self.domain.getDim()          d=self.domain.getDim()
1008          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1009          mypde.setValue(Y=1.)          mypde.setValue(Y=1.)
1010          coeff=mypde.getCoefficient("Y")          coeff=mypde.getCoefficient("Y")
1011          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),Function(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),Function(self.domain),1))
1012      def test_setCoefficient_y_Scalar(self):      def test_setCoefficient_y_Scalar(self):
1013          d=self.domain.getDim()          d=self.domain.getDim()
1014          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1015          mypde.setValue(y=1.)          mypde.setValue(y=1.)
1016          coeff=mypde.getCoefficient("y")          coeff=mypde.getCoefficient("y")
1017          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1))
1018      def test_setCoefficient_d_Scalar(self):      def test_setCoefficient_d_Scalar(self):
1019          d=self.domain.getDim()          d=self.domain.getDim()
1020          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1021          mypde.setValue(d=1.)          mypde.setValue(d=1.)
1022          coeff=mypde.getCoefficient("d")          coeff=mypde.getCoefficient("d")
1023          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1,1))
1024      def test_setCoefficient_d_contact_Scalar(self):      def test_setCoefficient_d_contact_Scalar(self):
1025          d=self.domain.getDim()          d=self.domain.getDim()
1026          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1027          mypde.setValue(d_contact=1.)          mypde.setValue(d_contact=1.)
1028          coeff=mypde.getCoefficient("d_contact")          coeff=mypde.getCoefficient("d_contact")
1029          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1,1))
1030      def test_setCoefficient_y_contact_Scalar(self):      def test_setCoefficient_y_contact_Scalar(self):
1031          d=self.domain.getDim()          d=self.domain.getDim()
1032          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1033          mypde.setValue(y_contact=1.)          mypde.setValue(y_contact=1.)
1034          coeff=mypde.getCoefficient("y_contact")          coeff=mypde.getCoefficient("y_contact")
1035          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1))
1036      def test_setCoefficient_A_reduced_Scalar(self):      def test_setCoefficient_A_reduced_Scalar(self):
1037          d=self.domain.getDim()          d=self.domain.getDim()
1038          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1039          mypde.setValue(A_reduced=numpy.ones((d,d)))          mypde.setValue(A_reduced=numpy.ones((d,d)))
1040          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
1041          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,d),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,d),ReducedFunction(self.domain),1,1))
1042      def test_setCoefficient_B_reduced_Scalar(self):      def test_setCoefficient_B_reduced_Scalar(self):
1043          d=self.domain.getDim()          d=self.domain.getDim()
1044          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1045          mypde.setValue(B_reduced=numpy.ones((d,)))          mypde.setValue(B_reduced=numpy.ones((d,)))
1046          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
1047          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))
1048      def test_setCoefficient_C_reduced_Scalar(self):      def test_setCoefficient_C_reduced_Scalar(self):
1049          d=self.domain.getDim()          d=self.domain.getDim()
1050          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1051          mypde.setValue(C_reduced=numpy.ones((d,)))          mypde.setValue(C_reduced=numpy.ones((d,)))
1052          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
1053          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))
1054      def test_setCoefficient_D_reduced_Scalar(self):      def test_setCoefficient_D_reduced_Scalar(self):
1055          d=self.domain.getDim()          d=self.domain.getDim()
1056          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1057          mypde.setValue(D_reduced=1.)          mypde.setValue(D_reduced=1.)
1058          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
1059          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))
1060      def test_setCoefficient_X_reduced_Scalar(self):      def test_setCoefficient_X_reduced_Scalar(self):
1061          d=self.domain.getDim()          d=self.domain.getDim()
1062          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1063          mypde.setValue(X_reduced=numpy.ones((d,)))          mypde.setValue(X_reduced=numpy.ones((d,)))
1064          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
1065          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1))
1066      def test_setCoefficient_Y_reduced_Scalar(self):      def test_setCoefficient_Y_reduced_Scalar(self):
1067          d=self.domain.getDim()          d=self.domain.getDim()
1068          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1069          mypde.setValue(Y_reduced=1.)          mypde.setValue(Y_reduced=1.)
1070          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
1071          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunction(self.domain),1))
1072      def test_setCoefficient_y_reduced_Scalar(self):      def test_setCoefficient_y_reduced_Scalar(self):
1073          d=self.domain.getDim()          d=self.domain.getDim()
1074          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1075          mypde.setValue(y_reduced=1.)          mypde.setValue(y_reduced=1.)
1076          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
1077          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))
1078      def test_setCoefficient_d_reduced_Scalar(self):      def test_setCoefficient_d_reduced_Scalar(self):
1079          d=self.domain.getDim()          d=self.domain.getDim()
1080          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1081          mypde.setValue(d_reduced=1.)          mypde.setValue(d_reduced=1.)
1082          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
1083          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))
1084      def test_setCoefficient_d_contact_reduced_Scalar(self):      def test_setCoefficient_d_contact_reduced_Scalar(self):
1085          d=self.domain.getDim()          d=self.domain.getDim()
1086          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1087          mypde.setValue(d_contact_reduced=1.)          mypde.setValue(d_contact_reduced=1.)
1088          coeff=mypde.getCoefficient("d_contact_reduced")          coeff=mypde.getCoefficient("d_contact_reduced")
1089          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1,1))
1090      def test_setCoefficient_y_contact_reduced_Scalar(self):      def test_setCoefficient_y_contact_reduced_Scalar(self):
1091          d=self.domain.getDim()          d=self.domain.getDim()
1092          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1093          mypde.setValue(y_contact_reduced=1.)          mypde.setValue(y_contact_reduced=1.)
1094          coeff=mypde.getCoefficient("y_contact_reduced")          coeff=mypde.getCoefficient("y_contact_reduced")
1095          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))
1096      def test_setCoefficient_r_Scalar(self):      def test_setCoefficient_r_Scalar(self):
1097          d=self.domain.getDim()          d=self.domain.getDim()
1098          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1099          mypde.setValue(r=1.)          mypde.setValue(r=1.)
1100          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
1101          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),Solution(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),Solution(self.domain),1))
1102      def test_setCoefficient_q_Scalar(self):      def test_setCoefficient_q_Scalar(self):
1103          d=self.domain.getDim()          d=self.domain.getDim()
1104          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1105          mypde.setValue(q=1.)          mypde.setValue(q=1.)
1106          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
1107          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),Solution(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),Solution(self.domain),1))
1108      def test_setCoefficient_r_Scalar_reducedOn(self):      def test_setCoefficient_r_Scalar_reducedOn(self):
1109          d=self.domain.getDim()          d=self.domain.getDim()
1110          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1111          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
1112          mypde.setValue(r=1.)          mypde.setValue(r=1.)
1113          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
1114          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))
1115      def test_setCoefficient_q_Scalar_reducedOn(self):      def test_setCoefficient_q_Scalar_reducedOn(self):
1116          d=self.domain.getDim()          d=self.domain.getDim()
1117          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1118          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
1119          mypde.setValue(q=1.)          mypde.setValue(q=1.)
1120          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
1121          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))
1122    
1123      def test_setCoefficient_A_reduced_Scalar_usingA(self):      def test_setCoefficient_A_reduced_Scalar_usingA(self):
1124          d=self.domain.getDim()          d=self.domain.getDim()
1125          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1126          mypde.setValue(A=Data(numpy.ones((d,d)),ReducedFunction(self.domain)))          mypde.setValue(A=Data(numpy.ones((d,d)),ReducedFunction(self.domain)))
1127          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
1128          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,d),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,d),ReducedFunction(self.domain),1,1))
1129      def test_setCoefficient_B_reduced_Scalar_usingB(self):      def test_setCoefficient_B_reduced_Scalar_usingB(self):
1130          d=self.domain.getDim()          d=self.domain.getDim()
1131          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1132          mypde.setValue(B=Data(numpy.ones((d,)),ReducedFunction(self.domain)))          mypde.setValue(B=Data(numpy.ones((d,)),ReducedFunction(self.domain)))
1133          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
1134          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))
1135      def test_setCoefficient_C_reduced_Scalar_usingC(self):      def test_setCoefficient_C_reduced_Scalar_usingC(self):
1136          d=self.domain.getDim()          d=self.domain.getDim()
1137          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1138          mypde.setValue(C=Data(numpy.ones((d,)),ReducedFunction(self.domain)))          mypde.setValue(C=Data(numpy.ones((d,)),ReducedFunction(self.domain)))
1139          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
1140          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))
1141      def test_setCoefficient_D_reduced_Scalar_usingD(self):      def test_setCoefficient_D_reduced_Scalar_usingD(self):
1142          d=self.domain.getDim()          d=self.domain.getDim()
1143          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1144          mypde.setValue(D=Scalar(1.,ReducedFunction(self.domain)))          mypde.setValue(D=Scalar(1.,ReducedFunction(self.domain)))
1145          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
1146          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))
1147      def test_setCoefficient_X_reduced_Scalar_usingX(self):      def test_setCoefficient_X_reduced_Scalar_usingX(self):
1148          d=self.domain.getDim()          d=self.domain.getDim()
1149          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1150          mypde.setValue(X_reduced=Data(numpy.ones((d,)),ReducedFunction(self.domain)))          mypde.setValue(X_reduced=Data(numpy.ones((d,)),ReducedFunction(self.domain)))
1151          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
1152          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1))
1153      def test_setCoefficient_Y_reduced_Scalar_usingY(self):      def test_setCoefficient_Y_reduced_Scalar_usingY(self):
1154          d=self.domain.getDim()          d=self.domain.getDim()
1155          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1156          mypde.setValue(Y=Scalar(1.,ReducedFunction(self.domain)))          mypde.setValue(Y=Scalar(1.,ReducedFunction(self.domain)))
1157          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
1158          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunction(self.domain),1))
1159      def test_setCoefficient_y_reduced_Scalar_using_y(self):      def test_setCoefficient_y_reduced_Scalar_using_y(self):
1160          d=self.domain.getDim()          d=self.domain.getDim()
1161          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1162          mypde.setValue(y=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(y=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))
1163          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
1164          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))
1165      def test_setCoefficient_d_reduced_Scalar_using_d(self):      def test_setCoefficient_d_reduced_Scalar_using_d(self):
1166          d=self.domain.getDim()          d=self.domain.getDim()
1167          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1168          mypde.setValue(d=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(d=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))
1169          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
1170          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))
1171      def test_setCoefficient_d_contact_reduced_Scalar_using_d_contact(self):      def test_setCoefficient_d_contact_reduced_Scalar_using_d_contact(self):
1172          d=self.domain.getDim()          d=self.domain.getDim()
1173          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1174          mypde.setValue(d_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))          mypde.setValue(d_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))
1175          coeff=mypde.getCoefficient("d_contact_reduced")          coeff=mypde.getCoefficient("d_contact_reduced")
1176          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1,1))
1177      def test_setCoefficient_y_contact_reduced_Scalar_using_y_contact(self):      def test_setCoefficient_y_contact_reduced_Scalar_using_y_contact(self):
1178          d=self.domain.getDim()          d=self.domain.getDim()
1179          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1180          mypde.setValue(y_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))          mypde.setValue(y_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))
1181          coeff=mypde.getCoefficient("y_contact_reduced")          coeff=mypde.getCoefficient("y_contact_reduced")
1182          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))
1183      #      #
1184      #  set coefficients for systems:      #  set coefficients for systems:
1185      #      #
# Line 1169  class Test_LinearPDE_noLumping(Test_line Line 1188  class Test_LinearPDE_noLumping(Test_line
1188          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1189          mypde.setValue(A=numpy.ones((self.N,d,self.N,d)))          mypde.setValue(A=numpy.ones((self.N,d,self.N,d)))
1190          coeff=mypde.getCoefficient("A")          coeff=mypde.getCoefficient("A")
1191          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N,d),Function(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,d,self.N,d),Function(self.domain),self.N,self.N))
1192      def test_setCoefficient_B_System(self):      def test_setCoefficient_B_System(self):
1193          d=self.domain.getDim()          d=self.domain.getDim()
1194          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1195          mypde.setValue(B=numpy.ones((self.N,d,self.N)))          mypde.setValue(B=numpy.ones((self.N,d,self.N)))
1196          coeff=mypde.getCoefficient("B")          coeff=mypde.getCoefficient("B")
1197          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N),Function(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,d,self.N),Function(self.domain),self.N,self.N))
1198      def test_setCoefficient_C_System(self):      def test_setCoefficient_C_System(self):
1199          d=self.domain.getDim()          d=self.domain.getDim()
1200          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1201          mypde.setValue(C=numpy.ones((self.N,self.N,d)))          mypde.setValue(C=numpy.ones((self.N,self.N,d)))
1202          coeff=mypde.getCoefficient("C")          coeff=mypde.getCoefficient("C")
1203          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N,d),Function(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N,d),Function(self.domain),self.N,self.N))
1204      def test_setCoefficient_D_System(self):      def test_setCoefficient_D_System(self):
1205          d=self.domain.getDim()          d=self.domain.getDim()
1206          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1207          mypde.setValue(D=numpy.ones((self.N,self.N)))          mypde.setValue(D=numpy.ones((self.N,self.N)))
1208          coeff=mypde.getCoefficient("D")          coeff=mypde.getCoefficient("D")
1209          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),Function(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),Function(self.domain),self.N,self.N))
1210      def test_setCoefficient_X_System(self):      def test_setCoefficient_X_System(self):
1211          d=self.domain.getDim()          d=self.domain.getDim()
1212          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1213          mypde.setValue(X=numpy.ones((self.N,d)))          mypde.setValue(X=numpy.ones((self.N,d)))
1214          coeff=mypde.getCoefficient("X")          coeff=mypde.getCoefficient("X")
1215          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,d),Function(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,d),Function(self.domain),self.N))
1216      def test_setCoefficient_Y_System(self):      def test_setCoefficient_Y_System(self):
1217          d=self.domain.getDim()          d=self.domain.getDim()
1218          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1219          mypde.setValue(Y=numpy.ones((self.N,)))          mypde.setValue(Y=numpy.ones((self.N,)))
1220          coeff=mypde.getCoefficient("Y")          coeff=mypde.getCoefficient("Y")
1221          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),Function(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),Function(self.domain),self.N))
1222      def test_setCoefficient_y_System(self):      def test_setCoefficient_y_System(self):
1223          d=self.domain.getDim()          d=self.domain.getDim()
1224          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1225          mypde.setValue(y=numpy.ones((self.N,)))          mypde.setValue(y=numpy.ones((self.N,)))
1226          coeff=mypde.getCoefficient("y")          coeff=mypde.getCoefficient("y")
1227          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),FunctionOnBoundary(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),FunctionOnBoundary(self.domain),self.N))
1228      def test_setCoefficient_d_System(self):      def test_setCoefficient_d_System(self):
1229          d=self.domain.getDim()          d=self.domain.getDim()
1230          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1231          mypde.setValue(d=numpy.ones((self.N,self.N)))          mypde.setValue(d=numpy.ones((self.N,self.N)))
1232          coeff=mypde.getCoefficient("d")          coeff=mypde.getCoefficient("d")
1233          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),FunctionOnBoundary(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),FunctionOnBoundary(self.domain),self.N,self.N))
1234      def test_setCoefficient_d_contact_System(self):      def test_setCoefficient_d_contact_System(self):
1235          d=self.domain.getDim()          d=self.domain.getDim()
1236          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1237          mypde.setValue(d_contact=numpy.ones((self.N,self.N)))          mypde.setValue(d_contact=numpy.ones((self.N,self.N)))
1238          coeff=mypde.getCoefficient("d_contact")          coeff=mypde.getCoefficient("d_contact")
1239          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),FunctionOnContactZero(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),FunctionOnContactZero(self.domain),self.N,self.N))
1240      def test_setCoefficient_y_contact_System(self):      def test_setCoefficient_y_contact_System(self):
1241          d=self.domain.getDim()          d=self.domain.getDim()
1242          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1243          mypde.setValue(y_contact=numpy.ones((self.N,)))          mypde.setValue(y_contact=numpy.ones((self.N,)))
1244          coeff=mypde.getCoefficient("y_contact")          coeff=mypde.getCoefficient("y_contact")
1245          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),FunctionOnContactZero(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),FunctionOnContactZero(self.domain),self.N))
1246      def test_setCoefficient_A_reduced_System(self):      def test_setCoefficient_A_reduced_System(self):
1247          d=self.domain.getDim()          d=self.domain.getDim()
1248          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1249          mypde.setValue(A_reduced=numpy.ones((self.N,d,self.N,d)))          mypde.setValue(A_reduced=numpy.ones((self.N,d,self.N,d)))
1250          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
1251          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N,d),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,d,self.N,d),ReducedFunction(self.domain),self.N,self.N))
1252      def test_setCoefficient_B_reduced_System(self):      def test_setCoefficient_B_reduced_System(self):
1253          d=self.domain.getDim()          d=self.domain.getDim()
1254          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1255          mypde.setValue(B_reduced=numpy.ones((self.N,d,self.N)))          mypde.setValue(B_reduced=numpy.ones((self.N,d,self.N)))
1256          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
1257          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,d,self.N),ReducedFunction(self.domain),self.N,self.N))
1258      def test_setCoefficient_C_reduced_System(self):      def test_setCoefficient_C_reduced_System(self):
1259          d=self.domain.getDim()          d=self.domain.getDim()
1260          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1261          mypde.setValue(C_reduced=numpy.ones((self.N,self.N,d)))          mypde.setValue(C_reduced=numpy.ones((self.N,self.N,d)))
1262          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
1263          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N,d),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N,d),ReducedFunction(self.domain),self.N,self.N))
1264      def test_setCoefficient_D_System_reduced(self):      def test_setCoefficient_D_System_reduced(self):
1265          d=self.domain.getDim()          d=self.domain.getDim()
1266          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1267          mypde.setValue(D_reduced=numpy.ones((self.N,self.N)))          mypde.setValue(D_reduced=numpy.ones((self.N,self.N)))
1268          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
1269          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))
1270      def test_setCoefficient_X_System_reduced(self):      def test_setCoefficient_X_System_reduced(self):
1271          d=self.domain.getDim()          d=self.domain.getDim()
1272          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1273          mypde.setValue(X_reduced=numpy.ones((self.N,d)))          mypde.setValue(X_reduced=numpy.ones((self.N,d)))
1274          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
1275          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,d),ReducedFunction(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,d),ReducedFunction(self.domain),self.N))
1276      def test_setCoefficient_Y_System_reduced(self):      def test_setCoefficient_Y_System_reduced(self):
1277          d=self.domain.getDim()          d=self.domain.getDim()
1278          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1279          mypde.setValue(Y_reduced=numpy.ones((self.N,)))          mypde.setValue(Y_reduced=numpy.ones((self.N,)))
1280          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
1281          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunction(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),ReducedFunction(self.domain),self.N))
1282      def test_setCoefficient_y_System_reduced(self):      def test_setCoefficient_y_System_reduced(self):
1283          d=self.domain.getDim()          d=self.domain.getDim()
1284          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1285          mypde.setValue(y_reduced=numpy.ones((self.N,)))          mypde.setValue(y_reduced=numpy.ones((self.N,)))
1286          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
1287          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunctionOnBoundary(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),ReducedFunctionOnBoundary(self.domain),self.N))
1288      def test_setCoefficient_d_reduced_System(self):      def test_setCoefficient_d_reduced_System(self):
1289          d=self.domain.getDim()          d=self.domain.getDim()
1290          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1291          mypde.setValue(d_reduced=numpy.ones((self.N,self.N)))          mypde.setValue(d_reduced=numpy.ones((self.N,self.N)))
1292          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
1293          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))
1294      def test_setCoefficient_d_contact_reduced_System(self):      def test_setCoefficient_d_contact_reduced_System(self):
1295          d=self.domain.getDim()          d=self.domain.getDim()
1296          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1297          mypde.setValue(d_contact_reduced=numpy.ones((self.N,self.N)))          mypde.setValue(d_contact_reduced=numpy.ones((self.N,self.N)))
1298          coeff=mypde.getCoefficient("d_contact_reduced")          coeff=mypde.getCoefficient("d_contact_reduced")
1299          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnContactZero(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnContactZero(self.domain),self.N,self.N))
1300      def test_setCoefficient_y_contact_reduced_System(self):      def test_setCoefficient_y_contact_reduced_System(self):
1301          d=self.domain.getDim()          d=self.domain.getDim()
1302          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1303          mypde.setValue(y_contact_reduced=numpy.ones((self.N,)))          mypde.setValue(y_contact_reduced=numpy.ones((self.N,)))
1304          coeff=mypde.getCoefficient("y_contact_reduced")          coeff=mypde.getCoefficient("y_contact_reduced")
1305          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunctionOnContactZero(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),ReducedFunctionOnContactZero(self.domain),self.N))
1306      def test_setCoefficient_r_System(self):      def test_setCoefficient_r_System(self):
1307          d=self.domain.getDim()          d=self.domain.getDim()
1308          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1309          mypde.setValue(r=numpy.ones((self.N,)))          mypde.setValue(r=numpy.ones((self.N,)))
1310          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
1311          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((self.N,),Solution(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((self.N,),Solution(self.domain),self.N))
1312      def test_setCoefficient_q_System(self):      def test_setCoefficient_q_System(self):
1313          d=self.domain.getDim()          d=self.domain.getDim()
1314          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1315          mypde.setValue(q=numpy.ones((self.N,)))          mypde.setValue(q=numpy.ones((self.N,)))
1316          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
1317          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((self.N,),Solution(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((self.N,),Solution(self.domain),self.N))
1318      def test_setCoefficient_r_System_reducedOn(self):      def test_setCoefficient_r_System_reducedOn(self):
1319          d=self.domain.getDim()          d=self.domain.getDim()
1320          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1321          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
1322          mypde.setValue(r=numpy.ones((self.N,)))          mypde.setValue(r=numpy.ones((self.N,)))
1323          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
1324          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((self.N,),ReducedSolution(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((self.N,),ReducedSolution(self.domain),self.N))
1325      def test_setCoefficient_q_System_reducedOn(self):      def test_setCoefficient_q_System_reducedOn(self):
1326          d=self.domain.getDim()          d=self.domain.getDim()
1327          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1328          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
1329          mypde.setValue(q=numpy.ones((self.N,)))          mypde.setValue(q=numpy.ones((self.N,)))
1330          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
1331          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((self.N,),ReducedSolution(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((self.N,),ReducedSolution(self.domain),self.N))
1332    
1333      def test_setCoefficient_A_reduced_System_using_A(self):      def test_setCoefficient_A_reduced_System_using_A(self):
1334          d=self.domain.getDim()          d=self.domain.getDim()
1335          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1336          mypde.setValue(A=Data(numpy.ones((self.N,d,self.N,d)),ReducedFunction(self.domain)))          mypde.setValue(A=Data(numpy.ones((self.N,d,self.N,d)),ReducedFunction(self.domain)))
1337          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
1338          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N,d),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,d,self.N,d),ReducedFunction(self.domain),self.N,self.N))
1339      def test_setCoefficient_B_reduced_System_using_B(self):      def test_setCoefficient_B_reduced_System_using_B(self):
1340          d=self.domain.getDim()          d=self.domain.getDim()
1341          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1342          mypde.setValue(B=Data(numpy.ones((self.N,d,self.N)),ReducedFunction(self.domain)))          mypde.setValue(B=Data(numpy.ones((self.N,d,self.N)),ReducedFunction(self.domain)))
1343          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
1344          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,d,self.N),ReducedFunction(self.domain),self.N,self.N))
1345      def test_setCoefficient_C_reduced_System_using_C(self):      def test_setCoefficient_C_reduced_System_using_C(self):
1346          d=self.domain.getDim()          d=self.domain.getDim()
1347          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1348          mypde.setValue(C=Data(numpy.ones((self.N,self.N,d)),ReducedFunction(self.domain)))          mypde.setValue(C=Data(numpy.ones((self.N,self.N,d)),ReducedFunction(self.domain)))
1349          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
1350          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N,d),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N,d),ReducedFunction(self.domain),self.N,self.N))
1351      def test_setCoefficient_D_System_reduced_using_D(self):      def test_setCoefficient_D_System_reduced_using_D(self):
1352          d=self.domain.getDim()          d=self.domain.getDim()
1353          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1354          mypde.setValue(D=Data(numpy.ones((self.N,self.N)),ReducedFunction(self.domain)))          mypde.setValue(D=Data(numpy.ones((self.N,self.N)),ReducedFunction(self.domain)))
1355          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
1356          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))
1357      def test_setCoefficient_X_System_reduced_using_X(self):      def test_setCoefficient_X_System_reduced_using_X(self):
1358          d=self.domain.getDim()          d=self.domain.getDim()
1359          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1360          mypde.setValue(X=Data(numpy.ones((self.N,d)),ReducedFunction(self.domain)))          mypde.setValue(X=Data(numpy.ones((self.N,d)),ReducedFunction(self.domain)))
1361          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
1362          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,d),ReducedFunction(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,d),ReducedFunction(self.domain),self.N))
1363      def test_setCoefficient_Y_System_reduced_using_Y(self):      def test_setCoefficient_Y_System_reduced_using_Y(self):
1364          d=self.domain.getDim()          d=self.domain.getDim()
1365          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1366          mypde.setValue(Y=Data(numpy.ones((self.N,)),ReducedFunction(self.domain)))          mypde.setValue(Y=Data(numpy.ones((self.N,)),ReducedFunction(self.domain)))
1367          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
1368          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunction(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),ReducedFunction(self.domain),self.N))
1369      def test_setCoefficient_y_reduced_System_using_y(self):      def test_setCoefficient_y_reduced_System_using_y(self):
1370          d=self.domain.getDim()          d=self.domain.getDim()
1371          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1372          mypde.setValue(y=Data(numpy.ones((self.N,)),ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(y=Data(numpy.ones((self.N,)),ReducedFunctionOnBoundary(self.domain)))
1373          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
1374          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunctionOnBoundary(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),ReducedFunctionOnBoundary(self.domain),self.N))
1375      def test_setCoefficient_d_reduced_System_using_d(self):      def test_setCoefficient_d_reduced_System_using_d(self):
1376          d=self.domain.getDim()          d=self.domain.getDim()
1377          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1378          mypde.setValue(d=Data(numpy.ones((self.N,self.N)),ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(d=Data(numpy.ones((self.N,self.N)),ReducedFunctionOnBoundary(self.domain)))
1379          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
1380          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))
1381      def test_setCoefficient_d_contact_reduced_System_using_d_contact(self):      def test_setCoefficient_d_contact_reduced_System_using_d_contact(self):
1382          d=self.domain.getDim()          d=self.domain.getDim()
1383          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1384          mypde.setValue(d_contact=Data(numpy.ones((self.N,self.N)),ReducedFunctionOnContactZero(self.domain)))          mypde.setValue(d_contact=Data(numpy.ones((self.N,self.N)),ReducedFunctionOnContactZero(self.domain)))
1385          coeff=mypde.getCoefficient("d_contact_reduced")          coeff=mypde.getCoefficient("d_contact_reduced")
1386          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnContactZero(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnContactZero(self.domain),self.N,self.N))
1387      def test_setCoefficient_y_contact_reduced_System_using_y_contact(self):      def test_setCoefficient_y_contact_reduced_System_using_y_contact(self):
1388          d=self.domain.getDim()          d=self.domain.getDim()
1389          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1390          mypde.setValue(y_contact=Data(numpy.ones((self.N,)),ReducedFunctionOnContactZero(self.domain)))          mypde.setValue(y_contact=Data(numpy.ones((self.N,)),ReducedFunctionOnContactZero(self.domain)))
1391          coeff=mypde.getCoefficient("y_contact_reduced")          coeff=mypde.getCoefficient("y_contact_reduced")
1392          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunctionOnContactZero(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),ReducedFunctionOnContactZero(self.domain),self.N))
1393      def test_resetCoefficient_HomogeneousConstraint(self):      def test_resetCoefficient_HomogeneousConstraint(self):
1394          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1395          x=self.domain.getX()          x=self.domain.getX()
# Line 1383  class Test_LinearPDE_noLumping(Test_line Line 1402  class Test_LinearPDE_noLumping(Test_line
1402      def test_resetCoefficient_InHomogeneousConstraint(self):      def test_resetCoefficient_InHomogeneousConstraint(self):
1403          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1404          mypde.setSymmetryOn()          mypde.setSymmetryOn()
1405        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1406          x=self.domain.getX()          x=self.domain.getX()
1407          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.,r=1,q=whereZero(x[0]))          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.,r=1,q=whereZero(x[0]))
1408          u1=mypde.getSolution(verbose=self.VERBOSE)          u1=mypde.getSolution()
1409          mypde.setValue(Y=2.,D=2)          mypde.setValue(Y=2.,D=2)
1410          u2=mypde.getSolution(verbose=self.VERBOSE)          u2=mypde.getSolution()
1411          self.failUnless(self.check(u2,u1),'first solution is wrong.')          self.failUnless(self.check(u2,u1),'first solution is wrong.')
1412          u2=mypde.getSolution(verbose=self.VERBOSE)          u2=mypde.getSolution()
1413          self.failUnless(self.check(u2,u1),'first solution is wrong.')          self.failUnless(self.check(u2,u1),'first solution is wrong.')
1414          mypde.setValue(r=2,Y=4.)          mypde.setValue(r=2,Y=4.)
1415          u2=mypde.getSolution(verbose=self.VERBOSE)          u2=mypde.getSolution()
1416          self.failUnless(self.check(u2,2*u1),'second solution is wrong.')          self.failUnless(self.check(u2,2*u1),'second solution is wrong.')
1417    
1418        def test_Status(self):
1419            DIM=self.domain.getDim()
1420            x=self.domain.getX()
1421            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1422            mypde.getSolverOptions().setSymmetryOn()
1423            mypde.getSolverOptions().setTolerance(self.RES_TOL)
1424            mypde.setValue(A=kronecker(self.domain), q=whereZero(x[0])+whereZero(x[0]-1.), Y=2.)
1425            x1=self.domain.getX()
1426            u1_ref=x1[0]*(1.-x1[0])
1427            u1=mypde.getSolution()
1428            error1=Lsup(u1-u1_ref)/Lsup(u1_ref)
1429            self.failUnless(mypde.getDomainStatus() == mypde.getSystemStatus(), "status of first pde does not match domain status.")
1430    
1431            self.domain.setX(x*5)
1432    
1433            self.failUnless(mypde.getDomainStatus() != mypde.getSystemStatus(), "status of first pde matches updated domain status.")
1434            x2=self.domain.getX()
1435            u2_ref=x2[0]*(5.-x2[0])
1436            u2=mypde.getSolution()
1437            error2=Lsup(u2-u2_ref)/Lsup(u2_ref)
1438            self.failUnless(error2 <= max(error1,self.RES_TOL)*10., "solution of second PDE wrong.")
1439            self.failUnless(mypde.getDomainStatus() == mypde.getSystemStatus(), "status of second pde does not match domain status.")
1440    
1441      def test_symmetryCheckTrue_System(self):      def test_symmetryCheckTrue_System(self):
1442          d=self.domain.getDim()          d=self.domain.getDim()
1443          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1529  class Test_LinearPDE_noLumping(Test_line Line 1572  class Test_LinearPDE_noLumping(Test_line
1572      def test_symmetryOnIterative(self):      def test_symmetryOnIterative(self):
1573          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1574          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1575          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1576            u=mypde.getSolution()
1577          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1578      def test_symmetryOnDirect(self):      def test_symmetryOnDirect(self):
1579          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1580          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1581          mypde.setSolverMethod(mypde.DIRECT)          mypde.getSolverOptions().setSolverMethod(SolverOptions.DIRECT)
1582          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1583            u=mypde.getSolution()
1584          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1585      def test_PCG_JACOBI(self):      def test_PCG_JACOBI(self):
1586          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1587          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1588          mypde.setSolverMethod(mypde.PCG,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1589          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1590        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1591            u=mypde.getSolution()
1592          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1593        def test_PCG_GAUSS_SEIDEL(self):
1594            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1595            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1596            mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1597        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1598        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1599            u=mypde.getSolution()
1600            self.failUnless(self.check(u,1.),'solution is wrong.')
1601        def test_PCG_AMG(self):
1602            if self.order!=2:
1603                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1604                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1605                mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1606                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1607                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1608                u=mypde.getSolution()
1609                self.failUnless(self.check(u,1.),'solution is wrong.')
1610      def test_PCG_ILU0(self):      def test_PCG_ILU0(self):
1611          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1612          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1613          mypde.setSolverMethod(mypde.PCG,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1614          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1615        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1616            u=mypde.getSolution()
1617          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1618      def test_PCG_RILU(self):      def test_PCG_RILU(self):
1619          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1620          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1621          mypde.setSolverMethod(mypde.PCG,mypde.RILU)      mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1622          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1623        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1624            u=mypde.getSolution()
1625            self.failUnless(self.check(u,1.),'solution is wrong.')
1626        def test_PCG_REC_ILU(self):
1627            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1628            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1629        mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1630        mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1631        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1632            u=mypde.getSolution()
1633          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1634      def test_DIRECT(self):      def test_DIRECT(self):
1635          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1636          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1637          mypde.setSolverMethod(mypde.DIRECT)          mypde.getSolverOptions().setSolverMethod(SolverOptions.DIRECT)
1638          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1639            u=mypde.getSolution()
1640          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1641      def test_BICGSTAB_JACOBI(self):      def test_BICGSTAB_JACOBI(self):
1642          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1643      mypde.setSolverMethod(mypde.BICGSTAB,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1644        mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1645          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1646          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1647            u=mypde.getSolution()
1648          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1649        def test_BICGSTAB_GAUSS_SEIDEL(self):
1650            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1651        mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1652        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1653            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1654            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1655            u=mypde.getSolution()
1656            self.failUnless(self.check(u,1.),'solution is wrong.')
1657        def test_BICGSTAB_AMG(self):
1658            if self.order!=2:
1659                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1660                mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1661                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1662                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1663                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1664                u=mypde.getSolution()
1665                self.failUnless(self.check(u,1.),'solution is wrong.')
1666      def test_BICGSTAB_ILU0(self):      def test_BICGSTAB_ILU0(self):
1667          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1668          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1669      mypde.setSolverMethod(mypde.BICGSTAB,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1670          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1671            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1672            u=mypde.getSolution()
1673          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1674      def test_BICGSTAB_RILU(self):      def test_BICGSTAB_RILU(self):
1675          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1676          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1677      mypde.setSolverMethod(mypde.BICGSTAB,mypde.RILU)      mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1678          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1679            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1680            u=mypde.getSolution()
1681            self.failUnless(self.check(u,1.),'solution is wrong.')
1682        def test_BICGSTAB_REC_ILU(self):
1683            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1684            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1685        mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1686        mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1687            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1688            u=mypde.getSolution()
1689          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1690      def test_MINRES_JACOBI(self):      def test_MINRES_JACOBI(self):
1691          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1692      mypde.setSolverMethod(mypde.MINRES,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1693        mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1694            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1695            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1696            u=mypde.getSolution()
1697            self.failUnless(self.check(u,1.),'solution is wrong.')
1698        def test_MINRES_GAUSS_SEIDEL(self):
1699            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1700        mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1701        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1702          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1703          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1704            u=mypde.getSolution()
1705          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1706        def test_MINRES_AMG(self):
1707            if self.order!=2:
1708                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1709                mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1710                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1711                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1712                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1713                u=mypde.getSolution()
1714                self.failUnless(self.check(u,1.),'solution is wrong.')
1715      def test_MINRES_ILU0(self):      def test_MINRES_ILU0(self):
1716          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1717          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1718      mypde.setSolverMethod(mypde.MINRES,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1719          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1720            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1721            u=mypde.getSolution()
1722          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1723      def test_MINRES_RILU(self):      def test_MINRES_RILU(self):
1724          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1725          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1726      mypde.setSolverMethod(mypde.MINRES,mypde.RILU)      mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1727          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1728            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1729            u=mypde.getSolution()
1730            self.failUnless(self.check(u,1.),'solution is wrong.')
1731        def test_MINRES_REC_ILU(self):
1732            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1733            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1734        mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1735        mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1736            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1737            u=mypde.getSolution()
1738          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1739      def test_TFQMR_JACOBI(self):      def test_TFQMR_JACOBI(self):
1740          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1741      mypde.setSolverMethod(mypde.TFQMR,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1742        mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1743          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1744          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1745            u=mypde.getSolution()
1746          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1747        def test_TFQMR_GAUSS_SEIDEL(self):
1748            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1749        mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1750        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1751            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1752            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1753            u=mypde.getSolution()
1754            self.failUnless(self.check(u,1.),'solution is wrong.')
1755        def test_TFQMR_AMG(self):
1756            if self.order!=2:
1757                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1758                mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1759                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1760                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1761                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1762                u=mypde.getSolution()
1763                self.failUnless(self.check(u,1.),'solution is wrong.')
1764      def test_TFQMR_ILU0(self):      def test_TFQMR_ILU0(self):
1765          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1766          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1767      mypde.setSolverMethod(mypde.TFQMR,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1768          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1769            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1770            u=mypde.getSolution()
1771          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1772      def test_TFQMR_RILU(self):      def test_TFQMR_RILU(self):
1773          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1774          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1775      mypde.setSolverMethod(mypde.TFQMR,mypde.RILU)      mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1776          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1777            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1778            u=mypde.getSolution()
1779            self.failUnless(self.check(u,1.),'solution is wrong.')
1780        def test_TFQMR_REC_ILU(self):
1781            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1782            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1783        mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1784        mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1785            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1786            u=mypde.getSolution()
1787          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1788      def test_PRES20_JACOBI(self):      def test_PRES20_JACOBI(self):
1789          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1790          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1791      mypde.setSolverMethod(mypde.PRES20,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1792          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1793            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1794            u=mypde.getSolution()
1795            self.failUnless(self.check(u,1.),'solution is wrong.')
1796        def test_PRES20_GAUSS_SEIDEL(self):
1797            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1798            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1799        mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1800        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1801            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1802            u=mypde.getSolution()
1803          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1804        def test_PRES20_AMG(self):
1805            if self.order!=2:
1806                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1807                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1808                mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1809                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1810                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1811                u=mypde.getSolution()
1812                self.failUnless(self.check(u,1.),'solution is wrong.')
1813      def test_PRES20_ILU0(self):      def test_PRES20_ILU0(self):
1814          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1815          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1816      mypde.setSolverMethod(mypde.PRES20,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1817          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1818            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1819            u=mypde.getSolution()
1820          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1821      def test_PRES20_RILU(self):      def test_PRES20_RILU(self):
1822          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1823          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1824      mypde.setSolverMethod(mypde.PRES20,mypde.RILU)      mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1825          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1826            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1827            u=mypde.getSolution()
1828            self.failUnless(self.check(u,1.),'solution is wrong.')
1829        def test_PRES20_REC_ILU(self):
1830            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1831            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1832        mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1833        mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1834            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1835            u=mypde.getSolution()
1836          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1837      def test_GMRESnoRestart_JACOBI(self):      def test_GMRESnoRestart_JACOBI(self):
1838          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1839          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1840      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1841          u=mypde.getSolution(verbose=self.VERBOSE,truncation=50)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1842        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1843        mypde.getSolverOptions().setTruncation(50)
1844            u=mypde.getSolution()
1845          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1846        def test_GMRESnoRestart_GAUSS_SEIDEL(self):
1847            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1848            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1849        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1850        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1851        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1852        mypde.getSolverOptions().setTruncation(50)
1853            u=mypde.getSolution()
1854            self.failUnless(self.check(u,1.),'solution is wrong.')
1855        def test_GMRESnoRestart_AMG(self):
1856            if self.order!=2:
1857                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1858                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1859                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1860                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1861                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1862                mypde.getSolverOptions().setTruncation(50)
1863                u=mypde.getSolution()
1864                self.failUnless(self.check(u,1.),'solution is wrong.')
1865      def test_GMRESnoRestart_ILU0(self):      def test_GMRESnoRestart_ILU0(self):
1866          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1867          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1868      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1869          u=mypde.getSolution(verbose=self.VERBOSE,truncation=50)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1870          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1871        mypde.getSolverOptions().setTruncation(50)                        
1872            u=mypde.getSolution()
1873          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1874      def test_GMRESnoRestart_RILU(self):      def test_GMRESnoRestart_RILU(self):
1875          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1876          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1877      mypde.setSolverMethod(mypde.GMRES,mypde.RILU)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1878          u=mypde.getSolution(verbose=self.VERBOSE,truncation=50)      mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1879          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1880        mypde.getSolverOptions().setTruncation(50)
1881            u=mypde.getSolution()
1882            self.failUnless(self.check(u,1.),'solution is wrong.')
1883        def test_GMRESnoRestart_REC_ILU(self):
1884            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1885            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1886        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1887        mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1888        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1889        mypde.getSolverOptions().setTruncation(50)
1890            u=mypde.getSolution()
1891          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1892      def test_GMRES_JACOBI(self):      def test_GMRES_JACOBI(self):
1893          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1894          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1895      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1896          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1897            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1898            u=mypde.getSolution()
1899            self.failUnless(self.check(u,1.),'solution is wrong.')
1900        def test_GMRES_GAUSS_SEIDEL(self):
1901            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1902            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1903        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1904        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1905            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1906            u=mypde.getSolution()
1907          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1908        def test_GMRES_AMG(self):
1909            if self.order!=2:
1910                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1911                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1912                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1913                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1914                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1915                u=mypde.getSolution()
1916                self.failUnless(self.check(u,1.),'solution is wrong.')        
1917      def test_GMRES_ILU0(self):      def test_GMRES_ILU0(self):
1918          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1919          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1920      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1921          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1922            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1923            u=mypde.getSolution()
1924          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1925      def test_GMRES_RILU(self):      def test_GMRES_RILU(self):
1926          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1927          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1928      mypde.setSolverMethod(mypde.GMRES,mypde.RILU)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1929          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1930            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1931            u=mypde.getSolution()
1932            self.failUnless(self.check(u,1.),'solution is wrong.')
1933        def test_GMRES_REC_ILU(self):
1934            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1935            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1936        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1937        mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1938            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1939            u=mypde.getSolution()
1940          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1941      def test_GMRES_truncation_restart_JACOBI(self):      def test_GMRES_truncation_restart_JACOBI(self):
1942          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1943          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1944      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1945          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1946        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1947        mypde.getSolverOptions().setTruncation(10)
1948        mypde.getSolverOptions().setRestart(20)
1949            u=mypde.getSolution()
1950            self.failUnless(self.check(u,1.),'solution is wrong.')
1951        def test_GMRES_truncation_restart_GAUSS_SEIDEL(self):
1952            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1953            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1954        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1955        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
1956        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1957        mypde.getSolverOptions().setTruncation(10)
1958        mypde.getSolverOptions().setRestart(20)
1959            u=mypde.getSolution()
1960          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1961        def test_GMRES_truncation_restart_AMG(self):
1962            if self.order!=2:
1963                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1964                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1965                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1966                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1967                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1968                mypde.getSolverOptions().setTruncation(10)
1969                mypde.getSolverOptions().setRestart(20)
1970                u=mypde.getSolution()
1971                self.failUnless(self.check(u,1.),'solution is wrong.')
1972      def test_GMRES_truncation_restart_ILU0(self):      def test_GMRES_truncation_restart_ILU0(self):
1973          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1974          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1975      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1976          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1977        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1978        mypde.getSolverOptions().setTruncation(10)
1979        mypde.getSolverOptions().setRestart(20)
1980            u=mypde.getSolution()
1981          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1982      def test_GMRES_truncation_restart_RILU(self):      def test_GMRES_truncation_restart_RILU(self):
1983          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1984          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1985      mypde.setSolverMethod(mypde.GMRES,mypde.RILU)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1986          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)      mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1987        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1988        mypde.getSolverOptions().setTruncation(10)
1989        mypde.getSolverOptions().setRestart(20)
1990            u=mypde.getSolution()
1991            self.failUnless(self.check(u,1.),'solution is wrong.')
1992        def test_GMRES_truncation_restart_REC_ILU(self):
1993            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1994            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1995        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1996        mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1997        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1998        mypde.getSolverOptions().setTruncation(10)
1999        mypde.getSolverOptions().setRestart(20)
2000            u=mypde.getSolution()
2001          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2002      #      #
2003      #   solver checks (PDE system)      #   solver checks (PDE system)
# Line 1702  class Test_LinearPDE_noLumping(Test_line Line 2012  class Test_LinearPDE_noLumping(Test_line
2012              Y[i]+=i              Y[i]+=i
2013          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2014          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2015          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2016            u=mypde.getSolution()
2017          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2018      def test_symmetryOnDirect_System(self):      def test_symmetryOnDirect_System(self):
2019          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
# Line 1714  class Test_LinearPDE_noLumping(Test_line Line 2025  class Test_LinearPDE_noLumping(Test_line
2025              Y[i]+=i              Y[i]+=i
2026          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2027          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2028          mypde.setSolverMethod(mypde.DIRECT)          mypde.getSolverOptions().setSolverMethod(SolverOptions.DIRECT)
2029          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2030            u=mypde.getSolution()
2031          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2032      def test_PCG_JACOBI_System(self):      def test_PCG_JACOBI_System(self):
2033          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
# Line 1727  class Test_LinearPDE_noLumping(Test_line Line 2039  class Test_LinearPDE_noLumping(Test_line
2039              Y[i]+=i              Y[i]+=i
2040          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2041          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2042          mypde.setSolverMethod(mypde.PCG,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
2043          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2044            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2045            u=mypde.getSolution()
2046            self.failUnless(self.check(u,1.),'solution is wrong.')
2047        def test_PCG_GAUSS_SEIDEL_System(self):
2048            A=Tensor4(0.,Function(self.domain))
2049            D=Tensor(1.,Function(self.domain))
2050            Y=Vector(self.domain.getDim(),Function(self.domain))
2051            for i in range(self.domain.getDim()):
2052                A[i,:,i,:]=kronecker(self.domain)
2053                D[i,i]+=i
2054                Y[i]+=i
2055            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2056            mypde.setValue(A=A,D=D,Y=Y)
2057            mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
2058        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2059            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2060            u=mypde.getSolution()
2061          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2062        def test_PCG_AMG_System(self):
2063            if self.order!=2:
2064                A=Tensor4(0.,Function(self.domain))
2065                D=Tensor(1.,Function(self.domain))
2066                Y=Vector(self.domain.getDim(),Function(self.domain))
2067                for i in range(self.domain.getDim()):
2068                    A[i,:,i,:]=kronecker(self.domain)
2069                    D[i,i]+=i
2070                    Y[i]+=i
2071                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2072                mypde.setValue(A=A,D=D,Y=Y)
2073                mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
2074                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2075                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2076                u=mypde.getSolution()
2077                self.failUnless(self.check(u,1.),'solution is wrong.')
2078      def test_PCG_ILU0_System(self):      def test_PCG_ILU0_System(self):
2079          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2080          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1740  class Test_LinearPDE_noLumping(Test_line Line 2085  class Test_LinearPDE_noLumping(Test_line
2085              Y[i]+=i              Y[i]+=i
2086          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2087          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2088          mypde.setSolverMethod(mypde.PCG,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
2089          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2090            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2091            u=mypde.getSolution()
2092          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2093      def test_DIRECT_System(self):      def test_DIRECT_System(self):
2094          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
# Line 1753  class Test_LinearPDE_noLumping(Test_line Line 2100  class Test_LinearPDE_noLumping(Test_line
2100              Y[i]+=i              Y[i]+=i
2101          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2102          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2103          mypde.setSolverMethod(mypde.DIRECT)          mypde.getSolverOptions().setSolverMethod(SolverOptions.DIRECT)
2104          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2105            u=mypde.getSolution()
2106          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2107      def test_BICGSTAB_JACOBI_System(self):      def test_BICGSTAB_JACOBI_System(self):
2108          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
# Line 1766  class Test_LinearPDE_noLumping(Test_line Line 2114  class Test_LinearPDE_noLumping(Test_line
2114              Y[i]+=i              Y[i]+=i
2115          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2116          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2117      mypde.setSolverMethod(mypde.BICGSTAB,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
2118          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2119            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2120            u=mypde.getSolution()
2121          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2122        def test_BICGSTAB_GAUSS_SEIDEL_System(self):
2123            A=Tensor4(0.,Function(self.domain))
2124            D=Tensor(1.,Function(self.domain))
2125            Y=Vector(self.domain.getDim(),Function(self.domain))
2126            for i in range(self.domain.getDim()):
2127                A[i,:,i,:]=kronecker(self.domain)
2128                D[i,i]+=i
2129                Y[i]+=i
2130            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2131            mypde.setValue(A=A,D=D,Y=Y)
2132        mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
2133        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2134            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2135            u=mypde.getSolution()
2136            self.failUnless(self.check(u,1.),'solution is wrong.')
2137        def test_BICGSTAB_AMG_System(self):
2138            if self.order!=2:
2139                A=Tensor4(0.,Function(self.domain))
2140                D=Tensor(1.,Function(self.domain))
2141                Y=Vector(self.domain.getDim(),Function(self.domain))
2142                for i in range(self.domain.getDim()):
2143                    A[i,:,i,:]=kronecker(self.domain)
2144                    D[i,i]+=i
2145                    Y[i]+=i
2146                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2147                mypde.setValue(A=A,D=D,Y=Y)
2148                mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
2149                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2150                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2151                u=mypde.getSolution()
2152                self.failUnless(self.check(u,1.),'solution is wrong.')
2153      def test_BICGSTAB_ILU0_System(self):      def test_BICGSTAB_ILU0_System(self):
2154          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2155          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1779  class Test_LinearPDE_noLumping(Test_line Line 2160  class Test_LinearPDE_noLumping(Test_line
2160              Y[i]+=i              Y[i]+=i
2161          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2162          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2163      mypde.setSolverMethod(mypde.BICGSTAB,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
2164          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2165            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2166            u=mypde.getSolution()
2167          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2168      def test_PRES20_JACOBI_System(self):      def test_PRES20_JACOBI_System(self):
2169          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
# Line 1792  class Test_LinearPDE_noLumping(Test_line Line 2175  class Test_LinearPDE_noLumping(Test_line
2175              Y[i]+=i              Y[i]+=i
2176          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2177          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2178      mypde.setSolverMethod(mypde.PRES20,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2179          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2180            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2181            u=mypde.getSolution()
2182          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2183        def test_PRES20_GAUSS_SEIDEL_System(self):
2184            A=Tensor4(0.,Function(self.domain))
2185            D=Tensor(1.,Function(self.domain))
2186            Y=Vector(self.domain.getDim(),Function(self.domain))
2187            for i in range(self.domain.getDim()):
2188                A[i,:,i,:]=kronecker(self.domain)
2189                D[i,i]+=i
2190                Y[i]+=i
2191            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2192            mypde.setValue(A=A,D=D,Y=Y)
2193        mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2194        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2195            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2196            u=mypde.getSolution()
2197            self.failUnless(self.check(u,1.),'solution is wrong.')
2198        def test_PRES20_AMG_System(self):
2199            if self.order!=2:
2200                A=Tensor4(0.,Function(self.domain))
2201                D=Tensor(1.,Function(self.domain))
2202                Y=Vector(self.domain.getDim(),Function(self.domain))
2203                for i in range(self.domain.getDim()):
2204                    A[i,:,i,:]=kronecker(self.domain)
2205                    D[i,i]+=i
2206                    Y[i]+=i
2207                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2208                mypde.setValue(A=A,D=D,Y=Y)
2209                mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2210                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2211                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2212                u=mypde.getSolution()
2213                self.failUnless(self.check(u,1.),'solution is wrong.')
2214      def test_PRES20_ILU0_System(self):      def test_PRES20_ILU0_System(self):
2215          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2216          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1805  class Test_LinearPDE_noLumping(Test_line Line 2221  class Test_LinearPDE_noLumping(Test_line
2221              Y[i]+=i              Y[i]+=i
2222          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2223          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2224      mypde.setSolverMethod(mypde.PRES20,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2225          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2226            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2227            u=mypde.getSolution()
2228          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2229      def test_GMRESnoRestart_JACOBI_System(self):      def test_GMRESnoRestart_JACOBI_System(self):
2230          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
# Line 1818  class Test_LinearPDE_noLumping(Test_line Line 2236  class Test_LinearPDE_noLumping(Test_line
2236              Y[i]+=i              Y[i]+=i
2237          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2238          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2239      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2240        mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2241          # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)          # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
2242          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2243            u=mypde.getSolution()
2244          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2245        def test_GMRESnoRestart_GAUSS_SEIDEL_System(self):
2246            A=Tensor4(0.,Function(self.domain))
2247            D=Tensor(1.,Function(self.domain))
2248            Y=Vector(self.domain.getDim(),Function(self.domain))
2249            for i in range(self.domain.getDim()):
2250                A[i,:,i,:]=kronecker(self.domain)
2251                D[i,i]+=i
2252                Y[i]+=i
2253            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2254            mypde.setValue(A=A,D=D,Y=Y)
2255        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2256        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2257            # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
2258            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2259            u=mypde.getSolution()
2260            self.failUnless(self.check(u,1.),'solution is wrong.')
2261        def test_GMRESnoRestart_AMG_System(self):
2262            if self.order!=2:
2263                A=Tensor4(0.,Function(self.domain))
2264                D=Tensor(1.,Function(self.domain))
2265                Y=Vector(self.domain.getDim(),Function(self.domain))
2266                for i in range(self.domain.getDim()):
2267                    A[i,:,i,:]=kronecker(self.domain)
2268                    D[i,i]+=i
2269                    Y[i]+=i
2270                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2271                mypde.setValue(A=A,D=D,Y=Y)
2272                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2273                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2274                # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
2275                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2276                u=mypde.getSolution()
2277                self.failUnless(self.check(u,1.),'solution is wrong.')
2278      def test_GMRESnoRestart_ILU0_System(self):      def test_GMRESnoRestart_ILU0_System(self):
2279          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2280          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1832  class Test_LinearPDE_noLumping(Test_line Line 2285  class Test_LinearPDE_noLumping(Test_line
2285              Y[i]+=i              Y[i]+=i
2286          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2287          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2288      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2289        mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2290          # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)          # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
2291          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2292            u=mypde.getSolution()
2293          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2294      def test_GMRES_JACOBI_System(self):      def test_GMRES_JACOBI_System(self):
2295          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
# Line 1846  class Test_LinearPDE_noLumping(Test_line Line 2301  class Test_LinearPDE_noLumping(Test_line
2301              Y[i]+=i              Y[i]+=i
2302          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2303          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2304      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2305          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2306            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2307            u=mypde.getSolution()
2308          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2309        def test_GMRES_GAUSS_SEIDEL_System(self):
2310            A=Tensor4(0.,Function(self.domain))
2311            D=Tensor(1.,Function(self.domain))
2312            Y=Vector(self.domain.getDim(),Function(self.domain))
2313            for i in range(self.domain.getDim()):
2314                A[i,:,i,:]=kronecker(self.domain)
2315                D[i,i]+=i
2316                Y[i]+=i
2317            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2318            mypde.setValue(A=A,D=D,Y=Y)
2319        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2320        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2321            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2322            u=mypde.getSolution()
2323            self.failUnless(self.check(u,1.),'solution is wrong.')
2324        def test_GMRES_AMG_System(self):
2325            if self.order!=2:
2326                A=Tensor4(0.,Function(self.domain))
2327                D=Tensor(1.,Function(self.domain))
2328                Y=Vector(self.domain.getDim(),Function(self.domain))
2329                for i in range(self.domain.getDim()):
2330                    A[i,:,i,:]=kronecker(self.domain)
2331                    D[i,i]+=i
2332                    Y[i]+=i
2333                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2334                mypde.setValue(A=A,D=D,Y=Y)
2335                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2336                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2337                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2338                u=mypde.getSolution()
2339                self.failUnless(self.check(u,1.),'solution is wrong.')
2340      def test_GMRES_ILU0_System(self):      def test_GMRES_ILU0_System(self):
2341          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2342          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1859  class Test_LinearPDE_noLumping(Test_line Line 2347  class Test_LinearPDE_noLumping(Test_line
2347              Y[i]+=i              Y[i]+=i
2348          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2349          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2350      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2351          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2352            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2353            u=mypde.getSolution()
2354          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2355      def test_GMRES_truncation_restart_JACOBI_System(self):      def test_GMRES_truncation_restart_JACOBI_System(self):
2356          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
# Line 1872  class Test_LinearPDE_noLumping(Test_line Line 2362  class Test_LinearPDE_noLumping(Test_line
2362              Y[i]+=i              Y[i]+=i
2363          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2364          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2365      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2366          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2367            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2368        mypde.getSolverOptions().setTruncation(10)
2369        mypde.getSolverOptions().setRestart(20)
2370            u=mypde.getSolution()
2371            self.failUnless(self.check(u,1.),'solution is wrong.')
2372        def test_GMRES_truncation_restart_GAUSS_SEIDEL_System(self):
2373            A=Tensor4(0.,Function(self.domain))
2374            D=Tensor(1.,Function(self.domain))
2375            Y=Vector(self.domain.getDim(),Function(self.domain))
2376            for i in range(self.domain.getDim()):
2377                A[i,:,i,:]=kronecker(self.domain)
2378                D[i,i]+=i
2379                Y[i]+=i
2380            mypde=LinearPDE(self.domain,debug=self.DEBUG)
2381            mypde.setValue(A=A,D=D,Y=Y)
2382        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2383        mypde.getSolverOptions().setPreconditioner(SolverOptions.GAUSS_SEIDEL)
2384            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2385        mypde.getSolverOptions().setTruncation(10)
2386        mypde.getSolverOptions().setRestart(20)
2387            u=mypde.getSolution()
2388          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2389        def test_GMRES_truncation_restart_AMG_System(self):
2390            if self.order!=2:
2391                A=Tensor4(0.,Function(self.domain))
2392                D=Tensor(1.,Function(self.domain))
2393                Y=Vector(self.domain.getDim(),Function(self.domain))
2394                for i in range(self.domain.getDim()):
2395                    A[i,:,i,:]=kronecker(self.domain)
2396                    D[i,i]+=i
2397                    Y[i]+=i
2398                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2399                mypde.setValue(A=A,D=D,Y=Y)
2400                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2401                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2402                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2403                mypde.getSolverOptions().setTruncation(10)
2404                mypde.getSolverOptions().setRestart(20)
2405                u=mypde.getSolution()
2406                self.failUnless(self.check(u,1.),'solution is wrong.')
2407      def test_GMRES_truncation_restart_ILU0_System(self):      def test_GMRES_truncation_restart_ILU0_System(self):
2408          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2409          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1885  class Test_LinearPDE_noLumping(Test_line Line 2414  class Test_LinearPDE_noLumping(Test_line
2414              Y[i]+=i              Y[i]+=i
2415          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2416          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2417      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2418          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2419            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2420        mypde.getSolverOptions().setTruncation(10)
2421        mypde.getSolverOptions().setRestart(20)
2422            u=mypde.getSolution()
2423          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2424    
2425  class Test_LinearPDE(Test_LinearPDE_noLumping):  class Test_LinearPDE(Test_LinearPDE_noLumping):
# Line 1894  class Test_LinearPDE(Test_LinearPDE_noLu Line 2427  class Test_LinearPDE(Test_LinearPDE_noLu
2427          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2428          try:          try:
2429             success=True             success=True
2430         mypde.setSolverMethod(mypde.LUMPING)         mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2431             mypde.setValue(A=kronecker(self.domain))             mypde.setValue(A=kronecker(self.domain))
2432             u=mypde.getSolution(verbose=self.VERBOSE)             mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2433               u=mypde.getSolution()    
2434          except ValueError:          except ValueError:
2435             success=False             success=False
2436          self.failUnless(not success,'error should be issued')          self.failUnless(not success,'error should be issued')
# Line 1904  class Test_LinearPDE(Test_LinearPDE_noLu Line 2438  class Test_LinearPDE(Test_LinearPDE_noLu
2438          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2439          try:          try:
2440             success=True             success=True
2441         mypde.setSolverMethod(mypde.LUMPING)         mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2442             mypde.setValue(B=kronecker(self.domain)[0])             mypde.setValue(B=kronecker(self.domain)[0])
2443             u=mypde.getSolution(verbose=self.VERBOSE)             mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2444               u=mypde.getSolution()
2445          except ValueError:          except ValueError:
2446             success=False             success=False
2447          self.failUnless(not success,'error should be issued')          self.failUnless(not success,'error should be issued')
# Line 1914  class Test_LinearPDE(Test_LinearPDE_noLu Line 2449  class Test_LinearPDE(Test_LinearPDE_noLu
2449          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2450          try:          try:
2451             success=True             success=True
2452         mypde.setSolverMethod(mypde.LUMPING)         mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2453             mypde.setValue(C=kronecker(self.domain)[0])             mypde.setValue(C=kronecker(self.domain)[0])
2454             u=mypde.getSolution(verbose=self.VERBOSE)             mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2455               u=mypde.getSolution()
2456          except ValueError:          except ValueError:
2457             success=False             success=False
2458          self.failUnless(not success,'error should be issued')          self.failUnless(not success,'error should be issued')
# Line 1925  class Test_LinearPDE(Test_LinearPDE_noLu Line 2461  class Test_LinearPDE(Test_LinearPDE_noLu
2461          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2462          try:          try:
2463             success=True             success=True
2464         mypde.setSolverMethod(mypde.LUMPING)         mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2465             mypde.setValue(A_reduced=kronecker(self.domain))             mypde.setValue(A_reduced=kronecker(self.domain))
2466             u=mypde.getSolution(verbose=self.VERBOSE)             mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2467               u=mypde.getSolution()
2468          except ValueError:          except ValueError:
2469             success=False             success=False
2470          self.failUnless(not success,'error should be issued')          self.failUnless(not success,'error should be issued')
# Line 1935  class Test_LinearPDE(Test_LinearPDE_noLu Line 2472  class Test_LinearPDE(Test_LinearPDE_noLu
2472          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2473          try:          try:
2474             success=True             success=True
2475         mypde.setSolverMethod(mypde.LUMPING)         mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2476             mypde.setValue(B_reduced=kronecker(self.domain)[0])             mypde.setValue(B_reduced=kronecker(self.domain)[0])
2477             u=mypde.getSolution(verbose=self.VERBOSE)             mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2478               u=mypde.getSolution()
2479          except ValueError:          except ValueError:
2480             success=False             success=False
2481          self.failUnless(not success,'error should be issued')          self.failUnless(not success,'error should be issued')
# Line 1945  class Test_LinearPDE(Test_LinearPDE_noLu Line 2483  class Test_LinearPDE(Test_LinearPDE_noLu
2483          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2484          try:          try:
2485             success=True             success=True
2486         mypde.setSolverMethod(mypde.LUMPING)         mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2487             mypde.setValue(C_reduced=kronecker(self.domain)[0])             mypde.setValue(C_reduced=kronecker(self.domain)[0])
2488             u=mypde.getSolution(verbose=self.VERBOSE)             mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2489               u=mypde.getSolution()
2490          except ValueError:          except ValueError:
2491             success=False             success=False
2492          self.failUnless(not success,'error should be issued')          self.failUnless(not success,'error should be issued')
2493                    
2494      def test_Lumping(self):      def test_Lumping(self):
2495          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2496      mypde.setSolverMethod(mypde.LUMPING)      mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2497          mypde.setValue(D=1.,Y=1.)          mypde.setValue(D=1.,Y=1.)
2498          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2499            u=mypde.getSolution()
2500          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2501      def test_Constrained_Lumping(self):      def test_Constrained_Lumping(self):
2502          x=self.domain.getX()          x=self.domain.getX()
2503          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2504      mypde.setSolverMethod(mypde.LUMPING)      mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2505          mypde.setValue(D=1.,Y=1.,q=whereZero(x[0]),r=1.)          mypde.setValue(D=1.,Y=1.,q=whereZero(x[0]),r=1.)
2506          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2507            u=mypde.getSolution()
2508          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2509    
2510      def test_Lumping_System(self):      def test_Lumping_System(self):
2511          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2512      mypde.setSolverMethod(mypde.LUMPING)      mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2513          mypde.setValue(D=numpy.array([[1.,0.],[0.,2.]]),Y=numpy.array([1.,2.]))          mypde.setValue(D=numpy.array([[1.,0.],[0.,2.]]),Y=numpy.array([1.,2.]))
2514          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2515            u=mypde.getSolution()
2516          self.failUnless(self.check(u,numpy.ones((2,))),'solution is wrong.')          self.failUnless(self.check(u,numpy.ones((2,))),'solution is wrong.')
2517      def test_Constrained_Lumping_System(self):      def test_Constrained_Lumping_System(self):
2518          x=self.domain.getX()          x=self.domain.getX()
2519          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2520      mypde.setSolverMethod(mypde.LUMPING)      mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2521          mypde.setValue(D=numpy.array([[1.,0.],[0.,2.]]),Y=numpy.array([1.,2.]), \          mypde.setValue(D=numpy.array([[1.,0.],[0.,2.]]),Y=numpy.array([1.,2.]), \
2522                         q=whereZero(x[0])*[0.,1],r=[0.,1.])                         q=whereZero(x[0])*[0.,1],r=[0.,1.])
2523          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2524            u=mypde.getSolution()
2525          self.failUnless(self.check(u,numpy.ones((2,))),'solution is wrong.')          self.failUnless(self.check(u,numpy.ones((2,))),'solution is wrong.')
2526    
2527      def test_Lumping_updateRHS(self):      def test_Lumping_updateRHS(self):
2528          x=self.domain.getX()          x=self.domain.getX()
2529          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2530      mypde.setSolverMethod(mypde.LUMPING)      mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2531          mypde.setValue(D=1.,Y=1.)          mypde.setValue(D=1.,Y=1.)
2532          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2533            u=mypde.getSolution()
2534          self.failUnless(self.check(u,1.),'first solution is wrong.')          self.failUnless(self.check(u,1.),'first solution is wrong.')
2535          mypde.setValue(Y=2.,q=whereZero(x[0]),r=2.)          mypde.setValue(Y=2.,q=whereZero(x[0]),r=2.)
2536          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2537            u=mypde.getSolution()
2538          self.failUnless(self.check(u,2.),'second solution is wrong.')          self.failUnless(self.check(u,2.),'second solution is wrong.')
2539      def test_Lumping_updateOperator(self):      def test_Lumping_updateOperator(self):
2540          x=self.domain.getX()          x=self.domain.getX()
2541          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2542      mypde.setSolverMethod(mypde.LUMPING)      mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2543          mypde.setValue(D=1.,Y=1.)          mypde.setValue(D=1.,Y=1.)
2544          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2545            u=mypde.getSolution()
2546          mypde.setValue(D=2.)          mypde.setValue(D=2.)
2547          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2548            u=mypde.getSolution()
2549          self.failUnless(self.check(u,0.5),'second solution is wrong.')          self.failUnless(self.check(u,0.5),'second solution is wrong.')
2550    
2551    
# Line 2012  class Test_TransportPDE(Test_linearPDEs) Line 2559  class Test_TransportPDE(Test_linearPDEs)
2559          self.failUnless(mypde.useBackwardEuler()==False,'backward Euler should not be used')          self.failUnless(mypde.useBackwardEuler()==False,'backward Euler should not be used')
2560      def test_setCoefficient_WithWrongName(self):      def test_setCoefficient_WithWrongName(self):
2561          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2562          self.failUnlessRaises(IllegalCoefficient,mypde.setValue, ROMA=Vector(0.,FunctionOnBoundary(self.domain)))          self.failUnlessRaises(IllegalCoefficient)
2563        mypde.getSolverOptions().setSolverMethod(SolverOptions.setValue, ROMA=Vector(0.,FunctionOnBoundary(self.domain)))
2564    
2565      def test_setCoefficient_WithIllegalFunctionSpace(self):      def test_setCoefficient_WithIllegalFunctionSpace(self):
2566          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2567          self.failUnlessRaises(IllegalCoefficientFunctionSpace,mypde.setValue,C=Vector(0.,FunctionOnBoundary(self.domain)))          self.failUnlessRaises(IllegalCoefficientFunctionSpace)
2568        mypde.getSolverOptions().setSolverMethod(SolverOptions.setValue,C=Vector(0.,FunctionOnBoundary(self.domain)))
2569                    
2570      def test_resetCoefficient_WithWrongShape(self):      def test_resetCoefficient_WithWrongShape(self):
2571          mypde=TransportPDE(self.domain,numEquations=2,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=2,debug=self.DEBUG)
# Line 2026  class Test_TransportPDE(Test_linearPDEs) Line 2575  class Test_TransportPDE(Test_linearPDEs)
2575          mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)
2576          mypde.setInitialSolution(1.)          mypde.setInitialSolution(1.)
2577    
     def test_setInitialSolution_scalar_negative(self):  
         mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)  
         self.failUnlessRaises(RuntimeError,mypde.setInitialSolution,-1.)  
   
2578      def test_setInitialSolution_scalar_WithWrongShape(self):      def test_setInitialSolution_scalar_WithWrongShape(self):
2579          mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)
2580          self.failUnlessRaises(ValueError,mypde.setInitialSolution,[1.,2.])          self.failUnlessRaises(ValueError,mypde.setInitialSolution,[1.,2.])
# Line 2038  class Test_TransportPDE(Test_linearPDEs) Line 2583  class Test_TransportPDE(Test_linearPDEs)
2583          mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)
2584          mypde.setInitialSolution([1.,2.])          mypde.setInitialSolution([1.,2.])
2585    
     def test_setInitialSolution_system(self):  
         mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)  
         self.failUnlessRaises(RuntimeError,mypde.setInitialSolution,[-1,2.])  
   
2586      def test_setInitialSolution_system_WithWrongShape(self):      def test_setInitialSolution_system_WithWrongShape(self):
2587          mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)
2588          self.failUnlessRaises(ValueError,mypde.setInitialSolution,1.)          self.failUnlessRaises(ValueError, mypde.setInitialSolution,1.)
   
2589    
2590      def test_attemptToChangeOrderAfterDefinedCoefficient(self):      def test_attemptToChangeOrderAfterDefinedCoefficient(self):
2591          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
# Line 2055  class Test_TransportPDE(Test_linearPDEs) Line 2595  class Test_TransportPDE(Test_linearPDEs)
2595      def test_reducedOnConfig(self):      def test_reducedOnConfig(self):
2596          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2597          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
2598          self.failUnlessEqual((mypde.getFunctionSpaceForSolution(),mypde.getFunctionSpaceForEquation()),(ReducedSolution(self.domain),ReducedSolution(self.domain)),"reduced function spaces expected.")          self.failUnlessEqual((mypde.getFunctionSpaceForSolution(), mypde.getFunctionSpaceForEquation()),(ReducedSolution(self.domain),ReducedSolution(self.domain)),"reduced function spaces expected.")
2599      #      #
2600      #  set coefficients for scalars:      #  set coefficients for scalars:
2601      #      #
# Line 2064  class Test_TransportPDE(Test_linearPDEs) Line 2604  class Test_TransportPDE(Test_linearPDEs)
2604          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2605          mypde.setValue(M=1.)          mypde.setValue(M=1.)
2606          coeff=mypde.getCoefficient("M")          coeff=mypde.getCoefficient("M")
2607          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),Function(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),Function(self.domain),1,1))
2608      def test_setCoefficient_A_Scalar(self):      def test_setCoefficient_A_Scalar(self):
2609          d=self.domain.getDim()          d=self.domain.getDim()
2610          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2611          mypde.setValue(A=numpy.ones((d,d)))          mypde.setValue(A=numpy.ones((d,d)))
2612          coeff=mypde.getCoefficient("A")          coeff=mypde.getCoefficient("A")
2613          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,d),Function(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,d),Function(self.domain),1,1))
2614      def test_setCoefficient_B_Scalar(self):      def test_setCoefficient_B_Scalar(self):
2615          d=self.domain.getDim()          d=self.domain.getDim()
2616          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2617          mypde.setValue(B=numpy.ones((d,)))          mypde.setValue(B=numpy.ones((d,)))
2618          coeff=mypde.getCoefficient("B")          coeff=mypde.getCoefficient("B")
2619          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),Function(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,),Function(self.domain),1,1))
2620      def test_setCoefficient_C_Scalar(self):      def test_setCoefficient_C_Scalar(self):
2621          d=self.domain.getDim()          d=self.domain.getDim()
2622          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2623          mypde.setValue(C=numpy.ones((d,)))          mypde.setValue(C=numpy.ones((d,)))
2624          coeff=mypde.getCoefficient("C")          coeff=mypde.getCoefficient("C")
2625          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),Function(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,),Function(self.domain),1,1))
2626      def test_setCoefficient_D_Scalar(self):      def test_setCoefficient_D_Scalar(self):
2627          d=self.domain.getDim()          d=self.domain.getDim()
2628          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2629          mypde.setValue(D=1.)          mypde.setValue(D=1.)
2630          coeff=mypde.getCoefficient("D")          coeff=mypde.getCoefficient("D")
2631          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),Function(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),Function(self.domain),1,1))
2632      def test_setCoefficient_X_Scalar(self):      def test_setCoefficient_X_Scalar(self):
2633          d=self.domain.getDim()          d=self.domain.getDim()
2634          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2635          mypde.setValue(X=numpy.ones((d,)))          mypde.setValue(X=numpy.ones((d,)))
2636          coeff=mypde.getCoefficient("X")          coeff=mypde.getCoefficient("X")
2637          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((d,),Function(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((d,),Function(self.domain),1))
2638      def test_setCoefficient_Y_Scalar(self):      def test_setCoefficient_Y_Scalar(self):
2639          d=self.domain.getDim()          d=self.domain.getDim()
2640          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2641          mypde.setValue(Y=1.)          mypde.setValue(Y=1.)
2642          coeff=mypde.getCoefficient("Y")          coeff=mypde.getCoefficient("Y")
2643          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),Function(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),Function(self.domain),1))
2644      def test_setCoefficient_y_Scalar(self):      def test_setCoefficient_y_Scalar(self):
2645          d=self.domain.getDim()          d=self.domain.getDim()
2646          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2647          mypde.setValue(y=1.)          mypde.setValue(y=1.)
2648          coeff=mypde.getCoefficient("y")          coeff=mypde.getCoefficient("y")
2649          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1))
2650      def test_setCoefficient_d_Scalar(self):      def test_setCoefficient_d_Scalar(self):
2651          d=self.domain.getDim()          d=self.domain.getDim()
2652          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2653          mypde.setValue(d=1.)          mypde.setValue(d=1.)
2654          coeff=mypde.getCoefficient("d")          coeff=mypde.getCoefficient("d")
2655          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1,1))
2656      def test_setCoefficient_m_Scalar(self):      def test_setCoefficient_m_Scalar(self):
2657          d=self.domain.getDim()          d=self.domain.getDim()
2658          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2659          mypde.setValue(m=1.)          mypde.setValue(m=1.)
2660          coeff=mypde.getCoefficient("m")          coeff=mypde.getCoefficient("m")
2661          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1,1))
2662      def test_setCoefficient_d_contact_Scalar(self):      def test_setCoefficient_d_contact_Scalar(self):
2663          d=self.domain.getDim()          d=self.domain.getDim()
2664          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2665          mypde.setValue(d_contact=1.)          mypde.setValue(d_contact=1.)
2666          coeff=mypde.getCoefficient("d_contact")          coeff=mypde.getCoefficient("d_contact")
2667          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1,1))
2668      def test_setCoefficient_y_contact_Scalar(self):      def test_setCoefficient_y_contact_Scalar(self):
2669          d=self.domain.getDim()          d=self.domain.getDim()
2670          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2671          mypde.setValue(y_contact=1.)          mypde.setValue(y_contact=1.)
2672          coeff=mypde.getCoefficient("y_contact")          coeff=mypde.getCoefficient("y_contact")
2673          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1))
2674    
2675      def test_setCoefficient_M_reduced_Scalar(self):      def test_setCoefficient_M_reduced_Scalar(self):
2676          d=self.domain.getDim()          d=self.domain.getDim()
2677          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2678          mypde.setValue(M_reduced=1.)          mypde.setValue(M_reduced=1.)
2679          coeff=mypde.getCoefficient("M_reduced")          coeff=mypde.getCoefficient("M_reduced")
2680          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))
2681      def test_setCoefficient_A_reduced_Scalar(self):      def test_setCoefficient_A_reduced_Scalar(self):
2682          d=self.domain.getDim()          d=self.domain.getDim()
2683          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2684          mypde.setValue(A_reduced=numpy.ones((d,d)))          mypde.setValue(A_reduced=numpy.ones((d,d)))
2685          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
2686          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,d),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,d),ReducedFunction(self.domain),1,1))
2687      def test_setCoefficient_B_reduced_Scalar(self):      def test_setCoefficient_B_reduced_Scalar(self):
2688          d=self.domain.getDim()          d=self.domain.getDim()
2689          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2690          mypde.setValue(B_reduced=numpy.ones((d,)))          mypde.setValue(B_reduced=numpy.ones((d,)))
2691          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
2692          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))
2693      def test_setCoefficient_C_reduced_Scalar(self):      def test_setCoefficient_C_reduced_Scalar(self):
2694          d=self.domain.getDim()          d=self.domain.getDim()
2695          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2696          mypde.setValue(C_reduced=numpy.ones((d,)))          mypde.setValue(C_reduced=numpy.ones((d,)))
2697          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
2698          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))
2699      def test_setCoefficient_D_reduced_Scalar(self):      def test_setCoefficient_D_reduced_Scalar(self):
2700          d=self.domain.getDim()          d=self.domain.getDim()
2701          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2702          mypde.setValue(D_reduced=1.)          mypde.setValue(D_reduced=1.)
2703          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
2704          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))
2705      def test_setCoefficient_X_reduced_Scalar(self):      def test_setCoefficient_X_reduced_Scalar(self):
2706          d=self.domain.getDim()          d=self.domain.getDim()
2707          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2708          mypde.setValue(X_reduced=numpy.ones((d,)))          mypde.setValue(X_reduced=numpy.ones((d,)))
2709          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
2710          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1))
2711      def test_setCoefficient_Y_reduced_Scalar(self):      def test_setCoefficient_Y_reduced_Scalar(self):
2712          d=self.domain.getDim()          d=self.domain.getDim()
2713          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2714          mypde.setValue(Y_reduced=1.)          mypde.setValue(Y_reduced=1.)
2715          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
2716          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunction(self.domain),1))
2717      def test_setCoefficient_y_reduced_Scalar(self):      def test_setCoefficient_y_reduced_Scalar(self):
2718          d=self.domain.getDim()          d=self.domain.getDim()
2719          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2720          mypde.setValue(y_reduced=1.)          mypde.setValue(y_reduced=1.)
2721          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
2722          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))
2723      def test_setCoefficient_m_reduced_Scalar(self):      def test_setCoefficient_m_reduced_Scalar(self):
2724          d=self.domain.getDim()          d=self.domain.getDim()
2725          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2726          mypde.setValue(m_reduced=1.)          mypde.setValue(m_reduced=1.)
2727          coeff=mypde.getCoefficient("m_reduced")          coeff=mypde.getCoefficient("m_reduced")
2728          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))
2729      def test_setCoefficient_d_reduced_Scalar(self):      def test_setCoefficient_d_reduced_Scalar(self):
2730          d=self.domain.getDim()          d=self.domain.getDim()
2731          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2732          mypde.setValue(d_reduced=1.)          mypde.setValue(d_reduced=1.)
2733          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
2734          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))
2735      def test_setCoefficient_d_contact_reduced_Scalar(self):      def test_setCoefficient_d_contact_reduced_Scalar(self):
2736          d=self.domain.getDim()          d=self.domain.getDim()
2737          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2738          mypde.setValue(d_contact_reduced=1.)          mypde.setValue(d_contact_reduced=1.)
2739          coeff=mypde.getCoefficient("d_contact_reduced")          coeff=mypde.getCoefficient("d_contact_reduced")
2740          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1,1))
2741      def test_setCoefficient_y_contact_reduced_Scalar(self):      def test_setCoefficient_y_contact_reduced_Scalar(self):
2742          d=self.domain.getDim()          d=self.domain.getDim()
2743          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2744          mypde.setValue(y_contact_reduced=1.)          mypde.setValue(y_contact_reduced=1.)
2745          coeff=mypde.getCoefficient("y_contact_reduced")          coeff=mypde.getCoefficient("y_contact_reduced")
2746          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))
2747      def test_setCoefficient_r_Scalar(self):      def test_setCoefficient_r_Scalar(self):
2748          d=self.domain.getDim()          d=self.domain.getDim()
2749          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
2750          mypde.setValue(r=1.)          mypde.setValue(r=1.)
2751          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
2752          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),Solution(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),Solution(self.domain),1))
2753      def test_setCoefficient_q_Scalar(self):      def test_setCoefficient_q_Scalar(self):
2754          d=self.domain.getDim()          d=self.domain.getDim()
2755          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
2756          mypde.setValue(q=1.)          mypde.setValue(q=1.)
2757          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
2758          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),Solution(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),Solution(self.domain),1))
2759      def test_setCoefficient_r_Scalar_reducedOn(self):      def test_setCoefficient_r_Scalar_reducedOn(self):
2760          d=self.domain.getDim()          d=self.domain.getDim()
2761          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
2762          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
2763          mypde.setValue(r=1.)          mypde.setValue(r=1.)
2764          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
2765          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))
2766      def test_setCoefficient_q_Scalar_reducedOn(self):      def test_setCoefficient_q_Scalar_reducedOn(self):
2767          d=self.domain.getDim()          d=self.domain.getDim()
2768          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
2769          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
2770          mypde.setValue(q=1.)          mypde.setValue(q=1.)
2771          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
2772          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))
2773    
2774      def test_setCoefficient_M_reduced_Scalar_usingM(self):      def test_setCoefficient_M_reduced_Scalar_usingM(self):
2775          d=self.domain.getDim()          d=self.domain.getDim()
2776          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2777          mypde.setValue(M=Scalar(1.,ReducedFunction(self.domain)))          mypde.setValue(M=Scalar(1.,ReducedFunction(self.domain)))
2778          coeff=mypde.getCoefficient("M_reduced")          coeff=mypde.getCoefficient("M_reduced")
2779          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))
2780      def test_setCoefficient_A_reduced_Scalar_usingA(self):      def test_setCoefficient_A_reduced_Scalar_usingA(self):
2781          d=self.domain.getDim()          d=self.domain.getDim()
2782          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2783          mypde.setValue(A=Data(numpy.ones((d,d)),ReducedFunction(self.domain)))          mypde.setValue(A=Data(numpy.ones((d,d)),ReducedFunction(self.domain)))
2784          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
2785          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,d),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,d),ReducedFunction(self.domain),1,1))
2786      def test_setCoefficient_B_reduced_Scalar_usingB(self):      def test_setCoefficient_B_reduced_Scalar_usingB(self):
2787          d=self.domain.getDim()          d=self.domain.getDim()
2788          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2789          mypde.setValue(B=Data(numpy.ones((d,)),ReducedFunction(self.domain)))          mypde.setValue(B=Data(numpy.ones((d,)),ReducedFunction(self.domain)))
2790          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
2791          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))
2792      def test_setCoefficient_C_reduced_Scalar_usingC(self):      def test_setCoefficient_C_reduced_Scalar_usingC(self):
2793          d=self.domain.getDim()          d=self.domain.getDim()
2794          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2795          mypde.setValue(C=Data(numpy.ones((d,)),ReducedFunction(self.domain)))          mypde.setValue(C=Data(numpy.ones((d,)),ReducedFunction(self.domain)))
2796          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
2797          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1,1))
2798      def test_setCoefficient_D_reduced_Scalar_usingD(self):      def test_setCoefficient_D_reduced_Scalar_usingD(self):
2799          d=self.domain.getDim()          d=self.domain.getDim()
2800          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2801          mypde.setValue(D=Scalar(1.,ReducedFunction(self.domain)))          mypde.setValue(D=Scalar(1.,ReducedFunction(self.domain)))
2802          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
2803          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunction(self.domain),1,1))
2804      def test_setCoefficient_X_reduced_Scalar_usingX(self):      def test_setCoefficient_X_reduced_Scalar_usingX(self):
2805          d=self.domain.getDim()          d=self.domain.getDim()
2806          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2807          mypde.setValue(X_reduced=Data(numpy.ones((d,)),ReducedFunction(self.domain)))          mypde.setValue(X_reduced=Data(numpy.ones((d,)),ReducedFunction(self.domain)))
2808          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
2809          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((d,),ReducedFunction(self.domain),1))
2810      def test_setCoefficient_Y_reduced_Scalar_usingY(self):      def test_setCoefficient_Y_reduced_Scalar_usingY(self):
2811          d=self.domain.getDim()          d=self.domain.getDim()
2812          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2813          mypde.setValue(Y=Scalar(1.,ReducedFunction(self.domain)))          mypde.setValue(Y=Scalar(1.,ReducedFunction(self.domain)))
2814          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
2815          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunction(self.domain),1))
2816      def test_setCoefficient_y_reduced_Scalar_using_y(self):      def test_setCoefficient_y_reduced_Scalar_using_y(self):
2817          d=self.domain.getDim()          d=self.domain.getDim()
2818          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2819          mypde.setValue(y=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(y=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))
2820          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
2821          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))
2822      def test_setCoefficient_m_reduced_Scalar_using_m(self):      def test_setCoefficient_m_reduced_Scalar_using_m(self):
2823          d=self.domain.getDim()          d=self.domain.getDim()
2824          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2825          mypde.setValue(d=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(d=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))
2826          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
2827          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))
2828      def test_setCoefficient_d_reduced_Scalar_using_d(self):      def test_setCoefficient_d_reduced_Scalar_using_d(self):
2829          d=self.domain.getDim()          d=self.domain.getDim()
2830          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2831          mypde.setValue(m=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(m=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))
2832          coeff=mypde.getCoefficient("m_reduced")          coeff=mypde.getCoefficient("m_reduced")
2833          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1,1))
2834      def test_setCoefficient_d_contact_reduced_Scalar_using_d_contact(self):      def test_setCoefficient_d_contact_reduced_Scalar_using_d_contact(self):
2835          d=self.domain.getDim()          d=self.domain.getDim()
2836          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2837          mypde.setValue(d_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))          mypde.setValue(d_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))
2838          coeff=mypde.getCoefficient("d_contact_reduced")          coeff=mypde.getCoefficient("d_contact_reduced")
2839          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1,1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1,1))
2840      def test_setCoefficient_y_contact_reduced_Scalar_using_y_contact(self):      def test_setCoefficient_y_contact_reduced_Scalar_using_y_contact(self):
2841          d=self.domain.getDim()          d=self.domain.getDim()
2842          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2843          mypde.setValue(y_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))          mypde.setValue(y_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))
2844          coeff=mypde.getCoefficient("y_contact_reduced")          coeff=mypde.getCoefficient("y_contact_reduced")
2845          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))
2846      #      #
2847      #  set coefficients for systems:      #  set coefficients for systems:
2848      #      #
# Line 2311  class Test_TransportPDE(Test_linearPDEs) Line 2851  class Test_TransportPDE(Test_linearPDEs)
2851          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2852          mypde.setValue(M=numpy.ones((self.N,self.N)))          mypde.setValue(M=numpy.ones((self.N,self.N)))
2853          coeff=mypde.getCoefficient("M")          coeff=mypde.getCoefficient("M")
2854          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),Function(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),Function(self.domain),self.N,self.N))
2855      def test_setCoefficient_A_System(self):      def test_setCoefficient_A_System(self):
2856          d=self.domain.getDim()          d=self.domain.getDim()
2857          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2858          mypde.setValue(A=numpy.ones((self.N,d,self.N,d)))          mypde.setValue(A=numpy.ones((self.N,d,self.N,d)))
2859          coeff=mypde.getCoefficient("A")          coeff=mypde.getCoefficient("A")
2860          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N,d),Function(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,d,self.N,d),Function(self.domain),self.N,self.N))
2861      def test_setCoefficient_B_System(self):      def test_setCoefficient_B_System(self):
2862          d=self.domain.getDim()          d=self.domain.getDim()
2863          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2864          mypde.setValue(B=numpy.ones((self.N,d,self.N)))          mypde.setValue(B=numpy.ones((self.N,d,self.N)))
2865          coeff=mypde.getCoefficient("B")          coeff=mypde.getCoefficient("B")
2866          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N),Function(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,d,self.N),Function(self.domain),self.N,self.N))
2867      def test_setCoefficient_C_System(self):      def test_setCoefficient_C_System(self):
2868          d=self.domain.getDim()          d=self.domain.getDim()
2869          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2870          mypde.setValue(C=numpy.ones((self.N,self.N,d)))          mypde.setValue(C=numpy.ones((self.N,self.N,d)))
2871          coeff=mypde.getCoefficient("C")          coeff=mypde.getCoefficient("C")
2872          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N,d),Function(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N,d),Function(self.domain),self.N,self.N))
2873      def test_setCoefficient_D_System(self):      def test_setCoefficient_D_System(self):
2874          d=self.domain.getDim()          d=self.domain.getDim()
2875          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2876          mypde.setValue(D=numpy.ones((self.N,self.N)))          mypde.setValue(D=numpy.ones((self.N,self.N)))
2877          coeff=mypde.getCoefficient("D")          coeff=mypde.getCoefficient("D")
2878          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),Function(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),Function(self.domain),self.N,self.N))
2879      def test_setCoefficient_X_System(self):      def test_setCoefficient_X_System(self):
2880          d=self.domain.getDim()          d=self.domain.getDim()
2881          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2882          mypde.setValue(X=numpy.ones((self.N,d)))          mypde.setValue(X=numpy.ones((self.N,d)))
2883          coeff=mypde.getCoefficient("X")          coeff=mypde.getCoefficient("X")
2884          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,d),Function(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,d),Function(self.domain),self.N))
2885      def test_setCoefficient_Y_System(self):      def test_setCoefficient_Y_System(self):
2886          d=self.domain.getDim()          d=self.domain.getDim()
2887          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2888          mypde.setValue(Y=numpy.ones((self.N,)))          mypde.setValue(Y=numpy.ones((self.N,)))
2889          coeff=mypde.getCoefficient("Y")          coeff=mypde.getCoefficient("Y")
2890          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),Function(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),Function(self.domain),self.N))
2891      def test_setCoefficient_y_System(self):      def test_setCoefficient_y_System(self):
2892          d=self.domain.getDim()          d=self.domain.getDim()
2893          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2894          mypde.setValue(y=numpy.ones((self.N,)))          mypde.setValue(y=numpy.ones((self.N,)))
2895          coeff=mypde.getCoefficient("y")          coeff=mypde.getCoefficient("y")
2896          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),FunctionOnBoundary(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),FunctionOnBoundary(self.domain),self.N))
2897      def test_setCoefficient_m_System(self):      def test_setCoefficient_m_System(self):
2898          d=self.domain.getDim()          d=self.domain.getDim()
2899          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2900          mypde.setValue(m=numpy.ones((self.N,self.N)))          mypde.setValue(m=numpy.ones((self.N,self.N)))
2901          coeff=mypde.getCoefficient("m")          coeff=mypde.getCoefficient("m")
2902          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),FunctionOnBoundary(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),FunctionOnBoundary(self.domain),self.N,self.N))
2903      def test_setCoefficient_d_System(self):      def test_setCoefficient_d_System(self):
2904          d=self.domain.getDim()          d=self.domain.getDim()
2905          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2906          mypde.setValue(d=numpy.ones((self.N,self.N)))          mypde.setValue(d=numpy.ones((self.N,self.N)))
2907          coeff=mypde.getCoefficient("d")          coeff=mypde.getCoefficient("d")
2908          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),FunctionOnBoundary(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),FunctionOnBoundary(self.domain),self.N,self.N))
2909      def test_setCoefficient_d_contact_System(self):      def test_setCoefficient_d_contact_System(self):
2910          d=self.domain.getDim()          d=self.domain.getDim()
2911          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2912          mypde.setValue(d_contact=numpy.ones((self.N,self.N)))          mypde.setValue(d_contact=numpy.ones((self.N,self.N)))
2913          coeff=mypde.getCoefficient("d_contact")          coeff=mypde.getCoefficient("d_contact")
2914          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),FunctionOnContactZero(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),FunctionOnContactZero(self.domain),self.N,self.N))
2915      def test_setCoefficient_y_contact_System(self):      def test_setCoefficient_y_contact_System(self):
2916          d=self.domain.getDim()          d=self.domain.getDim()
2917          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2918          mypde.setValue(y_contact=numpy.ones((self.N,)))          mypde.setValue(y_contact=numpy.ones((self.N,)))
2919          coeff=mypde.getCoefficient("y_contact")          coeff=mypde.getCoefficient("y_contact")
2920          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),FunctionOnContactZero(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),FunctionOnContactZero(self.domain),self.N))
2921      def test_setCoefficient_M_System_reduced(self):      def test_setCoefficient_M_System_reduced(self):
2922          d=self.domain.getDim()          d=self.domain.getDim()
2923          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2924          mypde.setValue(M_reduced=numpy.ones((self.N,self.N)))          mypde.setValue(M_reduced=numpy.ones((self.N,self.N)))
2925          coeff=mypde.getCoefficient("M_reduced")          coeff=mypde.getCoefficient("M_reduced")
2926          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))
2927      def test_setCoefficient_A_reduced_System(self):      def test_setCoefficient_A_reduced_System(self):
2928          d=self.domain.getDim()          d=self.domain.getDim()
2929          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2930          mypde.setValue(A_reduced=numpy.ones((self.N,d,self.N,d)))          mypde.setValue(A_reduced=numpy.ones((self.N,d,self.N,d)))
2931          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
2932          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N,d),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,d,self.N,d),ReducedFunction(self.domain),self.N,self.N))
2933      def test_setCoefficient_B_reduced_System(self):      def test_setCoefficient_B_reduced_System(self):
2934          d=self.domain.getDim()          d=self.domain.getDim()
2935          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2936          mypde.setValue(B_reduced=numpy.ones((self.N,d,self.N)))          mypde.setValue(B_reduced=numpy.ones((self.N,d,self.N)))
2937          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
2938          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,d,self.N),ReducedFunction(self.domain),self.N,self.N))
2939      def test_setCoefficient_C_reduced_System(self):      def test_setCoefficient_C_reduced_System(self):
2940          d=self.domain.getDim()          d=self.domain.getDim()
2941          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2942          mypde.setValue(C_reduced=numpy.ones((self.N,self.N,d)))          mypde.setValue(C_reduced=numpy.ones((self.N,self.N,d)))
2943          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
2944          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N,d),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N,d),ReducedFunction(self.domain),self.N,self.N))
2945      def test_setCoefficient_D_System_reduced(self):      def test_setCoefficient_D_System_reduced(self):
2946          d=self.domain.getDim()          d=self.domain.getDim()
2947          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2948          mypde.setValue(D_reduced=numpy.ones((self.N,self.N)))          mypde.setValue(D_reduced=numpy.ones((self.N,self.N)))
2949          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
2950          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))
2951      def test_setCoefficient_X_System_reduced(self):      def test_setCoefficient_X_System_reduced(self):
2952          d=self.domain.getDim()          d=self.domain.getDim()
2953          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2954          mypde.setValue(X_reduced=numpy.ones((self.N,d)))          mypde.setValue(X_reduced=numpy.ones((self.N,d)))
2955          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
2956          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,d),ReducedFunction(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,d),ReducedFunction(self.domain),self.N))
2957      def test_setCoefficient_Y_System_reduced(self):      def test_setCoefficient_Y_System_reduced(self):
2958          d=self.domain.getDim()          d=self.domain.getDim()
2959          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2960          mypde.setValue(Y_reduced=numpy.ones((self.N,)))          mypde.setValue(Y_reduced=numpy.ones((self.N,)))
2961          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
2962          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunction(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),ReducedFunction(self.domain),self.N))
2963      def test_setCoefficient_y_System_reduced(self):      def test_setCoefficient_y_System_reduced(self):
2964          d=self.domain.getDim()          d=self.domain.getDim()
2965          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2966          mypde.setValue(y_reduced=numpy.ones((self.N,)))          mypde.setValue(y_reduced=numpy.ones((self.N,)))
2967          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
2968          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunctionOnBoundary(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),ReducedFunctionOnBoundary(self.domain),self.N))
2969      def test_setCoefficient_m_reduced_System(self):      def test_setCoefficient_m_reduced_System(self):
2970          d=self.domain.getDim()          d=self.domain.getDim()
2971          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2972          mypde.setValue(m_reduced=numpy.ones((self.N,self.N)))          mypde.setValue(m_reduced=numpy.ones((self.N,self.N)))
2973          coeff=mypde.getCoefficient("m_reduced")          coeff=mypde.getCoefficient("m_reduced")
2974          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))
2975      def test_setCoefficient_d_reduced_System(self):      def test_setCoefficient_d_reduced_System(self):
2976          d=self.domain.getDim()          d=self.domain.getDim()
2977          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2978          mypde.setValue(d_reduced=numpy.ones((self.N,self.N)))          mypde.setValue(d_reduced=numpy.ones((self.N,self.N)))
2979          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
2980          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))
2981      def test_setCoefficient_d_contact_reduced_System(self):      def test_setCoefficient_d_contact_reduced_System(self):
2982          d=self.domain.getDim()          d=self.domain.getDim()
2983          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2984          mypde.setValue(d_contact_reduced=numpy.ones((self.N,self.N)))          mypde.setValue(d_contact_reduced=numpy.ones((self.N,self.N)))
2985          coeff=mypde.getCoefficient("d_contact_reduced")          coeff=mypde.getCoefficient("d_contact_reduced")
2986          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnContactZero(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnContactZero(self.domain),self.N,self.N))
2987      def test_setCoefficient_y_contact_reduced_System(self):      def test_setCoefficient_y_contact_reduced_System(self):
2988          d=self.domain.getDim()          d=self.domain.getDim()
2989          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2990          mypde.setValue(y_contact_reduced=numpy.ones((self.N,)))          mypde.setValue(y_contact_reduced=numpy.ones((self.N,)))
2991          coeff=mypde.getCoefficient("y_contact_reduced")          coeff=mypde.getCoefficient("y_contact_reduced")
2992          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunctionOnContactZero(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),ReducedFunctionOnContactZero(self.domain),self.N))
2993      def test_setCoefficient_r_System(self):      def test_setCoefficient_r_System(self):
2994          d=self.domain.getDim()          d=self.domain.getDim()
2995          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
2996          mypde.setValue(r=numpy.ones((self.N,)))          mypde.setValue(r=numpy.ones((self.N,)))
2997          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
2998          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((self.N,),Solution(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((self.N,),Solution(self.domain),self.N))
2999      def test_setCoefficient_q_System(self):      def test_setCoefficient_q_System(self):
3000          d=self.domain.getDim()          d=self.domain.getDim()
3001          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
3002          mypde.setValue(q=numpy.ones((self.N,)))          mypde.setValue(q=numpy.ones((self.N,)))
3003          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
3004          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((self.N,),Solution(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((self.N,),Solution(self.domain),self.N))
3005      def test_setCoefficient_r_System_reducedOn(self):      def test_setCoefficient_r_System_reducedOn(self):
3006          d=self.domain.getDim()          d=self.domain.getDim()
3007          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
3008          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
3009          mypde.setValue(r=numpy.ones((self.N,)))          mypde.setValue(r=numpy.ones((self.N,)))
3010          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
3011          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((self.N,),ReducedSolution(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((self.N,),ReducedSolution(self.domain),self.N))
3012      def test_setCoefficient_q_System_reducedOn(self):      def test_setCoefficient_q_System_reducedOn(self):
3013          d=self.domain.getDim()          d=self.domain.getDim()
3014          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
3015          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
3016          mypde.setValue(q=numpy.ones((self.N,)))          mypde.setValue(q=numpy.ones((self.N,)))
3017          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
3018          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((self.N,),ReducedSolution(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((self.N,),ReducedSolution(self.domain),self.N))
3019    
3020      def test_setCoefficient_M_System_reduced_using_D(self):      def test_setCoefficient_M_System_reduced_using_D(self):
3021          d=self.domain.getDim()          d=self.domain.getDim()
3022          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
3023          mypde.setValue(M=Data(numpy.ones((self.N,self.N)),ReducedFunction(self.domain)))          mypde.setValue(M=Data(numpy.ones((self.N,self.N)),ReducedFunction(self.domain)))
3024          coeff=mypde.getCoefficient("M_reduced")          coeff=mypde.getCoefficient("M_reduced")
3025          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))
3026      def test_setCoefficient_A_reduced_System_using_A(self):      def test_setCoefficient_A_reduced_System_using_A(self):
3027          d=self.domain.getDim()          d=self.domain.getDim()
3028          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
3029          mypde.setValue(A=Data(numpy.ones((self.N,d,self.N,d)),ReducedFunction(self.domain)))          mypde.setValue(A=Data(numpy.ones((self.N,d,self.N,d)),ReducedFunction(self.domain)))
3030          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
3031          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N,d),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,d,self.N,d),ReducedFunction(self.domain),self.N,self.N))
3032      def test_setCoefficient_B_reduced_System_using_B(self):      def test_setCoefficient_B_reduced_System_using_B(self):
3033          d=self.domain.getDim()          d=self.domain.getDim()
3034          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
3035          mypde.setValue(B=Data(numpy.ones((self.N,d,self.N)),ReducedFunction(self.domain)))          mypde.setValue(B=Data(numpy.ones((self.N,d,self.N)),ReducedFunction(self.domain)))
3036          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
3037          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,d,self.N),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,d,self.N),ReducedFunction(self.domain),self.N,self.N))
3038      def test_setCoefficient_C_reduced_System_using_C(self):      def test_setCoefficient_C_reduced_System_using_C(self):
3039          d=self.domain.getDim()          d=self.domain.getDim()
3040          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
3041          mypde.setValue(C=Data(numpy.ones((self.N,self.N,d)),ReducedFunction(self.domain)))          mypde.setValue(C=Data(numpy.ones((self.N,self.N,d)),ReducedFunction(self.domain)))
3042          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
3043          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N,d),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N,d),ReducedFunction(self.domain),self.N,self.N))
3044      def test_setCoefficient_D_System_reduced_using_D(self):      def test_setCoefficient_D_System_reduced_using_D(self):
3045          d=self.domain.getDim()          d=self.domain.getDim()
3046          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
3047          mypde.setValue(D=Data(numpy.ones((self.N,self.N)),ReducedFunction(self.domain)))          mypde.setValue(D=Data(numpy.ones((self.N,self.N)),ReducedFunction(self.domain)))
3048          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
3049          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunction(self.domain),self.N,self.N))
3050      def test_setCoefficient_X_System_reduced_using_X(self):      def test_setCoefficient_X_System_reduced_using_X(self):
3051          d=self.domain.getDim()          d=self.domain.getDim()
3052          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
3053          mypde.setValue(X=Data(numpy.ones((self.N,d)),ReducedFunction(self.domain)))          mypde.setValue(X=Data(numpy.ones((self.N,d)),ReducedFunction(self.domain)))
3054          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
3055          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,d),ReducedFunction(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,d),ReducedFunction(self.domain),self.N))
3056      def test_setCoefficient_Y_System_reduced_using_Y(self):      def test_setCoefficient_Y_System_reduced_using_Y(self):
3057          d=self.domain.getDim()          d=self.domain.getDim()
3058          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
3059          mypde.setValue(Y=Data(numpy.ones((self.N,)),ReducedFunction(self.domain)))          mypde.setValue(Y=Data(numpy.ones((self.N,)),ReducedFunction(self.domain)))
3060          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
3061          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunction(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),ReducedFunction(self.domain),self.N))
3062      def test_setCoefficient_y_reduced_System_using_y(self):      def test_setCoefficient_y_reduced_System_using_y(self):
3063          d=self.domain.getDim()          d=self.domain.getDim()
3064          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
3065          mypde.setValue(y=Data(numpy.ones((self.N,)),ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(y=Data(numpy.ones((self.N,)),ReducedFunctionOnBoundary(self.domain)))
3066          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
3067          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunctionOnBoundary(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),ReducedFunctionOnBoundary(self.domain),self.N))
3068      def test_setCoefficient_m_reduced_System_using_m(self):      def test_setCoefficient_m_reduced_System_using_m(self):
3069          d=self.domain.getDim()          d=self.domain.getDim()
3070          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
3071          mypde.setValue(m=Data(numpy.ones((self.N,self.N)),ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(m=Data(numpy.ones((self.N,self.N)),ReducedFunctionOnBoundary(self.domain)))
3072          coeff=mypde.getCoefficient("m_reduced")          coeff=mypde.getCoefficient("m_reduced")
3073          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))
3074      def test_setCoefficient_d_reduced_System_using_d(self):      def test_setCoefficient_d_reduced_System_using_d(self):
3075          d=self.domain.getDim()          d=self.domain.getDim()
3076          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
3077          mypde.setValue(d=Data(numpy.ones((self.N,self.N)),ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(d=Data(numpy.ones((self.N,self.N)),ReducedFunctionOnBoundary(self.domain)))
3078          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
3079          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnBoundary(self.domain),self.N,self.N))
3080      def test_setCoefficient_d_contact_reduced_System_using_d_contact(self):      def test_setCoefficient_d_contact_reduced_System_using_d_contact(self):
3081          d=self.domain.getDim()          d=self.domain.getDim()
3082          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
3083          mypde.setValue(d_contact=Data(numpy.ones((self.N,self.N)),ReducedFunctionOnContactZero(self.domain)))          mypde.setValue(d_contact=Data(numpy.ones((self.N,self.N)),ReducedFunctionOnContactZero(self.domain)))
3084          coeff=mypde.getCoefficient("d_contact_reduced")          coeff=mypde.getCoefficient("d_contact_reduced")
3085          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnContactZero(self.domain),self.N,self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions(), mypde.getNumEquations()),((self.N,self.N),ReducedFunctionOnContactZero(self.domain),self.N,self.N))
3086      def test_setCoefficient_y_contact_reduced_System_using_y_contact(self):      def test_setCoefficient_y_contact_reduced_System_using_y_contact(self):
3087          d=self.domain.getDim()          d=self.domain.getDim()
3088          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
3089          mypde.setValue(y_contact=Data(numpy.ones((self.N,)),ReducedFunctionOnContactZero(self.domain)))          mypde.setValue(y_contact=Data(numpy.ones((self.N,)),ReducedFunctionOnContactZero(self.domain)))
3090          coeff=mypde.getCoefficient("y_contact_reduced")          coeff=mypde.getCoefficient("y_contact_reduced")
3091          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((self.N,),ReducedFunctionOnContactZero(self.domain),self.N))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((self.N,),ReducedFunctionOnContactZero(self.domain),self.N))
3092    
3093      def test_symmetryCheckTrue_System(self):      def test_symmetryCheckTrue_System(self):
3094          d=self.domain.getDim()          d=self.domain.getDim()

Legend:
Removed from v.2470  
changed lines
  Added in v.3103

  ViewVC Help
Powered by ViewVC 1.1.26