]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Implement DoFAccessor::set_mg_dof_indices and get_mg_dof_indices for 1D 8593/head
authorPeter Munch <peterrmuench@gmail.com>
Sat, 17 Aug 2019 04:22:18 +0000 (06:22 +0200)
committerPeter Munch <peterrmuench@gmail.com>
Sat, 17 Aug 2019 23:05:25 +0000 (01:05 +0200)
doc/news/changes/minor/20190818PeterMunch [new file with mode: 0644]
include/deal.II/dofs/dof_accessor.templates.h

diff --git a/doc/news/changes/minor/20190818PeterMunch b/doc/news/changes/minor/20190818PeterMunch
new file mode 100644 (file)
index 0000000..ee11757
--- /dev/null
@@ -0,0 +1,3 @@
+New: Implement DoFAccessor::set_mg_dof_indices and get_mg_dof_indices for 1D.
+<br>
+(Peter Munch, 2019/08/18)
index be8285f8baad2fe1fd5257d9c6e6470f70b81961..bb90ee4087a53ab0da27d2d558a273cd3382b85a 100644 (file)
@@ -1408,12 +1408,29 @@ namespace internal
       template <typename DoFHandlerType, bool level_dof_access>
       static void
       set_mg_dof_indices(
-        const dealii::DoFAccessor<1, DoFHandlerType, level_dof_access> &,
-        const int,
-        const std::vector<types::global_dof_index> &,
-        const unsigned int)
+        const dealii::DoFAccessor<1, DoFHandlerType, level_dof_access>
+          &                                         accessor,
+        const int                                   level,
+        const std::vector<types::global_dof_index> &dof_indices,
+        const unsigned int                          fe_index)
       {
-        AssertThrow(false, ExcNotImplemented()); // TODO[TH]: implement
+        const FiniteElement<DoFHandlerType::dimension,
+                            DoFHandlerType::space_dimension> &fe =
+          accessor.get_dof_handler().get_fe(fe_index);
+        std::vector<types::global_dof_index>::const_iterator next =
+          dof_indices.begin();
+
+        for (unsigned int vertex = 0;
+             vertex < GeometryInfo<1>::vertices_per_cell;
+             ++vertex)
+          for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof)
+            accessor.set_mg_vertex_dof_index(
+              level, vertex, dof, *next++, fe_index);
+
+        for (unsigned int dof = 0; dof < fe.dofs_per_line; ++dof)
+          accessor.set_mg_dof_index(level, dof, *next++);
+
+        Assert(next == dof_indices.end(), ExcInternalError());
       }
 
 
@@ -2509,18 +2526,16 @@ template <template <int, int> class DoFHandlerType,
           bool level_dof_access>
 inline void
 DoFAccessor<0, DoFHandlerType<1, spacedim>, level_dof_access>::
-  get_mg_dof_indices(const int,
+  get_mg_dof_indices(const int                             level,
                      std::vector<types::global_dof_index> &dof_indices,
                      const unsigned int                    fe_index) const
 {
-  (void)dof_indices;
-  (void)fe_index;
-  Assert(this->dof_handler != nullptr, ExcInvalidObject());
-  Assert(dof_indices.size() ==
-           this->dof_handler->get_fe(fe_index).dofs_per_vertex,
-         ExcVectorDoesNotMatch());
+  AssertThrow(fe_index == 0, ExcMessage("Unknown triangulation!"));
 
-  Assert(false, ExcNotImplemented());
+  for (unsigned int i = 0; i < dof_indices.size(); ++i)
+    dof_indices[i] =
+      dealii::internal::DoFAccessorImplementation::Implementation::
+        mg_vertex_dof_index(*dof_handler, level, this->global_vertex_index, i);
 }
 
 

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.