From ea3c949f72b37ef0b2ce502a0a47b41da51c0ec5 Mon Sep 17 00:00:00 2001
From: benSepanski <ben_sepanski@alumni.baylor.edu>
Date: Mon, 29 Jun 2020 09:33:48 -0500
Subject: [PATCH] cleaned up some FIXMEs with integer types and avoiding copies

---
 meshmode/interop/firedrake/connection.py | 13 +++++++------
 meshmode/interop/firedrake/mesh.py       |  3 ---
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/meshmode/interop/firedrake/connection.py b/meshmode/interop/firedrake/connection.py
index e3d950d3..9916b8c9 100644
--- a/meshmode/interop/firedrake/connection.py
+++ b/meshmode/interop/firedrake/connection.py
@@ -274,14 +274,15 @@ class FromFiredrakeConnection:
             mm_field = mm_field.reshape(mm_field.shape[1])
 
         # resample from nodes
-        # FIXME : we're still allocating new memory when :param:`out` is supplied
-        resampled = np.copy(mm_field)
-        by_cell_view = self.to_discr.groups[0].view(resampled)
-        np.matmul(by_cell_view, self._resampling_mat_mm2fd.T, out=by_cell_view)
+        by_cell_field_view = self.to_discr.groups[0].view(mm_field)
+        by_cell_out_view = self.to_discr.groups[0].view(out.dat.data.T)
+        np.matmul(by_cell_field_view, self._resampling_mat_mm2fd.T,
+                  out=by_cell_out_view)
+
         # reorder data
         if len(out.dat.data.shape) == 1:
-            out.dat.data[:] = resampled[self._reordering_arr_mm2fd]
+            out.dat.data[:] = out.dat.data[self._reordering_arr_mm2fd]
         else:
-            out.dat.data[:] = resampled.T[self._reordering_arr_mm2fd, :]
+            out.dat.data[:] = out.dat.data.T[self._reordering_arr_mm2fd, :]
 
         return out
diff --git a/meshmode/interop/firedrake/mesh.py b/meshmode/interop/firedrake/mesh.py
index 26dbed76..470cd724 100644
--- a/meshmode/interop/firedrake/mesh.py
+++ b/meshmode/interop/firedrake/mesh.py
@@ -75,7 +75,6 @@ def _get_firedrake_nodal_info(fdrake_mesh_topology):
     def vert_id_dmp_to_fd(ndx):
         return top._vertex_numbering.getOffset(ndx)
 
-    # FIXME : Is this the right integer type?
     # We will fill in the values as we go
     vertex_indices = -np.ones((top.num_cells(), top.ufl_cell().num_vertices()),
                               dtype=np.int32)
@@ -122,7 +121,6 @@ def _get_firedrake_nodal_info(fdrake_mesh_topology):
     # Next go ahead and compute nodal adjacency by creating
     # neighbors and neighbor_starts as specified by :class:`NodalAdjacency`
     neighbors = []
-    # FIXME : Is this the right integer type to choose?
     neighbors_starts = np.zeros(top.num_cells() + 1, dtype=np.int32)
     for iel in range(len(cell_to_nodal_neighbors)):
         neighbors += cell_to_nodal_neighbors[iel]
@@ -340,7 +338,6 @@ def _get_firedrake_orientations(fdrake_mesh, unflipped_group, vertices,
 # {{{ Mesh conversion
 
 def import_firedrake_mesh(fdrake_mesh):
-    # FIXME : docs
     """
     Create a :mod:`meshmode` :class:`Mesh` from a :mod:`firedrake`
     :class:`MeshGeometry` with the same cells/elements, vertices, nodes,
-- 
GitLab