]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make it work
authorPeter Munch <peterrmuench@gmail.com>
Mon, 1 Jun 2020 07:26:59 +0000 (09:26 +0200)
committerPeter Munch <peterrmuench@gmail.com>
Mon, 1 Jun 2020 07:26:59 +0000 (09:26 +0200)
include/deal.II/grid/tria_accessor.h
include/deal.II/grid/tria_object.h
source/grid/tria.cc
source/grid/tria_accessor.cc

index a3bf94ab9813e6ab5d625a0c1694e009d2a96a8f..97dbb50eadc93a31a93d3a8a5e23e1149935155d 100644 (file)
@@ -1628,6 +1628,12 @@ private:
   void
   set(const std::initializer_list<int> &o) const;
 
+  /**
+   * The same as above but for `unsigned int`.
+   */
+  void
+  set(const std::initializer_list<unsigned int> &o) const;
+
   /**
    * Set the flag indicating, what <code>line_orientation()</code> will
    * return.
index b76197c34a5225afabb3d1cb48d8339c5689a5ec..f38bf01618e0337d25d738d4808be13219faa7d1 100644 (file)
 
 DEAL_II_NAMESPACE_OPEN
 
-#ifndef DOXYGEN
-namespace internal
-{
-  namespace TriangulationImplementation
-  {
-    class TriaObjectView;
-  }
-} // namespace internal
-#endif
-
 namespace internal
 {
   namespace TriangulationImplementation
@@ -73,6 +63,22 @@ namespace internal
         return *this;
       }
 
+      /**
+       * The same as above but for `unsigned int`.
+       */
+      TriaObjectView &
+      operator=(const std::initializer_list<unsigned int> &other)
+      {
+        AssertDimension(faces.size(), other.size());
+
+        const std::vector<unsigned int> other_v = other;
+
+        for (unsigned int i = 0; i < faces.size(); ++i)
+          faces[i] = other_v[i];
+
+        return *this;
+      }
+
       /**
        * Return index of the @p i-th face.
        */
index 4d6f469257dec13cbe04746606d17f33f8f89222..be135669f98b0f8d2dd9051daaf006865b991759 100644 (file)
@@ -2243,8 +2243,7 @@ namespace internal
       struct QuadComparator
       {
         inline bool
-        operator()(const std::vector<int> &q1,
-                   const std::vector<int> &q2) const
+        operator()(const std::vector<int> &q1, const std::vector<int> &q2) const
         {
           Assert(q1.size() == 4, ExcInternalError());
           Assert(q2.size() == 4, ExcInternalError());
@@ -2256,12 +2255,10 @@ namespace internal
           // compiler will probably
           // take care of most of
           // it anyway
-          if ((q1[0] < q2[0]) ||
-              ((q1[0] == q2[0]) && (q1[1] < q2[1])) ||
-              ((q1[0] == q2[0]) && (q1[1] == q2[1]) &&
-               (q1[2] < q2[2])) ||
-              ((q1[0] == q2[0]) && (q1[1] == q2[1]) &&
-               (q1[2] == q2[2]) && (q1[3] < q2[3])))
+          if ((q1[0] < q2[0]) || ((q1[0] == q2[0]) && (q1[1] < q2[1])) ||
+              ((q1[0] == q2[0]) && (q1[1] == q2[1]) && (q1[2] < q2[2])) ||
+              ((q1[0] == q2[0]) && (q1[1] == q2[1]) && (q1[2] == q2[2]) &&
+               (q1[3] < q2[3])))
             return true;
           else
             return false;
@@ -2540,10 +2537,10 @@ namespace internal
 
 
                 const std::vector<int> quad(
-                  {face_line_list[0],
-                   face_line_list[1],
-                   face_line_list[2],
-                   face_line_list[3]});
+                  {static_cast<int>(face_line_list[0]),
+                   static_cast<int>(face_line_list[1]),
+                   static_cast<int>(face_line_list[2]),
+                   static_cast<int>(face_line_list[3])});
 
                 // insert quad, with
                 // invalid iterator
@@ -2588,43 +2585,37 @@ namespace internal
                    quad[3],
                    quad[0],
                    quad[1]}), // face_orientation=false, face_flip=false,
