]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
First stab at ConstraintMatrix.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 10 Aug 2012 10:31:47 +0000 (10:31 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 10 Aug 2012 10:31:47 +0000 (10:31 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_bigger_global_dof_indices_3@25874 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/lac/constraint_matrix.h
deal.II/include/deal.II/lac/constraint_matrix.templates.h

index eb39e8c5927ac9c3c402a47515856cf8ca87fc57..3ad0737d1c3e1423e6df7400c278b25e9ec5b5a6 100644 (file)
@@ -54,8 +54,8 @@ namespace internals
 
 
 //TODO[WB]: We should have a function of the kind
-//   ConstraintMatrix::add_constraint (const unsigned int constrained_dof,
-//                const std::vector<std::pair<unsigned int, double> > &entries,
+//   ConstraintMatrix::add_constraint (const types::global_dof_index constrained_dof,
+//                const std::vector<std::pair<types::global_dof_index, double> > &entries,
 //                const double inhomogeneity = 0);
 // rather than building up constraints piecemeal through add_line/add_entry
 // etc. This would also eliminate the possibility of accidentally changing
@@ -205,7 +205,7 @@ class ConstraintMatrix : public Subscriptor
                                       * line. Always returns true if not in
                                       * the distributed case.
                                       */
-    bool can_store_line (const unsigned int line_index) const;
+    bool can_store_line (const types::global_dof_index line_index) const;
 
                                      /**
                                       * This function copies the content of @p
@@ -255,7 +255,7 @@ class ConstraintMatrix : public Subscriptor
                                       * line already exists, then the function
                                       * simply returns without doing anything.
                                       */
-    void add_line (const unsigned int line);
+    void add_line (const types::global_dof_index line);
 
                                      /**
                                       * Call the first add_line() function for
@@ -299,7 +299,7 @@ class ConstraintMatrix : public Subscriptor
                                       * inhomogeneities using
                                       * set_inhomogeneity().
                                       */
-    void add_lines (const std::set<unsigned int> &lines);
+    void add_lines (const std::set<types::global_dof_index> &lines);
 
                                      /**
                                       * Call the first add_line() function for
@@ -344,8 +344,8 @@ class ConstraintMatrix : public Subscriptor
                                       * same. Thus, it does no harm to
                                       * enter a constraint twice.
                                       */
-    void add_entry (const unsigned int line,
-                    const unsigned int column,
+    void add_entry (const types::global_dof_index line,
+                    const types::global_dof_index column,
                     const double value);
 
                                      /**
@@ -357,8 +357,8 @@ class ConstraintMatrix : public Subscriptor
                                       * function several times, but is
                                       * faster.
                                       */
-    void add_entries (const unsigned int                                  line,
-                      const std::vector<std::pair<unsigned int,double> > &col_val_pairs);
+    void add_entries (const types::global_dof_index                                  line,
+                      const std::vector<std::pair<types::global_dof_index,double> > &col_val_pairs);
 
                                      /**
                                       * Set an imhomogeneity to the
@@ -368,7 +368,7 @@ class ConstraintMatrix : public Subscriptor
                                       * Note: the line needs to be added with
                                       * one of the add_line() calls first.
                                       */
-    void set_inhomogeneity (const unsigned int line,
+    void set_inhomogeneity (const types::global_dof_index line,
                             const double       value);
 
                                      /**
@@ -454,7 +454,7 @@ class ConstraintMatrix : public Subscriptor
                                       * finally @p merge them together
                                       * again.
                                       */
-    void shift (const unsigned int offset);
+    void shift (const types::global_dof_index offset);
 
                                      /**
                                       * Clear all entries of this
@@ -498,7 +498,7 @@ class ConstraintMatrix : public Subscriptor
                                       * called, we have to perform a linear
                                       * search through all entries.
                                       */
-    bool is_constrained (const unsigned int index) const;
+    bool is_constrained (const types::global_dof_index index) const;
 
                                      /**
                                       * Return whether the dof is
@@ -519,7 +519,7 @@ class ConstraintMatrix : public Subscriptor
                                       * freedom but with a weight different
                                       * from one.
                                       */
-    bool is_identity_constrained (const unsigned int index) const;
+    bool is_identity_constrained (const types::global_dof_index index) const;
 
                                      /**
                                       * Return the maximum number of other
@@ -546,7 +546,7 @@ class ConstraintMatrix : public Subscriptor
                                       * non-trivial inhomogeneous valeus set
                                       * to the dof.
                                       */
-    bool is_inhomogeneously_constrained (const unsigned int index) const;
+    bool is_inhomogeneously_constrained (const types::global_dof_index index) const;
 
                                      /**
                                       * Returns <tt>false</tt> if all
@@ -563,8 +563,8 @@ class ConstraintMatrix : public Subscriptor
                                       * zero pointer in case the dof is not
                                       * constrained.
                                       */
-    const std::vector<std::pair<unsigned int,double> >*
-    get_constraint_entries (const unsigned int line) const;
+    const std::vector<std::pair<types::global_dof_index,double> >*
+    get_constraint_entries (const types::global_dof_index line) const;
 
                                      /**
                                       * Returns the value of the inhomogeneity
@@ -572,7 +572,7 @@ class ConstraintMatrix : public Subscriptor
                                       * line. Unconstrained dofs also return a
                                       * zero value.
                                       */
-    double get_inhomogeneity (const unsigned int line) const;
+    double get_inhomogeneity (const types::global_dof_index line) const;
 
                                      /**
                                       * Print the constraint lines. Mainly
@@ -957,7 +957,7 @@ class ConstraintMatrix : public Subscriptor
     template <class InVector, class OutVector>
     void
     distribute_local_to_global (const InVector                  &local_vector,
-                                const std::vector<unsigned int> &local_dof_indices,
+                                const std::vector<types::global_dof_index> &local_dof_indices,
                                 OutVector                       &global_vector) const;
 
                                      /**
@@ -1034,7 +1034,7 @@ class ConstraintMatrix : public Subscriptor
     template <typename VectorType>
     void
     distribute_local_to_global (const Vector<double>            &local_vector,
-                                const std::vector<unsigned int> &local_dof_indices,
+                                const std::vector<types::global_dof_index> &local_dof_indices,
                                 VectorType                      &global_vector,
                                 const FullMatrix<double>        &local_matrix) const;
 
@@ -1158,7 +1158,7 @@ class ConstraintMatrix : public Subscriptor
     template <typename MatrixType>
     void
     distribute_local_to_global (const FullMatrix<double>        &local_matrix,
-                                const std::vector<unsigned int> &local_dof_indices,
+                                const std::vector<types::global_dof_index> &local_dof_indices,
                                 MatrixType                      &global_matrix) const;
 
                                      /**
@@ -1169,8 +1169,8 @@ class ConstraintMatrix : public Subscriptor
     template <typename MatrixType>
     void
     distribute_local_to_global (const FullMatrix<double>        &local_matrix,
-                                const std::vector<unsigned int> &row_indices,
-                                const std::vector<unsigned int> &col_indices,
+                                const std::vector<types::global_dof_index> &row_indices,
+                                const std::vector<types::global_dof_index> &col_indices,
                                 MatrixType                      &global_matrix) const;
 
                                      /**
@@ -1195,7 +1195,7 @@ class ConstraintMatrix : public Subscriptor
     void
     distribute_local_to_global (const FullMatrix<double>        &local_matrix,
                                 const Vector<double>            &local_vector,
-                                const std::vector<unsigned int> &local_dof_indices,
+                                const std::vector<types::global_dof_index> &local_dof_indices,
                                 MatrixType                      &global_matrix,
                                 VectorType                      &global_vector,
                                 bool                            use_inhomogeneities_for_rhs = false) const;
@@ -1281,7 +1281,7 @@ class ConstraintMatrix : public Subscriptor
                                       */
     template <typename SparsityType>
     void
-    add_entries_local_to_global (const std::vector<unsigned int> &local_dof_indices,
+    add_entries_local_to_global (const std::vector<types::global_dof_index> &local_dof_indices,
                                  SparsityType                    &sparsity_pattern,
                                  const bool                       keep_constrained_entries = true,
                                  const Table<2,bool>             &dof_mask = default_empty_table) const;
@@ -1294,8 +1294,8 @@ class ConstraintMatrix : public Subscriptor
 
     template <typename SparsityType>
     void
-    add_entries_local_to_global (const std::vector<unsigned int> &row_indices,
-                                 const std::vector<unsigned int> &col_indices,
+    add_entries_local_to_global (const std::vector<types::global_dof_index> &row_indices,
+                                 const std::vector<types::global_dof_index> &col_indices,
                                  SparsityType                    &sparsity_pattern,
                                  const bool                       keep_constrained_entries = true,
                                  const Table<2,bool>             &dof_mask = default_empty_table) const;
@@ -1413,7 +1413,7 @@ class ConstraintMatrix : public Subscriptor
                                       * @ingroup Exceptions
                                       */
     DeclException1 (ExcLineInexistant,
-                    unsigned int,
+                    types::global_dof_index,
                     << "The specified line " << arg1
                     << " does not exist.");
                                      /**
@@ -1482,7 +1482,7 @@ class ConstraintMatrix : public Subscriptor
                                           * of entries that make up the homogenous
                                           * part of a constraint.
                                           */
-        typedef std::vector<std::pair<unsigned int,double> > Entries;
+        typedef std::vector<std::pair<types::global_dof_index,double> > Entries;
 
                                          /**
                                           * Number of this line. Since only
@@ -1491,7 +1491,7 @@ class ConstraintMatrix : public Subscriptor
                                           * and have to store the line
                                           * number explicitly.
                                           */
-        unsigned int line;
+        types::global_dof_index line;
 
                                          /**
                                           * Row numbers and values of the
@@ -1619,7 +1619,7 @@ class ConstraintMatrix : public Subscriptor
                                       * contributions into vectors and
                                       * matrices.
                                       */
-    std::vector<unsigned int> lines_cache;
+    std::vector<types::global_dof_index> lines_cache;
 
                                      /**
                                       * This IndexSet is used to limit the
@@ -1642,7 +1642,7 @@ class ConstraintMatrix : public Subscriptor
                                       * index of line @p line in the vector
                                       * lines_cache using local_lines.
                                       */
-    unsigned int calculate_line_index (const unsigned int line) const;
+    unsigned int calculate_line_index (const types::global_dof_index line) const;
 
                                      /**
                                       * Return @p true if the weight of an
@@ -1651,7 +1651,7 @@ class ConstraintMatrix : public Subscriptor
                                       * used to delete entries with zero
                                       * weight.
                                       */
-    static bool check_zero_weight (const std::pair<unsigned int, double> &p);
+    static bool check_zero_weight (const std::pair<types::global_dof_index, double> &p);
 
                                      /**
                                       * Dummy table that serves as default
@@ -1669,7 +1669,7 @@ class ConstraintMatrix : public Subscriptor
     void
     distribute_local_to_global (const FullMatrix<double>        &local_matrix,
                                 const Vector<double>            &local_vector,
-                                const std::vector<unsigned int> &local_dof_indices,
+                                const std::vector<types::global_dof_index> &local_dof_indices,
                                 MatrixType                      &global_matrix,
                                 VectorType                      &global_vector,
                                 bool                            use_inhomogeneities_for_rhs,
@@ -1684,7 +1684,7 @@ class ConstraintMatrix : public Subscriptor
     void
     distribute_local_to_global (const FullMatrix<double>        &local_matrix,
                                 const Vector<double>            &local_vector,
-                                const std::vector<unsigned int> &local_dof_indices,
+                                const std::vector<types::global_dof_index> &local_dof_indices,
                                 MatrixType                      &global_matrix,
                                 VectorType                      &global_vector,
                                 bool                            use_inhomogeneities_for_rhs,
@@ -1697,7 +1697,7 @@ class ConstraintMatrix : public Subscriptor
                                       */
     template <typename SparsityType>
     void
-    add_entries_local_to_global (const std::vector<unsigned int> &local_dof_indices,
+    add_entries_local_to_global (const std::vector<types::global_dof_index> &local_dof_indices,
                                  SparsityType                    &sparsity_pattern,
                                  const bool                       keep_constrained_entries,
                                  const Table<2,bool>             &dof_mask,
@@ -1710,7 +1710,7 @@ class ConstraintMatrix : public Subscriptor
                                       */
     template <typename SparsityType>
     void
-    add_entries_local_to_global (const std::vector<unsigned int> &local_dof_indices,
+    add_entries_local_to_global (const std::vector<types::global_dof_index> &local_dof_indices,
                                  SparsityType                    &sparsity_pattern,
                                  const bool                       keep_constrained_entries,
                                  const Table<2,bool>             &dof_mask,
@@ -1727,7 +1727,7 @@ class ConstraintMatrix : public Subscriptor
                                       * row indices.
                                       */
     void
-    make_sorted_row_list (const std::vector<unsigned int> &local_dof_indices,
+    make_sorted_row_list (const std::vector<types::global_dof_index> &local_dof_indices,
                           internals::GlobalRowsFromLocal  &global_rows) const;
 
                                      /**
@@ -1741,18 +1741,18 @@ class ConstraintMatrix : public Subscriptor
                                       * function.
                                       */
     void
-    make_sorted_row_list (const std::vector<unsigned int> &local_dof_indices,
-                          std::vector<unsigned int>       &active_dofs) const;
+    make_sorted_row_list (const std::vector<types::global_dof_index> &local_dof_indices,
+                          std::vector<types::global_dof_index>       &active_dofs) const;
 
                                      /**
                                       * Internal helper function for
                                       * distribute_local_to_global function.
                                       */
     double
-    resolve_vector_entry (const unsigned int                    i,
+    resolve_vector_entry (const types::global_dof_index                    i,
                           const internals::GlobalRowsFromLocal &global_rows,
                           const Vector<double>                 &local_vector,
-                          const std::vector<unsigned int>      &local_dof_indices,
+                          const std::vector<types::global_dof_index>      &local_dof_indices,
                           const FullMatrix<double>             &local_matrix) const;
 };
 
@@ -1783,7 +1783,7 @@ ConstraintMatrix::ConstraintMatrix (const ConstraintMatrix &constraint_matrix)
 
 inline
 void
-ConstraintMatrix::add_line (const unsigned int line)
+ConstraintMatrix::add_line (const types::global_dof_index line)
 {
   Assert (sorted==false, ExcMatrixIsClosed());
 
@@ -1825,8 +1825,8 @@ ConstraintMatrix::add_line (const unsigned int line)
 
 inline
 void
-ConstraintMatrix::add_entry (const unsigned int line,
-                             const unsigned int column,
+ConstraintMatrix::add_entry (const types::global_dof_index line,
+                             const types::global_dof_index column,
                              const double       value)
 {
   Assert (sorted==false, ExcMatrixIsClosed());
@@ -1862,7 +1862,7 @@ ConstraintMatrix::add_entry (const unsigned int line,
 
 inline
 void
-ConstraintMatrix::set_inhomogeneity (const unsigned int line,
+ConstraintMatrix::set_inhomogeneity (const types::global_dof_index line,
                                      const double       value)
 {
   const unsigned int line_index = calculate_line_index(line);
@@ -1878,7 +1878,7 @@ ConstraintMatrix::set_inhomogeneity (const unsigned int line,
 
 inline
 bool
-ConstraintMatrix::is_constrained (const unsigned int index) const
+ConstraintMatrix::is_constrained (const types::global_dof_index index) const
 {
   const unsigned int line_index = calculate_line_index(index);
   return ((line_index < lines_cache.size())
@@ -1890,7 +1890,7 @@ ConstraintMatrix::is_constrained (const unsigned int index) const
 
 inline
 bool
-ConstraintMatrix::is_inhomogeneously_constrained (const unsigned int index) const
+ConstraintMatrix::is_inhomogeneously_constrained (const types::global_dof_index index) const
 {
                                 // check whether the entry is
                                 // constrained. could use is_constrained, but
@@ -1909,8 +1909,8 @@ ConstraintMatrix::is_inhomogeneously_constrained (const unsigned int index) cons
 
 
 inline
-const std::vector<std::pair<unsigned int,double> >*
-ConstraintMatrix::get_constraint_entries (unsigned int line) const
+const std::vector<std::pair<types::global_dof_index,double> >*
+ConstraintMatrix::get_constraint_entries (const types::global_dof_index line) const
 {
                                 // check whether the entry is
                                 // constrained. could use is_constrained, but
@@ -1927,7 +1927,7 @@ ConstraintMatrix::get_constraint_entries (unsigned int line) const
 
 inline
 double
-ConstraintMatrix::get_inhomogeneity (const unsigned int line) const
+ConstraintMatrix::get_inhomogeneity (const types::global_dof_index line) const
 {
                                 // check whether the entry is
                                 // constrained. could use is_constrained, but
@@ -1943,7 +1943,7 @@ ConstraintMatrix::get_inhomogeneity (const unsigned int line) const
 
 
 inline unsigned int
-ConstraintMatrix::calculate_line_index (const unsigned int line) const
+ConstraintMatrix::calculate_line_index (const types::global_dof_index line) const
 {
                                    //IndexSet is unused (serial case)
   if (!local_lines.size())
@@ -1958,7 +1958,7 @@ ConstraintMatrix::calculate_line_index (const unsigned int line) const
 
 
 inline bool
-ConstraintMatrix::can_store_line (unsigned int line_index) const
+ConstraintMatrix::can_store_line (types::global_dof_index line_index) const
 {
   return !local_lines.size() || local_lines.is_element(line_index);
 }
@@ -1970,7 +1970,7 @@ inline
 void
 ConstraintMatrix::
 distribute_local_to_global (const InVector                  &local_vector,
-                            const std::vector<unsigned int> &local_dof_indices,
+                            const std::vector<types::global_dof_index> &local_dof_indices,
                             OutVector                       &global_vector) const
 {
   Assert (local_vector.size() == local_dof_indices.size(),
@@ -2043,7 +2043,7 @@ inline
 void
 ConstraintMatrix::
 distribute_local_to_global (const FullMatrix<double>        &local_matrix,
-                            const std::vector<unsigned int> &local_dof_indices,
+                            const std::vector<types::global_dof_index> &local_dof_indices,
                             MatrixType                      &global_matrix) const
 {
                                    // create a dummy and hand on to the
@@ -2063,7 +2063,7 @@ void
 ConstraintMatrix::
 distribute_local_to_global (const FullMatrix<double>        &local_matrix,
                             const Vector<double>            &local_vector,
-                            const std::vector<unsigned int> &local_dof_indices,
+                            const std::vector<types::global_dof_index> &local_dof_indices,
                             MatrixType                      &global_matrix,
                             VectorType                      &global_vector,
                             bool                            use_inhomogeneities_for_rhs) const
@@ -2083,7 +2083,7 @@ template <typename SparsityType>
 inline
 void
 ConstraintMatrix::
-add_entries_local_to_global (const std::vector<unsigned int> &local_dof_indices,
+add_entries_local_to_global (const std::vector<types::global_dof_index> &local_dof_indices,
                              SparsityType                    &sparsity_pattern,
                              const bool                       keep_constrained_entries,
                              const Table<2,bool>             &dof_mask) const
index ea3f98ab400a69d4ff8d9fe6d26f0c6ebee70319..c5696c74ddfba82184802e9d24acec53ca003731 100644 (file)
@@ -379,7 +379,7 @@ ConstraintMatrix::condense (SparseMatrix<number> &uncondensed,
                  entry = uncondensed.begin(row);
                entry != uncondensed.end(row); ++entry)
             {
-              const unsigned int column = entry->column();
+              const types::global_dof_index column = entry->column();
 
                                                // end of row reached?
                                                // this should not
@@ -425,7 +425,7 @@ ConstraintMatrix::condense (SparseMatrix<number> &uncondensed,
                  entry = uncondensed.begin(row);
                entry != uncondensed.end(row); ++entry)
             {
-              const unsigned int column = entry->column();
+              const types::global_dof_index column = entry->column();
 
                                                // end of row reached?
                                                // this should not

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.