/[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 4242 by jfenwick, Mon Feb 25 03:16:14 2013 UTC revision 4255 by jfenwick, Wed Feb 27 03:06:21 2013 UTC
# Line 29  Test suite for linearPDEs class Line 29  Test suite for linearPDEs class
29  __author__="Lutz Gross, l.gross@uq.edu.au"  __author__="Lutz Gross, l.gross@uq.edu.au"
30    
31  from esys.escript.util import Lsup,kronecker,interpolate,whereZero, outer, swap_axes  from esys.escript.util import Lsup,kronecker,interpolate,whereZero, outer, swap_axes
32  from esys.escript import Function,FunctionOnBoundary,FunctionOnContactZero,Solution,ReducedSolution,Vector,ContinuousFunction,Scalar, ReducedFunction,ReducedFunctionOnBoundary,ReducedFunctionOnContactZero,Data, Tensor4, Tensor, getEscriptParamInt  from esys.escript import Function,FunctionOnBoundary,FunctionOnContactZero,Solution,ReducedSolution,Vector,ContinuousFunction,Scalar, ReducedFunction,ReducedFunctionOnBoundary,ReducedFunctionOnContactZero,Data, Tensor4, Tensor, getEscriptParamInt, canInterpolate
33  from esys.escript.linearPDEs import LinearPDE,IllegalCoefficientValue,Poisson, IllegalCoefficientFunctionSpace, TransportPDE, IllegalCoefficient, Helmholtz, LameEquation, SolverOptions  from esys.escript.linearPDEs import LinearPDE,IllegalCoefficientValue,Poisson, IllegalCoefficientFunctionSpace, TransportPDE, IllegalCoefficient, Helmholtz, LameEquation, SolverOptions
34  import numpy  import numpy
35  import unittest  import unittest
# Line 44  class Test_linearPDEs(unittest.TestCase) Line 44  class Test_linearPDEs(unittest.TestCase)
44      # Can the domain interpolate from ReducedFunction to Function?      # Can the domain interpolate from ReducedFunction to Function?
45      def specialInterpolationSupported(self):      def specialInterpolationSupported(self):
46          if self._domainCanInterpolateAdvanced is None:          if self._domainCanInterpolateAdvanced is None:
47              d0=Data(0,(),ReducedFunction(self.domain))              self._domainCanInterpolateAdvanced=canInterpolate(ReducedFunction(self.domain), Function(self.domain))
             try:  
                 d1=Data(d0, Function(self.domain))  
                 self._domainCanInterpolateAdvanced=True  
             except:  
                 self._domainCanInterpolateAdvanced=False  
48          return self._domainCanInterpolateAdvanced          return self._domainCanInterpolateAdvanced
49    
50      def check(self,arg,ref_arg,tol=None):      def check(self,arg,ref_arg,tol=None):
# Line 2848  class Test_LinearPDE_noLumping(Test_line Line 2843  class Test_LinearPDE_noLumping(Test_line
2843          x=self.domain.getX()[0]          x=self.domain.getX()[0]
2844          f = pde.getFlux(x)          f = pde.getFlux(x)
2845          self.assertEqual(f.getShape(),(self.domain.getDim(),),"wrong shape of result.")          self.assertEqual(f.getShape(),(self.domain.getDim(),),"wrong shape of result.")
2846          if self.specialInterpolationSupported():          FS=ReducedFunction
             FS=Function  
         else:  
             FS=ReducedFunction  
2847          self.assertEqual(f.getFunctionSpace(),FS(self.domain),"wrong function space")          self.assertEqual(f.getFunctionSpace(),FS(self.domain),"wrong function space")
2848          f_ref=Data(x*kronecker(self.domain)[1]*2+(5-1)*kronecker(self.domain)[0], ReducedFunction(self.domain))          f_ref=Data(x*kronecker(self.domain)[1]*2+(5-1)*kronecker(self.domain)[0], ReducedFunction(self.domain))
2849          self.assertTrue(self.check(f, f_ref),"wrong result")          self.assertTrue(self.check(f, f_ref),"wrong result")

Legend:
Removed from v.4242  
changed lines
  Added in v.4255

  ViewVC Help
Powered by ViewVC 1.1.26