Hi! I'm new to the fenicsx and ngspetsc, so I'm not sure if this is a bug or something wrong with my implementation.
The minimum working example is:
########################################
from netgen.csg import OrthoBrick, Pnt, CSGeometry
from mpi4py import MPI
import ngsPETSc.utils.fenicsx as ngfx
cube = OrthoBrick(Pnt(0,0,0), Pnt(1,1,1))
geo = CSGeometry()
geo.Add(cube)
geoModel = ngfx.GeometricModel(geo, MPI.COMM_WORLD)
domain, (ct, ft), region_map = geoModel.model_to_mesh(gdim=3, hmax=0.5)
########################################
When I run this, I get:
Traceback (most recent call last):
File "***.py", line 10, in
domain, (ct, ft), region_map = geoModel.model_to_mesh(gdim=3, hmax=0.5)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../ngsPETSc/utils/fenicsx.py", line 136, in model_to_mesh
ct, ft = self.extract_linear_mesh(gdim=gdim, partitioner=partitioner)
File ".../ngsPETSc/utils/fenicsx.py", line 302, in extract_linear_mesh
ct = extract_element_tags(self.comm_rank, ngmesh, mesh, dim=mesh.topology.dim)
File ".../ngsPETSc/utils/fenicsx.py", line 668, in extract_element_tags
assert dolfinx_mesh.geometry.cmap.degree == 1, (
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'function' object has no attribute 'degree'
The code worked with an older version of dolfinx. I think this is caused by a change in the definition of cmap.
In my old version it was a property:
@Property
def cmap(self) -> _CoordinateElement:
"""Element that describes the geometry map."""
return _CoordinateElement(self._cpp_object.cmap)
But now it is a method:
def cmap(self, i=None) -> _CoordinateElement:
"""Element that describes the ith geometry map."""
return _CoordinateElement(self._cpp_object.cmap(i))
See (FEniCS/dolfinx@e2e69ab)
I believe the possible fix is to replace .cmap.degree with .cmap().degree in ngsPETSc/utils/fenicsx.py (at least for lines 668).
Thank you for this very useful package!
Hi! I'm new to the fenicsx and ngspetsc, so I'm not sure if this is a bug or something wrong with my implementation.
The minimum working example is:
When I run this, I get:
The code worked with an older version of dolfinx. I think this is caused by a change in the definition of cmap.
In my old version it was a property:
But now it is a method:
See (FEniCS/dolfinx@e2e69ab)
I believe the possible fix is to replace .cmap.degree with .cmap().degree in ngsPETSc/utils/fenicsx.py (at least for lines 668).
Thank you for this very useful package!