discretize 0.6.0 Release Notes#

November 16, 2020

This minor release is intended to bring consistent pep8 style naming across all of discretize’s classes and functions.

There are two major types of renaming, aliases and deprecations. We have chosen to move to more descriptive property names for classes, generally. For example, mesh.area is deprecated and now is mesh.face_area. Also properties like mesh.vnC are now officially mesh.shape_cells due to the more descriptive name, but can also be accessed as mesh.vnC to speed up some code writing for users. We have included a full list of aliases and deprecations below. In PR #227 we have detailed our reasonings behind individual name choices.

The other big change that will likely cause previous code to break is that all of these mesh.shape_* type properties are now explicitly tuple-s, making them immutable. These properties could previously be modified which would result in undefined and unsafe behavoir. A side effect of this, is that any code that relied on these properties being numpy.ndarray-s, will break. This is intentional.

There’s a few internal changes as well, to reorganize the file structure. importing items in discretize.utils from their individual module files is not recommended and might result in future broken code. Please only import these items from the discretize.utils module.

We have also separated the matplotlib plotting code into a separate module: discretize.utils.mixins.mpl_mod. At the same time we have further improved the plotting speed of discretize.TreeMesh and discretize.CurvilinearMesh. This also allows all of these functions to have a unified calling convention.

Finally, we have removed assert errors in favor of throwing the proper exception when checking inputs. We have removed all references to __future__ and six to clean up and drop python 2 compatibility.

Note

Testing now uses Azure CI. The new hub can be found at https://dev.azure.com/simpeg/

Changes#

This is a full list of the aliases and deprecations for this discretize release.

Aliases#

On discretize.base.BaseMesh:

  • origin=x0

  • n_cells=nC

  • n_nodes=nN

  • n_edges=nE

  • n_faces=nF

  • n_edges_x=nEx, n_edges_y=nEy, n_edges_z=nEz

  • n_faces_x=nFx, n_faces_y=nFy, n_faces_z=nFz

  • n_edges_per_direction=vnE, n_faces_per_direction=vnF

On discretize.base.BaseRectangularMesh:

  • shape_cells=vnC

  • shape_nodes=vnN

  • shape_edges_x=vnEx, shape_edges_y=vnEy, shape_edges_z=vnEz

  • shape_faces_x=vnFx, shape_faces_y=vnFy, shape_faces_z=vnFz

On discretize.base.BaseTensorMesh:

  • cell_centers=gridCC

  • nodes=gridN

  • edges_x=gridEx, edges_y=gridEy, edges_z=gridEz

  • faces_x=gridFx, faces_y=gridFy, faces_z=gridFz

On discretize.operators.DiffOperators:

  • average_face_to_cell=aveF2CC, average_face_to_cell_vector=aveF2CCV

  • average_face_x_to_cell=aveFx2CC, average_face_y_to_cell=aveFy2CC, average_face_z_to_cell=aveFz2CC

  • average_cell_to_face=aveCC2F, average_cell_vector_to_face=aveCCV2F

  • average_edge_to_cell=aveE2CC, average_edge_to_cell_vector=aveE2CCV

  • average_edge_x_to_cell=aveEx2CC, average_edge_y_to_cell=aveEy2CC, average_edge_z_to_cell=aveEz2CC

  • average_node_to_cell=aveN2CC, average_node_to_edge=aveN2E, average_node_to_face=aveN2F

On TreeMesh:

  • Similar to above, all n_hanging_XXX=nhX, and n_total_XXX=ntX, for each node=N, face_x,y,z=Fx,y,z, and edge_x,y,z=Ex,y,z

  • Also, similar to above: hanging_XXX=gridhX, for each hanging node=N, face_x,y,z=Fx,y,z and edge_x,y,z=Ex,y,z

These aliases are consistent across all meshes that inherit from these classes: discretize.TensorMesh, discretize.CurvilinearMesh, discretize.CylindricalMesh, and discretize.TreeMesh.

Deprecations#

These deprecations will give FutureWarning when called indicating that they will be removed in version 1.0.0 of discretize.

Base Classes#

On discretize.base.BaseMesh:

  • normalsface_normals

  • tangentsedge_tangents

  • projectEdgeVectorproject_edge_vector

  • projectFaceVectorproject_face_vector

