]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Help Intel's icc compiler when passing the address of a member template function...
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 8 May 2002 08:05:35 +0000 (08:05 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 8 May 2002 08:05:35 +0000 (08:05 +0000)
git-svn-id: https://svn.dealii.org/trunk@5833 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/sparse_matrix.templates.h
deal.II/lac/include/lac/sparse_vanka.templates.h
deal.II/lac/include/lac/sparsity_pattern.h

index 3ead4bbe901e767b1e5cb4f03563d45511a6c622..110702d024e4229c22a76f307abdf8a2a77654be 100644 (file)
@@ -295,11 +295,30 @@ SparseMatrix<number>::vmult (Vector<somenumber>& dst, const Vector<somenumber>&
     {
       const unsigned int n_threads = multithread_info.n_default_threads;
 
+                                      // then spawn threads. since
+                                      // some compilers have trouble
+                                      // finding out which
+                                      // 'encapsulate' function to
+                                      // take of all those possible
+                                      // ones if we simply drop in
+                                      // the address of an overloaded
+                                      // template member function,
+                                      // make it simpler for the
+                                      // compiler by giving it the
+                                      // correct type right away:
+      typedef
+       void (SparseMatrix<number>::*mem_fun_p)
+       (Vector<somenumber> &,
+        const Vector<somenumber> &,
+        const unsigned int        ,
+        const unsigned int) const;
+      const mem_fun_p comp
+       = &(SparseMatrix<number>::
+           template threaded_vmult<somenumber>);
       Threads::ThreadManager thread_manager;
       for (unsigned int i=0; i<n_threads; ++i)
        Threads::spawn (thread_manager,
-                       Threads::encapsulate (&SparseMatrix<number>::
-                                             template threaded_vmult<somenumber>)
+                       Threads::encapsulate (comp)
                        .collect_args (this, dst, src,
                                       n_rows * i / n_threads,
                                       n_rows * (i+1) / n_threads));
@@ -445,11 +464,29 @@ SparseMatrix<number>::matrix_norm_square (const Vector<somenumber>& v) const
                                       // the different parts
       std::vector<somenumber> partial_sums (n_threads, 0);
       Threads::ThreadManager thread_manager;
-                                      // spawn some jobs...
+                                      // then spawn threads. since
+                                      // some compilers have trouble
+                                      // finding out which
+                                      // 'encapsulate' function to
+                                      // take of all those possible
+                                      // ones if we simply drop in
+                                      // the address of an overloaded
+                                      // template member function,
+                                      // make it simpler for the
+                                      // compiler by giving it the
+                                      // correct type right away:
+      typedef
+       void (SparseMatrix<number>::*mem_fun_p)
+       (const Vector<somenumber> &,
+        const unsigned int        ,
+        const unsigned int        ,
+        somenumber               *) const;
+      const mem_fun_p comp
+       = &(SparseMatrix<number>::
+           template threaded_matrix_norm_square<somenumber>);
       for (unsigned int i=0; i<n_threads; ++i)
        Threads::spawn (thread_manager,
-                       Threads::encapsulate (&SparseMatrix<number>::
-                                             template threaded_matrix_norm_square<somenumber>)
+                       Threads::encapsulate (comp)
                        .collect_args (this, v,
                                       n_rows * i / n_threads,
                                       n_rows * (i+1) / n_threads,
@@ -538,11 +575,30 @@ SparseMatrix<number>::matrix_scalar_product (const Vector<somenumber>& u,
                                       // the different parts
       std::vector<somenumber> partial_sums (n_threads, 0);
       Threads::ThreadManager thread_manager;
-                                      // spawn some jobs...
+                                      // then spawn threads. since
+                                      // some compilers have trouble
+                                      // finding out which
+                                      // 'encapsulate' function to
+                                      // take of all those possible
+                                      // ones if we simply drop in
+                                      // the address of an overloaded
+                                      // template member function,
+                                      // make it simpler for the
+                                      // compiler by giving it the
+                                      // correct type right away:
+      typedef
+       void (SparseMatrix<number>::*mem_fun_p)
+       (const Vector<somenumber> &,
+        const Vector<somenumber> &,
+        const unsigned int        ,
+        const unsigned int        ,
+        somenumber               *) const;
+      const mem_fun_p comp
+       = &(SparseMatrix<number>::
+           template threaded_matrix_scalar_product<somenumber>);
       for (unsigned int i=0; i<n_threads; ++i)
        Threads::spawn (thread_manager,
-                       Threads::encapsulate (&SparseMatrix<number>::
-                                             template threaded_matrix_scalar_product<somenumber>)
+                       Threads::encapsulate (comp)
                        .collect_args (this, u, v,
                                       n_rows * i / n_threads,
                                       n_rows * (i+1) / n_threads,
@@ -674,11 +730,31 @@ SparseMatrix<number>::residual (Vector<somenumber>       &dst,
                                       // space for the square norms of
                                       // the different parts
       std::vector<somenumber> partial_norms (n_threads, 0);
+
+                                      // then spawn threads. since
+                                      // some compilers have trouble
+                                      // finding out which
+                                      // 'encapsulate' function to
+                                      // take of all those possible
+                                      // ones if we simply drop in
+                                      // the address of an overloaded
+                                      // template member function,
+                                      // make it simpler for the
+                                      // compiler by giving it the
+                                      // correct type right away:
+      typedef
+       void (SparseMatrix<number>::*mem_fun_p)
+       (Vector<somenumber>       &,
+        const Vector<somenumber> &,
+        const Vector<somenumber> &,
+        const std::pair<unsigned int,unsigned int>,
+        somenumber               *) const;
+      const mem_fun_p comp_residual = &SparseMatrix<number>::
+                                    template threaded_residual<somenumber>;
       Threads::ThreadManager thread_manager;
       for (unsigned int i=0; i<n_threads; ++i)
        Threads::spawn (thread_manager,
-                       Threads::encapsulate (&SparseMatrix<number>::
-                                             template threaded_residual<somenumber>)
+                       Threads::encapsulate (comp_residual)
                        .collect_args (this, dst, u, b,
                                       std::pair<unsigned int,unsigned int>
                                       (n_rows * i / n_threads,
index 10b2ce093a957b2073256d410f558fd4d48d5aba..143d1a8885bc9c5284ffd545d8657fe3b24acef1 100644 (file)
@@ -582,11 +582,29 @@ void SparseBlockVanka<number>::vmult (Vector<number2>       &dst,
                                     // otherwise: blocking requested
     {
 #ifdef DEAL_II_USE_MT
+                                      // spawn threads. since
+                                      // some compilers have trouble
+                                      // finding out which
+                                      // 'encapsulate' function to
+                                      // take of all those possible
+                                      // ones if we simply drop in
+                                      // the address of an overloaded
+                                      // template member function,
+                                      // make it simpler for the
+                                      // compiler by giving it the
+                                      // correct type right away:
+      typedef
+       void (SparseVanka<number>::*mem_fun_p)
+       (Vector<number2> &,
+        const Vector<number2> &,
+        const std::vector<bool> *) const;
+      const mem_fun_p comp
+       = &(SparseVanka<number>::
+           template apply_preconditioner<number2>);
       Threads::ThreadManager thread_manager;
       for (unsigned int block=0; block<n_blocks; ++block)
        Threads::spawn (thread_manager,
-                       Threads::encapsulate (&SparseVanka<number>::
-                                             template apply_preconditioner<number2>)
+                       Threads::encapsulate (comp)
                        .collect_args (this, dst, src, &dof_masks[block]));
 
       thread_manager.wait ();
index f917b9ca7eeb46ca042aa8c78079788eb56dcbbd..0ca2d58a46a017f989f1e0a1be855f4ade155ca1 100644 (file)
@@ -941,7 +941,7 @@ class SparsityPattern : public Subscriptor
                                      * lengths.
                                      */
     static
-    const unsigned int * const
+    const unsigned int *
     optimized_lower_bound (const unsigned int *first,
                           const unsigned int *last,
                           const unsigned int &val);
@@ -994,7 +994,7 @@ class SparsityPattern : public Subscriptor
 
 
 inline
-const unsigned int * const
+const unsigned int *
 SparsityPattern::optimized_lower_bound (const unsigned int *first,
                                        const unsigned int *last,
                                        const unsigned int &val)

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.