/[escript]/trunk/escriptcore/py_src/linearPDEs.py
ViewVC logotype

Diff of /trunk/escriptcore/py_src/linearPDEs.py

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

revision 6669 by uqagarro, Sun Apr 29 23:40:55 2018 UTC revision 6670 by uqagarro, Mon Apr 30 03:03:17 2018 UTC
# Line 41  by their advective terms. Line 41  by their advective terms.
41  :var __date__: date of the version  :var __date__: date of the version
42  """  """
43    
44    from esys.escript import *
45  from . import escriptcpp as escore  from . import escriptcpp as escore
46  from . import util  from . import util
47  import math  import math
# Line 259  class PDECoef(object): Line 260  class PDECoef(object):
260                  except:                  except:
261                    raise IllegalCoefficientFunctionSpace("Unable to interpolate coefficient to function space %s"%self.getFunctionSpace(domain))                    raise IllegalCoefficientFunctionSpace("Unable to interpolate coefficient to function space %s"%self.getFunctionSpace(domain))
262         else:         else:
263             newValue=escore.Data(newValue,self.getFunctionSpace(domain,reducedEquationOrder,reducedSolutionOrder))             try:
264                    newValue=escore.Data(newValue,self.getFunctionSpace(domain,reducedEquationOrder,reducedSolutionOrder))
265               except:
266                    if not (isinstance(newValue, Data) or \
267                    isinstance(newValue, float) or \
268                    isinstance(newValue, complex) or \
269                    isinstance(newValue, numpy.ndarray)):
270                        raise IllegalCoefficient("Illegal coefficient type: Type should be castable to Data.")
271                    else:
272                        raise RuntimeError("Check input data")
273         if not newValue.isEmpty():         if not newValue.isEmpty():
274             if not self.getShape(domain,numEquations,numSolutions)==newValue.getShape():             if not self.getShape(domain,numEquations,numSolutions)==newValue.getShape():
275                 raise IllegalCoefficientValue("Expected shape of coefficient is %s but actual shape is %s."%(self.getShape(domain,numEquations,numSolutions),newValue.getShape()))                 raise IllegalCoefficientValue("Expected shape of coefficient is %s but actual shape is %s."%(self.getShape(domain,numEquations,numSolutions),newValue.getShape()))
# Line 2131  class LinearPDE(LinearProblem): Line 2141  class LinearPDE(LinearProblem):
2141                 representation of the equation                 representation of the equation
2142        :raise IllegalCoefficient: if an unknown coefficient keyword is used        :raise IllegalCoefficient: if an unknown coefficient keyword is used
2143        """        """
   
2144        super(LinearPDE,self).setValue(**coefficients)        super(LinearPDE,self).setValue(**coefficients)
2145        # check if the systrem is inhomogeneous:        # check if the systrem is inhomogeneous:
2146        if len(coefficients)>0 and not self.isUsingLumping():        if len(coefficients)>0 and not self.isUsingLumping():

Legend:
Removed from v.6669  
changed lines
  Added in v.6670

  ViewVC Help
Powered by ViewVC 1.1.26