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

Contents of /trunk/modellib/py_src/geometry.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1809 - (show annotations)
Thu Sep 25 06:43:44 2008 UTC (11 years, 6 months ago) by ksteube
File MIME type: text/x-python
File size: 28485 byte(s)
Copyright updated in all python files

1
2 ########################################################
3 #
4 # Copyright (c) 2003-2008 by University of Queensland
5 # Earth Systems Science Computational Center (ESSCC)
6 # http://www.uq.edu.au/esscc
7 #
8 # Primary Business: Queensland, Australia
9 # Licensed under the Open Software License version 3.0
10 # http://www.opensource.org/licenses/osl-3.0.php
11 #
12 ########################################################
13
14 __copyright__="""Copyright (c) 2003-2008 by University of Queensland
15 Earth Systems Science Computational Center (ESSCC)
16 http://www.uq.edu.au/esscc
17 Primary Business: Queensland, Australia"""
18 __license__="""Licensed under the Open Software License version 3.0
19 http://www.opensource.org/licenses/osl-3.0.php"""
20 __url__="http://www.uq.edu.au/esscc/escript-finley"
21
22 from esys.escript import *
23 from esys.escript.modelframe import Model,ParameterSet
24 from esys import finley
25
26 class FinleyReader(ParameterSet):
27 """
28 reads finley mesh file.
29
30 @ivar source: mesh file in finley or gmsh format
31 @type source: C{DataSource}
32 @ivar intergrationOrder: integration order, default -1 (in).
33 @type intergrationOrder: C{int}
34 @ivar reducedIntegrationOrder: reduced integration order, default -1 (in).
35 @type reducedIntegrationOrder: C{int}
36 @ivar optimizeLabeling: switches on optimization of the labeling of the nodes
37 @type optimizeLabeling: C{bool}
38 """
39 def __init__(self,**kwargs):
40 """
41 initializes the object
42 """
43 super(FinleyReader,self).__init__(**kwargs)
44 self.declareParameter(source="none",
45 dim=None,
46 optimizeLabeling=True,
47 reducedIntegrationOrder=-1,
48 integrationOrder=-1)
49 self.__domain=None
50
51
52 def domain(self):
53 """
54 returns the domain
55
56 @return: the domain
57 @rtype: L{Domain}
58 """
59 if self.__domain == None:
60 if self.source.fileformat == "fly":
61 self.__domain=finley.ReadMesh(self.source.getLocalFileName(),self.integrationOrder)
62 elif self.source.fileformat == "gmsh":
63 if self.dim==None:
64 dim=3
65 else:
66 dim=self.dim
67 self.__domain=finley.ReadGmsh(self.source.getLocalFileName(),dim,self.integrationOrder,self.reducedIntegrationOrder, self.optimizeLabeling)
68 else:
69 raise TypeError("unknown mesh file format %s."%self.source.fileformat)
70 self.trace("mesh read from %s in %s format."%(self.source.getLocalFileName(), self.source.fileformat))
71 return self.__domain
72 class RectangularDomain(ParameterSet):
73 """
74 Generates a mesh over a rectangular domain finley.
75
76 @ivar dim: spatial dimension, default =2 (in).
77 @type dim: spatial dimension
78 @ivar l: spatial lengths, default [1.,1.,1.] (in).
79 @type l: C{list} of C{floats}s
80 @ivar n: number of elements, default [10,10,10] (in).
81 @type n: C{list} of C{int}s
82 @ivar order: element order, default 1 (in).
83 @type order: C{int}
84 @ivar periodic: flags for periodicity, default [False,False,False] (in).
85 @type periodic: C{list} of C{bool}s
86 @ivar intergrationOrder: integration order, default -1 (in).
87 @type intergrationOrder: C{int}
88 """
89 def __init__(self,**kwargs):
90 """
91 initializes the object
92 """
93 super(RectangularDomain,self).__init__(**kwargs)
94 self.declareParameter(dim=2,\
95 l=[1.,1.,1.],\
96 n=[10,10,10], \
97 order=1,\
98 periodic=[False,False,False],
99 integrationOrder=-1)
100 self.__domain=None
101
102 def domain(self):
103 """
104 returns the domain
105
106 @return: the domain
107 @rtype: L{Domain}
108 """
109 if self.__domain==None:
110 if self.dim==2:
111 self.__domain=finley.Rectangle(n0=self.n[0],\
112 n1=self.n[2],\
113 l0=self.l[0],\
114 l1=self.l[2],\
115 order=self.order, \
116 periodic0=self.periodic[0], \
117 periodic1=self.periodic[2], \
118 integrationOrder=self.integrationOrder)
119 else:
120 self.__domain=finley.Brick(n0=self.n[0],\
121 n1=self.n[1],\
122 n2=self.n[2],\
123 l0=self.l[0],\
124 l1=self.l[1],\
125 l2=self.l[2],\
126 order=self.order, \
127 periodic0=self.periodic[0], \
128 periodic1=self.periodic[1], \
129 periodic2=self.periodic[2], \
130 integrationOrder=self.integrationOrder)
131 return self.__domain
132
133 class UpdateGeometry(Model):
134 """
135 applies a displacement field to a domain
136
137 @ivar displacement: displacements applied to the original mesh coordinates (in).
138 @type displacement: L{escript.Vector}
139 @ivar domain: domain
140 @type domain: L{escript.Domain}
141 """
142 def __init__(self,**kwargs):
143 """
144 set-up the object
145 """
146 super(UpdateGeometry, self).__init__(**kwargs)
147 self.declareParameter(domain=None,\
148 displacement=None)
149
150
151 def doInitialization(self):
152 """
153 initialize model
154 """
155 self.__x=self.domain.getX()
156 self.__reset=True
157
158 def doStepPreprocessing(self,dt):
159 """
160 applies the current L{displacement} to mesh nodes if required.
161 """
162 if self.__reset:
163 self.trace("mesh nodes updated.")
164 self.domain.setX(self.__x+self.displacement)
165 self.__reset=False
166
167 def doStep(self,dt):
168 """
169 applies the current L{displacement} to mesh nodes.
170 """
171 self.trace("mesh nodes updated.")
172 self.domain.setX(self.__x+self.displacement)
173 self.__reset=True
174
175 def doStepPostprocessing(self,dt):
176 """
177 marks nodes as beeing updated.
178 """
179 self.__reset=False
180
181 class ConstrainerOverBox(Model):
182 """
183 Creates a characteristic function for the location of constraints
184 for all components of a value and selects the value from an initial value
185 ate these locations.
186
187 In the case that the spatial dimension is two, the arguments front and back are ignored.
188
189 @ivar domain: domain (in).
190 @ivar left: True to set a constraint at the left face of the domain (x[0]=min x[0]), default False (in).
191 @ivar right: True to set a constraint at the left face of the domain (x[0]=max x[0]), default False (in).
192 @ivar top: True to set a constraint at the left face of the domain (x[1]=min x[1]), default False (in).
193 @ivar bottom: True to set a constraint at the left face of the domain (x[1]=max x[1]), default False (in).
194 @ivar front: True to set a constraint at the left face of the domain (x[2]=min x[2]), default False (in).
195 @ivar back: True to set a constraint at the left face of the domain (x[2]=max x[2]), default False (in).
196 @ivar tol: absolute tolerance for "x=max x" condition, default 1.e-8 (in).
197 """
198 def __init__(self,**kwargs):
199 super(ConstrainerOverBox, self).__init__(**kwargs)
200 self.declareParameter(domain=None, \
201 value=None, \
202 left=False, \
203 right=False, \
204 top=False, \
205 bottom=False, \
206 front=False, \
207 back=False, \
208 tol=1.e-8)
209 self.__value_of_constraint = None
210 self.__location_of_constraint=None
211 def location_of_constraint(self):
212 """
213 return the values used to constrain a solution
214
215 @return: the mask marking the locations of the constraints
216 @rtype: L{escript.Scalar}
217 """
218 if self.__location_of_constraint == None: self.__setOutput()
219 return self.__location_of_constraint
220
221 def value_of_constraint(self):
222 """
223 return the values used to constrain a solution
224
225 @return: values to be used at the locations of the constraints. If
226 L{value} is not given C{None} is rerturned.
227 @rtype: L{escript.Scalar}
228 """
229 if self.__location_of_constraint == None: self.__setOutput()
230 return self.__value_of_constraint
231
232 def __setOutput(self):
233 if self.__location_of_constraint == None:
234 x=self.domain.getX()
235 val=self.value
236 if isinstance(val, int) or isinstance(val, float):
237 shape=()
238 elif isinstance(val, list) or isinstance(val, tuple) :
239 shape=(len(val),)
240 elif isinstance(val, numarray.NumArray):
241 shape=val.shape
242 elif val == None:
243 shape=()
244 else:
245 shape=val.getShape()
246 self.__location_of_constraint=Data(0,shape,x.getFunctionSpace())
247 if self.domain.getDim()==3:
248 x0,x1,x2=x[0],x[1],x[2]
249 if self.left: self.__location_of_constraint+=whereZero(x0-inf(x0),self.tol)
250 if self.right: self.__location_of_constraint+=whereZero(x0-sup(x0),self.tol)
251 if self.front: self.__location_of_constraint+=whereZero(x1-inf(x1),self.tol)
252 if self.back: self.__location_of_constraint+=whereZero(x1-sup(x1),self.tol)
253 if self.bottom: self.__location_of_constraint+=whereZero(x2-inf(x2),self.tol)
254 if self.top: self.__location_of_constraint+=whereZero(x2-sup(x2),self.tol)
255 else:
256 x0,x1=x[0],x[1]
257 if self.left: self.__location_of_constraint+=whereZero(x0-inf(x0),self.tol)
258 if self.right: self.__location_of_constraint+=whereZero(x0-sup(x0),self.tol)
259 if self.bottom: self.__location_of_constraint+=whereZero(x1-inf(x1),self.tol)
260 if self.top: self.__location_of_constraint+=whereZero(x1-sup(x1),self.tol)
261 if not self.value == None:
262 self.__value_of_constraint=self.__location_of_constraint*self.value
263 class ScalarConstrainerOverBox(Model):
264 """
265 Creates a characteristic function for the location of constraints
266 for a scalar value and selects the value from an initial value
267 ate these locations.
268
269 In the case that the spatial dimension is two, the arguments front and back are ignored.
270
271 @ivar domain: domain (in).
272 @ivar left: True to set a constraint at the left face of the domain (x[0]=min x[0]), default False (in).
273 @ivar right: True to set a constraint at the left face of the domain (x[0]=max x[0]), default False (in).
274 @ivar top: True to set a constraint at the left face of the domain (x[1]=min x[1]), default False (in).
275 @ivar bottom: True to set a constraint at the left face of the domain (x[1]=max x[1]), default False (in).
276 @ivar front: True to set a constraint at the left face of the domain (x[2]=min x[2]), default False (in).
277 @ivar back: True to set a constraint at the left face of the domain (x[2]=max x[2]), default False (in).
278 @ivar tol: absolute tolerance for "x=max x" condition, default 1.e-8 (in).
279 """
280 def __init__(self,**kwargs):
281 super(ScalarConstrainerOverBox, self).__init__(**kwargs)
282 self.declareParameter(domain=None, \
283 value=None, \
284 left=False, \
285 right=False, \
286 top=False, \
287 bottom=False, \
288 front=False, \
289 back=False, \
290 tol=1.e-8)
291 self.__value_of_constraint = None
292 self.__location_of_constraint=None
293 def location_of_constraint(self):
294 """
295 return the values used to constrain a solution
296
297 @return: the mask marking the locations of the constraints
298 @rtype: L{escript.Scalar}
299 """
300 if self.__location_of_constraint == None: self.__setOutput()
301 return self.__location_of_constraint
302
303 def value_of_constraint(self):
304 """
305 return the values used to constrain a solution
306
307 @return: values to be used at the locations of the constraints. If
308 L{value} is not given C{None} is rerturned.
309 @rtype: L{escript.Scalar}
310 """
311 if self.__location_of_constraint == None: self.__setOutput()
312 return self.__value_of_constraint
313
314 def __setOutput(self):
315 x=self.domain.getX()
316 self.__location_of_constraint=Scalar(0,x.getFunctionSpace())
317 if self.domain.getDim()==3:
318 x0,x1,x2=x[0],x[1],x[2]
319 if self.left: self.__location_of_constraint+=whereZero(x0-inf(x0),self.tol)
320 if self.right: self.__location_of_constraint+=whereZero(x0-sup(x0),self.tol)
321 if self.front: self.__location_of_constraint+=whereZero(x1-inf(x1),self.tol)
322 if self.back: self.__location_of_constraint+=whereZero(x1-sup(x1),self.tol)
323 if self.bottom: self.__location_of_constraint+=whereZero(x2-inf(x2),self.tol)
324 if self.top: self.__location_of_constraint+=whereZero(x2-sup(x2),self.tol)
325 else:
326 x0,x1=x[0],x[1]
327 if self.left: self.__location_of_constraint+=whereZero(x0-inf(x0),self.tol)
328 if self.right: self.__location_of_constraint+=whereZero(x0-sup(x0),self.tol)
329 if self.bottom: self.__location_of_constraint+=whereZero(x1-inf(x1),self.tol)
330 if self.top: self.__location_of_constraint+=whereZero(x1-sup(x1),self.tol)
331 if not self.value == None:
332 self.__value_of_constraint=self.__location_of_constraint*self.value
333
334 class VectorConstrainerOverBox(Model):
335 """
336 Creates a characteristic function for the location of constraints vector value.
337 In the case that the spatial dimension is two, the arguments front and
338 back as well as the third component of each argument is ignored.
339
340 @ivar domain: domain
341 @ivar left: list of three boolean. left[i]==True sets a constraint for the i-th component at the left face of the domain (x[0]=min x[0]),
342 default [False,False,False] (in).
343 @ivar right: list of three boolean. left[i]==True sets a constraint for the i-th component at the right face of the domain (x[0]=max x[0]),
344 default [False,False,False] (in).
345 @ivar top: list of three boolean. left[i]==True sets a constraint for the i-th component at the top face of the domain (x[1]=min x[1]),
346 default [False,False,False] (in).
347 @ivar bottom: list of three boolean. left[i]==True sets a constraint for the i-th component at the bottom face of the domain (x[1]=min x[1]),
348 default [False,False,False] (in).
349 @ivar front: list of three boolean. left[i]==True sets a constraint for the i-th component at the front face of the domain (x[2]=min x[2]),
350 default [False,False,False] (in).
351 @ivar back: list of three boolean. left[i]==True sets a constraint for the i-th component at the back face of the domain (x[2]=max x[2]),
352 default [False,False,False] (in).
353 @ivar tol: absolute tolerance for "x=max x" condition, default 1.e-8 (in).
354 """
355 def __init__(self, **kwargs):
356 super(VectorConstrainerOverBox, self).__init__(**kwargs)
357 self.declareParameter(domain=None, \
358 value=None, \
359 left=[False ,False ,False ], \
360 right=[False ,False ,False ], \
361 top=[False ,False ,False ], \
362 bottom=[False ,False ,False ], \
363 front=[False ,False ,False ], \
364 back=[False ,False ,False ], \
365 tol=1.e-8)
366 self.__value_of_constraint = None
367 self.__location_of_constraint=None
368
369 def location_of_constraint(self):
370 """
371 return the values used to constrain a solution
372
373 @return: the mask marking the locations of the constraints
374 @rtype: L{escript.Vector}
375 """
376 if self.__location_of_constraint == None: self.__setOutput()
377 return self.__location_of_constraint
378
379 def value_of_constraint(self):
380 """
381 return the values used to constrain a solution
382
383 @return: values to be used at the locations of the constraints. If
384 L{value} is not given C{None} is rerturned.
385 @rtype: L{escript.Vector}
386 """
387 if self.__location_of_constraint == None: self.__setOutput()
388 return self.__value_of_constraint
389
390 def __setOutput(self):
391 x=self.domain.getX()
392 self.__location_of_constraint=Vector(0,x.getFunctionSpace())
393 if self.domain.getDim()==3:
394 x0,x1,x2=x[0],x[1],x[2]
395 left_mask=whereZero(x0-inf(x0),self.tol)
396 if self.left[0]: self.__location_of_constraint+=left_mask*[1.,0.,0.]
397 if self.left[1]: self.__location_of_constraint+=left_mask*[0.,1.,0.]
398 if self.left[2]: self.__location_of_constraint+=left_mask*[0.,0.,1.]
399 right_mask=whereZero(x0-sup(x0),self.tol)
400 if self.right[0]: self.__location_of_constraint+=right_mask*[1.,0.,0.]
401 if self.right[1]: self.__location_of_constraint+=right_mask*[0.,1.,0.]
402 if self.right[2]: self.__location_of_constraint+=right_mask*[0.,0.,1.]
403 front_mask=whereZero(x1-inf(x1),self.tol)
404 if self.front[0]: self.__location_of_constraint+=front_mask*[1.,0.,0.]
405 if self.front[1]: self.__location_of_constraint+=front_mask*[0.,1.,0.]
406 if self.front[2]: self.__location_of_constraint+=front_mask*[0.,0.,1.]
407 back_mask=whereZero(x1-sup(x1),self.tol)
408 if self.back[0]: self.__location_of_constraint+=back_mask*[1.,0.,0.]
409 if self.back[1]: self.__location_of_constraint+=back_mask*[0.,1.,0.]
410 if self.back[2]: self.__location_of_constraint+=back_mask*[0.,0.,1.]
411 bottom_mask=whereZero(x2-inf(x2),self.tol)
412 if self.bottom[0]: self.__location_of_constraint+=bottom_mask*[1.,0.,0.]
413 if self.bottom[1]: self.__location_of_constraint+=bottom_mask*[0.,1.,0.]
414 if self.bottom[2]: self.__location_of_constraint+=bottom_mask*[0.,0.,1.]
415 top_mask=whereZero(x2-sup(x2),self.tol)
416 if self.top[0]: self.__location_of_constraint+=top_mask*[1.,0.,0.]
417 if self.top[1]: self.__location_of_constraint+=top_mask*[0.,1.,0.]
418 if self.top[2]: self.__location_of_constraint+=top_mask*[0.,0.,1.]
419 if not self.value == None:
420 self.__value_of_constraint=self.__location_of_constraint*self.value
421 else:
422 x0,x1=x[0],x[1]
423 left_mask=whereZero(x0-inf(x0),self.tol)
424 if self.left[0]: self.__location_of_constraint+=left_mask*[1.,0.]
425 if self.left[1]: self.__location_of_constraint+=left_mask*[0.,1.]
426 right_mask=whereZero(x0-sup(x0),self.tol)
427 if self.right[0]: self.__location_of_constraint+=right_mask*[1.,0.]
428 if self.right[1]: self.__location_of_constraint+=right_mask*[0.,1.]
429 bottom_mask=whereZero(x1-inf(x1),self.tol)
430 if self.bottom[0]: self.__location_of_constraint+=bottom_mask*[1.,0.]
431 if self.bottom[1]: self.__location_of_constraint+=bottom_mask*[0.,1.]
432 top_mask=whereZero(x1-sup(x1),self.tol)
433 if self.top[0]: self.__location_of_constraint+=top_mask*[1.,0.]
434 if self.top[1]: self.__location_of_constraint+=top_mask*[0.,1.]
435 if not self.value == None:
436 self.__value_of_constraint=self.__location_of_constraint*self.value[:2]
437
438 class ConstrainerAtBoxVertex(Model):
439 """
440 Creates a characteristic function for the location of constraints
441 for all components of a value and selects the value from an initial value
442 ate these locations.
443
444 In the case that the spatial dimension is two, the arguments front and back are ignored.
445
446 @ivar domain: domain (in).
447 @ivar tol: absolute tolerance for "x=left, front, bottom vertex" condition, default 1.e-8 (in).
448 """
449 def __init__(self,**kwargs):
450 super(ConstrainerAtBoxVertex, self).__init__(**kwargs)
451 self.declareParameter(domain=None, \
452 value=None, \
453 tol=1.e-8)
454 self.__value_of_constraint = None
455 self.__location_of_constraint=None
456 def location_of_constraint(self):
457 """
458 return the values used to constrain a solution
459
460 @return: the mask marking the locations of the constraints
461 @rtype: L{escript.Scalar}
462 """
463 if self.__location_of_constraint == None: self.__setOutput()
464 return self.__location_of_constraint
465
466 def value_of_constraint(self):
467 """
468 return the values used to constrain a solution
469
470 @return: values to be used at the locations of the constraints. If
471 L{value} is not given C{None} is rerturned.
472 @rtype: L{escript.Scalar}
473 """
474 if self.__location_of_constraint == None: self.__setOutput()
475 return self.__value_of_constraint
476
477 def __setOutput(self):
478 if self.__location_of_constraint == None:
479 x=self.domain.getX()
480 val=self.value
481 if isinstance(val, int) or isinstance(val, float):
482 shape=()
483 elif isinstance(val, list) or isinstance(val, tuple) :
484 shape=(len(val),)
485 elif isinstance(val, numarray.NumArray):
486 shape=val.shape
487 elif val == None:
488 shape=()
489 else:
490 shape=val.getShape()
491 if self.domain.getDim()==3:
492 vertex=[inf(x[0]),inf(x[1]),inf(x[2])]
493 else:
494 vertex=[inf(x[0]),inf(x[1])]
495 self.__location_of_constraint=whereZero(length(x-vertex),self.tol)*numarray.ones(shape)
496 if not self.value == None:
497 self.__value_of_constraint=self.__location_of_constraint*self.value
498 class ScalarConstrainerAtBoxVertex(Model):
499 """
500 Creates a characteristic function for the location of constraints
501 for a scalar value and selects the value from an initial value
502 ate these locations.
503
504 In the case that the spatial dimension is two, the arguments front and back are ignored.
505
506 @ivar domain: domain (in).
507 @ivar tol: absolute tolerance for "x=left, front, bottom vertex" condition, default 1.e-8 (in).
508 """
509 def __init__(self,**kwargs):
510 super(ScalarConstrainerAtBoxVertex, self).__init__(**kwargs)
511 self.declareParameter(domain=None, \
512 value=None, \
513 tol=1.e-8)
514 self.__value_of_constraint = None
515 self.__location_of_constraint=None
516 def location_of_constraint(self):
517 """
518 return the values used to constrain a solution
519
520 @return: the mask marking the locations of the constraints
521 @rtype: L{escript.Scalar}
522 """
523 if self.__location_of_constraint == None: self.__setOutput()
524 return self.__location_of_constraint
525
526 def value_of_constraint(self):
527 """
528 return the values used to constrain a solution
529
530 @return: values to be used at the locations of the constraints. If
531 L{value} is not given C{None} is rerturned.
532 @rtype: L{escript.Scalar}
533 """
534 if self.__location_of_constraint == None: self.__setOutput()
535 return self.__value_of_constraint
536
537 def __setOutput(self):
538 x=self.domain.getX()
539 self.__location_of_constraint=Scalar(0,x.getFunctionSpace())
540 if self.domain.getDim()==3:
541 vertex=[inf(x[0]),inf(x[1]),inf(x[2])]
542 else:
543 vertex=[inf(x[0]),inf(x[1])]
544 self.__location_of_constraint=whereZero(length(x-vertex),self.tol)
545 if not self.value == None:
546 self.__value_of_constraint=self.__location_of_constraint*self.value
547
548 class VectorConstrainerAtBoxVertex(Model):
549 """
550 Creates a characteristic function for the location of constraints vector value.
551 In the case that the spatial dimension is two, the arguments front and
552 back as well as the third component of each argument is ignored.
553
554 @ivar domain: domain
555 @ivar comp_mask: list of three boolean. comp_mask[i]==True sets a constraint for the i-th component at the left, front, bottom vertex, default [False,False,False] (in).
556 @ivar tol: absolute tolerance for "x=left, front, bottom vertex" condition, default 1.e-8 (in).
557 """
558 def __init__(self, **kwargs):
559 super(VectorConstrainerAtBoxVertex, self).__init__(**kwargs)
560 self.declareParameter(domain=None, \
561 value=None, \
562 comp_mask=[False, False, False],
563 tol=1.e-8)
564 self.__value_of_constraint = None
565 self.__location_of_constraint=None
566
567 def location_of_constraint(self):
568 """
569 return the values used to constrain a solution
570
571 @return: the mask marking the locations of the constraints
572 @rtype: L{escript.Vector}
573 """
574 if self.__location_of_constraint == None: self.__setOutput()
575 return self.__location_of_constraint
576
577 def value_of_constraint(self):
578 """
579 return the values used to constrain a solution
580
581 @return: values to be used at the locations of the constraints. If
582 L{value} is not given C{None} is rerturned.
583 @rtype: L{escript.Vector}
584 """
585 if self.__location_of_constraint == None: self.__setOutput()
586 return self.__value_of_constraint
587
588 def __setOutput(self):
589 x=self.domain.getX()
590 self.__location_of_constraint=Vector(0,x.getFunctionSpace())
591 if self.domain.getDim()==3:
592 vertex=[inf(x[0]),inf(x[1]),inf(x[2])]
593 msk=numarray.zeros((3,))
594 if self.comp_mask[0]: msk[0]=1
595 if self.comp_mask[1]: msk[1]=1
596 if self.comp_mask[2]: msk[2]=1
597 else:
598 vertex=[inf(x[0]),inf(x[1])]
599 msk=numarray.zeros((2,))
600 if self.comp_mask[0]: msk[0]=1
601 if self.comp_mask[1]: msk[1]=1
602 self.__location_of_constraint=whereZero(length(x-vertex),self.tol)*numarray.ones(shape)
603 if not self.value == None:
604 self.__value_of_constraint=self.__location_of_constraint*self.value
605

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26