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

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

  ViewVC Help
Powered by ViewVC 1.1.26