]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add Specializations for BlockVector<number> and vectors in TrilinosWrappers::
authorMatthias Maier <tamiko@43-1.org>
Wed, 8 Apr 2015 10:35:48 +0000 (12:35 +0200)
committerMatthias Maier <tamiko@43-1.org>
Sun, 19 Apr 2015 20:55:06 +0000 (22:55 +0200)
include/deal.II/lac/block_vector.h
include/deal.II/lac/trilinos_block_vector.h
include/deal.II/lac/trilinos_vector.h

index a39d0c89f4538c5d44acc181bf373b60de3d8e4a..d8cad92014c1f406505a7bd6b700cbd168c7c8a9 100644 (file)
@@ -36,6 +36,9 @@ namespace TrilinosWrappers
 }
 #endif
 
+// forward declaration
+template <typename> class ReinitRangeFactory;
+template <typename> class ReinitDomainFactory;
 
 
 /*! @addtogroup Vectors
@@ -460,6 +463,46 @@ void swap (BlockVector<Number> &u,
   u.swap (v);
 }
 
+
+/**
+ * Specialization for BlockVector<number>.
+ */
+template<typename number>
+class ReinitRangeFactory<BlockVector<number> >
+{
+public:
+
+  template <typename Matrix>
+  std::function<void(BlockVector<number> &, bool)>
+  operator()(const Matrix &matrix)
+  {
+    return [&matrix](BlockVector<number> &v, bool fast)
+    {
+      v.reinit(matrix.get_row_indices(), fast);
+    };
+  }
+};
+
+
+/**
+ * Specialization for BlockVector<number>.
+ */
+template<typename number>
+class ReinitDomainFactory<BlockVector<number> >
+{
+public:
+
+  template <typename Matrix>
+  std::function<void(BlockVector<number> &, bool)>
+  operator()(const Matrix &matrix)
+  {
+    return [&matrix](BlockVector<number> &v, bool fast)
+    {
+      v.reinit(matrix.get_column_indices(), fast);
+    };
+  }
+};
+
 DEAL_II_NAMESPACE_CLOSE
 
 #endif
index 422c54817ebafa8892f4973f1910335259b12b17..4b3e2d610bf87f32f0072dbd65b78a5b22d77101 100644 (file)
@@ -447,7 +447,87 @@ namespace TrilinosWrappers
     u.swap (v);
   }
 
-}
+} /* namespace TrilinosWrappers */
+
+
+/**
+ * Specialization for TrilinosWrappers::MPI::BlockVector.
+ */
+template<>
+class ReinitRangeFactory<TrilinosWrappers::MPI::BlockVector>
+{
+public:
+
+  template <typename Matrix>
+  std::function<void(TrilinosWrappers::MPI::BlockVector &, bool)>
+  operator()(const Matrix &matrix)
+  {
+    return [&matrix](TrilinosWrappers::MPI::BlockVector &v, bool fast)
+    {
+      v.reinit(matrix.range_partitioner(), fast);
+    };
+  }
+};
+
+
+/**
+ * Specialization for TrilinosWrappers::MPI::BlockVector.
+ */
+template<>
+class ReinitDomainFactory<TrilinosWrappers::MPI::BlockVector>
+{
+public:
+
+  template <typename Matrix>
+  std::function<void(TrilinosWrappers::MPI::BlockVector &, bool)>
+  operator()(const Matrix &matrix)
+  {
+    return [&matrix](TrilinosWrappers::MPI::BlockVector &v, bool fast)
+    {
+      v.reinit(matrix.domain_partitioner(), fast);
+    };
+  }
+};
+
+
+/**
+ * Specialization for TrilinosWrappers::BlockVector.
+ */
+template<>
+class ReinitRangeFactory<TrilinosWrappers::BlockVector>
+{
+public:
+
+  template <typename Matrix>
+  std::function<void(TrilinosWrappers::BlockVector &, bool)>
+  operator()(const Matrix &matrix)
+  {
+    return [&matrix](TrilinosWrappers::BlockVector &v, bool fast)
+    {
+      v.reinit(matrix.range_partitioner(), fast);
+    };
+  }
+};
+
+
+/**
+ * Specialization for TrilinosWrappers::BlockVector.
+ */
+template<>
+class ReinitDomainFactory<TrilinosWrappers::BlockVector>
+{
+public:
+
+  template <typename Matrix>
+  std::function<void(TrilinosWrappers::BlockVector &, bool)>
+  operator()(const Matrix &matrix)
+  {
+    return [&matrix](TrilinosWrappers::BlockVector &v, bool fast)
+    {
+      v.reinit(matrix.domain_partitioner(), fast);
+    };
+  }
+};
 
 /*@}*/
 
index a9ad0a6b1a7916ed8a88c64e4891eb570f723c3f..f4d252ed4172f6fc08a85b7ab7704ee052937782 100644 (file)
@@ -40,6 +40,9 @@ DEAL_II_NAMESPACE_OPEN
 // forward declaration
 template <typename> class Vector;
 
+template <typename> class ReinitRangeFactory;
+template <typename> class ReinitDomainFactory;
+
 /**
  * @addtogroup TrilinosWrappers
  * @{
@@ -936,7 +939,87 @@ namespace TrilinosWrappers
 #endif
 
 
-}
+} /* namespace TrilinosWrappers */
+
+
+/**
+ * Specialization for TrilinosWrappers::MPI::Vector.
+ */
+template<>
+class ReinitRangeFactory<TrilinosWrappers::MPI::Vector>
+{
+public:
+
+  template <typename Matrix>
+  std::function<void(TrilinosWrappers::MPI::Vector &, bool)>
+  operator()(const Matrix &matrix)
+  {
+    return [&matrix](TrilinosWrappers::MPI::Vector &v, bool fast)
+    {
+      v.reinit(matrix.range_partitioner(), fast);
+    };
+  }
+};
+
+
+/**
+ * Specialization for TrilinosWrappers::MPI::Vector.
+ */
+template<>
+class ReinitDomainFactory<TrilinosWrappers::MPI::Vector>
+{
+public:
+
+  template <typename Matrix>
+  std::function<void(TrilinosWrappers::MPI::Vector &, bool)>
+  operator()(const Matrix &matrix)
+  {
+    return [&matrix](TrilinosWrappers::MPI::Vector &v, bool fast)
+    {
+      v.reinit(matrix.domain_partitioner(), fast);
+    };
+  }
+};
+
+
+/**
+ * Specialization for TrilinosWrappers::MPI::Vector.
+ */
+template<>
+class ReinitRangeFactory<TrilinosWrappers::Vector>
+{
+public:
+
+  template <typename Matrix>
+  std::function<void(TrilinosWrappers::Vector &, bool)>
+  operator()(const Matrix &matrix)
+  {
+    return [&matrix](TrilinosWrappers::Vector &v, bool fast)
+    {
+      v.reinit(matrix.range_partitioner(), fast);
+    };
+  }
+};
+
+
+/**
+ * Specialization for TrilinosWrappers::MPI::Vector.
+ */
+template<>
+class ReinitDomainFactory<TrilinosWrappers::Vector>
+{
+public:
+
+  template <typename Matrix>
+  std::function<void(TrilinosWrappers::Vector &, bool)>
+  operator()(const Matrix &matrix)
+  {
+    return [&matrix](TrilinosWrappers::Vector &v, bool fast)
+    {
+      v.reinit(matrix.domain_partitioner(), fast);
+    };
+  }
+};
 
 
 /*@}*/

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.