]> https://gitweb.dealii.org/ - dealii.git/commitdiff
RCM: Update matrix_free, part 2: cuda_matrix_free
authorMatthias Maier <tamiko@43-1.org>
Fri, 25 May 2018 22:31:35 +0000 (17:31 -0500)
committerMatthias Maier <tamiko@43-1.org>
Wed, 6 Jun 2018 15:19:38 +0000 (10:19 -0500)
include/deal.II/matrix_free/cuda_matrix_free.h
include/deal.II/matrix_free/cuda_matrix_free.templates.h

index f114cf12a1cc4e715601d5f7d5533cc639e624ad..eff78e5974ca4ab76a6db6e9b551a012884a2698 100644 (file)
@@ -30,7 +30,7 @@
 #  include <deal.II/fe/mapping.h>
 #  include <deal.II/fe/mapping_q1.h>
 
-#  include <deal.II/lac/constraint_matrix.h>
+#  include <deal.II/lac/affine_constraints.h>
 #  include <deal.II/lac/cuda_vector.h>
 
 #  include <cuda_runtime_api.h>
@@ -153,26 +153,27 @@ namespace CUDAWrappers
 
     /**
      * Extracts the information needed to perform loops over cells. The
-     * DoFHandler and ConstraintMatrix describe the layout of degrees of
-     * freedom, the DoFHandler and the mapping describe the transformation from
-     * unit to real cell, and the finite element underlying the DoFHandler
-     * together with the quadrature formula describe the local operations.
+     * DoFHandler and AffineConstraints objects describe the layout of
+     * degrees of freedom, the DoFHandler and the mapping describe the
+     * transformation from unit to real cell, and the finite element
+     * underlying the DoFHandler together with the quadrature formula
+     * describe the local operations.
      */
     void
-    reinit(const Mapping<dim> &    mapping,
-           const DoFHandler<dim> & dof_handler,
-           const ConstraintMatrix &constraints,
-           const Quadrature<1> &   quad,
-           const AdditionalData    additional_data = AdditionalData());
+    reinit(const Mapping<dim> &             mapping,
+           const DoFHandler<dim> &          dof_handler,
+           const AffineConstraints<Number> &constraints,
+           const Quadrature<1> &            quad,
+           const AdditionalData             additional_data = AdditionalData());
 
     /**
      * Initializes the data structures. Same as above but using a Q1 mapping.
      */
     void
-    reinit(const DoFHandler<dim> & dof_handler,
-           const ConstraintMatrix &constraints,
-           const Quadrature<1> &   quad,
-           const AdditionalData    AdditionalData = AdditionalData());
+    reinit(const DoFHandler<dim> &          dof_handler,
+           const AffineConstraints<Number> &constraints,
+           const Quadrature<1> &            quad,
+           const AdditionalData             AdditionalData = AdditionalData());
 
     /**
      * Return the Data structure associated with @p color.
index 3bfc11dfcbfd6eaa26613c1996a1e23cb10752b6..b6317153fa99876a1533dc570249eaaa7a32330d 100644 (file)
@@ -381,12 +381,12 @@ namespace CUDAWrappers
 
 
 
-    template <int dim>
+    template <int dim, typename number>
     std::vector<types::global_dof_index>
     get_conflict_indices(
       const FilteredIterator<typename DoFHandler<dim>::active_cell_iterator>
-        &                     cell,
-      const ConstraintMatrix &constraints)
+        &                              cell,
+      const AffineConstraints<number> &constraints)
     {
       std::vector<types::global_dof_index> local_dof_indices(
         cell->get_fe().dofs_per_cell);
@@ -476,11 +476,11 @@ namespace CUDAWrappers
 
   template <int dim, typename Number>
   void
-  MatrixFree<dim, Number>::reinit(const Mapping<dim> &    mapping,
-                                  const DoFHandler<dim> & dof_handler,
-                                  const ConstraintMatrix &constraints,
-                                  const Quadrature<1> &   quad,
-                                  const AdditionalData    additional_data)
+  MatrixFree<dim, Number>::reinit(const Mapping<dim> &             mapping,
+                                  const DoFHandler<dim> &          dof_handler,
+                                  const AffineConstraints<Number> &constraints,
+                                  const Quadrature<1> &            quad,
+                                  const AdditionalData additional_data)
   {
     if (typeid(Number) == typeid(double))
       cudaDeviceSetSharedMemConfig(cudaSharedMemBankSizeEightByte);
@@ -550,11 +550,10 @@ namespace CUDAWrappers
     CellFilter end(IteratorFilters::LocallyOwnedCell(), dof_handler.end());
     typedef std::function<std::vector<types::global_dof_index>(
       CellFilter const &)>
-                    fun_type;
-    const fun_type &fun =
-      static_cast<fun_type>(std::bind(&internal::get_conflict_indices<dim>,
-                                      std::placeholders::_1,
-                                      constraints));
+               fun_type;
+    const auto fun = [&](const CellFilter &filter) {
+      return internal::get_conflict_indices<dim, Number>(filter, constraints);
+    };
 
     std::vector<std::vector<CellFilter>> graph =
       GraphColoring::make_graph_coloring(begin, end, fun);

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.