96 |
x=self.domain.getX() |
x=self.domain.getX() |
97 |
self._location_of_constraint=Scalar(0,x.getFunctionSpace()) |
self._location_of_constraint=Scalar(0,x.getFunctionSpace()) |
98 |
if self.domain.getDim()==3: |
if self.domain.getDim()==3: |
99 |
if self.left: self._location_of_constraint+=(x[0]-inf(x[0])).whereZero() |
if self.left: self._location_of_constraint+=whereZero(x[0]-inf(x[0])) |
100 |
if self.right: self._location_of_constraint+=(x[0]-sup(x[0])).whereZero() |
if self.right: self._location_of_constraint+=whereZero(x[0]-sup(x[0])) |
101 |
if self.front: self._location_of_constraint+=(x[1]-inf(x[1])).whereZero() |
if self.front: self._location_of_constraint+=whereZero(x[1]-inf(x[1])) |
102 |
if self.back: self._location_of_constraint+=(x[1]-sup(x[1])).whereZero() |
if self.back: self._location_of_constraint+=whereZero(x[1]-sup(x[1])) |
103 |
if self.bottom: self._location_of_constraint+=(x[2]-inf(x[2])).whereZero() |
if self.bottom: self._location_of_constraint+=whereZero(x[2]-inf(x[2])) |
104 |
if self.top: self._location_of_constraint+=(x[2]-sup(x[2])).whereZero() |
if self.top: self._location_of_constraint+=whereZero(x[2]-sup(x[2])) |
105 |
else: |
else: |
106 |
if self.left: self._location_of_constraint+=(x[0]-inf(x[0])).whereZero() |
if self.left: self._location_of_constraint+=whereZero(x[0]-inf(x[0])) |
107 |
if self.right: self._location_of_constraint+=(x[0]-sup(x[0])).whereZero() |
if self.right: self._location_of_constraint+=whereZero(x[0]-sup(x[0])) |
108 |
if self.bottom: self._location_of_constraint+=(x[1]-inf(x[1])).whereZero() |
if self.bottom: self._location_of_constraint+=whereZero(x[1]-inf(x[1])) |
109 |
if self.top: self._location_of_constraint+=(x[1]-sup(x[1])).whereZero() |
if self.top: self._location_of_constraint+=whereZero(x[1]-sup(x[1])) |
110 |
return self._location_of_constraint |
return self._location_of_constraint |
111 |
|
|
112 |
class VectorConstrainer(ParameterSet): |
class VectorConstrainer(ParameterSet): |
162 |
x=self.domain.getX() |
x=self.domain.getX() |
163 |
self._location_of_constraint=Vector(0,x.getFunctionSpace()) |
self._location_of_constraint=Vector(0,x.getFunctionSpace()) |
164 |
if self.domain.getDim()==3: |
if self.domain.getDim()==3: |
165 |
left_mask=(x[0]-inf(x[0])).whereZero() |
left_mask=whereZero(x[0]-inf(x[0])) |
166 |
if self.left[0]: self._location_of_constraint+=left_mask*[1.,0.,0.] |
if self.left[0]: self._location_of_constraint+=left_mask*[1.,0.,0.] |
167 |
if self.left[1]: self._location_of_constraint+=left_mask*[0.,1.,0.] |
if self.left[1]: self._location_of_constraint+=left_mask*[0.,1.,0.] |
168 |
if self.left[2]: self._location_of_constraint+=left_mask*[0.,0.,1.] |
if self.left[2]: self._location_of_constraint+=left_mask*[0.,0.,1.] |
169 |
right_mask=(x[0]-sup(x[0])).whereZero() |
right_mask=whereZero(x[0]-sup(x[0])) |
170 |
if self.right[0]: self._location_of_constraint+=right_mask*[1.,0.,0.] |
if self.right[0]: self._location_of_constraint+=right_mask*[1.,0.,0.] |
171 |
if self.right[1]: self._location_of_constraint+=right_mask*[0.,1.,0.] |
if self.right[1]: self._location_of_constraint+=right_mask*[0.,1.,0.] |
172 |
if self.right[2]: self._location_of_constraint+=right_mask*[0.,0.,1.] |
if self.right[2]: self._location_of_constraint+=right_mask*[0.,0.,1.] |
173 |
front_mask=(x[1]-inf(x[1])).whereZero() |
front_mask=whereZero(x[1]-inf(x[1])) |
174 |
if self.front[0]: self._location_of_constraint+=front_mask*[1.,0.,0.] |
if self.front[0]: self._location_of_constraint+=front_mask*[1.,0.,0.] |
175 |
if self.front[1]: self._location_of_constraint+=front_mask*[0.,1.,0.] |
if self.front[1]: self._location_of_constraint+=front_mask*[0.,1.,0.] |
176 |
if self.front[2]: self._location_of_constraint+=front_mask*[0.,0.,1.] |
if self.front[2]: self._location_of_constraint+=front_mask*[0.,0.,1.] |
177 |
back_mask=(x[1]-sup(x[1])).whereZero() |
back_mask=whereZero(x[1]-sup(x[1])) |
178 |
if self.back[0]: self._location_of_constraint+=back_mask*[1.,0.,0.] |
if self.back[0]: self._location_of_constraint+=back_mask*[1.,0.,0.] |
179 |
if self.back[1]: self._location_of_constraint+=back_mask*[0.,1.,0.] |
if self.back[1]: self._location_of_constraint+=back_mask*[0.,1.,0.] |
180 |
if self.back[2]: self._location_of_constraint+=back_mask*[0.,0.,1.] |
if self.back[2]: self._location_of_constraint+=back_mask*[0.,0.,1.] |
181 |
bottom_mask=(x[2]-inf(x[2])).whereZero() |
bottom_mask=whereZero(x[2]-inf(x[2])) |
182 |
if self.bottom[0]: self._location_of_constraint+=bottom_mask*[1.,0.,0.] |
if self.bottom[0]: self._location_of_constraint+=bottom_mask*[1.,0.,0.] |
183 |
if self.bottom[1]: self._location_of_constraint+=bottom_mask*[0.,1.,0.] |
if self.bottom[1]: self._location_of_constraint+=bottom_mask*[0.,1.,0.] |
184 |
if self.bottom[2]: self._location_of_constraint+=bottom_mask*[0.,0.,1.] |
if self.bottom[2]: self._location_of_constraint+=bottom_mask*[0.,0.,1.] |
185 |
top_mask=(x[2]-sup(x[2])).whereZero() |
top_mask=whereZero(x[2]-sup(x[2])) |
186 |
if self.top[0]: self._location_of_constraint+=top_mask*[1.,0.,0.] |
if self.top[0]: self._location_of_constraint+=top_mask*[1.,0.,0.] |
187 |
if self.top[1]: self._location_of_constraint+=top_mask*[0.,1.,0.] |
if self.top[1]: self._location_of_constraint+=top_mask*[0.,1.,0.] |
188 |
if self.top[2]: self._location_of_constraint+=top_mask*[0.,0.,1.] |
if self.top[2]: self._location_of_constraint+=top_mask*[0.,0.,1.] |
189 |
else: |
else: |
190 |
left_mask=(x[0]-inf(x[0])).whereZero() |
left_mask=whereZero(x[0]-inf(x[0])) |
191 |
if self.left[0]: self._location_of_constraint+=left_mask*[1.,0.] |
if self.left[0]: self._location_of_constraint+=left_mask*[1.,0.] |
192 |
if self.left[1]: self._location_of_constraint+=left_mask*[0.,1.] |
if self.left[1]: self._location_of_constraint+=left_mask*[0.,1.] |
193 |
right_mask=(x[0]-sup(x[0])).whereZero() |
right_mask=whereZero(x[0]-sup(x[0])) |
194 |
if self.right[0]: self._location_of_constraint+=right_mask*[1.,0.] |
if self.right[0]: self._location_of_constraint+=right_mask*[1.,0.] |
195 |
if self.right[1]: self._location_of_constraint+=right_mask*[0.,1.] |
if self.right[1]: self._location_of_constraint+=right_mask*[0.,1.] |
196 |
bottom_mask=(x[1]-inf(x[1])).whereZero() |
bottom_mask=whereZero(x[1]-inf(x[1])) |
197 |
if self.bottom[0]: self._location_of_constraint+=bottom_mask*[1.,0.] |
if self.bottom[0]: self._location_of_constraint+=bottom_mask*[1.,0.] |
198 |
if self.bottom[1]: self._location_of_constraint+=bottom_mask*[0.,1.] |
if self.bottom[1]: self._location_of_constraint+=bottom_mask*[0.,1.] |
199 |
top_mask=(x[1]-sup(x[1])).whereZero() |
top_mask=whereZero(x[1]-sup(x[1])) |
200 |
if self.top[0]: self._location_of_constraint+=top_mask*[1.,0.] |
if self.top[0]: self._location_of_constraint+=top_mask*[1.,0.] |
201 |
if self.top[1]: self._location_of_constraint+=top_mask*[0.,1.] |
if self.top[1]: self._location_of_constraint+=top_mask*[0.,1.] |
202 |
return self._location_of_constraint |
return self._location_of_constraint |