diff --git a/meshmode/interop/firedrake/__init__.py b/meshmode/interop/firedrake/__init__.py index 47c56e6a7a71d0aeac1461e9054479c4a9de368c..33daeb392b3276f855867ff79daaaea0ab3e2f64 100644 --- a/meshmode/interop/firedrake/__init__.py +++ b/meshmode/interop/firedrake/__init__.py @@ -163,7 +163,8 @@ def import_firedrake_function_space(cl_ctx, fdrake_fspace, mesh_importer): from meshmode.interop.firedrake.function_space_coordless import \ FiredrakeFunctionSpaceImporter mesh_importer.init(cl_ctx) - finat_elt_importer = FinatLagrangeElementImporter(fdrake_fspace.finat_elt) + finat_elt_importer = \ + FinatLagrangeElementImporter(fdrake_fspace.finat_element) topological_importer = FiredrakeFunctionSpaceImporter(fdrake_fspace, mesh_importer, finat_elt_importer) diff --git a/meshmode/interop/firedrake/function_space.py b/meshmode/interop/firedrake/function_space.py index 998bed3b464728da3c3e87ba484323f3a1ee65cf..85b3d6c22645f57ac2a14dff0e953307222b659f 100644 --- a/meshmode/interop/firedrake/function_space.py +++ b/meshmode/interop/firedrake/function_space.py @@ -88,7 +88,7 @@ class FiredrakeWithGeometryImporter(ExternalImportHandler): mesh_order = mesh_importer.data.coordinates.\ function_space().finat_element.degree - if mesh_order > self.data.degree: + if mesh_order > self.data.finat_element.degree: warn("Careful! When the mesh order is higher than the element" " order. Conversion MIGHT work, but maybe not..." " To be honest I really don't know.") @@ -98,7 +98,7 @@ class FiredrakeWithGeometryImporter(ExternalImportHandler): self._resampling_mat_mm2fd = None def __getattr__(self, attr): - return getattr(self._topology_a, attr) + return getattr(self._topology_importer, attr) def mesh_importer(self): return self._mesh_importer @@ -118,7 +118,7 @@ class FiredrakeWithGeometryImporter(ExternalImportHandler): if self._resampling_mat_fd2mm is None: element_grp = self.discretization().groups[0] self._resampling_mat_fd2mm = \ - self.finat_element_a.make_resampling_matrix(element_grp) + self.finat_element_importer.make_resampling_matrix(element_grp) self._resampling_mat_mm2fd = np.linalg.inv(self._resampling_mat_fd2mm) diff --git a/meshmode/interop/firedrake/function_space_coordless.py b/meshmode/interop/firedrake/function_space_coordless.py index 3d785bc96bc840c3aa09fab0b6eaae99303176d7..e6fdec6cd2137c0831340bb13db206da3e21f9e5 100644 --- a/meshmode/interop/firedrake/function_space_coordless.py +++ b/meshmode/interop/firedrake/function_space_coordless.py @@ -82,6 +82,10 @@ class FiredrakeFunctionSpaceImporter(ExternalImportHandler): a different mesh or finat element than the provided :param:`function_space` is built on. """ + # We want to ignore any geomery + function_space = function_space.topological + mesh_importer = mesh_importer.topological_importer + # {{{ Some type-checking from firedrake.functionspaceimpl import FunctionSpace, WithGeometry @@ -95,7 +99,7 @@ class FiredrakeFunctionSpaceImporter(ExternalImportHandler): raise TypeError(":param:`mesh_importer` must be either *None* " "or of type :class:`meshmode.interop.firedrake." "FiredrakeMeshTopologyImporter`") - if not function_space.mesh() == mesh_importer.data: + if not function_space.mesh().topological == mesh_importer.data: raise ValueError(":param:`mesh_importer`'s *data* attribute " "must be the same mesh as returned by " ":param:`function_space`'s *mesh()* method.") @@ -114,8 +118,7 @@ class FiredrakeFunctionSpaceImporter(ExternalImportHandler): # }}} - # We want to ignore any geometry and then finish initialization - function_space = function_space.topological + # finish initialization super(FiredrakeFunctionSpaceImporter, self).__init__(function_space) self._mesh_importer = mesh_importer @@ -170,6 +173,10 @@ class FiredrakeCoordinatelessFunctionImporter(ExternalImportHandler): importer for a firedrake function space which is not identical to ``function.topological.function_space()`` """ + # Throw out geometric information if there is any + function = function.topological + function_space_importer = function_space_importer.topological_importer + # {{{ Some type-checking from firedrake.function import Function, CoordinatelessFunction @@ -189,9 +196,6 @@ class FiredrakeCoordinatelessFunctionImporter(ExternalImportHandler): "attribute and ``function.function_space()`` " "must be identical.") - function = function.topological - function_space_importer = function_space_importer.topological_importer - super(FiredrakeCoordinatelessFunctionImporter, self).__init__(function) self._function_space_importer = function_space_importer diff --git a/meshmode/interop/firedrake/function_space_shared_data.py b/meshmode/interop/firedrake/function_space_shared_data.py index 1682ffdd973eca4dd17e69bbbf2df292bd4efb01..9bd03f27a088041249736315c5c3a7b45ec41bc4 100644 --- a/meshmode/interop/firedrake/function_space_shared_data.py +++ b/meshmode/interop/firedrake/function_space_shared_data.py @@ -216,15 +216,15 @@ class FiredrakeFunctionSpaceDataImporter(ExternalImportHandler): Note that :param:`mesh_importer` and :param:`finat_element_importer` are used for checking """ - if mesh_importer.topological_a == mesh_importer: + if mesh_importer.topological_importer == mesh_importer: raise TypeError(":param:`mesh_importer` is a " "FiredrakeMeshTopologyImporter, but " " must be a FiredrakeMeshGeometryImporter") - importer = (mesh_importer.importer(), finat_element_importer.importer()) + importer = (mesh_importer.data, finat_element_importer.data) super(FiredrakeFunctionSpaceDataImporter, self).__init__(importer) - self._fspace_data = FunctionSpaceData(mesh_importer.importer(), - finat_element_importer.importer()) + self._fspace_data = FunctionSpaceData(mesh_importer.data, + finat_element_importer.data) self._cl_ctx = cl_ctx self._mesh_importer = mesh_importer diff --git a/meshmode/interop/firedrake/mesh_geometry.py b/meshmode/interop/firedrake/mesh_geometry.py index 735bbc6a251e064b9d55a638a1e4ffefeeebd81f..216cb7b19dc4661a247a88220f7d215d68d46383 100644 --- a/meshmode/interop/firedrake/mesh_geometry.py +++ b/meshmode/interop/firedrake/mesh_geometry.py @@ -91,7 +91,7 @@ class FiredrakeMeshGeometryImporter(ExternalImportHandler): fspace_importer = coordinates_importer.function_space_importer() topology_importer = fspace_importer.mesh_importer() - if topology_importer != mesh.topology: + if topology_importer.data != mesh.topology: raise ValueError("Topology :param:`coordinates` lives on must be " "the same " "topology that :param:`mesh` lives on") @@ -138,7 +138,7 @@ class FiredrakeMeshGeometryImporter(ExternalImportHandler): coordinates_fs, coordinates_fs_importer, self) - f = Function(fspace_importer.data, val=self._coordinates_a.data) + f = Function(fspace_importer.data, val=self._coordinates_importer.data) self._coordinates_function_importer = \ FiredrakeFunctionImporter(f, fspace_importer)