Exemplo n.º 1
0
 def set_origin(self, x0, y0, z0):
     CreateTensorMesh.set_origin(self, x0, y0, z0)
Exemplo n.º 2
0
from pyvista import examples
from PVGeo.model_build import CreateTensorMesh
from PVGeo.grids import ExtractTopography
import os

###############################################################################
# For the grid data set, let's use one of the Model Building sources
# with the following parameters:
#
# - Origin: ``[793000, 9192500, 2690]``
# - X Cells: ``'1000 500 50*250 500 1000'``
# - Y Cells: ``'1000 500 55*250 500 1000'``
# - Z Cells: ``'30*100.0 5*250.0 500'``

mesh = CreateTensorMesh(origin=[793000, 9192500, 2690],
                        xcellstr='1000 500 50*250 500 1000',
                        ycellstr='1000 500 55*250 500 1000',
                        zcellstr='30*100.0 5*250.0 500').apply()

mesh.plot(show_grid=True, color=True, show_edges=True)

###############################################################################
# Now load the topography file from the example data:
link = 'https://dl.dropbox.com/s/gw5v3tiq68oge3l/Example-Extract-Topo.zip?dl=0'
examples.downloads._retrieve_file(link, 'Example-Extract-Topo.zip')
topo = pyvista.read(os.path.join(pyvista.EXAMPLES_PATH, 'topo.vtk'))

p = pyvista.Plotter()
p.add_mesh(topo, cmap='terrain')
p.add_mesh(mesh, color=True, show_edges=False, opacity=0.75)
p.show_grid()
p.show()
Exemplo n.º 3
0
 def set_z_cells_str(self, zcellstr):
     CreateTensorMesh.set_z_cells_str(self, zcellstr)
Exemplo n.º 4
0
 def set_y_cells_str(self, ycellstr):
     CreateTensorMesh.set_y_cells_str(self, ycellstr)
Exemplo n.º 5
0
 def set_x_cells_str(self, xcellstr):
     CreateTensorMesh.set_x_cells_str(self, xcellstr)
Exemplo n.º 6
0
 def __init__(self):
     CreateTensorMesh.__init__(self)
Exemplo n.º 7
0
 def test_generation(self):
     """`CreateTensorMesh`: make sure works."""
     g = CreateTensorMesh()
     g.set_x_cells_str('200 100 50 30*50.0 50 100 200')
     g.set_y_cells_str('200 100 50 25*50.0 50 100 200')
     g.set_z_cells_str('25*25.0 50 100 200')
     g.set_origin(-300.0, -450.0, 10.0)
     g.Update()
     grid = g.GetOutput()
     self.assertIsNotNone(grid)
     self.assertEqual(grid.GetNumberOfCells(), (36 * 31 * 28))
     bounds = grid.GetBounds()
     tb = (-300.0, 1900, -450, 1500, -965, 10)
     self.assertEqual(bounds, tb)