/[escript]/trunk/modellib/py_src/input.py
ViewVC logotype

Diff of /trunk/modellib/py_src/input.py

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

revision 5023 by jfenwick, Thu Feb 6 06:12:20 2014 UTC revision 5024 by jfenwick, Tue Jun 10 08:46:07 2014 UTC
# Line 297  class ScalarDistributionFromTags(Paramet Line 297  class ScalarDistributionFromTags(Paramet
297          Link against this method to get the output of this model.          Link against this method to get the output of this model.
298          """          """
299          d=Scalar(self.default,Function(self.domain))          d=Scalar(self.default,Function(self.domain))
300          if not self.tag0 == None: d.setTaggedValue(self.tag0,self.value0)          if not self.tag0 is None: d.setTaggedValue(self.tag0,self.value0)
301          if not self.tag1 == None: d.setTaggedValue(self.tag1,self.value1)          if not self.tag1 is None: d.setTaggedValue(self.tag1,self.value1)
302          if not self.tag2 == None: d.setTaggedValue(self.tag2,self.value2)          if not self.tag2 is None: d.setTaggedValue(self.tag2,self.value2)
303          if not self.tag3 == None: d.setTaggedValue(self.tag3,self.value3)          if not self.tag3 is None: d.setTaggedValue(self.tag3,self.value3)
304          if not self.tag4 == None: d.setTaggedValue(self.tag4,self.value4)          if not self.tag4 is None: d.setTaggedValue(self.tag4,self.value4)
305          if not self.tag5 == None: d.setTaggedValue(self.tag5,self.value5)          if not self.tag5 is None: d.setTaggedValue(self.tag5,self.value5)
306          if not self.tag6 == None: d.setTaggedValue(self.tag6,self.value6)          if not self.tag6 is None: d.setTaggedValue(self.tag6,self.value6)
307          if not self.tag7 == None: d.setTaggedValue(self.tag7,self.value7)          if not self.tag7 is None: d.setTaggedValue(self.tag7,self.value7)
308          if not self.tag8 == None: d.setTaggedValue(self.tag8,self.value8)          if not self.tag8 is None: d.setTaggedValue(self.tag8,self.value8)
309          if not self.tag9 == None: d.setTaggedValue(self.tag9,self.value9)          if not self.tag9 is None: d.setTaggedValue(self.tag9,self.value9)
310          return d          return d
311    
312  class SmoothScalarDistributionFromTags(ParameterSet):  class SmoothScalarDistributionFromTags(ParameterSet):
# Line 401  class SmoothScalarDistributionFromTags(P Line 401  class SmoothScalarDistributionFromTags(P
401          """          """
402          d=Scalar(self.default,Solution(self.domain))          d=Scalar(self.default,Solution(self.domain))
403          self.__pde=None          self.__pde=None
404          if not self.tag0 == None: d=self.__update(self.tag0,self.value0,d)          if not self.tag0 is None: d=self.__update(self.tag0,self.value0,d)
405          if not self.tag1 == None: d=self.__update(self.tag1,self.value1,d)          if not self.tag1 is None: d=self.__update(self.tag1,self.value1,d)
406          if not self.tag2 == None: d=self.__update(self.tag2,self.value2,d)          if not self.tag2 is None: d=self.__update(self.tag2,self.value2,d)
407          if not self.tag3 == None: d=self.__update(self.tag3,self.value3,d)          if not self.tag3 is None: d=self.__update(self.tag3,self.value3,d)
408          if not self.tag4 == None: d=self.__update(self.tag4,self.value4,d)          if not self.tag4 is None: d=self.__update(self.tag4,self.value4,d)
409          if not self.tag5 == None: d=self.__update(self.tag5,self.value5,d)          if not self.tag5 is None: d=self.__update(self.tag5,self.value5,d)
410          if not self.tag6 == None: d=self.__update(self.tag6,self.value6,d)          if not self.tag6 is None: d=self.__update(self.tag6,self.value6,d)
411          if not self.tag7 == None: d=self.__update(self.tag7,self.value7,d)          if not self.tag7 is None: d=self.__update(self.tag7,self.value7,d)
412          if not self.tag8 == None: d=self.__update(self.tag8,self.value8,d)          if not self.tag8 is None: d=self.__update(self.tag8,self.value8,d)
413          if not self.tag9 == None: d=self.__update(self.tag9,self.value9,d)          if not self.tag9 is None: d=self.__update(self.tag9,self.value9,d)
414          return d          return d
415    
416  class LinearCombination(ParameterSet):  class LinearCombination(ParameterSet):
# Line 446  class LinearCombination(ParameterSet): Line 446  class LinearCombination(ParameterSet):
446          returns f0*v0+f1*v1+f2*v2+f3*v3+f4*v4.          returns f0*v0+f1*v1+f2*v2+f3*v3+f4*v4.
447          Link against this method to get the output of this model.          Link against this method to get the output of this model.
448          """          """
449          if not self.f0 == None and not self.v0 == None:          if not self.f0 is None and not self.v0 is None:
450              fv0 = self.f0*self.v0              fv0 = self.f0*self.v0
451          else:          else:
452              fv0 = None              fv0 = None
453    
454          if not self.f1 == None and not self.v1 == None:          if not self.f1 is None and not self.v1 is None:
455              fv1 = self.f1*self.v1              fv1 = self.f1*self.v1
456          else:          else:
457              fv1 = None              fv1 = None
458    
459          if not self.f2 == None and not self.v2 == None:          if not self.f2 is None and not self.v2 is None:
460              fv2 = f2*v2              fv2 = f2*v2
461          else:          else:
462              fv2 = None              fv2 = None
463    
464          if not self.f3 == None and not self.v3 == None:          if not self.f3 is None and not self.v3 is None:
465              fv3 = self.f3*self.v3              fv3 = self.f3*self.v3
466          else:          else:
467              fv3 = None              fv3 = None
468    
469          if not self.f4 == None and not self.v4 == None:          if not self.f4 is None and not self.v4 is None:
470              fv4 = self.f4*self.v4              fv4 = self.f4*self.v4
471          else:          else:
472              fv4 = None              fv4 = None
473    
474          if fv0 == None:          if fv0 is None:
475               out = 0.               out = 0.
476          else:          else:
477               out = fv0               out = fv0
478          if not fv1 == None:          if not fv1 is None:
479              out += fv1              out += fv1
480          if not fv2 == None:          if not fv2 is None:
481              out += fv2              out += fv2
482          if not fv3 == None:          if not fv3 is None:
483              out += fv3              out += fv3
484          return out          return out
485    
# Line 507  class MergeConstraints(ParameterSet): Line 507  class MergeConstraints(ParameterSet):
507            :rtype: `escript.Scalar`            :rtype: `escript.Scalar`
508            """            """
509            out_loc=0            out_loc=0
510            if not self.location_of_constraint0 == None:            if not self.location_of_constraint0 is None:
511                 out_loc=wherePositive(out_loc+wherePositive(self.location_of_constraint0))                 out_loc=wherePositive(out_loc+wherePositive(self.location_of_constraint0))
512            if not self.location_of_constraint1 == None:            if not self.location_of_constraint1 is None:
513                 out_loc=wherePositive(out_loc+wherePositive(self.location_of_constraint1))                 out_loc=wherePositive(out_loc+wherePositive(self.location_of_constraint1))
514            if not self.location_of_constraint2 == None:            if not self.location_of_constraint2 is None:
515                 out_loc=wherePositive(out_loc+wherePositive(self.location_of_constraint2))                 out_loc=wherePositive(out_loc+wherePositive(self.location_of_constraint2))
516            if not self.location_of_constraint3 == None:            if not self.location_of_constraint3 is None:
517                 out_loc=wherePositive(out_loc+wherePositive(self.location_of_constraint3))                 out_loc=wherePositive(out_loc+wherePositive(self.location_of_constraint3))
518            return out_loc            return out_loc
519    
# Line 527  class MergeConstraints(ParameterSet): Line 527  class MergeConstraints(ParameterSet):
527            """            """
528            out_loc=0            out_loc=0
529            out=0            out=0
530            if not self.location_of_constraint0 == None:            if not self.location_of_constraint0 is None:
531                 tmp=wherePositive(self.location_of_constraint0)                 tmp=wherePositive(self.location_of_constraint0)
532                 out=out*(1.-tmp)+self.value_of_constraint0*tmp                 out=out*(1.-tmp)+self.value_of_constraint0*tmp
533                 out_loc=wherePositive(out_loc+tmp)                 out_loc=wherePositive(out_loc+tmp)
534            if not self.location_of_constraint1 == None:            if not self.location_of_constraint1 is None:
535                 tmp=wherePositive(self.location_of_constraint1)                 tmp=wherePositive(self.location_of_constraint1)
536                 out=out*(1.-tmp)+self.value_of_constraint1*tmp                 out=out*(1.-tmp)+self.value_of_constraint1*tmp
537                 out_loc=wherePositive(out_loc+tmp)                 out_loc=wherePositive(out_loc+tmp)
538            if not self.location_of_constraint2 == None:            if not self.location_of_constraint2 is None:
539                 tmp=wherePositive(self.location_of_constraint2)                 tmp=wherePositive(self.location_of_constraint2)
540                 out=out*(1.-tmp)+self.value_of_constraint2*tmp                 out=out*(1.-tmp)+self.value_of_constraint2*tmp
541                 out_loc=wherePositive(out_loc+tmp)                 out_loc=wherePositive(out_loc+tmp)
542            if not self.location_of_constraint3 == None:            if not self.location_of_constraint3 is None:
543                 tmp=wherePositive(self.location_of_constraint3)                 tmp=wherePositive(self.location_of_constraint3)
544                 out=out*(1.-tmp)+self.value_of_constraint3*tmp                 out=out*(1.-tmp)+self.value_of_constraint3*tmp
545                 out_loc=wherePositive(out_loc+tmp)                 out_loc=wherePositive(out_loc+tmp)

Legend:
Removed from v.5023  
changed lines
  Added in v.5024

  ViewVC Help
Powered by ViewVC 1.1.26