-                                   // face_rotation=false
-                  test_quad_2(
-                    {quad[0],
-                     quad[1],
-                     quad[3],
-                     quad[2]}), // face_orientation=false, face_flip=false,
-                                     // face_rotation=true
-                  test_quad_3(
-                    {quad[3],
-                     quad[2],
-                     quad[1],
-                     quad[0]}), // face_orientation=false, face_flip=true,
-                                     // face_rotation=false
-                  test_quad_4(
-                    {quad[1],
-                     quad[0],
-                     quad[2],
-                     quad[3]}), // face_orientation=false, face_flip=true,
-                                     // face_rotation=true
-                  test_quad_5(
-                    {quad[2],
-                     quad[3],
-                     quad[1],
-                     quad[0]}), // face_orientation=true,  face_flip=false,
-                                     // face_rotation=true
-                  test_quad_6(
-                    {quad[1],
-                     quad[0],
-                     quad[3],
-                     quad[2]}), // face_orientation=true,  face_flip=true,
-                                     // face_rotation=false
-                  test_quad_7(
-                    {quad[3],
-                     quad[2],
-                     quad[0],
-                     quad[1]}); // face_orientation=true,  face_flip=true,
-                                     // face_rotation=true
+                              // face_rotation=false
+                  test_quad_2({quad[0],
+                               quad[1],
+                               quad[3],
+                               quad[2]}), // face_orientation=false,
+                                          // face_flip=false, face_rotation=true
+                  test_quad_3({quad[3],
+                               quad[2],
+                               quad[1],
+                               quad[0]}), // face_orientation=false,
+                                          // face_flip=true, face_rotation=false
+                  test_quad_4({quad[1],
+                               quad[0],
+                               quad[2],
+                               quad[3]}), // face_orientation=false,
+                                          // face_flip=true, face_rotation=true
+                  test_quad_5({quad[2],
+                               quad[3],
+                               quad[1],
+                               quad[0]}), // face_orientation=true,
+                                          // face_flip=false, face_rotation=true
+                  test_quad_6({quad[1],
+                               quad[0],
+                               quad[3],
+                               quad[2]}), // face_orientation=true,
+                                          // face_flip=true, face_rotation=false
+                  test_quad_7({quad[3],
+                               quad[2],
+                               quad[0],
+                               quad[1]}); // face_orientation=true,
+                                          // face_flip=true, face_rotation=true
                 if (needed_quads.find(test_quad_1) == needed_quads.end() &&
                     needed_quads.find(test_quad_2) == needed_quads.end() &&
                     needed_quads.find(test_quad_3) == needed_quads.end() &&
@@ -2657,7 +2648,7 @@ namespace internal
           for (q = needed_quads.begin(); quad != triangulation.end_quad();
                ++quad, ++q)
             {
-              quad->set(q->first);
+              quad->set({q->first[0], q->first[1], q->first[2], q->first[3]});
               quad->set_used_flag();
               quad->clear_user_flag();
               quad->clear_user_data();
@@ -2750,10 +2741,10 @@ namespace internal
                           ->index();
 
                   const std::vector<int> quad(
-                    {face_line_list[0],
-                     face_line_list[1],
-                     face_line_list[2],
-                     face_line_list[3]});
+                    {static_cast<int>(face_line_list[0]),
+                     static_cast<int>(face_line_list[1]),
+                     static_cast<int>(face_line_list[2]),
+                     static_cast<int>(face_line_list[3])});
 
                   if (needed_quads.find(quad) != needed_quads.end())
                     {
@@ -2783,43 +2774,43 @@ namespace internal
                          quad[3],
                          quad[0],
                          quad[1]}), // face_orientation=false,
