-
Notifications
You must be signed in to change notification settings - Fork 110
Closed
Description
Hi,
During the review of the code I was wondering why you don't set a dataclass for the mesh: you could than directly add method or property and allow you to do more with the data itsel without having to unpack the dict each time etc...
for example:
@dataclass
class PyeitMesh:
element:np.ndarray
node:np.ndarray
perm:np.ndarray
@property
def n_pts(self)->int:
return self.node.shape[0]
@property
def n_dim(self)->int:
return self.node.shape[1]
@property
def n_elems(self)->int:
return self.element.shape[0]
@property
def n_vertices(self)->int:
return self.element.shape[1]
def stats(self):
"""
print mesh or tetrahedral status
Parameters
----------
p: array_like
coordinates of nodes (x, y) in 2D, (x, y, z) in 3D
t: array_like
connectives forming elements
Notes
-----
a simple function for illustration purpose only.
print the status (size) of nodes and elements
"""
print("mesh status:")
print(f"{self.n_pts} nodes, {self.n_elems} elements")
then you can avoid such code:
self.pts = mesh["node"]
self.tri = mesh["element"]
shape of the mesh
self.no_num, self.n_dim = self.pts.shape
self.el_num, self.n_vertices = self.tri.shape
and use that instead
self.mesh.node #(instead self.pts )
self.mesh.n_pts #(instead self.no_num ), etc..
also you can integrate setting of permittivity... and much more whcih is on the mesh data related!
If you are interested I could start to set it!
Metadata
Metadata
Assignees
Labels
No labels