I'm working on Google Colab and trying to extract a gmsh geometry using dolfinx.io. I get and error saying AttributeError: module 'dolfinx.io' has no attribute 'extract_gmsh_geometry'. The following lines of code worked yesterday, and I don't know what's happening:
import ufl
import gmsh
import pyvista
import numpy as np
from mpi4py import MPI
from dolfinx import io
from dolfinx import cpp
from dolfinx import fem
from dolfinx import mesh
from dolfinx import plot
from petsc4py import PETSc
import matplotlib.pyplot as plt
from petsc4py.PETSc import ScalarType
if MPI.COMM_WORLD.rank == 0:
# Get mesh geometry
geometry_data = io.extract_gmsh_geometry(gmsh.model)
# Get mesh topology for each element
topology_data = io.extract_gmsh_topology_and_markers(gmsh.model)
# Extract the cell type and number of nodes per cell and broadcast
# it to the other processors
if MPI.COMM_WORLD.rank == 0:
# Extract the cell type and number of nodes per cell and broadcast
# it to the other processors
gmsh_cell_type = list(topology_data.keys())[0]
properties = gmsh.model.mesh.getElementProperties(gmsh_cell_type)
name, dim, order, num_nodes, local_coords, _ = properties
cells = topology_data[gmsh_cell_type]["topology"]
cell_id, num_nodes = MPI.COMM_WORLD.bcast([gmsh_cell_type, num_nodes], root=0)
else:
cell_id, num_nodes = MPI.COMM_WORLD.bcast([None, None], root=0)
cells, geometry_data = np.empty([0, num_nodes]), np.empty([0, gdim])
# Permute topology data from MSH-ordering to dolfinx-ordering
ufl_domain = io.ufl_mesh_from_gmsh(cell_id, gdim)
gmsh_cell_perm = io.cell_perm_gmsh(cpp.mesh.to_type(str(ufl_domain.ufl_cell())), num_nodes)
cells = cells[:, gmsh_cell_perm]
# Generate domain
domain = mesh.create_mesh(MPI.COMM_WORLD, cells, geometry_data[:, :gdim], ufl_domain)
gmsh.finalize()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
[<ipython-input-47-3e23f9976d95>](https://localhost:8080/#) in <module>()
3 if MPI.COMM_WORLD.rank == 0:
4 # Get mesh geometry
----> 5 geometry_data = io.extract_gmsh_geometry(gmsh.model)
6 # Get mesh topology for each element
7 topology_data = io.extract_gmsh_topology_and_markers(gmsh.model)
AttributeError: module 'dolfinx.io' has no attribute 'extract_gmsh_geometry'
I'm working on Google Colab and trying to extract a gmsh geometry using dolfinx.io. I get and error saying
AttributeError: module 'dolfinx.io' has no attribute 'extract_gmsh_geometry'
. The following lines of code worked yesterday, and I don't know what's happening:Here are the blocks of code I'm trying to run: