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

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

  ViewVC Help
Powered by ViewVC 1.1.26