382 |
return the values used to constrain a solution |
return the values used to constrain a solution |
383 |
|
|
384 |
@return: the mask marking the locations of the constraints |
@return: the mask marking the locations of the constraints |
385 |
@rtype: L{escript.Vector} |
@rtype: L{escript.Scalar} |
386 |
""" |
""" |
387 |
out_loc=0 |
out_loc=0 |
388 |
if not self.location_of_constraint0 == None and not self.value_of_constraint0== None: |
if not self.location_of_constraint0 == None: |
389 |
out_loc=wherePositive(out_loc+wherePositive(self.location_of_constraint0)) |
out_loc=wherePositive(out_loc+wherePositive(self.location_of_constraint0)) |
390 |
if not self.location_of_constraint1 == None and not self.value_of_constraint1== None: |
if not self.location_of_constraint1 == None: |
391 |
out_loc=wherePositive(out_loc+wherePositive(self.location_of_constraint1)) |
out_loc=wherePositive(out_loc+wherePositive(self.location_of_constraint1)) |
392 |
if not self.location_of_constraint2 == None and not self.value_of_constraint2== None: |
if not self.location_of_constraint2 == None: |
393 |
out_loc=wherePositive(out_loc+wherePositive(self.location_of_constraint2)) |
out_loc=wherePositive(out_loc+wherePositive(self.location_of_constraint2)) |
394 |
if not self.location_of_constraint3 == None and not self.value_of_constraint3== None: |
if not self.location_of_constraint3 == None: |
395 |
out_loc=wherePositive(out_loc+wherePositive(self.location_of_constraint3)) |
out_loc=wherePositive(out_loc+wherePositive(self.location_of_constraint3)) |
396 |
return out_loc |
return out_loc |
397 |
|
|
401 |
|
|
402 |
@return: values to be used at the locations of the constraints. If |
@return: values to be used at the locations of the constraints. If |
403 |
L{value} is not given C{None} is rerturned. |
L{value} is not given C{None} is rerturned. |
404 |
@rtype: L{escript.Vector} |
@rtype: L{escript.Scalar} |
405 |
""" |
""" |
406 |
out_loc=0 |
out_loc=0 |
407 |
out=0 |
out=0 |
408 |
if not self.location_of_constraint0 == None and not self.value_of_constraint0== None: |
if not self.location_of_constraint0 == None: |
409 |
tmp=wherePositive(self.location_of_constraint0) |
tmp=wherePositive(self.location_of_constraint0) |
410 |
out=out*out_loc+self.value_of_constraint0*tmp |
out=out*(1.-tmp)+self.value_of_constraint0*tmp |
411 |
out_loc=wherePositive(out_loc+tmp) |
out_loc=wherePositive(out_loc+tmp) |
412 |
if not self.location_of_constraint1 == None and not self.value_of_constraint1== None: |
if not self.location_of_constraint1 == None: |
413 |
tmp=wherePositive(self.location_of_constraint1) |
tmp=wherePositive(self.location_of_constraint1) |
414 |
out=out*out_loc+self.value_of_constraint1*tmp |
out=out*(1.-tmp)+self.value_of_constraint1*tmp |
415 |
out_loc=wherePositive(out_loc+tmp) |
out_loc=wherePositive(out_loc+tmp) |
416 |
if not self.location_of_constraint2 == None and not self.value_of_constraint2== None: |
if not self.location_of_constraint2 == None: |
417 |
tmp=wherePositive(self.location_of_constraint2) |
tmp=wherePositive(self.location_of_constraint2) |
418 |
out=out*out_loc+self.value_of_constraint2*tmp |
out=out*(1.-tmp)+self.value_of_constraint2*tmp |
419 |
out_loc=wherePositive(out_loc+tmp) |
out_loc=wherePositive(out_loc+tmp) |
420 |
if not self.location_of_constraint3 == None and not self.value_of_constraint3== None: |
if not self.location_of_constraint3 == None: |
421 |
tmp=wherePositive(self.location_of_constraint3) |
tmp=wherePositive(self.location_of_constraint3) |
422 |
out=out*out_loc+self.value_of_constraint3*tmp |
out=out*(1.-tmp)+self.value_of_constraint3*tmp |
423 |
out_loc=wherePositive(out_loc+tmp) |
out_loc=wherePositive(out_loc+tmp) |
424 |
return out |
return out |
425 |
# vim: expandtab shiftwidth=4: |
# vim: expandtab shiftwidth=4: |