On discretize.base.BaseRectangularMesh:

  • rreshape

  • nCxshape_cells[0], nCyshape_cells[1], nCzshape_cells[2]

  • nNxshape_nodes[0], nNyshape_nodes[1], nNzshape_nodes[2]

  • hx``→``h[0], hyh[1], hz``→ ``h[2]

On discretize.base.BaseTensorMesh:

  • vectorNxnodes_x, vectorNynodes_y, vectorNznodes_z

  • vectorCCxcell_centers_x, vectorCCycell_centers_y, vectorCCzcell_centers_z

  • getInterpolationMatget_interpolation_matrix

  • isInsideis_inside

  • getTensorget_tensor

On discretize.base.MeshIO:

  • readUBCread_UBC

  • readModelUBCread_model_UBC

  • writeUBCwrite_UBC

  • writeModelUBCwrite_model_UBC

On discretize.operators.DiffOperators:

  • cellGradcell_gradient

  • cellGradBCcell_gradient_BC

  • cellGradxcell_gradient_x, cellGradycell_gradient_y, cellGradzcell_gradient_z

  • nodalGradnodal_gradient

  • nodalLaplaciannodal_laplacian

  • faceDivface_divergence

  • faceDivxface_x_divergence, faceDivyface_y_divergence, faceDivz →``face_z_divergence``

  • edgeCurledge_curl

  • setCellGradBCset_cell_gradient_BC

  • getBCProjWFget_BC_projections

  • getBCProjWF_simpleget_BC_projections_simple

On discretize.operators.InnerProducts:

  • getFaceInnerProductget_face_inner_product

  • getEdgeInnerProductget_edge_inner_product

  • getFaceInnerProductDerivget_face_inner_product_deriv

  • getEdgeInnerProductDerivget_edge_inner_product_deriv

Main Meshes#

CylMeshCylindricalMesh

On discretize.TensorMesh, discretize.CylindricalMesh, discretize.TreeMesh, discretize.CurvilinearMesh:

  • volcell_volumes

  • areaface_areas

  • edgeedge_lengths

On discretize.TensorMesh, discretize.CylindricalMesh, discretize.TreeMesh:

  • areaFxface_x_areas, areaFyface_y_areas, areaFz →``face_z_areas``

  • edgeExedge_x_lengths, edgeEyedge_y_lengths, edgeEz →``edge_z_lengths``

On discretize.TensorMesh, discretize.TreeMesh:

  • faceBoundaryIndface_boundary_indices

  • cellBoundaryIndcell_boundary_indices

On discretize.CurvilinearMesh: * The nodes property is now node_list to avoid the name clash with the nodes location property

On discretize.CylindricalMesh:

  • isSymmetricis_symmetric

  • cartesianOrigincartesian_origin

  • getInterpolationMatCartMeshget_interpolation_matrix_cartesian_mesh

  • cartesianGridcartesian_grid

On discretize.TreeMesh:

  • maxLevelmax_used_level

  • permuteCCpermute_cells

  • permuteFpermute_faces

  • permuteEpermute_edges

And for plotting with matplotlib:

  • plotGridplot_grid

  • plotImageplot_image

  • plotSliceplot_slice

Utilities deprecations#

Deprecations inside discretize.utils:

  • isScalaris_scalar

  • asArray_N_x_Dimas_array_n_by_dim

  • sdInvsdinv

  • getSubArrayget_subarray

  • inv3X3BlockDiagonalinverse_3x3_block_diagonal

  • inv2X2BlockDiagonalinverse_2x2_block_diagonal

  • makePropertyTensormake_property_tensor

  • invPropertyTensorinverse_property_tensor

  • exampleLrmGridexample_curvilinear_grid

  • meshTensorunpack_widths

  • closestPointsclosest_points_index

  • ExtractCoreMeshextract_core_mesh

  • volTetravolume_tetrahedron

  • indexCubeindex_cube

  • faceInfoface_info

  • interpmatinterpolation_matrix

  • rotationMatrixFromNormalsrotate_points_from_normals

  • rotatePointsFromNormalsrotation_matrix_from_normals

Contributors#

  • @jcapriot

With reviews from:

  • @prisae

  • @lheagy

Also, input on function names were given by many of the discretize developers.

Pull requests#

  • #227: Restructure.