]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Move some FullMatrix functions with Tensors into the header.
authorDavid Wells <drwells@email.unc.edu>
Tue, 21 Mar 2023 21:14:10 +0000 (17:14 -0400)
committerDavid Wells <drwells@email.unc.edu>
Tue, 21 Mar 2023 21:34:01 +0000 (17:34 -0400)
include/deal.II/lac/full_matrix.h
include/deal.II/lac/full_matrix.templates.h
source/lac/full_matrix.inst.in

index 462571b9bb9f7ee323fa326c521f1c1ebd075589..2d246856fb1a3ca0c6db0dd5198db408a83ecc67 100644 (file)
@@ -1191,6 +1191,66 @@ FullMatrix<number>::copy_from(const MatrixType &M)
 
 
 
+template <typename number>
+template <int dim>
+void
+FullMatrix<number>::copy_from(const Tensor<2, dim> &T,
+                              const unsigned int    src_r_i,
+                              const unsigned int    src_r_j,
+                              const unsigned int    src_c_i,
+                              const unsigned int    src_c_j,
+                              const size_type       dst_r,
+                              const size_type       dst_c)
+{
+  Assert(!this->empty(), ExcEmptyMatrix());
+  AssertIndexRange(src_r_j - src_r_i, this->m() - dst_r);
+  AssertIndexRange(src_c_j - src_c_i, this->n() - dst_c);
+  AssertIndexRange(src_r_j, dim);
+  AssertIndexRange(src_c_j, dim);
+  AssertIndexRange(src_r_i, src_r_j + 1);
+  AssertIndexRange(src_c_i, src_c_j + 1);
+
+  for (size_type i = 0; i < src_r_j - src_r_i + 1; ++i)
+    for (size_type j = 0; j < src_c_j - src_c_i + 1; ++j)
+      {
+        const unsigned int src_r_index = static_cast<unsigned int>(i + src_r_i);
+        const unsigned int src_c_index = static_cast<unsigned int>(j + src_c_i);
+        (*this)(i + dst_r, j + dst_c)  = number(T[src_r_index][src_c_index]);
+      }
+}
+
+
+
+template <typename number>
+template <int dim>
+void
+FullMatrix<number>::copy_to(Tensor<2, dim> &   T,
+                            const size_type    src_r_i,
+                            const size_type    src_r_j,
+                            const size_type    src_c_i,
+                            const size_type    src_c_j,
+                            const unsigned int dst_r,
+                            const unsigned int dst_c) const
+{
+  Assert(!this->empty(), ExcEmptyMatrix());
+  AssertIndexRange(src_r_j - src_r_i, dim - dst_r);
+  AssertIndexRange(src_c_j - src_c_i, dim - dst_c);
+  AssertIndexRange(src_r_j, this->m());
+  AssertIndexRange(src_r_j, this->n());
+  AssertIndexRange(src_r_i, src_r_j + 1);
+  AssertIndexRange(src_c_j, src_c_j + 1);
+
+  for (size_type i = 0; i < src_r_j - src_r_i + 1; ++i)
+    for (size_type j = 0; j < src_c_j - src_c_i + 1; ++j)
+      {
+        const unsigned int dst_r_index = static_cast<unsigned int>(i + dst_r);
+        const unsigned int dst_c_index = static_cast<unsigned int>(j + dst_c);
+        T[dst_r_index][dst_c_index] = double((*this)(i + src_r_i, j + src_c_i));
+      }
+}
+
+
+
 template <typename number>
 template <typename MatrixType>
 void
index e3b93fd147b9a18b69fcef01b6dc30ccc3149422..c60726c6fb846b66fe5075cf6481da646c600a08 100644 (file)
@@ -1666,64 +1666,6 @@ FullMatrix<number>::right_invert(const FullMatrix<number2> &A)
 }
 
 
