You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tutorials/tutorial6/tutorial.py
+32-12Lines changed: 32 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
#!/usr/bin/env python
2
2
# coding: utf-8
3
3
4
-
# # Tutorial: Building custom geometries with PINA `Location` class
4
+
# # Tutorial: Building custom geometries with PINA `DomainInterface` class
5
5
#
6
6
# [](https://colab.research.google.com/github/mathLab/PINA/blob/master/tutorials/tutorial6/tutorial.ipynb)
# Next, we will create the `Heart(Location)` class and initialize it.
181
+
# Next, we will create the `Heart(DomainInterface)` class and initialize it.
183
182
184
183
# In[12]:
185
184
186
185
187
-
classHeart(Location):
186
+
classHeart(DomainInterface):
188
187
"""Implementation of the Heart Domain."""
189
188
190
189
def__init__(self, sample_border=False):
191
190
super().__init__()
192
191
193
192
194
193
195
-
# Because the `Location` class we are inheriting from requires both a `sample` method and `is_inside` method, we will create them and just add in "pass" for the moment.
194
+
# In[ ]:
195
+
196
+
197
+
198
+
199
+
200
+
# Because the `DomainInterface` class we are inheriting from requires both a `sample` method and `is_inside` method, we will create them and just add in "pass" for the moment. We also observe that the methods `sample_modes` and `variables` of the `DomainInterface` class are initialized as `abstractmethod`, so we need to redefine them both in the subclass `Heart` .
196
201
197
202
# In[13]:
198
203
199
204
200
-
classHeart(Location):
205
+
classHeart(DomainInterface):
201
206
"""Implementation of the Heart Domain."""
202
207
203
208
def__init__(self, sample_border=False):
@@ -208,15 +213,22 @@ def is_inside(self):
208
213
209
214
defsample(self):
210
215
pass
216
+
217
+
@property
218
+
defsample_modes(self):
219
+
pass
211
220
221
+
@property
222
+
defvariables(self):
223
+
pass
212
224
213
-
# Now we have the skeleton for our `Heart` class. The `sample` method is where most of the work is done so let's fill it out.
214
225
215
-
# In[14]:
226
+
# Now we have the skeleton for our `Heart` class. Also the `sample` method is where most of the work is done so let's fill it out.
0 commit comments