]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Rename ConstraintLine::line to ConstraintLine::index
authorMatthias Maier <tamiko@43-1.org>
Tue, 8 Aug 2017 22:58:43 +0000 (17:58 -0500)
committerMatthias Maier <tamiko@43-1.org>
Tue, 8 Aug 2017 23:54:04 +0000 (18:54 -0500)
include/deal.II/lac/constraint_matrix.h
include/deal.II/lac/constraint_matrix.templates.h
source/lac/constraint_matrix.cc

index 1957cc4a218d13990963c0d09097050162cdfa27..233fd53b911f6905ef30a12cb3a09423e27ee2f7 100644 (file)
@@ -1134,10 +1134,11 @@ public:
     typedef std::vector<std::pair<size_type,double> > Entries;
 
     /**
-     * Number of this line. Since only very few lines are stored, we can not
-     * assume a specific order and have to store the line number explicitly.
+     * Global DoF index of this line. Since only very few lines are stored,
+     * we can not assume a specific order and have to store the index
+     * explicitly.
      */
-    size_type line;
+    size_type index;
 
     /**
      * Row numbers and values of the entries in this line.
@@ -1504,7 +1505,7 @@ ConstraintMatrix::add_line (const size_type line)
 
   // push a new line to the end of the list
   lines.emplace_back ();
-  lines.back().line = line;
+  lines.back().index = line;
   lines.back().inhomogeneity = 0.;
   lines_cache[line_index] = lines.size()-1;
 }
@@ -1538,7 +1539,7 @@ ConstraintMatrix::add_entry (const size_type line,
   Assert (!local_lines.size() || local_lines.is_element(column),
           ExcColumnNotStoredHere(line, column));
   ConstraintLine *line_ptr = &lines[lines_cache[line_index]];
-  Assert (line_ptr->line == line, ExcInternalError());
+  Assert (line_ptr->index == line, ExcInternalError());
   for (ConstraintLine::Entries::const_iterator
        p=line_ptr->entries.begin();
        p != line_ptr->entries.end(); ++p)
index 2f973b755d00340c08b4680c758bc46d3193ef64..1cb91e26492b6c0e71847fd83ba4b69a0aafbb9f 100644 (file)
@@ -87,7 +87,7 @@ ConstraintMatrix::condense (const VectorType &vec_ghosted,
               ExcMessage ("Inhomogeneous constraint cannot be condensed "
                           "without any matrix specified."));
 
-      const typename VectorType::value_type old_value = vec_ghosted(constraint_line->line);
+      const typename VectorType::value_type old_value = vec_ghosted(constraint_line->index);
       for (size_type q=0; q!=constraint_line->entries.size(); ++q)
         if (vec.in_local_range(constraint_line->entries[q].first) == true)
           vec(constraint_line->entries[q].first)
@@ -101,8 +101,8 @@ ConstraintMatrix::condense (const VectorType &vec_ghosted,
   for (std::vector<ConstraintLine>::const_iterator
        constraint_line = lines.begin();
        constraint_line!=lines.end(); ++constraint_line)
-    if (vec.in_local_range(constraint_line->line) == true)
-      vec(constraint_line->line) = 0.;
+    if (vec.in_local_range(constraint_line->index) == true)
+      vec(constraint_line->index) = 0.;
 
   vec.compress(VectorOperation::insert);
 }
@@ -152,7 +152,7 @@ ConstraintMatrix::condense (SparseMatrix<number> &uncondensed,
                                      numbers::invalid_size_type);
 
   for (size_type c=0; c<lines.size(); ++c)
-    distribute[lines[c].line] = c;
+    distribute[lines[c].index] = c;
 
   const size_type n_rows = sparsity.n_rows();
   for (size_type row=0; row<n_rows; ++row)
@@ -290,7 +290,7 @@ ConstraintMatrix::condense (SparseMatrix<number> &uncondensed,
                 vec(lines[distribute[row]].entries[q].first)
                 += (vec(row) * lines[distribute[row]].entries[q].second);
 
-              vec(lines[distribute[row]].line) = 0.;
+              vec(lines[distribute[row]].index) = 0.;
             }
         }
     }
@@ -350,7 +350,7 @@ ConstraintMatrix::condense (BlockSparseMatrix<number> &uncondensed,
                                      numbers::invalid_size_type);
 
   for (size_type c=0; c<lines.size(); ++c)
-    distribute[lines[c].line] = c;
+    distribute[lines[c].index] = c;
 
   const size_type n_rows = sparsity.n_rows();
   for (size_type row=0; row<n_rows; ++row)
@@ -492,7 +492,7 @@ ConstraintMatrix::condense (BlockSparseMatrix<number> &uncondensed,
                 vec(lines[distribute[row]].entries[q].first)
                 += (vec(row) * lines[distribute[row]].entries[q].second);
 
-              vec(lines[distribute[row]].line) = 0.;
+              vec(lines[distribute[row]].index) = 0.;
             }
         }
     }
@@ -612,7 +612,7 @@ ConstraintMatrix::set_zero (VectorType &vec) const
   // above. therefore, copy the content which is cheap
   std::vector<size_type> constrained_lines(lines.size());
   for (unsigned int i=0; i<lines.size(); ++i)
-    constrained_lines[i] = lines[i].line;
+    constrained_lines[i] = lines[i].index;
   internal::ConstraintMatrix::set_zero_all(constrained_lines, vec);
 }
 
@@ -875,7 +875,7 @@ ConstraintMatrix::distribute (VectorType &vec) const
       typedef std::vector<ConstraintLine>::const_iterator constraint_iterator;
       for (constraint_iterator it = lines.begin();
            it != lines.end(); ++it)
-        if (vec_owned_elements.is_element(it->line))
+        if (vec_owned_elements.is_element(it->index))
           for (unsigned int i=0; i<it->entries.size(); ++i)
             if (!vec_owned_elements.is_element(it->entries[i].first))
               needed_elements.add_index(it->entries[i].first);
@@ -888,7 +888,7 @@ ConstraintMatrix::distribute (VectorType &vec) const
 
       for (constraint_iterator it = lines.begin();
            it != lines.end(); ++it)
-        if (vec_owned_elements.is_element(it->line))
+        if (vec_owned_elements.is_element(it->index))
           {
             typename VectorType::value_type
             new_value = it->inhomogeneity;
@@ -898,7 +898,7 @@ ConstraintMatrix::distribute (VectorType &vec) const
                                ghosted_vector, it->entries[i].first)) *
                             it->entries[i].second);
             AssertIsFinite(new_value);
-            internal::ElementAccess<VectorType>::set(new_value, it->line, vec);
+            internal::ElementAccess<VectorType>::set(new_value, it->index, vec);
           }
 
       // now compress to communicate the entries that we added to
@@ -917,7 +917,7 @@ ConstraintMatrix::distribute (VectorType &vec) const
       for (; next_constraint != lines.end(); ++next_constraint)
         {
           // fill entry in line
-          // next_constraint.line by adding the
+          // next_constraint.index by adding the
           // different contributions
           typename VectorType::value_type
           new_value = next_constraint->inhomogeneity;
@@ -927,7 +927,7 @@ ConstraintMatrix::distribute (VectorType &vec) const
                              vec, next_constraint->entries[i].first))*
                           next_constraint->entries[i].second);
           AssertIsFinite(new_value);
-          internal::ElementAccess<VectorType>::set(new_value, next_constraint->line,
+          internal::ElementAccess<VectorType>::set(new_value, next_constraint->index,
                                                    vec);
         }
     }
index 31694628e50d22f4171d04a9cbbb8e4588bfdd11..f9aa08942c468db113cbc4f1d00c25b66d30ce30 100644 (file)
@@ -74,7 +74,7 @@ ConstraintMatrix::check_zero_weight (const std::pair<size_type, double> &p)
 bool
 ConstraintMatrix::ConstraintLine::operator < (const ConstraintLine &a) const
 {
-  return line < a.line;
+  return index < a.index;
 }
 
 
@@ -82,7 +82,7 @@ ConstraintMatrix::ConstraintLine::operator < (const ConstraintLine &a) const
 bool
 ConstraintMatrix::ConstraintLine::operator == (const ConstraintLine &a) const
 {
-  return line == a.line;
+  return index == a.index;
 }
 
 
@@ -90,7 +90,7 @@ ConstraintMatrix::ConstraintLine::operator == (const ConstraintLine &a) const
 std::size_t
 ConstraintMatrix::ConstraintLine::memory_consumption () const
 {
-  return (MemoryConsumption::memory_consumption (line) +
+  return (MemoryConsumption::memory_consumption (index) +
           MemoryConsumption::memory_consumption (entries) +
           MemoryConsumption::memory_consumption (inhomogeneity));
 }
@@ -135,7 +135,7 @@ ConstraintMatrix::add_entries
   Assert (is_constrained(line), ExcLineInexistant(line));
 
   ConstraintLine *line_ptr = &lines[lines_cache[calculate_line_index(line)]];
-  Assert (line_ptr->line == line, ExcInternalError());
+  Assert (line_ptr->index == line, ExcInternalError());
 
   // if in debug mode, check whether an entry for this column already
   // exists and if its the same as the one entered at present
@@ -174,13 +174,13 @@ void ConstraintMatrix::add_selected_constraints
   if (constraints.n_constraints() == 0)
     return;
 
-  Assert (filter.size() > constraints.lines.back().line,
+  Assert (filter.size() > constraints.lines.back().index,
           ExcMessage ("Filter needs to be larger than constraint matrix size."));
   for (std::vector<ConstraintLine>::const_iterator line=constraints.lines.begin();
        line!=constraints.lines.end(); ++line)
-    if (filter.is_element(line->line))
+    if (filter.is_element(line->index))
       {
-        const size_type row = filter.index_within_set (line->line);
+        const size_type row = filter.index_within_set (line->index);
         add_line (row);
         set_inhomogeneity (row, line->inhomogeneity);
         for (size_type i=0; i<line->entries.size(); ++i)
@@ -208,14 +208,14 @@ void ConstraintMatrix::close ()
     size_type counter = 0;
     for (std::vector<ConstraintLine>::const_iterator line=lines.begin();
          line!=lines.end(); ++line, ++counter)
-      new_lines[calculate_line_index(line->line)] = counter;
+      new_lines[calculate_line_index(line->index)] = counter;
     std::swap (lines_cache, new_lines);
   }
 
   // in debug mode: check whether we really set the pointers correctly.
   for (size_type i=0; i<lines_cache.size(); ++i)
     if (lines_cache[i] != numbers::invalid_size_type)
-      Assert (i == calculate_line_index(lines[lines_cache[i]].line),
+      Assert (i == calculate_line_index(lines[lines_cache[i]].index),
               ExcInternalError());
 
   // first, strip zero entries, as we have to do that only once
@@ -295,12 +295,12 @@ void ConstraintMatrix::close ()
                 const size_type  dof_index = line->entries[entry].first;
                 const double     weight = line->entries[entry].second;
 
-                Assert (dof_index != line->line,
+                Assert (dof_index != line->index,
                         ExcMessage ("Cycle in constraints detected!"));
 
                 const ConstraintLine *constrained_line =
                   &lines[lines_cache[calculate_line_index(dof_index)]];
-                Assert (constrained_line->line == dof_index,
+                Assert (constrained_line->index == dof_index,
                         ExcInternalError());
 
                 // now we have to replace an entry by its expansion. we do
@@ -471,7 +471,7 @@ void ConstraintMatrix::close ()
           // make sure that entry->first is not the index of a line itself
           const bool is_circle = is_constrained(entry->first);
           Assert (is_circle == false,
-                  ExcDoFConstrainedToConstrainedDoF(line->line, entry->first));
+                  ExcDoFConstrainedToConstrainedDoF(line->index, entry->first));
         }
 #endif
 
@@ -559,7 +559,7 @@ ConstraintMatrix::merge (const ConstraintMatrix &other_constraints,
     for (std::vector<ConstraintLine>::const_iterator line = lines.begin();
          line != lines.end(); ++line)
       {
-        size_type local_line_no = calculate_line_index(line->line);
+        size_type local_line_no = calculate_line_index(line->index);
         if (local_line_no >= lines_cache.size())
           lines_cache.resize(local_line_no+1, numbers::invalid_size_type);
         lines_cache[local_line_no] = index++;
@@ -569,7 +569,7 @@ ConstraintMatrix::merge (const ConstraintMatrix &other_constraints,
     for (std::vector<ConstraintLine>::const_iterator line = other_constraints.lines.begin();
          line != other_constraints.lines.end(); ++line)
       {
-        const size_type local_line_no = calculate_line_index(line->line);
+        const size_type local_line_no = calculate_line_index(line->index);
         if (local_line_no >= lines_cache.size())
           {
             lines_cache.resize(local_line_no+1, numbers::invalid_size_type);
@@ -590,7 +590,7 @@ ConstraintMatrix::merge (const ConstraintMatrix &other_constraints,
               {
               case no_conflicts_allowed:
                 AssertThrow (false,
-                             ExcDoFIsConstrainedFromBothObjects (line->line));
+                             ExcDoFIsConstrainedFromBothObjects (line->index));
                 break;
 
               case left_object_wins:
@@ -611,7 +611,7 @@ ConstraintMatrix::merge (const ConstraintMatrix &other_constraints,
     // check that we set the pointers correctly
     for (size_type i=0; i<lines_cache.size(); ++i)
       if (lines_cache[i] != numbers::invalid_size_type)
-        Assert (i == calculate_line_index(lines[lines_cache[i]].line),
+        Assert (i == calculate_line_index(lines[lines_cache[i]].index),
                 ExcInternalError());
   }
 
@@ -639,7 +639,7 @@ void ConstraintMatrix::shift (const size_type offset)
   for (std::vector<ConstraintLine>::iterator i = lines.begin();
        i != lines.end(); ++i)
     {
-      i->line += offset;
+      i->index += offset;
       for (ConstraintLine::Entries::iterator
            j = i->entries.begin();
            j != i->entries.end(); ++j)
@@ -651,7 +651,7 @@ void ConstraintMatrix::shift (const size_type offset)
   // are still linked correctly
   for (size_type i=0; i<lines_cache.size(); ++i)
     Assert(lines_cache[i] == numbers::invalid_size_type ||
-           calculate_line_index(lines[lines_cache[i]].line) == i,
+           calculate_line_index(lines[lines_cache[i]].index) == i,
            ExcInternalError());
 #endif
 }
@@ -703,7 +703,7 @@ void ConstraintMatrix::condense (SparsityPattern &sparsity) const
                                     numbers::invalid_size_type);
 
   for (size_type c=0; c<lines.size(); ++c)
-    distribute[lines[c].line] = c;
+    distribute[lines[c].index] = c;
 
   const size_type n_rows = sparsity.n_rows();
   for (size_type row=0; row<n_rows; ++row)
@@ -787,7 +787,7 @@ void ConstraintMatrix::condense (DynamicSparsityPattern &sparsity) const
                                     numbers::invalid_size_type);
 
   for (size_type c=0; c<lines.size(); ++c)
-    distribute[lines[c].line] = c;
+    distribute[lines[c].index] = c;
 
   const size_type n_rows = sparsity.n_rows();
   for (size_type row=0; row<n_rows; ++row)
@@ -887,7 +887,7 @@ void ConstraintMatrix::condense (BlockSparsityPattern &sparsity) const
                                      numbers::invalid_size_type);
 
   for (size_type c=0; c<lines.size(); ++c)
-    distribute[lines[c].line] = c;
+    distribute[lines[c].index] = c;
 
   const size_type n_rows = sparsity.n_rows();
   for (size_type row=0; row<n_rows; ++row)
@@ -998,7 +998,7 @@ void ConstraintMatrix::condense (BlockDynamicSparsityPattern &sparsity) const
                                      numbers::invalid_size_type);
 
   for (size_type c=0; c<lines.size(); ++c)
-    distribute[lines[c].line] = static_cast<signed int>(c);
+    distribute[lines[c].index] = static_cast<signed int>(c);
 
   const size_type n_rows = sparsity.n_rows();
   for (size_type row=0; row<n_rows; ++row)
@@ -1094,7 +1094,7 @@ bool ConstraintMatrix::is_identity_constrained (const size_type index) const
     return false;
 
   const ConstraintLine &p = lines[lines_cache[calculate_line_index(index)]];
-  Assert (p.line == index, ExcInternalError());
+  Assert (p.index == index, ExcInternalError());
 
   // return if an entry for this line was found and if it has only one
   // entry equal to 1.0
@@ -1109,7 +1109,7 @@ bool ConstraintMatrix::are_identity_constrained (const size_type index1,
   if (is_constrained(index1) == true)
     {
       const ConstraintLine &p = lines[lines_cache[calculate_line_index(index1)]];
-      Assert (p.line == index1, ExcInternalError());
+      Assert (p.index == index1, ExcInternalError());
 
       // return if an entry for this line was found and if it has only one
       // entry equal to 1.0 and that one is index2
@@ -1120,7 +1120,7 @@ bool ConstraintMatrix::are_identity_constrained (const size_type index1,
   else if (is_constrained(index2) == true)
     {
       const ConstraintLine &p = lines[lines_cache[calculate_line_index(index2)]];
-      Assert (p.line == index2, ExcInternalError());
+      Assert (p.index == index2, ExcInternalError());
 
       // return if an entry for this line was found and if it has only one
       // entry equal to 1.0 and that one is index1
@@ -1169,13 +1169,13 @@ void ConstraintMatrix::print (std::ostream &out) const
       if (lines[i].entries.size() > 0)
         {
           for (size_type j=0; j<lines[i].entries.size(); ++j)
-            out << "    " << lines[i].line
+            out << "    " << lines[i].index
                 << " " << lines[i].entries[j].first
                 << ":  " << lines[i].entries[j].second << "\n";
 
           // print out inhomogeneity.
           if (lines[i].inhomogeneity != 0)
-            out << "    " << lines[i].line
+            out << "    " << lines[i].index
                 << ": " << lines[i].inhomogeneity << "\n";
         }
       else
@@ -1184,11 +1184,11 @@ void ConstraintMatrix::print (std::ostream &out) const
         // combination of other dofs
         {
           if (lines[i].inhomogeneity != 0)
-            out << "    " << lines[i].line
+            out << "    " << lines[i].index
                 << " = " << lines[i].inhomogeneity
                 << "\n";
           else
-            out << "    " << lines[i].line << " = 0\n";
+            out << "    " << lines[i].index << " = 0\n";
         }
     }
 
@@ -1207,12 +1207,12 @@ ConstraintMatrix::write_dot (std::ostream &out) const
       // same concept as in the previous function
       if (lines[i].entries.size() > 0)
         for (size_type j=0; j<lines[i].entries.size(); ++j)
-          out << "  " << lines[i].line << "->" << lines[i].entries[j].first
+          out << "  " << lines[i].index << "->" << lines[i].entries[j].first
               << "; // weight: "
               << lines[i].entries[j].second
               << "\n";
       else
-        out << "  " << lines[i].line << "\n";
+        out << "  " << lines[i].index << "\n";
     }
   out << "}" << std::endl;
 }

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.