-template <typename number>
-template <int dim>
-void
-FullMatrix<number>::copy_from(const Tensor<2, dim> &T,
-                              const unsigned int    src_r_i,
-                              const unsigned int    src_r_j,
-                              const unsigned int    src_c_i,
-                              const unsigned int    src_c_j,
-                              const size_type       dst_r,
-                              const size_type       dst_c)
-{
-  Assert(!this->empty(), ExcEmptyMatrix());
-  AssertIndexRange(src_r_j - src_r_i, this->m() - dst_r);
-  AssertIndexRange(src_c_j - src_c_i, this->n() - dst_c);
-  AssertIndexRange(src_r_j, dim);
-  AssertIndexRange(src_c_j, dim);
-  AssertIndexRange(src_r_i, src_r_j + 1);
-  AssertIndexRange(src_c_i, src_c_j + 1);
-
-  for (size_type i = 0; i < src_r_j - src_r_i + 1; ++i)
-    for (size_type j = 0; j < src_c_j - src_c_i + 1; ++j)
-      {
-        const unsigned int src_r_index = static_cast<unsigned int>(i + src_r_i);
-        const unsigned int src_c_index = static_cast<unsigned int>(j + src_c_i);
-        (*this)(i + dst_r, j + dst_c)  = number(T[src_r_index][src_c_index]);
-      }
-}
-
-
-template <typename number>
-template <int dim>
-void
-FullMatrix<number>::copy_to(Tensor<2, dim> &   T,
-                            const size_type    src_r_i,
-                            const size_type    src_r_j,
-                            const size_type    src_c_i,
-                            const size_type    src_c_j,
-                            const unsigned int dst_r,
-                            const unsigned int dst_c) const
-{
-  Assert(!this->empty(), ExcEmptyMatrix());
-  AssertIndexRange(src_r_j - src_r_i, dim - dst_r);
-  AssertIndexRange(src_c_j - src_c_i, dim - dst_c);
-  AssertIndexRange(src_r_j, this->m());
-  AssertIndexRange(src_r_j, this->n());
-  AssertIndexRange(src_r_i, src_r_j + 1);
-  AssertIndexRange(src_c_j, src_c_j + 1);
-
-  for (size_type i = 0; i < src_r_j - src_r_i + 1; ++i)
-    for (size_type j = 0; j < src_c_j - src_c_i + 1; ++j)
-      {
-        const unsigned int dst_r_index = static_cast<unsigned int>(i + dst_r);
-        const unsigned int dst_c_index = static_cast<unsigned int>(j + dst_c);
-        T[dst_r_index][dst_c_index] = double((*this)(i + src_r_i, j + src_c_i));
-      }
-}
-
-
 
 template <typename number>
 template <typename somenumber>
index a6c3ee23f9ec1120cd454aa101057b39288d692b..90b48df1350331c03a7e3fd2e32d5a3484ccf503 100644 (file)
@@ -25,61 +25,8 @@ for (S : REAL_AND_COMPLEX_SCALARS)
     template void FullMatrix<S>::print(std::ostream &,
                                        const unsigned int,
                                        const unsigned int) const;
-
-    template void FullMatrix<S>::copy_from<1>(const Tensor<2, 1> &,
-                                              const unsigned int,
-                                              const unsigned int,
-                                              unsigned int,
-                                              const unsigned int,
-                                              const size_type,
-                                              const size_type);
-
-    template void FullMatrix<S>::copy_from<2>(const Tensor<2, 2> &,
-                                              const unsigned int,
-                                              const unsigned int,
-                                              unsigned int,
-                                              const unsigned int,
-                                              const size_type,
-                                              const size_type);
-
-    template void FullMatrix<S>::copy_from<3>(const Tensor<2, 3> &,
-                                              const unsigned int,
-                                              const unsigned int,
-                                              unsigned int,
-                                              const unsigned int,
-                                              const size_type,
-                                              const size_type);
-  }
-
-
-for (S : REAL_SCALARS)
-  {
-    template void FullMatrix<S>::copy_to<1>(Tensor<2, 1> &,
-                                            const size_type,
-                                            const size_type,
-                                            const size_type,
-                                            const size_type,
-                                            const unsigned int,
-                                            const unsigned int) const;
-
-    template void FullMatrix<S>::copy_to<2>(Tensor<2, 2> &,
-                                            const size_type,
-                                            const size_type,
-                                            const size_type,
-                                            const size_type,
-                                            const unsigned int,
-                                            const unsigned int) const;
-
-    template void FullMatrix<S>::copy_to<3>(Tensor<2, 3> &,
-                                            const size_type,
-                                            const size_type,
-                                            const size_type,
-                                            const size_type,
-                                            const unsigned int,
-                                            const unsigned int) const;
   }
 
-
 for (S1, S2 : REAL_SCALARS)
   {
     template FullMatrix<S1> &FullMatrix<S1>::operator=(

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.