11 |
from esys.escript.modelframe import Model,ParameterSet |
from esys.escript.modelframe import Model,ParameterSet |
12 |
from esys import finley |
from esys import finley |
13 |
|
|
14 |
class Domain(Model): |
class FinleyReader(ParameterSet): |
|
""" |
|
|
template L{Model} for a domain. |
|
|
|
|
|
@ivar intergrationOrder: integration order, default -1 (in). |
|
|
@type intergrationOrder: C{int} |
|
|
@ivar displacement: displacements applied to the original mesh coordinates |
|
|
@type displacement: C{None} or L{escript.Vector} |
|
|
@ivar domain: domain (out) |
|
|
@type domain: L{escript.Domain} |
|
|
""" |
|
|
def __init__(self,debug=False): |
|
|
""" |
|
|
initializes the object |
|
|
""" |
|
|
super(Domain, self).__init__(debug=debug) |
|
|
self.declareParameter(domain=None,\ |
|
|
displacement=None,\ |
|
|
integrationOrder=-1) |
|
|
|
|
|
|
|
|
def doInitialization(self): |
|
|
""" |
|
|
applies an initial L{displacement} to the mesh nodes (if not equal to C{None}) |
|
|
""" |
|
|
self.__x=self.domain.getX() |
|
|
if self.displacement: |
|
|
self.trace("mesh nodes updated in initialization.") |
|
|
self.domain.setX(self.__x+self.displacement) |
|
|
|
|
|
def doStepPreprocessing(self,dt): |
|
|
""" |
|
|
applies the final L{displacement} to mesh nodes. |
|
|
""" |
|
|
self.__do_final_update=True |
|
|
|
|
|
def doStep(self,dt): |
|
|
""" |
|
|
applies the current L{displacement} to mesh nodes. |
|
|
""" |
|
|
if self.displacement: |
|
|
self.trace("mesh nodes updated in update.") |
|
|
self.domain.setX(self.__x+self.displacement) |
|
|
self.__do_final_update=False |
|
|
|
|
|
def doStepPostprocessing(self,dt): |
|
|
""" |
|
|
applies the final L{displacement} to mesh nodes. |
|
|
""" |
|
|
if self.displacement and self.__do_final_update: |
|
|
self.trace("final mesh nodes update.") |
|
|
self.domain.setX(self.__x+self.displacement) |
|
|
self.__update=False |
|
|
|
|
|
class FinleyReader(Domain): |
|
15 |
""" |
""" |
16 |
reads finley mesh file. |
reads finley mesh file. |
17 |
|
|
18 |
@ivar source: file name of the finley input file |
@ivar source: file name of the finley input file |
19 |
@type source: C{str} |
@type source: C{str} |
20 |
|
@ivar intergrationOrder: integration order, default -1 (in). |
21 |
|
@type intergrationOrder: C{int} |
22 |
""" |
""" |
23 |
def __init__(self,debug=False): |
def __init__(self,debug=False): |
24 |
super(FinleyReader,self).__init__(debug=debug) |
""" |
25 |
self.declareParameter(source="none") |
initializes the object |
26 |
|
""" |
27 |
|
super(FinleyReader,self).__init__(debug=debug) |
28 |
|
self.declareParameter(source="none", |
29 |
|
integrationOrder=-1) |
30 |
|
self.__domain=None |
31 |
|
|
32 |
|
def domain(self): |
33 |
|
""" |
34 |
|
returns the domain |
35 |
|
|
36 |
def doInitialization(self): |
@return: the domain |
37 |
self.domain=finley.ReadMesh(self.source,self.integrationOrder) |
@rtype: L{Domain} |
38 |
self.trace("mesh read from %s"%self.source) |
""" |
39 |
super(FinleyReader, self).doInitialization() |
if not self.__domain: |
40 |
|
self.__domain=finley.ReadMesh(self.source,self.integrationOrder) |
41 |
|
self.trace("mesh read from %s"%self.source) |
42 |
|
return self.__domain |
43 |
|
|
44 |
|
|
45 |
class RectangularDomain(Domain): |
class RectangularDomain(ParameterSet): |
46 |
""" |
""" |
47 |
Generates a mesh over a rectangular domain finley. |
Generates a mesh over a rectangular domain finley. |
48 |
|
|
56 |
@type order: C{int} |
@type order: C{int} |
57 |
@ivar periodic: flags for periodicity, default [False,False,False] (in). |
@ivar periodic: flags for periodicity, default [False,False,False] (in). |
58 |
@type periodic: C{list} of C{bool}s |
@type periodic: C{list} of C{bool}s |
59 |
|
@ivar intergrationOrder: integration order, default -1 (in). |
60 |
|
@type intergrationOrder: C{int} |
61 |
""" |
""" |
62 |
def __init__(self,debug=False): |
def __init__(self,debug=False): |
63 |
""" |
""" |
68 |
l=[1.,1.,1.],\ |
l=[1.,1.,1.],\ |
69 |
n=[10,10,10], \ |
n=[10,10,10], \ |
70 |
order=1,\ |
order=1,\ |
71 |
periodic=[False,False,False]) |
periodic=[False,False,False], |
72 |
|
integrationOrder=-1) |
73 |
|
self.__domain=None |
74 |
|
|
75 |
def doInitialization(self): |
def domain(self): |
76 |
""" |
""" |
77 |
initializes the object |
returns the domain |
78 |
|
|
79 |
|
@return: the domain |
80 |
|
@rtype: L{Domain} |
81 |
""" |
""" |
82 |
if self.dim==2: |
if not self.__domain: |
83 |
self.domain=finley.Rectangle(n0=self.n[0],\ |
if self.dim==2: |
84 |
n1=self.n[1],\ |
self.domain=finley.Rectangle(n0=self.n[0],\ |
85 |
l0=self.l[0],\ |
n1=self.n[1],\ |
86 |
l1=self.l[1],\ |
l0=self.l[0],\ |
87 |
order=self.order, \ |
l1=self.l[1],\ |
88 |
periodic0=self.periodic[0], \ |
order=self.order, \ |
89 |
periodic1=self.periodic[1], \ |
periodic0=self.periodic[0], \ |
90 |
integrationOrder=self.integrationOrder) |
periodic1=self.periodic[1], \ |
91 |
else: |
integrationOrder=self.integrationOrder) |
92 |
self.__domain=finley.Brick(n0=self.n[0],\ |
else: |
93 |
n1=self.n[1],\ |
self.__domain=finley.Brick(n0=self.n[0],\ |
94 |
n2=self.n[2],\ |
n1=self.n[1],\ |
95 |
l0=self.l[0],\ |
n2=self.n[2],\ |
96 |
l1=self.l[1],\ |
l0=self.l[0],\ |
97 |
l2=self.l[2],\ |
l1=self.l[1],\ |
98 |
order=self.order, \ |
l2=self.l[2],\ |
99 |
periodic0=self.periodic[0], \ |
order=self.order, \ |
100 |
periodic1=self.periodic[1], \ |
periodic0=self.periodic[0], \ |
101 |
periodic2=self.periodic[2], \ |
periodic1=self.periodic[1], \ |
102 |
integrationOrder=self.integrationOrder) |
periodic2=self.periodic[2], \ |
103 |
super(RectangularDomain, self).doInitialization() |
integrationOrder=self.integrationOrder) |
104 |
|
return self.__domain |
105 |
|
|
106 |
|
class UpdateGeometry(Model): |
107 |
|
""" |
108 |
|
applies a displacement field to a domain |
109 |
|
|
110 |
|
@ivar displacement: displacements applied to the original mesh coordinates (in). |
111 |
|
@type displacement: L{escript.Vector} |
112 |
|
@ivar domain: domain |
113 |
|
@type domain: L{escript.Domain} |
114 |
|
""" |
115 |
|
def __init__(self,debug=False): |
116 |
|
""" |
117 |
|
set-up the object |
118 |
|
""" |
119 |
|
super(UpdateGeometry, self).__init__(debug=debug) |
120 |
|
self.declareParameter(domain=None,\ |
121 |
|
displacement=None) |
122 |
|
|
123 |
|
|
124 |
|
def doInitialization(self): |
125 |
|
""" |
126 |
|
initialize model |
127 |
|
""" |
128 |
|
self.__x=self.domain.getX() |
129 |
|
self.__reset=True |
130 |
|
|
131 |
|
def doStepPreprocessing(self,dt): |
132 |
|
""" |
133 |
|
applies the current L{displacement} to mesh nodes if required. |
134 |
|
""" |
135 |
|
if self.__reset: |
136 |
|
self.trace("mesh nodes updated.") |
137 |
|
self.domain.setX(self.__x+self.displacement) |
138 |
|
self.__reset=False |
139 |
|
|
140 |
|
def doStep(self,dt): |
141 |
|
""" |
142 |
|
applies the current L{displacement} to mesh nodes. |
143 |
|
""" |
144 |
|
self.trace("mesh nodes updated.") |
145 |
|
self.domain.setX(self.__x+self.displacement) |
146 |
|
self.__reset=True |
147 |
|
|
148 |
|
def doStepPostprocessing(self,dt): |
149 |
|
""" |
150 |
|
marks nodes as beeing updated. |
151 |
|
""" |
152 |
|
self.__reset=False |
153 |
|
|
154 |
class ScalarConstrainer(Model): |
class ScalarConstrainer(Model): |
155 |
""" |
""" |
156 |
Creates a characteristic function for the location of constraints |
Creates a characteristic function for the location of constraints |
157 |
for a scalar value and selects the value from an initial value |
for a scalar value and selects the value from an initial value |
158 |
ate these locations. |
ate these locations. |
159 |
|
|
160 |
In the case that the spatial dimension is two, the arguments front and back are ignored. |
In the case that the spatial dimension is two, the arguments front and back are ignored. |
161 |
|
|
162 |
@ivar domain: domain (in). |
@ivar domain: domain (in). |
163 |
@ivar left: True to set a constraint at the left face of the domain (x[0]=min x[0]), default False (in). |
@ivar left: True to set a constraint at the left face of the domain (x[0]=min x[0]), default False (in). |
164 |
@ivar right: True to set a constraint at the left face of the domain (x[0]=max x[0]), default False (in). |
@ivar right: True to set a constraint at the left face of the domain (x[0]=max x[0]), default False (in). |
165 |
@ivar top: True to set a constraint at the left face of the domain (x[1]=min x[1]), default False (in). |
@ivar top: True to set a constraint at the left face of the domain (x[1]=min x[1]), default False (in). |
166 |
@ivar bottom: True to set a constraint at the left face of the domain (x[1]=max x[1]), default False (in). |
@ivar bottom: True to set a constraint at the left face of the domain (x[1]=max x[1]), default False (in). |
167 |
@ivar front: True to set a constraint at the left face of the domain (x[2]=min x[2]), default False (in). |
@ivar front: True to set a constraint at the left face of the domain (x[2]=min x[2]), default False (in). |
168 |
@ivar back: True to set a constraint at the left face of the domain (x[2]=max x[2]), default False (in). |
@ivar back: True to set a constraint at the left face of the domain (x[2]=max x[2]), default False (in). |
169 |
@ivar tol: absolute tolerance for "x=max x" condition, default 1.e-8 (in). |
@ivar tol: absolute tolerance for "x=max x" condition, default 1.e-8 (in). |
170 |
@ivar location_of_constraint: locations of the constraints (out). |
""" |
171 |
@ivar constraint: locations of the constraints (out). |
def __init__(self,debug=False): |
|
""" |
|
|
def __init__(self,debug=False): |
|
172 |
ParameterSet.__init__(self,debug=debug) |
ParameterSet.__init__(self,debug=debug) |
173 |
self.declareParameter(domain=None, \ |
self.declareParameter(domain=None, \ |
174 |
value=0, \ |
value=None, \ |
175 |
left=False, \ |
left=False, \ |
176 |
right=False, \ |
right=False, \ |
177 |
top=False, \ |
top=False, \ |
178 |
bottom=False, \ |
bottom=False, \ |
179 |
front=False, \ |
front=False, \ |
180 |
back=False, \ |
back=False, \ |
181 |
tol=1.e-8, \ |
tol=1.e-8) |
182 |
value_of_constraint = None, \ |
self.__value_of_constraint = None |
183 |
location_of_constraint=None) |
self.__location_of_constraint=None |
184 |
def doInitialization(self): |
def location_of_constraint(self): |
185 |
|
""" |
186 |
|
return the values used to constrain a solution |
187 |
|
|
188 |
|
@return: the mask marking the locations of the constraints |
189 |
|
@rtype: L{escript.Scalar} |
190 |
""" |
""" |
191 |
Returns the mask of the location of constraint. |
if not self.__location_of_constraint: self.__setOutput() |
192 |
|
return self.__location_of_constraint |
193 |
|
|
194 |
|
def value_of_constraint(self): |
195 |
""" |
""" |
196 |
|
return the values used to constrain a solution |
197 |
|
|
198 |
|
@return: values to be used at the locations of the constraints. If |
199 |
|
L{value} is not given C{None} is rerturned. |
200 |
|
@rtype: L{escript.Scalar} |
201 |
|
""" |
202 |
|
if not self.__location_of_constraint: self.__setOutput() |
203 |
|
return self.__value_of_constraint |
204 |
|
|
205 |
|
def __setOutput(self): |
206 |
x=self.domain.getX() |
x=self.domain.getX() |
207 |
self.location_of_constraint=Scalar(0,x.getFunctionSpace()) |
self.__location_of_constraint=Scalar(0,x.getFunctionSpace()) |
208 |
if self.domain.getDim()==3: |
if self.domain.getDim()==3: |
209 |
x0,x1,x2=x[0],x[1],x[2] |
x0,x1,x2=x[0],x[1],x[2] |
210 |
if self.left: self.location_of_constraint+=whereZero(x0-inf(x0),self.tol) |
if self.left: self.__location_of_constraint+=whereZero(x0-inf(x0),self.tol) |
211 |
if self.right: self.location_of_constraint+=whereZero(x0-sup(x0),self.tol) |
if self.right: self.__location_of_constraint+=whereZero(x0-sup(x0),self.tol) |
212 |
if self.front: self.location_of_constraint+=whereZero(x1-inf(x1),self.tol) |
if self.front: self.__location_of_constraint+=whereZero(x1-inf(x1),self.tol) |
213 |
if self.back: self.location_of_constraint+=whereZero(x1-sup(x1),self.tol) |
if self.back: self.__location_of_constraint+=whereZero(x1-sup(x1),self.tol) |
214 |
if self.bottom: self.location_of_constraint+=whereZero(x2-inf(x2),self.tol) |
if self.bottom: self.__location_of_constraint+=whereZero(x2-inf(x2),self.tol) |
215 |
if self.top: self.location_of_constraint+=whereZero(x2-sup(x2),self.tol) |
if self.top: self.__location_of_constraint+=whereZero(x2-sup(x2),self.tol) |
216 |
else: |
else: |
217 |
x0,x1=x[0],x[1] |
x0,x1=x[0],x[1] |
218 |
if self.left: self.location_of_constraint+=whereZero(x0-inf(x0),self.tol) |
if self.left: self.__location_of_constraint+=whereZero(x0-inf(x0),self.tol) |
219 |
if self.right: self.location_of_constraint+=whereZero(x0-sup(x0),self.tol) |
if self.right: self.__location_of_constraint+=whereZero(x0-sup(x0),self.tol) |
220 |
if self.bottom: self.location_of_constraint+=whereZero(x1-inf(x1),self.tol) |
if self.bottom: self.__location_of_constraint+=whereZero(x1-inf(x1),self.tol) |
221 |
if self.top: self.location_of_constraint+=whereZero(x1-sup(x1),self.tol) |
if self.top: self.__location_of_constraint+=whereZero(x1-sup(x1),self.tol) |
222 |
self.value_of_constraint=self.location_of_constraint*self.value |
if self.value: |
223 |
|
self.__value_of_constraint=self.__location_of_constraint*self.value |
224 |
|
|
225 |
class VectorConstrainer(Model): |
class VectorConstrainer(Model): |
226 |
""" |
""" |
242 |
@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]), |
@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]), |
243 |
default [False,False,False] (in). |
default [False,False,False] (in). |
244 |
@ivar tol: absolute tolerance for "x=max x" condition, default 1.e-8 (in). |
@ivar tol: absolute tolerance for "x=max x" condition, default 1.e-8 (in). |
|
@ivar location_of_constraint: locations of the constraints (out). |
|
|
@ivar constraint: locations of the constraints (out). |
|
|
|
|
245 |
""" |
""" |
246 |
def __init__(self,debug=False): |
def __init__(self,debug=False): |
247 |
ParameterSet.__init__(self,debug=debug) |
ParameterSet.__init__(self,debug=debug) |
248 |
self.declareParameter(domain=None, \ |
self.declareParameter(domain=None, \ |
249 |
value=[0,0,0], \ |
value=None, \ |
250 |
left=[0,0,0], \ |
left=[0,0,0], \ |
251 |
right=[0,0,0], \ |
right=[0,0,0], \ |
252 |
top=[0,0,0], \ |
top=[0,0,0], \ |
253 |
bottom=[0,0,0], \ |
bottom=[0,0,0], \ |
254 |
front=[0,0,0], \ |
front=[0,0,0], \ |
255 |
back=[0,0,0], \ |
back=[0,0,0], \ |
256 |
tol=1.e-8, \ |
tol=1.e-8) |
257 |
value_of_constraint = None, \ |
self.__value_of_constraint = None |
258 |
location_of_constraint=None) |
self.__location_of_constraint=None |
259 |
def doInitialization(self): |
|
260 |
|
def location_of_constraint(self): |
261 |
""" |
""" |
262 |
sets the location_of_constraint and value_of_constraint to be kept throughout the simulation. |
return the values used to constrain a solution |
263 |
|
|
264 |
|
@return: the mask marking the locations of the constraints |
265 |
|
@rtype: L{escript.Vector} |
266 |
""" |
""" |
267 |
if self.location_of_constraint==None: |
if not self.__location_of_constraint: self.__setOutput() |
268 |
x=self.domain.getX() |
return self.__location_of_constraint |
269 |
self.location_of_constraint=Vector(0,x.getFunctionSpace()) |
|
270 |
if self.domain.getDim()==3: |
def value_of_constraint(self): |
271 |
x0,x1,x2=x[0],x[1],x[2] |
""" |
272 |
left_mask=whereZero(x0-inf(x0),self.tol) |
return the values used to constrain a solution |
273 |
if self.left[0]: self.location_of_constraint+=left_mask*[1.,0.,0.] |
|
274 |
if self.left[1]: self.location_of_constraint+=left_mask*[0.,1.,0.] |
@return: values to be used at the locations of the constraints. If |
275 |
if self.left[2]: self.location_of_constraint+=left_mask*[0.,0.,1.] |
L{value} is not given C{None} is rerturned. |
276 |
right_mask=whereZero(x0-sup(x0),self.tol) |
@rtype: L{escript.Vector} |
277 |
if self.right[0]: self.location_of_constraint+=right_mask*[1.,0.,0.] |
""" |
278 |
if self.right[1]: self.location_of_constraint+=right_mask*[0.,1.,0.] |
if not self.__location_of_constraint: self.__setOutput() |
279 |
if self.right[2]: self.location_of_constraint+=right_mask*[0.,0.,1.] |
return self.__value_of_constraint |
280 |
front_mask=whereZero(x1-inf(x1),self.tol) |
|
281 |
if self.front[0]: self.location_of_constraint+=front_mask*[1.,0.,0.] |
def __setOutput(self): |
282 |
if self.front[1]: self.location_of_constraint+=front_mask*[0.,1.,0.] |
x=self.domain.getX() |
283 |
if self.front[2]: self.location_of_constraint+=front_mask*[0.,0.,1.] |
self.__location_of_constraint=Vector(0,x.getFunctionSpace()) |
284 |
back_mask=whereZero(x1-sup(x1),self.tol) |
if self.domain.getDim()==3: |
285 |
if self.back[0]: self.location_of_constraint+=back_mask*[1.,0.,0.] |
x0,x1,x2=x[0],x[1],x[2] |
286 |
if self.back[1]: self.location_of_constraint+=back_mask*[0.,1.,0.] |
left_mask=whereZero(x0-inf(x0),self.tol) |
287 |
if self.back[2]: self.location_of_constraint+=back_mask*[0.,0.,1.] |
if self.left[0]: self.__location_of_constraint+=left_mask*[1.,0.,0.] |
288 |
bottom_mask=whereZero(x2-inf(x2),self.tol) |
if self.left[1]: self.__location_of_constraint+=left_mask*[0.,1.,0.] |
289 |
if self.bottom[0]: self.location_of_constraint+=bottom_mask*[1.,0.,0.] |
if self.left[2]: self.__location_of_constraint+=left_mask*[0.,0.,1.] |
290 |
if self.bottom[1]: self.location_of_constraint+=bottom_mask*[0.,1.,0.] |
right_mask=whereZero(x0-sup(x0),self.tol) |
291 |
if self.bottom[2]: self.location_of_constraint+=bottom_mask*[0.,0.,1.] |
if self.right[0]: self.__location_of_constraint+=right_mask*[1.,0.,0.] |
292 |
top_mask=whereZero(x2-sup(x2),self.tol) |
if self.right[1]: self.__location_of_constraint+=right_mask*[0.,1.,0.] |
293 |
if self.top[0]: self.location_of_constraint+=top_mask*[1.,0.,0.] |
if self.right[2]: self.__location_of_constraint+=right_mask*[0.,0.,1.] |
294 |
if self.top[1]: self.location_of_constraint+=top_mask*[0.,1.,0.] |
front_mask=whereZero(x1-inf(x1),self.tol) |
295 |
if self.top[2]: self.location_of_constraint+=top_mask*[0.,0.,1.] |
if self.front[0]: self.__location_of_constraint+=front_mask*[1.,0.,0.] |
296 |
self.value_of_constraint=self.location_of_constraint*self.value |
if self.front[1]: self.__location_of_constraint+=front_mask*[0.,1.,0.] |
297 |
else: |
if self.front[2]: self.__location_of_constraint+=front_mask*[0.,0.,1.] |
298 |
x0,x1=x[0],x[1] |
back_mask=whereZero(x1-sup(x1),self.tol) |
299 |
left_mask=whereZero(x0-inf(x0),self.tol) |
if self.back[0]: self.__location_of_constraint+=back_mask*[1.,0.,0.] |
300 |
if self.left[0]: self.location_of_constraint+=left_mask*[1.,0.] |
if self.back[1]: self.__location_of_constraint+=back_mask*[0.,1.,0.] |
301 |
if self.left[1]: self.location_of_constraint+=left_mask*[0.,1.] |
if self.back[2]: self.__location_of_constraint+=back_mask*[0.,0.,1.] |
302 |
right_mask=whereZero(x0-sup(x0),self.tol) |
bottom_mask=whereZero(x2-inf(x2),self.tol) |
303 |
if self.right[0]: self.location_of_constraint+=right_mask*[1.,0.] |
if self.bottom[0]: self.__location_of_constraint+=bottom_mask*[1.,0.,0.] |
304 |
if self.right[1]: self.location_of_constraint+=right_mask*[0.,1.] |
if self.bottom[1]: self.__location_of_constraint+=bottom_mask*[0.,1.,0.] |
305 |
bottom_mask=whereZero(x1-inf(x1),self.tol) |
if self.bottom[2]: self.__location_of_constraint+=bottom_mask*[0.,0.,1.] |
306 |
if self.bottom[0]: self.location_of_constraint+=bottom_mask*[1.,0.] |
top_mask=whereZero(x2-sup(x2),self.tol) |
307 |
if self.bottom[1]: self.location_of_constraint+=bottom_mask*[0.,1.] |
if self.top[0]: self.__location_of_constraint+=top_mask*[1.,0.,0.] |
308 |
top_mask=whereZero(x1-sup(x1),self.tol) |
if self.top[1]: self.__location_of_constraint+=top_mask*[0.,1.,0.] |
309 |
if self.top[0]: self.location_of_constraint+=top_mask*[1.,0.] |
if self.top[2]: self.__location_of_constraint+=top_mask*[0.,0.,1.] |
310 |
if self.top[1]: self.location_of_constraint+=top_mask*[0.,1.] |
if self.value: |
311 |
self.value_of_constraint=self.location_of_constraint*self.value[:2] |
self.__value_of_constraint=self.__location_of_constraint*self.value |
312 |
|
else: |
313 |
|
x0,x1=x[0],x[1] |
314 |
|
left_mask=whereZero(x0-inf(x0),self.tol) |
315 |
|
if self.left[0]: self.__location_of_constraint+=left_mask*[1.,0.] |
316 |
|
if self.left[1]: self.__location_of_constraint+=left_mask*[0.,1.] |
317 |
|
right_mask=whereZero(x0-sup(x0),self.tol) |
318 |
|
if self.right[0]: self.__location_of_constraint+=right_mask*[1.,0.] |
319 |
|
if self.right[1]: self.__location_of_constraint+=right_mask*[0.,1.] |
320 |
|
bottom_mask=whereZero(x1-inf(x1),self.tol) |
321 |
|
if self.bottom[0]: self.__location_of_constraint+=bottom_mask*[1.,0.] |
322 |
|
if self.bottom[1]: self.__location_of_constraint+=bottom_mask*[0.,1.] |
323 |
|
top_mask=whereZero(x1-sup(x1),self.tol) |
324 |
|
if self.top[0]: self.__location_of_constraint+=top_mask*[1.,0.] |
325 |
|
if self.top[1]: self.__location_of_constraint+=top_mask*[0.,1.] |
326 |
|
if self.value: |
327 |
|
self.__value_of_constraint=self.__location_of_constraint*self.value[:2] |
328 |
|
|
329 |
# vim: expandtab shiftwidth=4: |
# vim: expandtab shiftwidth=4: |