Skip to content

Commit

Permalink
Correct formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacarniato committed Nov 12, 2024
1 parent 6de1c6f commit f65bf5c
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions docs/examples/14_contacts_generation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
}
],
"source": [
"from meshkernel import MakeGridParameters,Mesh1d, Mesh2d, MeshKernel, GeometryList\n",
"from meshkernel import MakeGridParameters, Mesh1d, Mesh2d, MeshKernel, GeometryList\n",
"from meshkernel.version import __version__\n",
"\n",
"__version__"
]
},
Expand Down Expand Up @@ -55,13 +56,15 @@
"metadata": {},
"outputs": [],
"source": [
"def plot_mesh_and_contacts(mesh1d_output_0, mesh2d_output_0, contacts_output_0 = None):\n",
"def plot_mesh_and_contacts(mesh1d_output_0, mesh2d_output_0, contacts_output_0=None):\n",
" fig, ax = plt.subplots()\n",
" mesh1d_output_0.plot_edges(ax, color=\"blue\")\n",
" mesh2d_output_0.plot_edges(ax, color=\"black\")\n",
" if contacts_output_0:\n",
" contacts_output_0.plot_edges(ax, mesh1d_output_0, mesh2d_output_0, color=\"red\")\n",
" ax.plot(mesh1d_output_0.node_x, mesh1d_output_0.node_y, 'o', color=\"blue\", markersize=5)\n",
" ax.plot(\n",
" mesh1d_output_0.node_x, mesh1d_output_0.node_y, \"o\", color=\"blue\", markersize=5\n",
" )\n",
" plt.show()"
]
},
Expand All @@ -88,15 +91,18 @@
" upper_right_x=100.0,\n",
" upper_right_y=100.0,\n",
" block_size_x=10.0,\n",
" block_size_y=10.0)\n",
" block_size_y=10.0,\n",
")\n",
"\n",
"mk.curvilinear_compute_rectangular_grid_on_extension(make_grid_parameters)\n",
"mk.curvilinear_convert_to_mesh2d()\n",
"\n",
"mesh1d_node_x = [0.0,50.0,100.0]\n",
"mesh1d_node_y = [20.00001,20.0,20.0]\n",
"mesh1d_edge_nodes = [0,1,1,2]\n",
"mesh1d = Mesh1d(node_x=mesh1d_node_x,node_y=mesh1d_node_y,edge_nodes=mesh1d_edge_nodes )\n",
"mesh1d_node_x = [0.0, 50.0, 100.0]\n",
"mesh1d_node_y = [20.00001, 20.0, 20.0]\n",
"mesh1d_edge_nodes = [0, 1, 1, 2]\n",
"mesh1d = Mesh1d(\n",
" node_x=mesh1d_node_x, node_y=mesh1d_node_y, edge_nodes=mesh1d_edge_nodes\n",
")\n",
"mk.mesh1d_set(mesh1d)"
]
},
Expand Down Expand Up @@ -194,10 +200,10 @@
}
],
"source": [
"x_coordinates = np.array([0.0,100.0,100.0,0.0,0.0], dtype=np.double)\n",
"y_coordinates = np.array([0.0,0.0,100.0,100.0,0.0], dtype=np.double)\n",
"x_coordinates = np.array([0.0, 100.0, 100.0, 0.0, 0.0], dtype=np.double)\n",
"y_coordinates = np.array([0.0, 0.0, 100.0, 100.0, 0.0], dtype=np.double)\n",
"area_selection = GeometryList(x_coordinates, y_coordinates)\n",
"mk.contacts_compute_single(node_mask, area_selection, projection_factor =0.0)\n",
"mk.contacts_compute_single(node_mask, area_selection, projection_factor=0.0)\n",
"mesh1d_output_0 = mk.mesh1d_get()\n",
"mesh2d_output_0 = mk.mesh2d_get()\n",
"contacts_output_0 = mk.contacts_get()\n",
Expand Down Expand Up @@ -263,7 +269,7 @@
}
],
"source": [
"mk.contacts_compute_boundary(node_mask, search_radius = 50.0)\n",
"mk.contacts_compute_boundary(node_mask, search_radius=50.0)\n",
"mesh1d_output_0 = mk.mesh1d_get()\n",
"mesh2d_output_0 = mk.mesh2d_get()\n",
"contacts_output_0 = mk.contacts_get()\n",
Expand Down

0 comments on commit f65bf5c

Please sign in to comment.