pythonic names

This commit is contained in:
Martin Diehl 2020-10-27 13:42:49 +01:00
parent fa67a2ddf8
commit 0804e6ee74
5 changed files with 18 additions and 18 deletions

View File

@ -473,7 +473,7 @@ class Geom:
Compress with zlib algorithm. Defaults to True.
"""
v = VTK.from_rectilinearGrid(self.grid,self.size,self.origin)
v = VTK.from_rectilinear_grid(self.grid,self.size,self.origin)
v.add(self.material.flatten(order='F'),'material')
v.add_comments(self.comments)
@ -508,7 +508,7 @@ class Geom:
def show(self):
"""Show on screen."""
v = VTK.from_rectilinearGrid(self.grid,self.size,self.origin)
v = VTK.from_rectilinear_grid(self.grid,self.size,self.origin)
v.show()

View File

@ -1212,14 +1212,14 @@ class Result:
if mode.lower()=='cell':
if self.structured:
v = VTK.from_rectilinearGrid(self.grid,self.size,self.origin)
v = VTK.from_rectilinear_grid(self.grid,self.size,self.origin)
else:
with h5py.File(self.fname,'r') as f:
v = VTK.from_unstructuredGrid(f['/geometry/x_n'][()],
v = VTK.from_unstructured_grid(f['/geometry/x_n'][()],
f['/geometry/T_c'][()]-1,
f['/geometry/T_c'].attrs['VTK_TYPE'].decode())
elif mode.lower()=='point':
v = VTK.from_polyData(self.cell_coordinates)
v = VTK.from_poly_data(self.cell_coordinates)
N_digits = int(np.floor(np.log10(max(1,int(self.increments[-1][3:])))))+1

View File

@ -36,7 +36,7 @@ class VTK:
@staticmethod
def from_rectilinearGrid(grid,size,origin=np.zeros(3)):
def from_rectilinear_grid(grid,size,origin=np.zeros(3)):
"""
Create VTK of type vtk.vtkRectilinearGrid.
@ -64,7 +64,7 @@ class VTK:
@staticmethod
def from_unstructuredGrid(nodes,connectivity,cell_type):
def from_unstructured_grid(nodes,connectivity,cell_type):
"""
Create VTK of type vtk.vtkUnstructuredGrid.
@ -96,7 +96,7 @@ class VTK:
@staticmethod
def from_polyData(points):
def from_poly_data(points):
"""
Create VTK of type vtk.polyData.

View File

@ -49,7 +49,7 @@ class TestGeom:
assert geom_equal(new,default)
def test_invalid_vtr(self,tmp_path):
v = VTK.from_rectilinearGrid(np.random.randint(5,10,3)*2,np.random.random(3) + 1.0)
v = VTK.from_rectilinear_grid(np.random.randint(5,10,3)*2,np.random.random(3) + 1.0)
v.save(tmp_path/'no_materialpoint.vtr')
with pytest.raises(ValueError):
Geom.load(tmp_path/'no_materialpoint.vtr')

View File

@ -18,7 +18,7 @@ def default():
"""Simple VTK."""
grid = np.array([5,6,7],int)
size = np.array([.6,1.,.5])
return VTK.from_rectilinearGrid(grid,size)
return VTK.from_rectilinear_grid(grid,size)
class TestVTK:
@ -30,7 +30,7 @@ class TestVTK:
grid = np.random.randint(5,10,3)*2
size = np.random.random(3) + 1.0
origin = np.random.random(3)
v = VTK.from_rectilinearGrid(grid,size,origin)
v = VTK.from_rectilinear_grid(grid,size,origin)
string = v.__repr__()
v.save(tmp_path/'rectilinearGrid',False)
vtr = VTK.load(tmp_path/'rectilinearGrid.vtr')
@ -41,7 +41,7 @@ class TestVTK:
def test_polyData(self,tmp_path):
points = np.random.rand(100,3)
v = VTK.from_polyData(points)
v = VTK.from_poly_data(points)
string = v.__repr__()
v.save(tmp_path/'polyData',False)
vtp = VTK.load(tmp_path/'polyData.vtp')
@ -60,7 +60,7 @@ class TestVTK:
def test_unstructuredGrid(self,tmp_path,cell_type,n):
nodes = np.random.rand(n,3)
connectivity = np.random.choice(np.arange(n),n,False).reshape(-1,n)
v = VTK.from_unstructuredGrid(nodes,connectivity,cell_type)
v = VTK.from_unstructured_grid(nodes,connectivity,cell_type)
string = v.__repr__()
v.save(tmp_path/'unstructuredGrid',False)
vtu = VTK.load(tmp_path/'unstructuredGrid.vtu')
@ -72,7 +72,7 @@ class TestVTK:
def test_parallel_out(self,tmp_path):
points = np.random.rand(102,3)
v = VTK.from_polyData(points)
v = VTK.from_poly_data(points)
fname_s = tmp_path/'single.vtp'
fname_p = tmp_path/'parallel.vtp'
v.save(fname_s,False)
@ -121,7 +121,7 @@ class TestVTK:
def test_compare_reference_polyData(self,update,reference_dir,tmp_path):
points=np.dstack((np.linspace(0.,1.,10),np.linspace(0.,2.,10),np.linspace(-1.,1.,10))).squeeze()
polyData = VTK.from_polyData(points)
polyData = VTK.from_poly_data(points)
polyData.add(points,'coordinates')
if update:
polyData.save(reference_dir/'polyData')
@ -133,7 +133,7 @@ class TestVTK:
def test_compare_reference_rectilinearGrid(self,update,reference_dir,tmp_path):
grid = np.array([5,6,7],int)
size = np.array([.6,1.,.5])
rectilinearGrid = VTK.from_rectilinearGrid(grid,size)
rectilinearGrid = VTK.from_rectilinear_grid(grid,size)
c = grid_filters.cell_coord0(grid,size).reshape(-1,3,order='F')
n = grid_filters.node_coord0(grid,size).reshape(-1,3,order='F')
rectilinearGrid.add(c,'cell')