create_mesh

mfai.pytorch.models.nlam.create_mesh.build_graph_for_grid(grid_xy, cache_dir_path, plot=False, levels=None, hierarchical=False)[source]

xy: (x, y) coordinates of grid points, shape (2, N_x, N_y). plot: If graphs should be plotted during generation (default: False). levels: Limit multi-scale mesh to given number of levels, from bottom up (default: None (no limit)). hierarchical: Generate hierarchical mesh graph (default: 0, no).

Return type:

None

Parameters:
mfai.pytorch.models.nlam.create_mesh.from_networkx_with_start_index(nx_graph, start_index)[source]
Return type:

Data

Parameters:
  • nx_graph (Graph | DiGraph)

  • start_index (int)

mfai.pytorch.models.nlam.create_mesh.grid2mesh(G_bottom_mesh, all_mesh_nodes, xy, plot, cache_dir_path)[source]
Return type:

tuple[DiGraph, NodeView, ndarray, list[NodeView]]

Parameters:
  • G_bottom_mesh (DiGraph)

  • all_mesh_nodes (NodeView)

  • xy (ndarray)

  • plot (bool)

  • cache_dir_path (Path)

mfai.pytorch.models.nlam.create_mesh.hierarchical_mesh(G, mesh_levels, plot, cache_dir_path)[source]
Return type:

tuple[list[Data], list[Tensor], DiGraph, NodeView]

Parameters:
mfai.pytorch.models.nlam.create_mesh.mesh2grid(G_g2m, vm, vm_xy, vg_list, plot, cache_dir_path)[source]
Return type:

None

Parameters:
  • G_g2m (DiGraph)

  • vm (NodeView)

  • vm_xy (ndarray)

  • vg_list (list[NodeView])

  • plot (bool)

  • cache_dir_path (Path)

mfai.pytorch.models.nlam.create_mesh.mk_2d_graph(xy, nx, ny)[source]
Return type:

DiGraph

Parameters:
mfai.pytorch.models.nlam.create_mesh.monolevel_mesh(G, nx, plot)[source]
Return type:

tuple[list[Data], list[Tensor], DiGraph, NodeView]

Parameters:
mfai.pytorch.models.nlam.create_mesh.plot_graph(graph, title=None)[source]
Return type:

tuple[Figure, Axes]

Parameters:
  • graph (Graph)

  • title (str | None)

mfai.pytorch.models.nlam.create_mesh.prepend_node_index(graph, new_index)[source]
Return type:

Graph

Parameters:
  • graph (Graph)

  • new_index (int)

mfai.pytorch.models.nlam.create_mesh.save_edges(graph, name, base_path)[source]
Return type:

None

Parameters:
  • graph (Data)

  • name (str)

  • base_path (Path)

mfai.pytorch.models.nlam.create_mesh.save_edges_list(graphs, name, base_path)[source]
Return type:

None

Parameters:
mfai.pytorch.models.nlam.create_mesh.sort_nodes_internally(nx_graph)[source]
Return type:

DiGraph

Parameters:

nx_graph (Graph | DiGraph)

mfai.pytorch.models.nlam.create_mesh.torch_save(data, path)[source]

Saving files with torch to be writeable by anyone.

Return type:

None

Parameters: