/[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 2828 by artak, Tue Dec 22 01:24:40 2009 UTC
# Line 1  Line 1 
1    
2  ########################################################  ########################################################
3  #  #
4  # Copyright (c) 2003-2008 by University of Queensland  # Copyright (c) 2003-2009 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-2009 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() == 10, "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    
651          self.failUnless(so.getLevelMax() == 10, "initial  LevelMax is wrong.")          self.failUnless(so.getLevelMax() == 3, "initial  LevelMax is wrong.")
652          self.failUnlessRaises(ValueError,so.setLevelMax,-1)          self.failUnlessRaises(ValueError,so.setLevelMax,-1)
653          so.setLevelMax(3)          so.setLevelMax(20)
654          self.failUnless(so.getLevelMax() == 3, "LevelMax is wrong.")          self.failUnless(so.getLevelMax() == 20, "LevelMax is wrong.")
655    
656          self.failUnless(so.getCoarseningThreshold() == 0.05, "initial  CoarseningThreshold is wrong.")          self.failUnless(so.getCoarseningThreshold() == 0.25, "initial  CoarseningThreshold is wrong.")
657          self.failUnlessRaises(ValueError,so.setCoarseningThreshold,-1)          self.failUnlessRaises(ValueError,so.setCoarseningThreshold,-1)
658          so.setCoarseningThreshold(0.1)          so.setCoarseningThreshold(0.1)
659          self.failUnless(so.getCoarseningThreshold() == 0.1, "CoarseningThreshold is wrong.")          self.failUnless(so.getCoarseningThreshold() == 0.1, "CoarseningThreshold is wrong.")
660            
661            self.failUnless(so.getMinCoarseMatrixSize() == 500, "initial  Minimum Coarse Matrix Size is wrong.")
662            self.failUnlessRaises(ValueError,so.setMinCoarseMatrixSize,-1)
663            so.setMinCoarseMatrixSize(1000)
664            self.failUnless(so.getMinCoarseMatrixSize() == 1000, "Minimum Coarse Matrix Size is wrong.")
665    
666          self.failUnless(so.getNumSweeps() == 2, "initial  Sweeps is wrong.")          self.failUnless(so.getNumSweeps() == 2, "initial  Sweeps is wrong.")
667          self.failUnlessRaises(ValueError,so.setNumSweeps,-1)          self.failUnlessRaises(ValueError,so.setNumSweeps,-1)
# Line 699  class Test_LinearPDE_noLumping(Test_line Line 709  class Test_LinearPDE_noLumping(Test_line
709          self.failUnless(so.getRelaxationFactor() == 0.1, "Relaxation is wrong.")          self.failUnless(so.getRelaxationFactor() == 0.1, "Relaxation is wrong.")
710    
711    
712          self.failUnless(so.getIterMax() == 10000, "initial IterMax is wrong.")          self.failUnless(so.getIterMax() == 100000, "initial IterMax is wrong.")
713          self.failUnlessRaises(ValueError,so.setIterMax,0)          self.failUnlessRaises(ValueError,so.setIterMax,0)
714          so.setIterMax(11)          so.setIterMax(11)
715          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 730  class Test_LinearPDE_noLumping(Test_line
730          self.failUnless(so.getRestart() == 14, "Truncation is wrong.")          self.failUnless(so.getRestart() == 14, "Truncation is wrong.")
731          so.setRestart(None)          so.setRestart(None)
732          self.failUnless(so.getRestart() == None, "Truncation is wrong.")          self.failUnless(so.getRestart() == None, "Truncation is wrong.")
733            
734            self.failUnless(not so.isVerbose(), "initial verbosity flag is wrong.")
735            so.setVerbosityOn()
736            self.failUnless(so.isVerbose(), "verbosity (1) flag is wrong.")
737            so.setVerbosityOff()
738            self.failUnless(not so.isVerbose(), "verbosity (2) flag is wrong.")
739            so.setVerbosity(verbose=True)
740            self.failUnless(so.isVerbose(), "verbosity (3) flag is wrong.")
741            so.setVerbosity(verbose=False)
742            self.failUnless(not so.isVerbose(), "verbosity (4) flag is wrong.")
743    
744          self.failUnless(not so.isSymmetric(), "initial symmetry flag is wrong.")          self.failUnless(not so.isSymmetric(), "initial symmetry flag is wrong.")
745          so.setSymmetryOn()          so.setSymmetryOn()
746          self.failUnless(so.isSymmetric(), "symmetry (1) flag is wrong.")          self.failUnless(so.isSymmetric(), "symmetry (1) flag is wrong.")
# Line 843  class Test_LinearPDE_noLumping(Test_line Line 863  class Test_LinearPDE_noLumping(Test_line
863          self.failUnless(so.getCoarsening() == 34, "RUGE_STUEBEN_COARSENING is not set.")          self.failUnless(so.getCoarsening() == 34, "RUGE_STUEBEN_COARSENING is not set.")
864          so.setCoarsening(so.AGGREGATION_COARSENING)          so.setCoarsening(so.AGGREGATION_COARSENING)
865          self.failUnless(so.getCoarsening() == 35, "AGREGATION_COARSENING is not set.")          self.failUnless(so.getCoarsening() == 35, "AGREGATION_COARSENING is not set.")
866            so.setCoarsening(so.STANDARD_COARSENING)
867            self.failUnless(so.getCoarsening() == 39, "STANDARD_COARSENING is not set.")
868          so.setCoarsening(so.DEFAULT)          so.setCoarsening(so.DEFAULT)
869          self.failUnless(so.getCoarsening() == 0, "DEFAULT is not set.")          self.failUnless(so.getCoarsening() == 0, "DEFAULT is not set.")
870    
# Line 924  class Test_LinearPDE_noLumping(Test_line Line 946  class Test_LinearPDE_noLumping(Test_line
946                    
947      def test_setCoefficient_WithIllegalFunctionSpace(self):      def test_setCoefficient_WithIllegalFunctionSpace(self):
948          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
949          self.failUnlessRaises(IllegalCoefficientFunctionSpace,mypde.setValue, C=Vector(0.,FunctionOnBoundary(self.domain)))          self.failUnlessRaises(IllegalCoefficientFunctionSpace, mypde.setValue, C=Vector(0.,FunctionOnBoundary(self.domain)))
950    
951      def test_setCoefficient_WithWrongName(self):      def test_setCoefficient_WithWrongName(self):
952          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 945  class Test_LinearPDE_noLumping(Test_line Line 967  class Test_LinearPDE_noLumping(Test_line
967      def test_attemptToChangeOrderAfterDefinedCoefficient(self):      def test_attemptToChangeOrderAfterDefinedCoefficient(self):
968          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
969          mypde.setValue(D=1.)          mypde.setValue(D=1.)
970          self.failUnlessRaises(RuntimeError,mypde.setReducedOrderOn)          self.failUnlessRaises(RuntimeError, mypde.setReducedOrderOn)
971    
972      def test_reducedOnConfig(self):      def test_reducedOnConfig(self):
973          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
974          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
975          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.")
976      #      #
977      #  set coefficients for scalars:      #  set coefficients for scalars:
978      #      #
# Line 959  class Test_LinearPDE_noLumping(Test_line Line 981  class Test_LinearPDE_noLumping(Test_line
981          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
982          mypde.setValue(A=numpy.ones((d,d)))          mypde.setValue(A=numpy.ones((d,d)))
983          coeff=mypde.getCoefficient("A")          coeff=mypde.getCoefficient("A")
984          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))
985      def test_setCoefficient_B_Scalar(self):      def test_setCoefficient_B_Scalar(self):
986          d=self.domain.getDim()          d=self.domain.getDim()
987          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
988          mypde.setValue(B=numpy.ones((d,)))          mypde.setValue(B=numpy.ones((d,)))
989          coeff=mypde.getCoefficient("B")          coeff=mypde.getCoefficient("B")
990          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))
991      def test_setCoefficient_C_Scalar(self):      def test_setCoefficient_C_Scalar(self):
992          d=self.domain.getDim()          d=self.domain.getDim()
993          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
994          mypde.setValue(C=numpy.ones((d,)))          mypde.setValue(C=numpy.ones((d,)))
995          coeff=mypde.getCoefficient("C")          coeff=mypde.getCoefficient("C")
996          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))
997      def test_setCoefficient_D_Scalar(self):      def test_setCoefficient_D_Scalar(self):
998          d=self.domain.getDim()          d=self.domain.getDim()
999          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1000          mypde.setValue(D=1.)          mypde.setValue(D=1.)
1001          coeff=mypde.getCoefficient("D")          coeff=mypde.getCoefficient("D")
1002          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))
1003      def test_setCoefficient_X_Scalar(self):      def test_setCoefficient_X_Scalar(self):
1004          d=self.domain.getDim()          d=self.domain.getDim()
1005          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1006          mypde.setValue(X=numpy.ones((d,)))          mypde.setValue(X=numpy.ones((d,)))
1007          coeff=mypde.getCoefficient("X")          coeff=mypde.getCoefficient("X")
1008          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))
1009      def test_setCoefficient_Y_Scalar(self):      def test_setCoefficient_Y_Scalar(self):
1010          d=self.domain.getDim()          d=self.domain.getDim()
1011          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1012          mypde.setValue(Y=1.)          mypde.setValue(Y=1.)
1013          coeff=mypde.getCoefficient("Y")          coeff=mypde.getCoefficient("Y")
1014          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),Function(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),Function(self.domain),1))
1015      def test_setCoefficient_y_Scalar(self):      def test_setCoefficient_y_Scalar(self):
1016          d=self.domain.getDim()          d=self.domain.getDim()
1017          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1018          mypde.setValue(y=1.)          mypde.setValue(y=1.)
1019          coeff=mypde.getCoefficient("y")          coeff=mypde.getCoefficient("y")
1020          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1))
1021      def test_setCoefficient_d_Scalar(self):      def test_setCoefficient_d_Scalar(self):
1022          d=self.domain.getDim()          d=self.domain.getDim()
1023          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1024          mypde.setValue(d=1.)          mypde.setValue(d=1.)
1025          coeff=mypde.getCoefficient("d")          coeff=mypde.getCoefficient("d")
1026          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))
1027      def test_setCoefficient_d_contact_Scalar(self):      def test_setCoefficient_d_contact_Scalar(self):
1028          d=self.domain.getDim()          d=self.domain.getDim()
1029          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1030          mypde.setValue(d_contact=1.)          mypde.setValue(d_contact=1.)
1031          coeff=mypde.getCoefficient("d_contact")          coeff=mypde.getCoefficient("d_contact")
1032          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))
1033      def test_setCoefficient_y_contact_Scalar(self):      def test_setCoefficient_y_contact_Scalar(self):
1034          d=self.domain.getDim()          d=self.domain.getDim()
1035          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1036          mypde.setValue(y_contact=1.)          mypde.setValue(y_contact=1.)
1037          coeff=mypde.getCoefficient("y_contact")          coeff=mypde.getCoefficient("y_contact")
1038          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1))
1039      def test_setCoefficient_A_reduced_Scalar(self):      def test_setCoefficient_A_reduced_Scalar(self):
1040          d=self.domain.getDim()          d=self.domain.getDim()
1041          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1042          mypde.setValue(A_reduced=numpy.ones((d,d)))          mypde.setValue(A_reduced=numpy.ones((d,d)))
1043          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
1044          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))
1045      def test_setCoefficient_B_reduced_Scalar(self):      def test_setCoefficient_B_reduced_Scalar(self):
1046          d=self.domain.getDim()          d=self.domain.getDim()
1047          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1048          mypde.setValue(B_reduced=numpy.ones((d,)))          mypde.setValue(B_reduced=numpy.ones((d,)))
1049          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
1050          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))
1051      def test_setCoefficient_C_reduced_Scalar(self):      def test_setCoefficient_C_reduced_Scalar(self):
1052          d=self.domain.getDim()          d=self.domain.getDim()
1053          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1054          mypde.setValue(C_reduced=numpy.ones((d,)))          mypde.setValue(C_reduced=numpy.ones((d,)))
1055          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
1056          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))
1057      def test_setCoefficient_D_reduced_Scalar(self):      def test_setCoefficient_D_reduced_Scalar(self):
1058          d=self.domain.getDim()          d=self.domain.getDim()
1059          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1060          mypde.setValue(D_reduced=1.)          mypde.setValue(D_reduced=1.)
1061          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
1062          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))
1063      def test_setCoefficient_X_reduced_Scalar(self):      def test_setCoefficient_X_reduced_Scalar(self):
1064          d=self.domain.getDim()          d=self.domain.getDim()
1065          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1066          mypde.setValue(X_reduced=numpy.ones((d,)))          mypde.setValue(X_reduced=numpy.ones((d,)))
1067          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
1068          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))
1069      def test_setCoefficient_Y_reduced_Scalar(self):      def test_setCoefficient_Y_reduced_Scalar(self):
1070          d=self.domain.getDim()          d=self.domain.getDim()
1071          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1072          mypde.setValue(Y_reduced=1.)          mypde.setValue(Y_reduced=1.)
1073          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
1074          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunction(self.domain),1))
1075      def test_setCoefficient_y_reduced_Scalar(self):      def test_setCoefficient_y_reduced_Scalar(self):
1076          d=self.domain.getDim()          d=self.domain.getDim()
1077          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1078          mypde.setValue(y_reduced=1.)          mypde.setValue(y_reduced=1.)
1079          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
1080          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))
1081      def test_setCoefficient_d_reduced_Scalar(self):      def test_setCoefficient_d_reduced_Scalar(self):
1082          d=self.domain.getDim()          d=self.domain.getDim()
1083          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1084          mypde.setValue(d_reduced=1.)          mypde.setValue(d_reduced=1.)
1085          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
1086          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))
1087      def test_setCoefficient_d_contact_reduced_Scalar(self):      def test_setCoefficient_d_contact_reduced_Scalar(self):
1088          d=self.domain.getDim()          d=self.domain.getDim()
1089          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1090          mypde.setValue(d_contact_reduced=1.)          mypde.setValue(d_contact_reduced=1.)
1091          coeff=mypde.getCoefficient("d_contact_reduced")          coeff=mypde.getCoefficient("d_contact_reduced")
1092          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))
1093      def test_setCoefficient_y_contact_reduced_Scalar(self):      def test_setCoefficient_y_contact_reduced_Scalar(self):
1094          d=self.domain.getDim()          d=self.domain.getDim()
1095          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1096          mypde.setValue(y_contact_reduced=1.)          mypde.setValue(y_contact_reduced=1.)
1097          coeff=mypde.getCoefficient("y_contact_reduced")          coeff=mypde.getCoefficient("y_contact_reduced")
1098          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))
1099      def test_setCoefficient_r_Scalar(self):      def test_setCoefficient_r_Scalar(self):
1100          d=self.domain.getDim()          d=self.domain.getDim()
1101          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1102          mypde.setValue(r=1.)          mypde.setValue(r=1.)
1103          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
1104          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),Solution(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),Solution(self.domain),1))
1105      def test_setCoefficient_q_Scalar(self):      def test_setCoefficient_q_Scalar(self):
1106          d=self.domain.getDim()          d=self.domain.getDim()
1107          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1108          mypde.setValue(q=1.)          mypde.setValue(q=1.)
1109          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
1110          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),Solution(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),Solution(self.domain),1))
1111      def test_setCoefficient_r_Scalar_reducedOn(self):      def test_setCoefficient_r_Scalar_reducedOn(self):
1112          d=self.domain.getDim()          d=self.domain.getDim()
1113          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1114          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
1115          mypde.setValue(r=1.)          mypde.setValue(r=1.)
1116          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
1117          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))
1118      def test_setCoefficient_q_Scalar_reducedOn(self):      def test_setCoefficient_q_Scalar_reducedOn(self):
1119          d=self.domain.getDim()          d=self.domain.getDim()
1120          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1121          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
1122          mypde.setValue(q=1.)          mypde.setValue(q=1.)
1123          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
1124          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))
1125    
1126      def test_setCoefficient_A_reduced_Scalar_usingA(self):      def test_setCoefficient_A_reduced_Scalar_usingA(self):
1127          d=self.domain.getDim()          d=self.domain.getDim()
1128          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1129          mypde.setValue(A=Data(numpy.ones((d,d)),ReducedFunction(self.domain)))          mypde.setValue(A=Data(numpy.ones((d,d)),ReducedFunction(self.domain)))
1130          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
1131          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))
1132      def test_setCoefficient_B_reduced_Scalar_usingB(self):      def test_setCoefficient_B_reduced_Scalar_usingB(self):
1133          d=self.domain.getDim()          d=self.domain.getDim()
1134          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1135          mypde.setValue(B=Data(numpy.ones((d,)),ReducedFunction(self.domain)))          mypde.setValue(B=Data(numpy.ones((d,)),ReducedFunction(self.domain)))
1136          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
1137          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))
1138      def test_setCoefficient_C_reduced_Scalar_usingC(self):      def test_setCoefficient_C_reduced_Scalar_usingC(self):
1139          d=self.domain.getDim()          d=self.domain.getDim()
1140          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1141          mypde.setValue(C=Data(numpy.ones((d,)),ReducedFunction(self.domain)))          mypde.setValue(C=Data(numpy.ones((d,)),ReducedFunction(self.domain)))
1142          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
1143          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))
1144      def test_setCoefficient_D_reduced_Scalar_usingD(self):      def test_setCoefficient_D_reduced_Scalar_usingD(self):
1145          d=self.domain.getDim()          d=self.domain.getDim()
1146          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1147          mypde.setValue(D=Scalar(1.,ReducedFunction(self.domain)))          mypde.setValue(D=Scalar(1.,ReducedFunction(self.domain)))
1148          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
1149          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))
1150      def test_setCoefficient_X_reduced_Scalar_usingX(self):      def test_setCoefficient_X_reduced_Scalar_usingX(self):
1151          d=self.domain.getDim()          d=self.domain.getDim()
1152          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1153          mypde.setValue(X_reduced=Data(numpy.ones((d,)),ReducedFunction(self.domain)))          mypde.setValue(X_reduced=Data(numpy.ones((d,)),ReducedFunction(self.domain)))
1154          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
1155          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))
1156      def test_setCoefficient_Y_reduced_Scalar_usingY(self):      def test_setCoefficient_Y_reduced_Scalar_usingY(self):
1157          d=self.domain.getDim()          d=self.domain.getDim()
1158          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1159          mypde.setValue(Y=Scalar(1.,ReducedFunction(self.domain)))          mypde.setValue(Y=Scalar(1.,ReducedFunction(self.domain)))
1160          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
1161          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunction(self.domain),1))
1162      def test_setCoefficient_y_reduced_Scalar_using_y(self):      def test_setCoefficient_y_reduced_Scalar_using_y(self):
1163          d=self.domain.getDim()          d=self.domain.getDim()
1164          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1165          mypde.setValue(y=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(y=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))
1166          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
1167          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))
1168      def test_setCoefficient_d_reduced_Scalar_using_d(self):      def test_setCoefficient_d_reduced_Scalar_using_d(self):
1169          d=self.domain.getDim()          d=self.domain.getDim()
1170          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1171          mypde.setValue(d=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(d=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))
1172          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
1173          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))
1174      def test_setCoefficient_d_contact_reduced_Scalar_using_d_contact(self):      def test_setCoefficient_d_contact_reduced_Scalar_using_d_contact(self):
1175          d=self.domain.getDim()          d=self.domain.getDim()
1176          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1177          mypde.setValue(d_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))          mypde.setValue(d_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))
1178          coeff=mypde.getCoefficient("d_contact_reduced")          coeff=mypde.getCoefficient("d_contact_reduced")
1179          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))
1180      def test_setCoefficient_y_contact_reduced_Scalar_using_y_contact(self):      def test_setCoefficient_y_contact_reduced_Scalar_using_y_contact(self):
1181          d=self.domain.getDim()          d=self.domain.getDim()
1182          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1183          mypde.setValue(y_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))          mypde.setValue(y_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))
1184          coeff=mypde.getCoefficient("y_contact_reduced")          coeff=mypde.getCoefficient("y_contact_reduced")
1185          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))
1186      #      #
1187      #  set coefficients for systems:      #  set coefficients for systems:
1188      #      #
# Line 1169  class Test_LinearPDE_noLumping(Test_line Line 1191  class Test_LinearPDE_noLumping(Test_line
1191          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1192          mypde.setValue(A=numpy.ones((self.N,d,self.N,d)))          mypde.setValue(A=numpy.ones((self.N,d,self.N,d)))
1193          coeff=mypde.getCoefficient("A")          coeff=mypde.getCoefficient("A")
1194          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))
1195      def test_setCoefficient_B_System(self):      def test_setCoefficient_B_System(self):
1196          d=self.domain.getDim()          d=self.domain.getDim()
1197          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1198          mypde.setValue(B=numpy.ones((self.N,d,self.N)))          mypde.setValue(B=numpy.ones((self.N,d,self.N)))
1199          coeff=mypde.getCoefficient("B")          coeff=mypde.getCoefficient("B")
1200          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))
1201      def test_setCoefficient_C_System(self):      def test_setCoefficient_C_System(self):
1202          d=self.domain.getDim()          d=self.domain.getDim()
1203          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1204          mypde.setValue(C=numpy.ones((self.N,self.N,d)))          mypde.setValue(C=numpy.ones((self.N,self.N,d)))
1205          coeff=mypde.getCoefficient("C")          coeff=mypde.getCoefficient("C")
1206          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))
1207      def test_setCoefficient_D_System(self):      def test_setCoefficient_D_System(self):
1208          d=self.domain.getDim()          d=self.domain.getDim()
1209          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1210          mypde.setValue(D=numpy.ones((self.N,self.N)))          mypde.setValue(D=numpy.ones((self.N,self.N)))
1211          coeff=mypde.getCoefficient("D")          coeff=mypde.getCoefficient("D")
1212          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))
1213      def test_setCoefficient_X_System(self):      def test_setCoefficient_X_System(self):
1214          d=self.domain.getDim()          d=self.domain.getDim()
1215          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1216          mypde.setValue(X=numpy.ones((self.N,d)))          mypde.setValue(X=numpy.ones((self.N,d)))
1217          coeff=mypde.getCoefficient("X")          coeff=mypde.getCoefficient("X")
1218          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))
1219      def test_setCoefficient_Y_System(self):      def test_setCoefficient_Y_System(self):
1220          d=self.domain.getDim()          d=self.domain.getDim()
1221          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1222          mypde.setValue(Y=numpy.ones((self.N,)))          mypde.setValue(Y=numpy.ones((self.N,)))
1223          coeff=mypde.getCoefficient("Y")          coeff=mypde.getCoefficient("Y")
1224          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))
1225      def test_setCoefficient_y_System(self):      def test_setCoefficient_y_System(self):
1226          d=self.domain.getDim()          d=self.domain.getDim()
1227          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1228          mypde.setValue(y=numpy.ones((self.N,)))          mypde.setValue(y=numpy.ones((self.N,)))
1229          coeff=mypde.getCoefficient("y")          coeff=mypde.getCoefficient("y")
1230          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))
1231      def test_setCoefficient_d_System(self):      def test_setCoefficient_d_System(self):
1232          d=self.domain.getDim()          d=self.domain.getDim()
1233          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1234          mypde.setValue(d=numpy.ones((self.N,self.N)))          mypde.setValue(d=numpy.ones((self.N,self.N)))
1235          coeff=mypde.getCoefficient("d")          coeff=mypde.getCoefficient("d")
1236          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))
1237      def test_setCoefficient_d_contact_System(self):      def test_setCoefficient_d_contact_System(self):
1238          d=self.domain.getDim()          d=self.domain.getDim()
1239          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1240          mypde.setValue(d_contact=numpy.ones((self.N,self.N)))          mypde.setValue(d_contact=numpy.ones((self.N,self.N)))
1241          coeff=mypde.getCoefficient("d_contact")          coeff=mypde.getCoefficient("d_contact")
1242          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))
1243      def test_setCoefficient_y_contact_System(self):      def test_setCoefficient_y_contact_System(self):
1244          d=self.domain.getDim()          d=self.domain.getDim()
1245          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1246          mypde.setValue(y_contact=numpy.ones((self.N,)))          mypde.setValue(y_contact=numpy.ones((self.N,)))
1247          coeff=mypde.getCoefficient("y_contact")          coeff=mypde.getCoefficient("y_contact")
1248          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))
1249      def test_setCoefficient_A_reduced_System(self):      def test_setCoefficient_A_reduced_System(self):
1250          d=self.domain.getDim()          d=self.domain.getDim()
1251          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1252          mypde.setValue(A_reduced=numpy.ones((self.N,d,self.N,d)))          mypde.setValue(A_reduced=numpy.ones((self.N,d,self.N,d)))
1253          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
1254          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))
1255      def test_setCoefficient_B_reduced_System(self):      def test_setCoefficient_B_reduced_System(self):
1256          d=self.domain.getDim()          d=self.domain.getDim()
1257          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1258          mypde.setValue(B_reduced=numpy.ones((self.N,d,self.N)))          mypde.setValue(B_reduced=numpy.ones((self.N,d,self.N)))
1259          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
1260          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))
1261      def test_setCoefficient_C_reduced_System(self):      def test_setCoefficient_C_reduced_System(self):
1262          d=self.domain.getDim()          d=self.domain.getDim()
1263          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1264          mypde.setValue(C_reduced=numpy.ones((self.N,self.N,d)))          mypde.setValue(C_reduced=numpy.ones((self.N,self.N,d)))
1265          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
1266          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))
1267      def test_setCoefficient_D_System_reduced(self):      def test_setCoefficient_D_System_reduced(self):
1268          d=self.domain.getDim()          d=self.domain.getDim()
1269          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1270          mypde.setValue(D_reduced=numpy.ones((self.N,self.N)))          mypde.setValue(D_reduced=numpy.ones((self.N,self.N)))
1271          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
1272          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))
1273      def test_setCoefficient_X_System_reduced(self):      def test_setCoefficient_X_System_reduced(self):
1274          d=self.domain.getDim()          d=self.domain.getDim()
1275          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1276          mypde.setValue(X_reduced=numpy.ones((self.N,d)))          mypde.setValue(X_reduced=numpy.ones((self.N,d)))
1277          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
1278          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))
1279      def test_setCoefficient_Y_System_reduced(self):      def test_setCoefficient_Y_System_reduced(self):
1280          d=self.domain.getDim()          d=self.domain.getDim()
1281          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1282          mypde.setValue(Y_reduced=numpy.ones((self.N,)))          mypde.setValue(Y_reduced=numpy.ones((self.N,)))
1283          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
1284          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))
1285      def test_setCoefficient_y_System_reduced(self):      def test_setCoefficient_y_System_reduced(self):
1286          d=self.domain.getDim()          d=self.domain.getDim()
1287          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1288          mypde.setValue(y_reduced=numpy.ones((self.N,)))          mypde.setValue(y_reduced=numpy.ones((self.N,)))
1289          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
1290          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))
1291      def test_setCoefficient_d_reduced_System(self):      def test_setCoefficient_d_reduced_System(self):
1292          d=self.domain.getDim()          d=self.domain.getDim()
1293          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1294          mypde.setValue(d_reduced=numpy.ones((self.N,self.N)))          mypde.setValue(d_reduced=numpy.ones((self.N,self.N)))
1295          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
1296          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))
1297      def test_setCoefficient_d_contact_reduced_System(self):      def test_setCoefficient_d_contact_reduced_System(self):
1298          d=self.domain.getDim()          d=self.domain.getDim()
1299          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1300          mypde.setValue(d_contact_reduced=numpy.ones((self.N,self.N)))          mypde.setValue(d_contact_reduced=numpy.ones((self.N,self.N)))
1301          coeff=mypde.getCoefficient("d_contact_reduced")          coeff=mypde.getCoefficient("d_contact_reduced")
1302          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))
1303      def test_setCoefficient_y_contact_reduced_System(self):      def test_setCoefficient_y_contact_reduced_System(self):
1304          d=self.domain.getDim()          d=self.domain.getDim()
1305          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1306          mypde.setValue(y_contact_reduced=numpy.ones((self.N,)))          mypde.setValue(y_contact_reduced=numpy.ones((self.N,)))
1307          coeff=mypde.getCoefficient("y_contact_reduced")          coeff=mypde.getCoefficient("y_contact_reduced")
1308          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))
1309      def test_setCoefficient_r_System(self):      def test_setCoefficient_r_System(self):
1310          d=self.domain.getDim()          d=self.domain.getDim()
1311          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1312          mypde.setValue(r=numpy.ones((self.N,)))          mypde.setValue(r=numpy.ones((self.N,)))
1313          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
1314          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))
1315      def test_setCoefficient_q_System(self):      def test_setCoefficient_q_System(self):
1316          d=self.domain.getDim()          d=self.domain.getDim()
1317          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1318          mypde.setValue(q=numpy.ones((self.N,)))          mypde.setValue(q=numpy.ones((self.N,)))
1319          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
1320          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))
1321      def test_setCoefficient_r_System_reducedOn(self):      def test_setCoefficient_r_System_reducedOn(self):
1322          d=self.domain.getDim()          d=self.domain.getDim()
1323          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1324          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
1325          mypde.setValue(r=numpy.ones((self.N,)))          mypde.setValue(r=numpy.ones((self.N,)))
1326          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
1327          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))
1328      def test_setCoefficient_q_System_reducedOn(self):      def test_setCoefficient_q_System_reducedOn(self):
1329          d=self.domain.getDim()          d=self.domain.getDim()
1330          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numEquations=3,debug=self.DEBUG)
1331          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
1332          mypde.setValue(q=numpy.ones((self.N,)))          mypde.setValue(q=numpy.ones((self.N,)))
1333          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
1334          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))
1335    
1336      def test_setCoefficient_A_reduced_System_using_A(self):      def test_setCoefficient_A_reduced_System_using_A(self):
1337          d=self.domain.getDim()          d=self.domain.getDim()
1338          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1339          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)))
1340          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
1341          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))
1342      def test_setCoefficient_B_reduced_System_using_B(self):      def test_setCoefficient_B_reduced_System_using_B(self):
1343          d=self.domain.getDim()          d=self.domain.getDim()
1344          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1345          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)))
1346          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
1347          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))
1348      def test_setCoefficient_C_reduced_System_using_C(self):      def test_setCoefficient_C_reduced_System_using_C(self):
1349          d=self.domain.getDim()          d=self.domain.getDim()
1350          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1351          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)))
1352          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
1353          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))
1354      def test_setCoefficient_D_System_reduced_using_D(self):      def test_setCoefficient_D_System_reduced_using_D(self):
1355          d=self.domain.getDim()          d=self.domain.getDim()
1356          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1357          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)))
1358          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
1359          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))
1360      def test_setCoefficient_X_System_reduced_using_X(self):      def test_setCoefficient_X_System_reduced_using_X(self):
1361          d=self.domain.getDim()          d=self.domain.getDim()
1362          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1363          mypde.setValue(X=Data(numpy.ones((self.N,d)),ReducedFunction(self.domain)))          mypde.setValue(X=Data(numpy.ones((self.N,d)),ReducedFunction(self.domain)))
1364          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
1365          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))
1366      def test_setCoefficient_Y_System_reduced_using_Y(self):      def test_setCoefficient_Y_System_reduced_using_Y(self):
1367          d=self.domain.getDim()          d=self.domain.getDim()
1368          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1369          mypde.setValue(Y=Data(numpy.ones((self.N,)),ReducedFunction(self.domain)))          mypde.setValue(Y=Data(numpy.ones((self.N,)),ReducedFunction(self.domain)))
1370          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
1371          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))
1372      def test_setCoefficient_y_reduced_System_using_y(self):      def test_setCoefficient_y_reduced_System_using_y(self):
1373          d=self.domain.getDim()          d=self.domain.getDim()
1374          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1375          mypde.setValue(y=Data(numpy.ones((self.N,)),ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(y=Data(numpy.ones((self.N,)),ReducedFunctionOnBoundary(self.domain)))
1376          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
1377          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))
1378      def test_setCoefficient_d_reduced_System_using_d(self):      def test_setCoefficient_d_reduced_System_using_d(self):
1379          d=self.domain.getDim()          d=self.domain.getDim()
1380          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1381          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)))
1382          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
1383          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))
1384      def test_setCoefficient_d_contact_reduced_System_using_d_contact(self):      def test_setCoefficient_d_contact_reduced_System_using_d_contact(self):
1385          d=self.domain.getDim()          d=self.domain.getDim()
1386          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1387          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)))
1388          coeff=mypde.getCoefficient("d_contact_reduced")          coeff=mypde.getCoefficient("d_contact_reduced")
1389          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))
1390      def test_setCoefficient_y_contact_reduced_System_using_y_contact(self):      def test_setCoefficient_y_contact_reduced_System_using_y_contact(self):
1391          d=self.domain.getDim()          d=self.domain.getDim()
1392          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=LinearPDE(self.domain,numSolutions=3,debug=self.DEBUG)
1393          mypde.setValue(y_contact=Data(numpy.ones((self.N,)),ReducedFunctionOnContactZero(self.domain)))          mypde.setValue(y_contact=Data(numpy.ones((self.N,)),ReducedFunctionOnContactZero(self.domain)))
1394          coeff=mypde.getCoefficient("y_contact_reduced")          coeff=mypde.getCoefficient("y_contact_reduced")
1395          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))
1396      def test_resetCoefficient_HomogeneousConstraint(self):      def test_resetCoefficient_HomogeneousConstraint(self):
1397          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1398          x=self.domain.getX()          x=self.domain.getX()
# Line 1383  class Test_LinearPDE_noLumping(Test_line Line 1405  class Test_LinearPDE_noLumping(Test_line
1405      def test_resetCoefficient_InHomogeneousConstraint(self):      def test_resetCoefficient_InHomogeneousConstraint(self):
1406          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1407          mypde.setSymmetryOn()          mypde.setSymmetryOn()
1408        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1409          x=self.domain.getX()          x=self.domain.getX()
1410          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]))
1411          u1=mypde.getSolution(verbose=self.VERBOSE)          u1=mypde.getSolution()
1412          mypde.setValue(Y=2.,D=2)          mypde.setValue(Y=2.,D=2)
1413          u2=mypde.getSolution(verbose=self.VERBOSE)          u2=mypde.getSolution()
1414          self.failUnless(self.check(u2,u1),'first solution is wrong.')          self.failUnless(self.check(u2,u1),'first solution is wrong.')
1415          u2=mypde.getSolution(verbose=self.VERBOSE)          u2=mypde.getSolution()
1416          self.failUnless(self.check(u2,u1),'first solution is wrong.')          self.failUnless(self.check(u2,u1),'first solution is wrong.')
1417          mypde.setValue(r=2,Y=4.)          mypde.setValue(r=2,Y=4.)
1418          u2=mypde.getSolution(verbose=self.VERBOSE)          u2=mypde.getSolution()
1419          self.failUnless(self.check(u2,2*u1),'second solution is wrong.')          self.failUnless(self.check(u2,2*u1),'second solution is wrong.')
1420    
1421        def test_Status(self):
1422            DIM=self.domain.getDim()
1423            x=self.domain.getX()
1424            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1425            mypde.getSolverOptions().setSymmetryOn()
1426            mypde.getSolverOptions().setTolerance(self.RES_TOL)
1427            mypde.setValue(A=kronecker(self.domain), q=whereZero(x[0])+whereZero(x[0]-1.), Y=2.)
1428            x1=self.domain.getX()
1429            u1_ref=x1[0]*(1.-x1[0])
1430            u1=mypde.getSolution()
1431            error1=Lsup(u1-u1_ref)/Lsup(u1_ref)
1432            self.failUnless(mypde.getDomainStatus() == mypde.getSystemStatus(), "status of first pde does not match domain status.")
1433    
1434            self.domain.setX(x*5)
1435    
1436            self.failUnless(mypde.getDomainStatus() != mypde.getSystemStatus(), "status of first pde matches updated domain status.")
1437            x2=self.domain.getX()
1438            u2_ref=x2[0]*(5.-x2[0])
1439            u2=mypde.getSolution()
1440            error2=Lsup(u2-u2_ref)/Lsup(u2_ref)
1441            self.failUnless(error2 <= max(error1,self.RES_TOL)*10., "solution of second PDE wrong.")
1442            self.failUnless(mypde.getDomainStatus() == mypde.getSystemStatus(), "status of second pde does not match domain status.")
1443    
1444      def test_symmetryCheckTrue_System(self):      def test_symmetryCheckTrue_System(self):
1445          d=self.domain.getDim()          d=self.domain.getDim()
1446          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
# Line 1529  class Test_LinearPDE_noLumping(Test_line Line 1575  class Test_LinearPDE_noLumping(Test_line
1575      def test_symmetryOnIterative(self):      def test_symmetryOnIterative(self):
1576          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1577          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1578          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1579            u=mypde.getSolution()
1580          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1581      def test_symmetryOnDirect(self):      def test_symmetryOnDirect(self):
1582          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1583          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1584          mypde.setSolverMethod(mypde.DIRECT)          mypde.getSolverOptions().setSolverMethod(SolverOptions.DIRECT)
1585          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1586            u=mypde.getSolution()
1587          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1588      def test_PCG_JACOBI(self):      def test_PCG_JACOBI(self):
1589          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1590          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1591          mypde.setSolverMethod(mypde.PCG,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1592          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1593        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1594            u=mypde.getSolution()
1595          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1596        def test_PCG_AMG(self):
1597            if self.order!=2:
1598                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1599                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1600                mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1601                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1602                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1603                u=mypde.getSolution()
1604                self.failUnless(self.check(u,1.),'solution is wrong.')
1605      def test_PCG_ILU0(self):      def test_PCG_ILU0(self):
1606          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1607          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1608          mypde.setSolverMethod(mypde.PCG,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1609          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1610        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1611            u=mypde.getSolution()
1612          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1613      def test_PCG_RILU(self):      def test_PCG_RILU(self):
1614          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1615          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1616          mypde.setSolverMethod(mypde.PCG,mypde.RILU)      mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1617          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1618        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1619            u=mypde.getSolution()
1620            self.failUnless(self.check(u,1.),'solution is wrong.')
1621        def test_PCG_REC_ILU(self):
1622            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1623            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1624        mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1625        mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1626        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1627            u=mypde.getSolution()
1628          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1629      def test_DIRECT(self):      def test_DIRECT(self):
1630          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1631          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1632          mypde.setSolverMethod(mypde.DIRECT)          mypde.getSolverOptions().setSolverMethod(SolverOptions.DIRECT)
1633          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1634            u=mypde.getSolution()
1635          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1636      def test_BICGSTAB_JACOBI(self):      def test_BICGSTAB_JACOBI(self):
1637          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1638      mypde.setSolverMethod(mypde.BICGSTAB,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1639        mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1640          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1641          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1642            u=mypde.getSolution()
1643          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1644        def test_BICGSTAB_AMG(self):
1645            if self.order!=2:
1646                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1647                mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1648                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1649                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1650                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1651                u=mypde.getSolution()
1652                self.failUnless(self.check(u,1.),'solution is wrong.')
1653      def test_BICGSTAB_ILU0(self):      def test_BICGSTAB_ILU0(self):
1654          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1655          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1656      mypde.setSolverMethod(mypde.BICGSTAB,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1657          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1658            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1659            u=mypde.getSolution()
1660          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1661      def test_BICGSTAB_RILU(self):      def test_BICGSTAB_RILU(self):
1662          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1663          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1664      mypde.setSolverMethod(mypde.BICGSTAB,mypde.RILU)      mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1665          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1666            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1667            u=mypde.getSolution()
1668            self.failUnless(self.check(u,1.),'solution is wrong.')
1669        def test_BICGSTAB_REC_ILU(self):
1670            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1671            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1672        mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
1673        mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1674            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1675            u=mypde.getSolution()
1676          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1677      def test_MINRES_JACOBI(self):      def test_MINRES_JACOBI(self):
1678          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1679      mypde.setSolverMethod(mypde.MINRES,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1680        mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1681          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1682          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1683            u=mypde.getSolution()
1684          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1685        def test_MINRES_AMG(self):
1686            if self.order!=2:
1687                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1688                mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1689                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1690                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1691                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1692                u=mypde.getSolution()
1693                self.failUnless(self.check(u,1.),'solution is wrong.')
1694      def test_MINRES_ILU0(self):      def test_MINRES_ILU0(self):
1695          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1696          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1697      mypde.setSolverMethod(mypde.MINRES,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1698          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1699            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1700            u=mypde.getSolution()
1701          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1702      def test_MINRES_RILU(self):      def test_MINRES_RILU(self):
1703          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1704          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1705      mypde.setSolverMethod(mypde.MINRES,mypde.RILU)      mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1706          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1707            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1708            u=mypde.getSolution()
1709            self.failUnless(self.check(u,1.),'solution is wrong.')
1710        def test_MINRES_REC_ILU(self):
1711            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1712            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1713        mypde.getSolverOptions().setSolverMethod(SolverOptions.MINRES)
1714        mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1715            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1716            u=mypde.getSolution()
1717          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1718      def test_TFQMR_JACOBI(self):      def test_TFQMR_JACOBI(self):
1719          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1720      mypde.setSolverMethod(mypde.TFQMR,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1721        mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1722          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1723          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1724            u=mypde.getSolution()
1725          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1726        def test_TFQMR_AMG(self):
1727            if self.order!=2:
1728                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1729                mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1730                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1731                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1732                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1733                mypde.getSolverOptions().setVerbosity(True)
1734                u=mypde.getSolution()
1735                self.failUnless(self.check(u,1.),'solution is wrong.')
1736      def test_TFQMR_ILU0(self):      def test_TFQMR_ILU0(self):
1737          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1738          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1739      mypde.setSolverMethod(mypde.TFQMR,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1740          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1741            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1742            u=mypde.getSolution()
1743          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1744      def test_TFQMR_RILU(self):      def test_TFQMR_RILU(self):
1745          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1746          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1747      mypde.setSolverMethod(mypde.TFQMR,mypde.RILU)      mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1748          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1749            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1750            u=mypde.getSolution()
1751            self.failUnless(self.check(u,1.),'solution is wrong.')
1752        def test_TFQMR_REC_ILU(self):
1753            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1754            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1755        mypde.getSolverOptions().setSolverMethod(SolverOptions.TFQMR)
1756        mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1757            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1758            u=mypde.getSolution()
1759          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1760      def test_PRES20_JACOBI(self):      def test_PRES20_JACOBI(self):
1761          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1762          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1763      mypde.setSolverMethod(mypde.PRES20,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1764          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1765            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1766            u=mypde.getSolution()
1767          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1768        def test_PRES20_AMG(self):
1769            if self.order!=2:
1770                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1771                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1772                mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1773                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1774                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1775                u=mypde.getSolution()
1776                self.failUnless(self.check(u,1.),'solution is wrong.')
1777      def test_PRES20_ILU0(self):      def test_PRES20_ILU0(self):
1778          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1779          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1780      mypde.setSolverMethod(mypde.PRES20,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1781          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1782            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1783            u=mypde.getSolution()
1784          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1785      def test_PRES20_RILU(self):      def test_PRES20_RILU(self):
1786          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1787          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1788      mypde.setSolverMethod(mypde.PRES20,mypde.RILU)      mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1789          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1790            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1791            u=mypde.getSolution()
1792            self.failUnless(self.check(u,1.),'solution is wrong.')
1793        def test_PRES20_REC_ILU(self):
1794            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1795            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1796        mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
1797        mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1798            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1799            u=mypde.getSolution()
1800          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1801      def test_GMRESnoRestart_JACOBI(self):      def test_GMRESnoRestart_JACOBI(self):
1802          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1803          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1804      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1805          u=mypde.getSolution(verbose=self.VERBOSE,truncation=50)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1806        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1807        mypde.getSolverOptions().setTruncation(50)
1808            u=mypde.getSolution()
1809          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1810        def test_GMRESnoRestart_AMG(self):
1811            if self.order!=2:
1812                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1813                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1814                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1815                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1816                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1817                mypde.getSolverOptions().setTruncation(50)
1818                u=mypde.getSolution()
1819                self.failUnless(self.check(u,1.),'solution is wrong.')
1820      def test_GMRESnoRestart_ILU0(self):      def test_GMRESnoRestart_ILU0(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.GMRES,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1824          u=mypde.getSolution(verbose=self.VERBOSE,truncation=50)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1825          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1826        mypde.getSolverOptions().setTruncation(50)                        
1827            u=mypde.getSolution()
1828          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1829      def test_GMRESnoRestart_RILU(self):      def test_GMRESnoRestart_RILU(self):
1830          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1831          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1832      mypde.setSolverMethod(mypde.GMRES,mypde.RILU)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1833          u=mypde.getSolution(verbose=self.VERBOSE,truncation=50)      mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1834          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1835        mypde.getSolverOptions().setTruncation(50)
1836            u=mypde.getSolution()
1837            self.failUnless(self.check(u,1.),'solution is wrong.')
1838        def test_GMRESnoRestart_REC_ILU(self):
1839            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1840            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1841        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1842        mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1843        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1844        mypde.getSolverOptions().setTruncation(50)
1845            u=mypde.getSolution()
1846          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1847      def test_GMRES_JACOBI(self):      def test_GMRES_JACOBI(self):
1848          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1849          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1850      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1851          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1852            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1853            u=mypde.getSolution()
1854          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1855        def test_GMRES_AMG(self):
1856            if self.order!=2:
1857                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1858                mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1859                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1860                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1861                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1862                u=mypde.getSolution()
1863                self.failUnless(self.check(u,1.),'solution is wrong.')        
1864      def test_GMRES_ILU0(self):      def test_GMRES_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)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1869            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1870            u=mypde.getSolution()
1871          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1872      def test_GMRES_RILU(self):      def test_GMRES_RILU(self):
1873          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1874          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1875      mypde.setSolverMethod(mypde.GMRES,mypde.RILU)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1876          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1877            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1878            u=mypde.getSolution()
1879            self.failUnless(self.check(u,1.),'solution is wrong.')
1880        def test_GMRES_REC_ILU(self):
1881            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1882            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1883        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1884        mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1885            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1886            u=mypde.getSolution()
1887          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1888      def test_GMRES_truncation_restart_JACOBI(self):      def test_GMRES_truncation_restart_JACOBI(self):
1889          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1890          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1891      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1892          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1893        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1894        mypde.getSolverOptions().setTruncation(10)
1895        mypde.getSolverOptions().setRestart(20)
1896            u=mypde.getSolution()
1897          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1898        def test_GMRES_truncation_restart_AMG(self):
1899            if self.order!=2:
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.AMG)
1904                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1905                mypde.getSolverOptions().setTruncation(10)
1906                mypde.getSolverOptions().setRestart(20)
1907                u=mypde.getSolution()
1908                self.failUnless(self.check(u,1.),'solution is wrong.')
1909      def test_GMRES_truncation_restart_ILU0(self):      def test_GMRES_truncation_restart_ILU0(self):
1910          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1911          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1912      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1913          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
1914        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1915        mypde.getSolverOptions().setTruncation(10)
1916        mypde.getSolverOptions().setRestart(20)
1917            u=mypde.getSolution()
1918          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1919      def test_GMRES_truncation_restart_RILU(self):      def test_GMRES_truncation_restart_RILU(self):
1920          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1921          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)          mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1922      mypde.setSolverMethod(mypde.GMRES,mypde.RILU)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1923          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)      mypde.getSolverOptions().setPreconditioner(SolverOptions.RILU)
1924        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1925        mypde.getSolverOptions().setTruncation(10)
1926        mypde.getSolverOptions().setRestart(20)
1927            u=mypde.getSolution()
1928            self.failUnless(self.check(u,1.),'solution is wrong.')
1929        def test_GMRES_truncation_restart_REC_ILU(self):
1930            mypde=LinearPDE(self.domain,debug=self.DEBUG)
1931            mypde.setValue(A=kronecker(self.domain),D=1.,Y=1.)
1932        mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
1933        mypde.getSolverOptions().setPreconditioner(SolverOptions.REC_ILU)
1934        mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1935        mypde.getSolverOptions().setTruncation(10)
1936        mypde.getSolverOptions().setRestart(20)
1937            u=mypde.getSolution()
1938          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1939      #      #
1940      #   solver checks (PDE system)      #   solver checks (PDE system)
# Line 1702  class Test_LinearPDE_noLumping(Test_line Line 1949  class Test_LinearPDE_noLumping(Test_line
1949              Y[i]+=i              Y[i]+=i
1950          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1951          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
1952          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1953            u=mypde.getSolution()
1954          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1955      def test_symmetryOnDirect_System(self):      def test_symmetryOnDirect_System(self):
1956          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
# Line 1714  class Test_LinearPDE_noLumping(Test_line Line 1962  class Test_LinearPDE_noLumping(Test_line
1962              Y[i]+=i              Y[i]+=i
1963          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1964          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
1965          mypde.setSolverMethod(mypde.DIRECT)          mypde.getSolverOptions().setSolverMethod(SolverOptions.DIRECT)
1966          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1967            u=mypde.getSolution()
1968          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1969      def test_PCG_JACOBI_System(self):      def test_PCG_JACOBI_System(self):
1970          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
# Line 1727  class Test_LinearPDE_noLumping(Test_line Line 1976  class Test_LinearPDE_noLumping(Test_line
1976              Y[i]+=i              Y[i]+=i
1977          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
1978          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
1979          mypde.setSolverMethod(mypde.PCG,mypde.JACOBI)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1980          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
1981            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1982            u=mypde.getSolution()
1983          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
1984        def test_PCG_AMG_System(self):
1985            if self.order!=2:
1986                A=Tensor4(0.,Function(self.domain))
1987                D=Tensor(1.,Function(self.domain))
1988                Y=Vector(self.domain.getDim(),Function(self.domain))
1989                for i in range(self.domain.getDim()):
1990                    A[i,:,i,:]=kronecker(self.domain)
1991                    D[i,i]+=i
1992                    Y[i]+=i
1993                mypde=LinearPDE(self.domain,debug=self.DEBUG)
1994                mypde.setValue(A=A,D=D,Y=Y)
1995                mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
1996                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
1997                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
1998                u=mypde.getSolution()
1999                self.failUnless(self.check(u,1.),'solution is wrong.')
2000      def test_PCG_ILU0_System(self):      def test_PCG_ILU0_System(self):
2001          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2002          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1740  class Test_LinearPDE_noLumping(Test_line Line 2007  class Test_LinearPDE_noLumping(Test_line
2007              Y[i]+=i              Y[i]+=i
2008          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2009          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2010          mypde.setSolverMethod(mypde.PCG,mypde.ILU0)          mypde.getSolverOptions().setSolverMethod(SolverOptions.PCG)
2011          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2012            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2013            u=mypde.getSolution()
2014          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2015      def test_DIRECT_System(self):      def test_DIRECT_System(self):
2016          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
# Line 1753  class Test_LinearPDE_noLumping(Test_line Line 2022  class Test_LinearPDE_noLumping(Test_line
2022              Y[i]+=i              Y[i]+=i
2023          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2024          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2025          mypde.setSolverMethod(mypde.DIRECT)          mypde.getSolverOptions().setSolverMethod(SolverOptions.DIRECT)
2026          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2027            u=mypde.getSolution()
2028          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2029      def test_BICGSTAB_JACOBI_System(self):      def test_BICGSTAB_JACOBI_System(self):
2030          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
# Line 1766  class Test_LinearPDE_noLumping(Test_line Line 2036  class Test_LinearPDE_noLumping(Test_line
2036              Y[i]+=i              Y[i]+=i
2037          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2038          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2039      mypde.setSolverMethod(mypde.BICGSTAB,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
2040          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2041            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2042            u=mypde.getSolution()
2043          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2044        def test_BICGSTAB_AMG_System(self):
2045            if self.order!=2:
2046                A=Tensor4(0.,Function(self.domain))
2047                D=Tensor(1.,Function(self.domain))
2048                Y=Vector(self.domain.getDim(),Function(self.domain))
2049                for i in range(self.domain.getDim()):
2050                    A[i,:,i,:]=kronecker(self.domain)
2051                    D[i,i]+=i
2052                    Y[i]+=i
2053                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2054                mypde.setValue(A=A,D=D,Y=Y)
2055                mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
2056                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2057                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2058                u=mypde.getSolution()
2059                self.failUnless(self.check(u,1.),'solution is wrong.')
2060      def test_BICGSTAB_ILU0_System(self):      def test_BICGSTAB_ILU0_System(self):
2061          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2062          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1779  class Test_LinearPDE_noLumping(Test_line Line 2067  class Test_LinearPDE_noLumping(Test_line
2067              Y[i]+=i              Y[i]+=i
2068          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2069          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2070      mypde.setSolverMethod(mypde.BICGSTAB,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.BICGSTAB)
2071          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2072            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2073            u=mypde.getSolution()
2074          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2075      def test_PRES20_JACOBI_System(self):      def test_PRES20_JACOBI_System(self):
2076          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
# Line 1792  class Test_LinearPDE_noLumping(Test_line Line 2082  class Test_LinearPDE_noLumping(Test_line
2082              Y[i]+=i              Y[i]+=i
2083          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2084          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2085      mypde.setSolverMethod(mypde.PRES20,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2086          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2087            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2088            u=mypde.getSolution()
2089          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2090        def test_PRES20_AMG_System(self):
2091            if self.order!=2:
2092                A=Tensor4(0.,Function(self.domain))
2093                D=Tensor(1.,Function(self.domain))
2094                Y=Vector(self.domain.getDim(),Function(self.domain))
2095                for i in range(self.domain.getDim()):
2096                    A[i,:,i,:]=kronecker(self.domain)
2097                    D[i,i]+=i
2098                    Y[i]+=i
2099                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2100                mypde.setValue(A=A,D=D,Y=Y)
2101                mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2102                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2103                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2104                u=mypde.getSolution()
2105                self.failUnless(self.check(u,1.),'solution is wrong.')
2106      def test_PRES20_ILU0_System(self):      def test_PRES20_ILU0_System(self):
2107          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2108          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1805  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.PRES20,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.PRES20)
2117          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
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_GMRESnoRestart_JACOBI_System(self):      def test_GMRESnoRestart_JACOBI_System(self):
2122          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
# Line 1818  class Test_LinearPDE_noLumping(Test_line Line 2128  class Test_LinearPDE_noLumping(Test_line
2128              Y[i]+=i              Y[i]+=i
2129          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2130          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2131      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2132        mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2133          # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)          # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
2134          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2135            u=mypde.getSolution()
2136          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2137        def test_GMRESnoRestart_AMG_System(self):
2138            if self.order!=2:
2139                A=Tensor4(0.,Function(self.domain))
2140                D=Tensor(1.,Function(self.domain))
2141                Y=Vector(self.domain.getDim(),Function(self.domain))
2142                for i in range(self.domain.getDim()):
2143                    A[i,:,i,:]=kronecker(self.domain)
2144                    D[i,i]+=i
2145                    Y[i]+=i
2146                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2147                mypde.setValue(A=A,D=D,Y=Y)
2148                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2149                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2150                # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
2151                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2152                u=mypde.getSolution()
2153                self.failUnless(self.check(u,1.),'solution is wrong.')
2154      def test_GMRESnoRestart_ILU0_System(self):      def test_GMRESnoRestart_ILU0_System(self):
2155          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2156          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1832  class Test_LinearPDE_noLumping(Test_line Line 2161  class Test_LinearPDE_noLumping(Test_line
2161              Y[i]+=i              Y[i]+=i
2162          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2163          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2164      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2165        mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2166          # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)          # u=mypde.getSolution(verbose=self.VERBOSE,truncation=5)
2167          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2168            u=mypde.getSolution()
2169          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2170      def test_GMRES_JACOBI_System(self):      def test_GMRES_JACOBI_System(self):
2171          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
# Line 1846  class Test_LinearPDE_noLumping(Test_line Line 2177  class Test_LinearPDE_noLumping(Test_line
2177              Y[i]+=i              Y[i]+=i
2178          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2179          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2180      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2181          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2182            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2183            u=mypde.getSolution()
2184          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2185        def test_GMRES_AMG_System(self):
2186            if self.order!=2:
2187                A=Tensor4(0.,Function(self.domain))
2188                D=Tensor(1.,Function(self.domain))
2189                Y=Vector(self.domain.getDim(),Function(self.domain))
2190                for i in range(self.domain.getDim()):
2191                    A[i,:,i,:]=kronecker(self.domain)
2192                    D[i,i]+=i
2193                    Y[i]+=i
2194                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2195                mypde.setValue(A=A,D=D,Y=Y)
2196                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2197                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2198                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2199                u=mypde.getSolution()
2200                self.failUnless(self.check(u,1.),'solution is wrong.')
2201      def test_GMRES_ILU0_System(self):      def test_GMRES_ILU0_System(self):
2202          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2203          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1859  class Test_LinearPDE_noLumping(Test_line Line 2208  class Test_LinearPDE_noLumping(Test_line
2208              Y[i]+=i              Y[i]+=i
2209          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2210          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2211      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2212          u=mypde.getSolution(verbose=self.VERBOSE)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2213            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2214            u=mypde.getSolution()
2215          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2216      def test_GMRES_truncation_restart_JACOBI_System(self):      def test_GMRES_truncation_restart_JACOBI_System(self):
2217          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
# Line 1872  class Test_LinearPDE_noLumping(Test_line Line 2223  class Test_LinearPDE_noLumping(Test_line
2223              Y[i]+=i              Y[i]+=i
2224          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2225          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2226      mypde.setSolverMethod(mypde.GMRES,mypde.JACOBI)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2227          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)      mypde.getSolverOptions().setPreconditioner(SolverOptions.JACOBI)
2228            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2229        mypde.getSolverOptions().setTruncation(10)
2230        mypde.getSolverOptions().setRestart(20)
2231            u=mypde.getSolution()
2232          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2233        def test_GMRES_truncation_restart_AMG_System(self):
2234            if self.order!=2:
2235                A=Tensor4(0.,Function(self.domain))
2236                D=Tensor(1.,Function(self.domain))
2237                Y=Vector(self.domain.getDim(),Function(self.domain))
2238                for i in range(self.domain.getDim()):
2239                    A[i,:,i,:]=kronecker(self.domain)
2240                    D[i,i]+=i
2241                    Y[i]+=i
2242                mypde=LinearPDE(self.domain,debug=self.DEBUG)
2243                mypde.setValue(A=A,D=D,Y=Y)
2244                mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2245                mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
2246                mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2247                mypde.getSolverOptions().setTruncation(10)
2248                mypde.getSolverOptions().setRestart(20)
2249                u=mypde.getSolution()
2250                self.failUnless(self.check(u,1.),'solution is wrong.')
2251      def test_GMRES_truncation_restart_ILU0_System(self):      def test_GMRES_truncation_restart_ILU0_System(self):
2252          A=Tensor4(0.,Function(self.domain))          A=Tensor4(0.,Function(self.domain))
2253          D=Tensor(1.,Function(self.domain))          D=Tensor(1.,Function(self.domain))
# Line 1885  class Test_LinearPDE_noLumping(Test_line Line 2258  class Test_LinearPDE_noLumping(Test_line
2258              Y[i]+=i              Y[i]+=i
2259          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2260          mypde.setValue(A=A,D=D,Y=Y)          mypde.setValue(A=A,D=D,Y=Y)
2261      mypde.setSolverMethod(mypde.GMRES,mypde.ILU0)      mypde.getSolverOptions().setSolverMethod(SolverOptions.GMRES)
2262          u=mypde.getSolution(verbose=self.VERBOSE,truncation=10,restart=20)      mypde.getSolverOptions().setPreconditioner(SolverOptions.ILU0)
2263            mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2264        mypde.getSolverOptions().setTruncation(10)
2265        mypde.getSolverOptions().setRestart(20)
2266            u=mypde.getSolution()
2267          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2268    
2269  class Test_LinearPDE(Test_LinearPDE_noLumping):  class Test_LinearPDE(Test_LinearPDE_noLumping):
# Line 1894  class Test_LinearPDE(Test_LinearPDE_noLu Line 2271  class Test_LinearPDE(Test_LinearPDE_noLu
2271          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2272          try:          try:
2273             success=True             success=True
2274         mypde.setSolverMethod(mypde.LUMPING)         mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2275             mypde.setValue(A=kronecker(self.domain))             mypde.setValue(A=kronecker(self.domain))
2276             u=mypde.getSolution(verbose=self.VERBOSE)             mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2277               u=mypde.getSolution()    
2278          except ValueError:          except ValueError:
2279             success=False             success=False
2280          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 2282  class Test_LinearPDE(Test_LinearPDE_noLu
2282          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2283          try:          try:
2284             success=True             success=True
2285         mypde.setSolverMethod(mypde.LUMPING)         mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2286             mypde.setValue(B=kronecker(self.domain)[0])             mypde.setValue(B=kronecker(self.domain)[0])
2287             u=mypde.getSolution(verbose=self.VERBOSE)             mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2288               u=mypde.getSolution()
2289          except ValueError:          except ValueError:
2290             success=False             success=False
2291          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 2293  class Test_LinearPDE(Test_LinearPDE_noLu
2293          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2294          try:          try:
2295             success=True             success=True
2296         mypde.setSolverMethod(mypde.LUMPING)         mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2297             mypde.setValue(C=kronecker(self.domain)[0])             mypde.setValue(C=kronecker(self.domain)[0])
2298             u=mypde.getSolution(verbose=self.VERBOSE)             mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2299               u=mypde.getSolution()
2300          except ValueError:          except ValueError:
2301             success=False             success=False
2302          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 2305  class Test_LinearPDE(Test_LinearPDE_noLu
2305          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2306          try:          try:
2307             success=True             success=True
2308         mypde.setSolverMethod(mypde.LUMPING)         mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2309             mypde.setValue(A_reduced=kronecker(self.domain))             mypde.setValue(A_reduced=kronecker(self.domain))
2310             u=mypde.getSolution(verbose=self.VERBOSE)             mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2311               u=mypde.getSolution()
2312          except ValueError:          except ValueError:
2313             success=False             success=False
2314          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 2316  class Test_LinearPDE(Test_LinearPDE_noLu
2316          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2317          try:          try:
2318             success=True             success=True
2319         mypde.setSolverMethod(mypde.LUMPING)         mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2320             mypde.setValue(B_reduced=kronecker(self.domain)[0])             mypde.setValue(B_reduced=kronecker(self.domain)[0])
2321             u=mypde.getSolution(verbose=self.VERBOSE)             mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2322               u=mypde.getSolution()
2323          except ValueError:          except ValueError:
2324             success=False             success=False
2325          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 2327  class Test_LinearPDE(Test_LinearPDE_noLu
2327          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2328          try:          try:
2329             success=True             success=True
2330         mypde.setSolverMethod(mypde.LUMPING)         mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2331             mypde.setValue(C_reduced=kronecker(self.domain)[0])             mypde.setValue(C_reduced=kronecker(self.domain)[0])
2332             u=mypde.getSolution(verbose=self.VERBOSE)             mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2333               u=mypde.getSolution()
2334          except ValueError:          except ValueError:
2335             success=False             success=False
2336          self.failUnless(not success,'error should be issued')          self.failUnless(not success,'error should be issued')
2337                    
2338      def test_Lumping(self):      def test_Lumping(self):
2339          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2340      mypde.setSolverMethod(mypde.LUMPING)      mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2341          mypde.setValue(D=1.,Y=1.)          mypde.setValue(D=1.,Y=1.)
2342          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2343            u=mypde.getSolution()
2344          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2345      def test_Constrained_Lumping(self):      def test_Constrained_Lumping(self):
2346          x=self.domain.getX()          x=self.domain.getX()
2347          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2348      mypde.setSolverMethod(mypde.LUMPING)      mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2349          mypde.setValue(D=1.,Y=1.,q=whereZero(x[0]),r=1.)          mypde.setValue(D=1.,Y=1.,q=whereZero(x[0]),r=1.)
2350          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2351            u=mypde.getSolution()
2352          self.failUnless(self.check(u,1.),'solution is wrong.')          self.failUnless(self.check(u,1.),'solution is wrong.')
2353    
2354      def test_Lumping_System(self):      def test_Lumping_System(self):
2355          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2356      mypde.setSolverMethod(mypde.LUMPING)      mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2357          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.]))
2358          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2359            u=mypde.getSolution()
2360          self.failUnless(self.check(u,numpy.ones((2,))),'solution is wrong.')          self.failUnless(self.check(u,numpy.ones((2,))),'solution is wrong.')
2361      def test_Constrained_Lumping_System(self):      def test_Constrained_Lumping_System(self):
2362          x=self.domain.getX()          x=self.domain.getX()
2363          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2364      mypde.setSolverMethod(mypde.LUMPING)      mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2365          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.]), \
2366                         q=whereZero(x[0])*[0.,1],r=[0.,1.])                         q=whereZero(x[0])*[0.,1],r=[0.,1.])
2367          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2368            u=mypde.getSolution()
2369          self.failUnless(self.check(u,numpy.ones((2,))),'solution is wrong.')          self.failUnless(self.check(u,numpy.ones((2,))),'solution is wrong.')
2370    
2371      def test_Lumping_updateRHS(self):      def test_Lumping_updateRHS(self):
2372          x=self.domain.getX()          x=self.domain.getX()
2373          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2374      mypde.setSolverMethod(mypde.LUMPING)      mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2375          mypde.setValue(D=1.,Y=1.)          mypde.setValue(D=1.,Y=1.)
2376          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2377            u=mypde.getSolution()
2378          self.failUnless(self.check(u,1.),'first solution is wrong.')          self.failUnless(self.check(u,1.),'first solution is wrong.')
2379          mypde.setValue(Y=2.,q=whereZero(x[0]),r=2.)          mypde.setValue(Y=2.,q=whereZero(x[0]),r=2.)
2380          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2381            u=mypde.getSolution()
2382          self.failUnless(self.check(u,2.),'second solution is wrong.')          self.failUnless(self.check(u,2.),'second solution is wrong.')
2383      def test_Lumping_updateOperator(self):      def test_Lumping_updateOperator(self):
2384          x=self.domain.getX()          x=self.domain.getX()
2385          mypde=LinearPDE(self.domain,debug=self.DEBUG)          mypde=LinearPDE(self.domain,debug=self.DEBUG)
2386      mypde.setSolverMethod(mypde.LUMPING)      mypde.getSolverOptions().setSolverMethod(SolverOptions.LUMPING)
2387          mypde.setValue(D=1.,Y=1.)          mypde.setValue(D=1.,Y=1.)
2388          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2389            u=mypde.getSolution()
2390          mypde.setValue(D=2.)          mypde.setValue(D=2.)
2391          u=mypde.getSolution(verbose=self.VERBOSE)          mypde.getSolverOptions().setVerbosity(self.VERBOSE)
2392            u=mypde.getSolution()
2393          self.failUnless(self.check(u,0.5),'second solution is wrong.')          self.failUnless(self.check(u,0.5),'second solution is wrong.')
2394    
2395    
# Line 2012  class Test_TransportPDE(Test_linearPDEs) Line 2403  class Test_TransportPDE(Test_linearPDEs)
2403          self.failUnless(mypde.useBackwardEuler()==False,'backward Euler should not be used')          self.failUnless(mypde.useBackwardEuler()==False,'backward Euler should not be used')
2404      def test_setCoefficient_WithWrongName(self):      def test_setCoefficient_WithWrongName(self):
2405          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2406          self.failUnlessRaises(IllegalCoefficient,mypde.setValue, ROMA=Vector(0.,FunctionOnBoundary(self.domain)))          self.failUnlessRaises(IllegalCoefficient)
2407        mypde.getSolverOptions().setSolverMethod(SolverOptions.setValue, ROMA=Vector(0.,FunctionOnBoundary(self.domain)))
2408    
2409      def test_setCoefficient_WithIllegalFunctionSpace(self):      def test_setCoefficient_WithIllegalFunctionSpace(self):
2410          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2411          self.failUnlessRaises(IllegalCoefficientFunctionSpace,mypde.setValue,C=Vector(0.,FunctionOnBoundary(self.domain)))          self.failUnlessRaises(IllegalCoefficientFunctionSpace)
2412        mypde.getSolverOptions().setSolverMethod(SolverOptions.setValue,C=Vector(0.,FunctionOnBoundary(self.domain)))
2413                    
2414      def test_resetCoefficient_WithWrongShape(self):      def test_resetCoefficient_WithWrongShape(self):
2415          mypde=TransportPDE(self.domain,numEquations=2,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=2,debug=self.DEBUG)
# Line 2028  class Test_TransportPDE(Test_linearPDEs) Line 2421  class Test_TransportPDE(Test_linearPDEs)
2421    
2422      def test_setInitialSolution_scalar_negative(self):      def test_setInitialSolution_scalar_negative(self):
2423          mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)
2424          self.failUnlessRaises(RuntimeError,mypde.setInitialSolution,-1.)          self.failUnlessRaises(RuntimeError, mypde.setInitialSolution,-1.)
2425    
2426      def test_setInitialSolution_scalar_WithWrongShape(self):      def test_setInitialSolution_scalar_WithWrongShape(self):
2427          mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=1,debug=self.DEBUG)
# Line 2040  class Test_TransportPDE(Test_linearPDEs) Line 2433  class Test_TransportPDE(Test_linearPDEs)
2433    
2434      def test_setInitialSolution_system(self):      def test_setInitialSolution_system(self):
2435          mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)
2436          self.failUnlessRaises(RuntimeError,mypde.setInitialSolution,[-1,2.])          self.failUnlessRaises(RuntimeError, mypde.setInitialSolution,[-1,2.])
2437    
2438      def test_setInitialSolution_system_WithWrongShape(self):      def test_setInitialSolution_system_WithWrongShape(self):
2439          mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=2,debug=self.DEBUG)
2440          self.failUnlessRaises(ValueError,mypde.setInitialSolution,1.)          self.failUnlessRaises(ValueError, mypde.setInitialSolution,1.)
2441    
2442    
2443      def test_attemptToChangeOrderAfterDefinedCoefficient(self):      def test_attemptToChangeOrderAfterDefinedCoefficient(self):
# Line 2055  class Test_TransportPDE(Test_linearPDEs) Line 2448  class Test_TransportPDE(Test_linearPDEs)
2448      def test_reducedOnConfig(self):      def test_reducedOnConfig(self):
2449          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2450          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
2451          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.")
2452      #      #
2453      #  set coefficients for scalars:      #  set coefficients for scalars:
2454      #      #
# Line 2064  class Test_TransportPDE(Test_linearPDEs) Line 2457  class Test_TransportPDE(Test_linearPDEs)
2457          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2458          mypde.setValue(M=1.)          mypde.setValue(M=1.)
2459          coeff=mypde.getCoefficient("M")          coeff=mypde.getCoefficient("M")
2460          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))
2461      def test_setCoefficient_A_Scalar(self):      def test_setCoefficient_A_Scalar(self):
2462          d=self.domain.getDim()          d=self.domain.getDim()
2463          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2464          mypde.setValue(A=numpy.ones((d,d)))          mypde.setValue(A=numpy.ones((d,d)))
2465          coeff=mypde.getCoefficient("A")          coeff=mypde.getCoefficient("A")
2466          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))
2467      def test_setCoefficient_B_Scalar(self):      def test_setCoefficient_B_Scalar(self):
2468          d=self.domain.getDim()          d=self.domain.getDim()
2469          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2470          mypde.setValue(B=numpy.ones((d,)))          mypde.setValue(B=numpy.ones((d,)))
2471          coeff=mypde.getCoefficient("B")          coeff=mypde.getCoefficient("B")
2472          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))
2473      def test_setCoefficient_C_Scalar(self):      def test_setCoefficient_C_Scalar(self):
2474          d=self.domain.getDim()          d=self.domain.getDim()
2475          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2476          mypde.setValue(C=numpy.ones((d,)))          mypde.setValue(C=numpy.ones((d,)))
2477          coeff=mypde.getCoefficient("C")          coeff=mypde.getCoefficient("C")
2478          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))
2479      def test_setCoefficient_D_Scalar(self):      def test_setCoefficient_D_Scalar(self):
2480          d=self.domain.getDim()          d=self.domain.getDim()
2481          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2482          mypde.setValue(D=1.)          mypde.setValue(D=1.)
2483          coeff=mypde.getCoefficient("D")          coeff=mypde.getCoefficient("D")
2484          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))
2485      def test_setCoefficient_X_Scalar(self):      def test_setCoefficient_X_Scalar(self):
2486          d=self.domain.getDim()          d=self.domain.getDim()
2487          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2488          mypde.setValue(X=numpy.ones((d,)))          mypde.setValue(X=numpy.ones((d,)))
2489          coeff=mypde.getCoefficient("X")          coeff=mypde.getCoefficient("X")
2490          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))
2491      def test_setCoefficient_Y_Scalar(self):      def test_setCoefficient_Y_Scalar(self):
2492          d=self.domain.getDim()          d=self.domain.getDim()
2493          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2494          mypde.setValue(Y=1.)          mypde.setValue(Y=1.)
2495          coeff=mypde.getCoefficient("Y")          coeff=mypde.getCoefficient("Y")
2496          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),Function(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),Function(self.domain),1))
2497      def test_setCoefficient_y_Scalar(self):      def test_setCoefficient_y_Scalar(self):
2498          d=self.domain.getDim()          d=self.domain.getDim()
2499          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2500          mypde.setValue(y=1.)          mypde.setValue(y=1.)
2501          coeff=mypde.getCoefficient("y")          coeff=mypde.getCoefficient("y")
2502          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),FunctionOnBoundary(self.domain),1))
2503      def test_setCoefficient_d_Scalar(self):      def test_setCoefficient_d_Scalar(self):
2504          d=self.domain.getDim()          d=self.domain.getDim()
2505          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2506          mypde.setValue(d=1.)          mypde.setValue(d=1.)
2507          coeff=mypde.getCoefficient("d")          coeff=mypde.getCoefficient("d")
2508          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))
2509      def test_setCoefficient_m_Scalar(self):      def test_setCoefficient_m_Scalar(self):
2510          d=self.domain.getDim()          d=self.domain.getDim()
2511          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2512          mypde.setValue(m=1.)          mypde.setValue(m=1.)
2513          coeff=mypde.getCoefficient("m")          coeff=mypde.getCoefficient("m")
2514          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))
2515      def test_setCoefficient_d_contact_Scalar(self):      def test_setCoefficient_d_contact_Scalar(self):
2516          d=self.domain.getDim()          d=self.domain.getDim()
2517          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2518          mypde.setValue(d_contact=1.)          mypde.setValue(d_contact=1.)
2519          coeff=mypde.getCoefficient("d_contact")          coeff=mypde.getCoefficient("d_contact")
2520          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))
2521      def test_setCoefficient_y_contact_Scalar(self):      def test_setCoefficient_y_contact_Scalar(self):
2522          d=self.domain.getDim()          d=self.domain.getDim()
2523          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2524          mypde.setValue(y_contact=1.)          mypde.setValue(y_contact=1.)
2525          coeff=mypde.getCoefficient("y_contact")          coeff=mypde.getCoefficient("y_contact")
2526          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),FunctionOnContactZero(self.domain),1))
2527    
2528      def test_setCoefficient_M_reduced_Scalar(self):      def test_setCoefficient_M_reduced_Scalar(self):
2529          d=self.domain.getDim()          d=self.domain.getDim()
2530          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2531          mypde.setValue(M_reduced=1.)          mypde.setValue(M_reduced=1.)
2532          coeff=mypde.getCoefficient("M_reduced")          coeff=mypde.getCoefficient("M_reduced")
2533          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))
2534      def test_setCoefficient_A_reduced_Scalar(self):      def test_setCoefficient_A_reduced_Scalar(self):
2535          d=self.domain.getDim()          d=self.domain.getDim()
2536          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2537          mypde.setValue(A_reduced=numpy.ones((d,d)))          mypde.setValue(A_reduced=numpy.ones((d,d)))
2538          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
2539          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))
2540      def test_setCoefficient_B_reduced_Scalar(self):      def test_setCoefficient_B_reduced_Scalar(self):
2541          d=self.domain.getDim()          d=self.domain.getDim()
2542          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2543          mypde.setValue(B_reduced=numpy.ones((d,)))          mypde.setValue(B_reduced=numpy.ones((d,)))
2544          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
2545          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))
2546      def test_setCoefficient_C_reduced_Scalar(self):      def test_setCoefficient_C_reduced_Scalar(self):
2547          d=self.domain.getDim()          d=self.domain.getDim()
2548          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2549          mypde.setValue(C_reduced=numpy.ones((d,)))          mypde.setValue(C_reduced=numpy.ones((d,)))
2550          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
2551          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))
2552      def test_setCoefficient_D_reduced_Scalar(self):      def test_setCoefficient_D_reduced_Scalar(self):
2553          d=self.domain.getDim()          d=self.domain.getDim()
2554          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2555          mypde.setValue(D_reduced=1.)          mypde.setValue(D_reduced=1.)
2556          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
2557          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))
2558      def test_setCoefficient_X_reduced_Scalar(self):      def test_setCoefficient_X_reduced_Scalar(self):
2559          d=self.domain.getDim()          d=self.domain.getDim()
2560          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2561          mypde.setValue(X_reduced=numpy.ones((d,)))          mypde.setValue(X_reduced=numpy.ones((d,)))
2562          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
2563          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))
2564      def test_setCoefficient_Y_reduced_Scalar(self):      def test_setCoefficient_Y_reduced_Scalar(self):
2565          d=self.domain.getDim()          d=self.domain.getDim()
2566          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2567          mypde.setValue(Y_reduced=1.)          mypde.setValue(Y_reduced=1.)
2568          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
2569          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunction(self.domain),1))
2570      def test_setCoefficient_y_reduced_Scalar(self):      def test_setCoefficient_y_reduced_Scalar(self):
2571          d=self.domain.getDim()          d=self.domain.getDim()
2572          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2573          mypde.setValue(y_reduced=1.)          mypde.setValue(y_reduced=1.)
2574          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
2575          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))
2576      def test_setCoefficient_m_reduced_Scalar(self):      def test_setCoefficient_m_reduced_Scalar(self):
2577          d=self.domain.getDim()          d=self.domain.getDim()
2578          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2579          mypde.setValue(m_reduced=1.)          mypde.setValue(m_reduced=1.)
2580          coeff=mypde.getCoefficient("m_reduced")          coeff=mypde.getCoefficient("m_reduced")
2581          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))
2582      def test_setCoefficient_d_reduced_Scalar(self):      def test_setCoefficient_d_reduced_Scalar(self):
2583          d=self.domain.getDim()          d=self.domain.getDim()
2584          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2585          mypde.setValue(d_reduced=1.)          mypde.setValue(d_reduced=1.)
2586          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
2587          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))
2588      def test_setCoefficient_d_contact_reduced_Scalar(self):      def test_setCoefficient_d_contact_reduced_Scalar(self):
2589          d=self.domain.getDim()          d=self.domain.getDim()
2590          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2591          mypde.setValue(d_contact_reduced=1.)          mypde.setValue(d_contact_reduced=1.)
2592          coeff=mypde.getCoefficient("d_contact_reduced")          coeff=mypde.getCoefficient("d_contact_reduced")
2593          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))
2594      def test_setCoefficient_y_contact_reduced_Scalar(self):      def test_setCoefficient_y_contact_reduced_Scalar(self):
2595          d=self.domain.getDim()          d=self.domain.getDim()
2596          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2597          mypde.setValue(y_contact_reduced=1.)          mypde.setValue(y_contact_reduced=1.)
2598          coeff=mypde.getCoefficient("y_contact_reduced")          coeff=mypde.getCoefficient("y_contact_reduced")
2599          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))
2600      def test_setCoefficient_r_Scalar(self):      def test_setCoefficient_r_Scalar(self):
2601          d=self.domain.getDim()          d=self.domain.getDim()
2602          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
2603          mypde.setValue(r=1.)          mypde.setValue(r=1.)
2604          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
2605          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),Solution(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),Solution(self.domain),1))
2606      def test_setCoefficient_q_Scalar(self):      def test_setCoefficient_q_Scalar(self):
2607          d=self.domain.getDim()          d=self.domain.getDim()
2608          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
2609          mypde.setValue(q=1.)          mypde.setValue(q=1.)
2610          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
2611          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),Solution(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),Solution(self.domain),1))
2612      def test_setCoefficient_r_Scalar_reducedOn(self):      def test_setCoefficient_r_Scalar_reducedOn(self):
2613          d=self.domain.getDim()          d=self.domain.getDim()
2614          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
2615          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
2616          mypde.setValue(r=1.)          mypde.setValue(r=1.)
2617          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
2618          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))
2619      def test_setCoefficient_q_Scalar_reducedOn(self):      def test_setCoefficient_q_Scalar_reducedOn(self):
2620          d=self.domain.getDim()          d=self.domain.getDim()
2621          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
2622          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
2623          mypde.setValue(q=1.)          mypde.setValue(q=1.)
2624          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
2625          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumSolutions()),((),ReducedSolution(self.domain),1))
2626    
2627      def test_setCoefficient_M_reduced_Scalar_usingM(self):      def test_setCoefficient_M_reduced_Scalar_usingM(self):
2628          d=self.domain.getDim()          d=self.domain.getDim()
2629          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2630          mypde.setValue(M=Scalar(1.,ReducedFunction(self.domain)))          mypde.setValue(M=Scalar(1.,ReducedFunction(self.domain)))
2631          coeff=mypde.getCoefficient("M_reduced")          coeff=mypde.getCoefficient("M_reduced")
2632          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))
2633      def test_setCoefficient_A_reduced_Scalar_usingA(self):      def test_setCoefficient_A_reduced_Scalar_usingA(self):
2634          d=self.domain.getDim()          d=self.domain.getDim()
2635          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2636          mypde.setValue(A=Data(numpy.ones((d,d)),ReducedFunction(self.domain)))          mypde.setValue(A=Data(numpy.ones((d,d)),ReducedFunction(self.domain)))
2637          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
2638          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))
2639      def test_setCoefficient_B_reduced_Scalar_usingB(self):      def test_setCoefficient_B_reduced_Scalar_usingB(self):
2640          d=self.domain.getDim()          d=self.domain.getDim()
2641          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2642          mypde.setValue(B=Data(numpy.ones((d,)),ReducedFunction(self.domain)))          mypde.setValue(B=Data(numpy.ones((d,)),ReducedFunction(self.domain)))
2643          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
2644          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))
2645      def test_setCoefficient_C_reduced_Scalar_usingC(self):      def test_setCoefficient_C_reduced_Scalar_usingC(self):
2646          d=self.domain.getDim()          d=self.domain.getDim()
2647          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2648          mypde.setValue(C=Data(numpy.ones((d,)),ReducedFunction(self.domain)))          mypde.setValue(C=Data(numpy.ones((d,)),ReducedFunction(self.domain)))
2649          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
2650          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))
2651      def test_setCoefficient_D_reduced_Scalar_usingD(self):      def test_setCoefficient_D_reduced_Scalar_usingD(self):
2652          d=self.domain.getDim()          d=self.domain.getDim()
2653          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2654          mypde.setValue(D=Scalar(1.,ReducedFunction(self.domain)))          mypde.setValue(D=Scalar(1.,ReducedFunction(self.domain)))
2655          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
2656          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))
2657      def test_setCoefficient_X_reduced_Scalar_usingX(self):      def test_setCoefficient_X_reduced_Scalar_usingX(self):
2658          d=self.domain.getDim()          d=self.domain.getDim()
2659          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2660          mypde.setValue(X_reduced=Data(numpy.ones((d,)),ReducedFunction(self.domain)))          mypde.setValue(X_reduced=Data(numpy.ones((d,)),ReducedFunction(self.domain)))
2661          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
2662          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))
2663      def test_setCoefficient_Y_reduced_Scalar_usingY(self):      def test_setCoefficient_Y_reduced_Scalar_usingY(self):
2664          d=self.domain.getDim()          d=self.domain.getDim()
2665          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2666          mypde.setValue(Y=Scalar(1.,ReducedFunction(self.domain)))          mypde.setValue(Y=Scalar(1.,ReducedFunction(self.domain)))
2667          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
2668          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunction(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunction(self.domain),1))
2669      def test_setCoefficient_y_reduced_Scalar_using_y(self):      def test_setCoefficient_y_reduced_Scalar_using_y(self):
2670          d=self.domain.getDim()          d=self.domain.getDim()
2671          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2672          mypde.setValue(y=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(y=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))
2673          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
2674          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnBoundary(self.domain),1))
2675      def test_setCoefficient_m_reduced_Scalar_using_m(self):      def test_setCoefficient_m_reduced_Scalar_using_m(self):
2676          d=self.domain.getDim()          d=self.domain.getDim()
2677          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2678          mypde.setValue(d=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(d=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))
2679          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
2680          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))
2681      def test_setCoefficient_d_reduced_Scalar_using_d(self):      def test_setCoefficient_d_reduced_Scalar_using_d(self):
2682          d=self.domain.getDim()          d=self.domain.getDim()
2683          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2684          mypde.setValue(m=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(m=Scalar(1.,ReducedFunctionOnBoundary(self.domain)))
2685          coeff=mypde.getCoefficient("m_reduced")          coeff=mypde.getCoefficient("m_reduced")
2686          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))
2687      def test_setCoefficient_d_contact_reduced_Scalar_using_d_contact(self):      def test_setCoefficient_d_contact_reduced_Scalar_using_d_contact(self):
2688          d=self.domain.getDim()          d=self.domain.getDim()
2689          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2690          mypde.setValue(d_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))          mypde.setValue(d_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))
2691          coeff=mypde.getCoefficient("d_contact_reduced")          coeff=mypde.getCoefficient("d_contact_reduced")
2692          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))
2693      def test_setCoefficient_y_contact_reduced_Scalar_using_y_contact(self):      def test_setCoefficient_y_contact_reduced_Scalar_using_y_contact(self):
2694          d=self.domain.getDim()          d=self.domain.getDim()
2695          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2696          mypde.setValue(y_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))          mypde.setValue(y_contact=Scalar(1.,ReducedFunctionOnContactZero(self.domain)))
2697          coeff=mypde.getCoefficient("y_contact_reduced")          coeff=mypde.getCoefficient("y_contact_reduced")
2698          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(), mypde.getNumEquations()),((),ReducedFunctionOnContactZero(self.domain),1))
2699      #      #
2700      #  set coefficients for systems:      #  set coefficients for systems:
2701      #      #
# Line 2311  class Test_TransportPDE(Test_linearPDEs) Line 2704  class Test_TransportPDE(Test_linearPDEs)
2704          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2705          mypde.setValue(M=numpy.ones((self.N,self.N)))          mypde.setValue(M=numpy.ones((self.N,self.N)))
2706          coeff=mypde.getCoefficient("M")          coeff=mypde.getCoefficient("M")
2707          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))
2708      def test_setCoefficient_A_System(self):      def test_setCoefficient_A_System(self):
2709          d=self.domain.getDim()          d=self.domain.getDim()
2710          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2711          mypde.setValue(A=numpy.ones((self.N,d,self.N,d)))          mypde.setValue(A=numpy.ones((self.N,d,self.N,d)))
2712          coeff=mypde.getCoefficient("A")          coeff=mypde.getCoefficient("A")
2713          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))
2714      def test_setCoefficient_B_System(self):      def test_setCoefficient_B_System(self):
2715          d=self.domain.getDim()          d=self.domain.getDim()
2716          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2717          mypde.setValue(B=numpy.ones((self.N,d,self.N)))          mypde.setValue(B=numpy.ones((self.N,d,self.N)))
2718          coeff=mypde.getCoefficient("B")          coeff=mypde.getCoefficient("B")
2719          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))
2720      def test_setCoefficient_C_System(self):      def test_setCoefficient_C_System(self):
2721          d=self.domain.getDim()          d=self.domain.getDim()
2722          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2723          mypde.setValue(C=numpy.ones((self.N,self.N,d)))          mypde.setValue(C=numpy.ones((self.N,self.N,d)))
2724          coeff=mypde.getCoefficient("C")          coeff=mypde.getCoefficient("C")
2725          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))
2726      def test_setCoefficient_D_System(self):      def test_setCoefficient_D_System(self):
2727          d=self.domain.getDim()          d=self.domain.getDim()
2728          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2729          mypde.setValue(D=numpy.ones((self.N,self.N)))          mypde.setValue(D=numpy.ones((self.N,self.N)))
2730          coeff=mypde.getCoefficient("D")          coeff=mypde.getCoefficient("D")
2731          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))
2732      def test_setCoefficient_X_System(self):      def test_setCoefficient_X_System(self):
2733          d=self.domain.getDim()          d=self.domain.getDim()
2734          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2735          mypde.setValue(X=numpy.ones((self.N,d)))          mypde.setValue(X=numpy.ones((self.N,d)))
2736          coeff=mypde.getCoefficient("X")          coeff=mypde.getCoefficient("X")
2737          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))
2738      def test_setCoefficient_Y_System(self):      def test_setCoefficient_Y_System(self):
2739          d=self.domain.getDim()          d=self.domain.getDim()
2740          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2741          mypde.setValue(Y=numpy.ones((self.N,)))          mypde.setValue(Y=numpy.ones((self.N,)))
2742          coeff=mypde.getCoefficient("Y")          coeff=mypde.getCoefficient("Y")
2743          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))
2744      def test_setCoefficient_y_System(self):      def test_setCoefficient_y_System(self):
2745          d=self.domain.getDim()          d=self.domain.getDim()
2746          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2747          mypde.setValue(y=numpy.ones((self.N,)))          mypde.setValue(y=numpy.ones((self.N,)))
2748          coeff=mypde.getCoefficient("y")          coeff=mypde.getCoefficient("y")
2749          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))
2750      def test_setCoefficient_m_System(self):      def test_setCoefficient_m_System(self):
2751          d=self.domain.getDim()          d=self.domain.getDim()
2752          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2753          mypde.setValue(m=numpy.ones((self.N,self.N)))          mypde.setValue(m=numpy.ones((self.N,self.N)))
2754          coeff=mypde.getCoefficient("m")          coeff=mypde.getCoefficient("m")
2755          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))
2756      def test_setCoefficient_d_System(self):      def test_setCoefficient_d_System(self):
2757          d=self.domain.getDim()          d=self.domain.getDim()
2758          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2759          mypde.setValue(d=numpy.ones((self.N,self.N)))          mypde.setValue(d=numpy.ones((self.N,self.N)))
2760          coeff=mypde.getCoefficient("d")          coeff=mypde.getCoefficient("d")
2761          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))
2762      def test_setCoefficient_d_contact_System(self):      def test_setCoefficient_d_contact_System(self):
2763          d=self.domain.getDim()          d=self.domain.getDim()
2764          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2765          mypde.setValue(d_contact=numpy.ones((self.N,self.N)))          mypde.setValue(d_contact=numpy.ones((self.N,self.N)))
2766          coeff=mypde.getCoefficient("d_contact")          coeff=mypde.getCoefficient("d_contact")
2767          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))
2768      def test_setCoefficient_y_contact_System(self):      def test_setCoefficient_y_contact_System(self):
2769          d=self.domain.getDim()          d=self.domain.getDim()
2770          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2771          mypde.setValue(y_contact=numpy.ones((self.N,)))          mypde.setValue(y_contact=numpy.ones((self.N,)))
2772          coeff=mypde.getCoefficient("y_contact")          coeff=mypde.getCoefficient("y_contact")
2773          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))
2774      def test_setCoefficient_M_System_reduced(self):      def test_setCoefficient_M_System_reduced(self):
2775          d=self.domain.getDim()          d=self.domain.getDim()
2776          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2777          mypde.setValue(M_reduced=numpy.ones((self.N,self.N)))          mypde.setValue(M_reduced=numpy.ones((self.N,self.N)))
2778          coeff=mypde.getCoefficient("M_reduced")          coeff=mypde.getCoefficient("M_reduced")
2779          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))
2780      def test_setCoefficient_A_reduced_System(self):      def test_setCoefficient_A_reduced_System(self):
2781          d=self.domain.getDim()          d=self.domain.getDim()
2782          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2783          mypde.setValue(A_reduced=numpy.ones((self.N,d,self.N,d)))          mypde.setValue(A_reduced=numpy.ones((self.N,d,self.N,d)))
2784          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
2785          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))
2786      def test_setCoefficient_B_reduced_System(self):      def test_setCoefficient_B_reduced_System(self):
2787          d=self.domain.getDim()          d=self.domain.getDim()
2788          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2789          mypde.setValue(B_reduced=numpy.ones((self.N,d,self.N)))          mypde.setValue(B_reduced=numpy.ones((self.N,d,self.N)))
2790          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
2791          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))
2792      def test_setCoefficient_C_reduced_System(self):      def test_setCoefficient_C_reduced_System(self):
2793          d=self.domain.getDim()          d=self.domain.getDim()
2794          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2795          mypde.setValue(C_reduced=numpy.ones((self.N,self.N,d)))          mypde.setValue(C_reduced=numpy.ones((self.N,self.N,d)))
2796          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
2797          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))
2798      def test_setCoefficient_D_System_reduced(self):      def test_setCoefficient_D_System_reduced(self):
2799          d=self.domain.getDim()          d=self.domain.getDim()
2800          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2801          mypde.setValue(D_reduced=numpy.ones((self.N,self.N)))          mypde.setValue(D_reduced=numpy.ones((self.N,self.N)))
2802          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
2803          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))
2804      def test_setCoefficient_X_System_reduced(self):      def test_setCoefficient_X_System_reduced(self):
2805          d=self.domain.getDim()          d=self.domain.getDim()
2806          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2807          mypde.setValue(X_reduced=numpy.ones((self.N,d)))          mypde.setValue(X_reduced=numpy.ones((self.N,d)))
2808          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
2809          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))
2810      def test_setCoefficient_Y_System_reduced(self):      def test_setCoefficient_Y_System_reduced(self):
2811          d=self.domain.getDim()          d=self.domain.getDim()
2812          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2813          mypde.setValue(Y_reduced=numpy.ones((self.N,)))          mypde.setValue(Y_reduced=numpy.ones((self.N,)))
2814          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
2815          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))
2816      def test_setCoefficient_y_System_reduced(self):      def test_setCoefficient_y_System_reduced(self):
2817          d=self.domain.getDim()          d=self.domain.getDim()
2818          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2819          mypde.setValue(y_reduced=numpy.ones((self.N,)))          mypde.setValue(y_reduced=numpy.ones((self.N,)))
2820          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
2821          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))
2822      def test_setCoefficient_m_reduced_System(self):      def test_setCoefficient_m_reduced_System(self):
2823          d=self.domain.getDim()          d=self.domain.getDim()
2824          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2825          mypde.setValue(m_reduced=numpy.ones((self.N,self.N)))          mypde.setValue(m_reduced=numpy.ones((self.N,self.N)))
2826          coeff=mypde.getCoefficient("m_reduced")          coeff=mypde.getCoefficient("m_reduced")
2827          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))
2828      def test_setCoefficient_d_reduced_System(self):      def test_setCoefficient_d_reduced_System(self):
2829          d=self.domain.getDim()          d=self.domain.getDim()
2830          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2831          mypde.setValue(d_reduced=numpy.ones((self.N,self.N)))          mypde.setValue(d_reduced=numpy.ones((self.N,self.N)))
2832          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
2833          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))
2834      def test_setCoefficient_d_contact_reduced_System(self):      def test_setCoefficient_d_contact_reduced_System(self):
2835          d=self.domain.getDim()          d=self.domain.getDim()
2836          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2837          mypde.setValue(d_contact_reduced=numpy.ones((self.N,self.N)))          mypde.setValue(d_contact_reduced=numpy.ones((self.N,self.N)))
2838          coeff=mypde.getCoefficient("d_contact_reduced")          coeff=mypde.getCoefficient("d_contact_reduced")
2839          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))
2840      def test_setCoefficient_y_contact_reduced_System(self):      def test_setCoefficient_y_contact_reduced_System(self):
2841          d=self.domain.getDim()          d=self.domain.getDim()
2842          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2843          mypde.setValue(y_contact_reduced=numpy.ones((self.N,)))          mypde.setValue(y_contact_reduced=numpy.ones((self.N,)))
2844          coeff=mypde.getCoefficient("y_contact_reduced")          coeff=mypde.getCoefficient("y_contact_reduced")
2845          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))
2846      def test_setCoefficient_r_System(self):      def test_setCoefficient_r_System(self):
2847          d=self.domain.getDim()          d=self.domain.getDim()
2848          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
2849          mypde.setValue(r=numpy.ones((self.N,)))          mypde.setValue(r=numpy.ones((self.N,)))
2850          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
2851          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))
2852      def test_setCoefficient_q_System(self):      def test_setCoefficient_q_System(self):
2853          d=self.domain.getDim()          d=self.domain.getDim()
2854          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
2855          mypde.setValue(q=numpy.ones((self.N,)))          mypde.setValue(q=numpy.ones((self.N,)))
2856          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
2857          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))
2858      def test_setCoefficient_r_System_reducedOn(self):      def test_setCoefficient_r_System_reducedOn(self):
2859          d=self.domain.getDim()          d=self.domain.getDim()
2860          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
2861          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
2862          mypde.setValue(r=numpy.ones((self.N,)))          mypde.setValue(r=numpy.ones((self.N,)))
2863          coeff=mypde.getCoefficient("r")          coeff=mypde.getCoefficient("r")
2864          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))
2865      def test_setCoefficient_q_System_reducedOn(self):      def test_setCoefficient_q_System_reducedOn(self):
2866          d=self.domain.getDim()          d=self.domain.getDim()
2867          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numEquations=3,debug=self.DEBUG)
2868          mypde.setReducedOrderOn()          mypde.setReducedOrderOn()
2869          mypde.setValue(q=numpy.ones((self.N,)))          mypde.setValue(q=numpy.ones((self.N,)))
2870          coeff=mypde.getCoefficient("q")          coeff=mypde.getCoefficient("q")
2871          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))
2872    
2873      def test_setCoefficient_M_System_reduced_using_D(self):      def test_setCoefficient_M_System_reduced_using_D(self):
2874          d=self.domain.getDim()          d=self.domain.getDim()
2875          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2876          mypde.setValue(M=Data(numpy.ones((self.N,self.N)),ReducedFunction(self.domain)))          mypde.setValue(M=Data(numpy.ones((self.N,self.N)),ReducedFunction(self.domain)))
2877          coeff=mypde.getCoefficient("M_reduced")          coeff=mypde.getCoefficient("M_reduced")
2878          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))
2879      def test_setCoefficient_A_reduced_System_using_A(self):      def test_setCoefficient_A_reduced_System_using_A(self):
2880          d=self.domain.getDim()          d=self.domain.getDim()
2881          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2882          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)))
2883          coeff=mypde.getCoefficient("A_reduced")          coeff=mypde.getCoefficient("A_reduced")
2884          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))
2885      def test_setCoefficient_B_reduced_System_using_B(self):      def test_setCoefficient_B_reduced_System_using_B(self):
2886          d=self.domain.getDim()          d=self.domain.getDim()
2887          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2888          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)))
2889          coeff=mypde.getCoefficient("B_reduced")          coeff=mypde.getCoefficient("B_reduced")
2890          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))
2891      def test_setCoefficient_C_reduced_System_using_C(self):      def test_setCoefficient_C_reduced_System_using_C(self):
2892          d=self.domain.getDim()          d=self.domain.getDim()
2893          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2894          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)))
2895          coeff=mypde.getCoefficient("C_reduced")          coeff=mypde.getCoefficient("C_reduced")
2896          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))
2897      def test_setCoefficient_D_System_reduced_using_D(self):      def test_setCoefficient_D_System_reduced_using_D(self):
2898          d=self.domain.getDim()          d=self.domain.getDim()
2899          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2900          mypde.setValue(D=Data(numpy.ones((self.N,self.N)),ReducedFunction(self.domain)))          mypde.setValue(D=Data(numpy.ones((self.N,self.N)),ReducedFunction(self.domain)))
2901          coeff=mypde.getCoefficient("D_reduced")          coeff=mypde.getCoefficient("D_reduced")
2902          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))
2903      def test_setCoefficient_X_System_reduced_using_X(self):      def test_setCoefficient_X_System_reduced_using_X(self):
2904          d=self.domain.getDim()          d=self.domain.getDim()
2905          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2906          mypde.setValue(X=Data(numpy.ones((self.N,d)),ReducedFunction(self.domain)))          mypde.setValue(X=Data(numpy.ones((self.N,d)),ReducedFunction(self.domain)))
2907          coeff=mypde.getCoefficient("X_reduced")          coeff=mypde.getCoefficient("X_reduced")
2908          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))
2909      def test_setCoefficient_Y_System_reduced_using_Y(self):      def test_setCoefficient_Y_System_reduced_using_Y(self):
2910          d=self.domain.getDim()          d=self.domain.getDim()
2911          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2912          mypde.setValue(Y=Data(numpy.ones((self.N,)),ReducedFunction(self.domain)))          mypde.setValue(Y=Data(numpy.ones((self.N,)),ReducedFunction(self.domain)))
2913          coeff=mypde.getCoefficient("Y_reduced")          coeff=mypde.getCoefficient("Y_reduced")
2914          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))
2915      def test_setCoefficient_y_reduced_System_using_y(self):      def test_setCoefficient_y_reduced_System_using_y(self):
2916          d=self.domain.getDim()          d=self.domain.getDim()
2917          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2918          mypde.setValue(y=Data(numpy.ones((self.N,)),ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(y=Data(numpy.ones((self.N,)),ReducedFunctionOnBoundary(self.domain)))
2919          coeff=mypde.getCoefficient("y_reduced")          coeff=mypde.getCoefficient("y_reduced")
2920          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))
2921      def test_setCoefficient_m_reduced_System_using_m(self):      def test_setCoefficient_m_reduced_System_using_m(self):
2922          d=self.domain.getDim()          d=self.domain.getDim()
2923          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2924          mypde.setValue(m=Data(numpy.ones((self.N,self.N)),ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(m=Data(numpy.ones((self.N,self.N)),ReducedFunctionOnBoundary(self.domain)))
2925          coeff=mypde.getCoefficient("m_reduced")          coeff=mypde.getCoefficient("m_reduced")
2926          self.failUnlessEqual((coeff.getShape(),coeff.getFunctionSpace(),mypde.getNumSolutions(),mypde.getNumEquations()),((self.N,self.N),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))
2927      def test_setCoefficient_d_reduced_System_using_d(self):      def test_setCoefficient_d_reduced_System_using_d(self):
2928          d=self.domain.getDim()          d=self.domain.getDim()
2929          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2930          mypde.setValue(d=Data(numpy.ones((self.N,self.N)),ReducedFunctionOnBoundary(self.domain)))          mypde.setValue(d=Data(numpy.ones((self.N,self.N)),ReducedFunctionOnBoundary(self.domain)))
2931          coeff=mypde.getCoefficient("d_reduced")          coeff=mypde.getCoefficient("d_reduced")
2932          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))
2933      def test_setCoefficient_d_contact_reduced_System_using_d_contact(self):      def test_setCoefficient_d_contact_reduced_System_using_d_contact(self):
2934          d=self.domain.getDim()          d=self.domain.getDim()
2935          mypde=TransportPDE(self.domain,debug=self.DEBUG)          mypde=TransportPDE(self.domain,debug=self.DEBUG)
2936          mypde.setValue(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)))
2937          coeff=mypde.getCoefficient("d_contact_reduced")          coeff=mypde.getCoefficient("d_contact_reduced")
2938          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))
2939      def test_setCoefficient_y_contact_reduced_System_using_y_contact(self):      def test_setCoefficient_y_contact_reduced_System_using_y_contact(self):
2940          d=self.domain.getDim()          d=self.domain.getDim()
2941          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)          mypde=TransportPDE(self.domain,numSolutions=3,debug=self.DEBUG)
2942          mypde.setValue(y_contact=Data(numpy.ones((self.N,)),ReducedFunctionOnContactZero(self.domain)))          mypde.setValue(y_contact=Data(numpy.ones((self.N,)),ReducedFunctionOnContactZero(self.domain)))
2943          coeff=mypde.getCoefficient("y_contact_reduced")          coeff=mypde.getCoefficient("y_contact_reduced")
2944          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))
2945    
2946      def test_symmetryCheckTrue_System(self):      def test_symmetryCheckTrue_System(self):
2947          d=self.domain.getDim()          d=self.domain.getDim()

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

  ViewVC Help
Powered by ViewVC 1.1.26