-                                         // face_flip=false, face_rotation=false
+                                    // face_flip=false, face_rotation=false
                         test_quad_2(
                           {quad[0],
                            quad[1],
                            quad[3],
                            quad[2]}), // face_orientation=false,
-                                   // face_flip=false, face_rotation=true
+                                      // face_flip=false, face_rotation=true
                         test_quad_3(
                           {quad[3],
                            quad[2],
                            quad[1],
                            quad[0]}), // face_orientation=false,
-                                   // face_flip=true,  face_rotation=false
+                                      // face_flip=true,  face_rotation=false
                         test_quad_4(
                           {quad[1],
                            quad[0],
                            quad[2],
                            quad[3]}), // face_orientation=false,
-                                           // face_flip=true, face_rotation=true
+                                      // face_flip=true, face_rotation=true
                         test_quad_5(
                           {quad[2],
                            quad[3],
                            quad[1],
                            quad[0]}), // face_orientation=true,
-                                   // face_flip=false, face_rotation=true
+                                      // face_flip=false, face_rotation=true
                         test_quad_6(
                           {quad[1],
                            quad[0],
                            quad[3],
                            quad[2]}), // face_orientation=true,
-                                   // face_flip=true,  face_rotation=false
+                                      // face_flip=true,  face_rotation=false
                         test_quad_7(
                           {quad[3],
                            quad[2],
                            quad[0],
                            quad[1]}); // face_orientation=true,
-                                           // face_flip=true, face_rotation=true
+                                      // face_flip=true, face_rotation=true
                       if (needed_quads.find(test_quad_1) != needed_quads.end())
                         {
                           face_iterator[face] = needed_quads[test_quad_1].first;
@@ -3169,16 +3160,14 @@ namespace internal
             // and because boundary quad
             // orientation does not carry
             // any information.
-            std::vector<int> quad_compare_1(
-              {line[0]->index(),
-               line[1]->index(),
-               line[2]->index(),
-               line[3]->index()});
-            std::vector<int> quad_compare_2(
-              {line[2]->index(),
-               line[3]->index(),
-               line[0]->index(),
-               line[1]->index()});
+            std::vector<int> quad_compare_1({line[0]->index(),
+                                             line[1]->index(),
+                                             line[2]->index(),
+                                             line[3]->index()});
+            std::vector<int> quad_compare_2({line[2]->index(),
+                                             line[3]->index(),
+                                             line[0]->index(),
+                                             line[1]->index()});
 
             // try to find the quad with
             // lines situated as
@@ -3218,8 +3207,10 @@ namespace internal
                 // lexicographic ordering)
                 for (unsigned int i = 0; i < 4; ++i)
                   {
-                    quad_compare_1[i] = line_counterclock[lex2cclock[i]]->index();
-                    quad_compare_2[(i + 2) % 4] = line_counterclock[lex2cclock[i]]->index();
+                    quad_compare_1[i] =
+                      line_counterclock[lex2cclock[i]]->index();
+                    quad_compare_2[(i + 2) % 4] =
+                      line_counterclock[lex2cclock[i]]->index();
                   }
 
                 ++n_rotations;
index 08f615529b5c34f0ddd35ee683ce52a4ea5f77f9..a07f7173ade944f74869af2b6354cf165aac00d1 100644 (file)
@@ -1496,6 +1496,16 @@ TriaAccessor<structdim, dim, spacedim>::set(
 
 
 
+template <int structdim, int dim, int spacedim>
+void
+TriaAccessor<structdim, dim, spacedim>::set(
+  const std::initializer_list<unsigned int> &object) const
+{
+  this->objects().get_object(this->present_index) = object;
+}
+
+
+
 template <int structdim, int dim, int spacedim>
 Point<spacedim>
 TriaAccessor<structdim, dim, spacedim>::barycenter() const

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.