]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Changes necessary for compilation with DEC cxx.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 24 Sep 2001 16:31:16 +0000 (16:31 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 24 Sep 2001 16:31:16 +0000 (16:31 +0000)
git-svn-id: https://svn.dealii.org/trunk@5054 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/source/multithread_info.cc
deal.II/base/source/table_handler.cc
deal.II/deal.II/source/grid/grid_tools.cc
deal.II/deal.II/source/numerics/matrices.cc
deal.II/examples/step-10/step-10.cc
deal.II/examples/step-11/step-11.cc

index 8b0b883a1fccb2c4657bdfa809500d46e8522303..00ab313f0ac5614e53bd6aee763a81b50b4949ab 100644 (file)
@@ -52,7 +52,7 @@ unsigned int MultithreadInfo::get_n_cpus()
 }
 
 
-#elif defined(__sun__)
+#elif defined(__sun__) || defined(__osf__)
 
 
 unsigned int MultithreadInfo::get_n_cpus()
index bb0cbef3f7ce64f9d8cb37f74d16e5c2ec08babc..cbf5a6d0eb559c18a721acc3ebb21016b3bf05f6 100644 (file)
@@ -17,6 +17,7 @@
 #include <strstream>
 #include <iostream>
 #include <iomanip>
+#include <strings.h>
 
 //TODO:[WB] (compiler) use i/ostringstream instead of i/ostrstream if they become available
 
index c9e04e827c9ea1b17fdffc57dd1f0ca12e39b8d4..82c4954ab2322df5dc6572be262ab5d6e35a6b7a 100644 (file)
@@ -17,6 +17,7 @@
 #include <grid/tria.h>
 #include <grid/tria_accessor.h>
 #include <grid/tria_iterator.h>
+#include <cmath>
 
 #if deal_II_dimension != 1
 
@@ -67,7 +68,7 @@ GridTools::diameter (const Triangulation<dim> &tria)
          max_distance_sqr = (vertices[i]-vertices[j]).square();
     };
 
-  return sqrt(max_distance_sqr);
+  return std::sqrt(max_distance_sqr);
 };
 
 
@@ -85,7 +86,7 @@ GridTools::diameter (const Triangulation<1> &tria)
   while (!leftmost->at_boundary(0))  leftmost  = leftmost->neighbor(0);
   while (!rightmost->at_boundary(1)) rightmost = rightmost->neighbor(1);
 
-  return sqrt((leftmost->vertex(0) - rightmost->vertex(1)).square());
+  return std::sqrt((leftmost->vertex(0) - rightmost->vertex(1)).square());
 };
 
 #endif
index adf4e2b5930fb01c6e3d35951b48fdd78bde9fb4..a605371058c499d4b706cb55bd3d8105f7585e7f 100644 (file)
@@ -87,9 +87,17 @@ void MatrixCreator::create_mass_matrix (const Mapping<dim>       &mapping,
   Threads::ThreadMutex mutex;
   
                                   // then assemble in parallel
+  typedef void (*create_mass_matrix_1_t) (const Mapping<dim>       &mapping,
+                                         const DoFHandler<dim>    &dof,
+                                         const Quadrature<dim>    &q,
+                                         SparseMatrix<double>     &matrix,
+                                         const Function<dim> * const coefficient,
+                                         const IteratorRange<dim>  range,
+                                         Threads::ThreadMutex     &mutex);
+  create_mass_matrix_1_t p = &MatrixCreator::template create_mass_matrix_1<dim>;
   for (unsigned int thread=0; thread<n_threads; ++thread)
     Threads::spawn (thread_manager,
-                   Threads::encapsulate(&MatrixCreator::template create_mass_matrix_1<dim>)
+                   Threads::encapsulate(p)
                    .collect_args (mapping, dof, q, matrix, coefficient,
                                   thread_ranges[thread], mutex));
   thread_manager.wait ();  
@@ -237,10 +245,19 @@ void MatrixCreator::create_mass_matrix (const Mapping<dim>       &mapping,
   Threads::ThreadMutex mutex;
   
                                   // then assemble in parallel
+  typedef void (*create_mass_matrix_2_t) (const Mapping<dim>       &mapping,
+                                         const DoFHandler<dim>    &dof,
+                                         const Quadrature<dim>    &q,
+                                         SparseMatrix<double>     &matrix,
+                                         const Function<dim>      &rhs,
+                                         Vector<double>           &rhs_vector,
+                                         const Function<dim> * const coefficient,
+                                         const IteratorRange<dim>  range,
+                                         Threads::ThreadMutex     &mutex);
+  create_mass_matrix_2_t p = &MatrixCreator::template create_mass_matrix_2<dim>;
   for (unsigned int thread=0; thread<n_threads; ++thread)
     Threads::spawn (thread_manager,
-                   Threads::encapsulate(&MatrixCreator::template
-                                        create_mass_matrix_2<dim>)
+                   Threads::encapsulate(p)
                    .collect_args (mapping, dof, q, matrix, rhs,
                                   rhs_vector, coefficient,
                                   thread_ranges[thread], mutex));
@@ -439,10 +456,21 @@ MatrixCreator::create_boundary_mass_matrix (const Mapping<dim>        &mapping,
   Threads::ThreadMutex mutex;
   
                                   // then assemble in parallel
+  typedef void (*create_boundary_mass_matrix_1_t)
+      (const Mapping<dim>        &mapping,
+       const DoFHandler<dim>     &dof,
+       const Quadrature<dim-1>   &q,
+       SparseMatrix<double>      &matrix,
+       const typename FunctionMap<dim>::type &boundary_functions,
+       Vector<double>            &rhs_vector,
+       std::vector<unsigned int> &dof_to_boundary_mapping,
+       const Function<dim> * const coefficient,
+       const IteratorRange<dim>   range,
+       Threads::ThreadMutex      &mutex);
+  create_boundary_mass_matrix_1_t p = &MatrixCreator::template create_boundary_mass_matrix_1<dim>;
   for (unsigned int thread=0; thread<n_threads; ++thread)
     Threads::spawn (thread_manager,
-                   Threads::encapsulate(&MatrixCreator::template 
-                                        create_boundary_mass_matrix_1<dim>)
+                   Threads::encapsulate(p)
                    .collect_args (mapping, dof, q, matrix,
                                   boundary_functions, rhs_vector,
                                   dof_to_boundary_mapping, coefficient,
@@ -843,10 +871,17 @@ void MatrixCreator::create_laplace_matrix (const Mapping<dim>       &mapping,
   Threads::ThreadMutex mutex;
   
                                   // then assemble in parallel
+  typedef void (*create_laplace_matrix_1_t) (const Mapping<dim>       &mapping,
+                                            const DoFHandler<dim>    &dof,
+                                            const Quadrature<dim>    &q,
+                                            SparseMatrix<double>     &matrix,
+                                            const Function<dim> * const coefficient,
+                                            const IteratorRange<dim>  range,
+                                            Threads::ThreadMutex     &mutex);
+  create_laplace_matrix_1_t p = &MatrixCreator::template create_laplace_matrix_1<dim>;
   for (unsigned int thread=0; thread<n_threads; ++thread)
     Threads::spawn (thread_manager,
-                   Threads::encapsulate(&MatrixCreator::template
-                                        create_laplace_matrix_1<dim>)
+                   Threads::encapsulate(p)
                    .collect_args (mapping, dof, q, matrix, coefficient,
                                   thread_ranges[thread], mutex));
   thread_manager.wait ();  
@@ -999,10 +1034,19 @@ void MatrixCreator::create_laplace_matrix (const Mapping<dim>       &mapping,
   Threads::ThreadMutex mutex;
   
                                   // then assemble in parallel
+  typedef void (*create_laplace_matrix_2_t) (const Mapping<dim>       &mapping,
+                                            const DoFHandler<dim>    &dof,
+                                            const Quadrature<dim>    &q,
+                                            SparseMatrix<double>     &matrix,
+                                            const Function<dim>      &rhs,
+                                            Vector<double>           &rhs_vector,
+                                            const Function<dim> * const coefficient,
+                                            const IteratorRange<dim>  range,
+                                            Threads::ThreadMutex     &mutex);
+  create_laplace_matrix_2_t p = &MatrixCreator::template create_laplace_matrix_2<dim>;
   for (unsigned int thread=0; thread<n_threads; ++thread)
     Threads::spawn (thread_manager,
-                   Threads::encapsulate(&MatrixCreator::template
-                                        create_laplace_matrix_2<dim>)
+                   Threads::encapsulate(p)
                    .collect_args (mapping, dof, q, matrix, rhs,
                                   rhs_vector, coefficient,
                                   thread_ranges[thread], mutex));
index 7062c8d6b38c56ca8cf53884a5bad487e2cf084a..6070e89f6154d4802329ad5f4edf18753aef448d 100644 (file)
@@ -26,7 +26,7 @@
 
                                 // And this again is C++:
 #include <fstream>
-
+#include <cmath>
 
                                 // Now, as we want to compute the
                                 // value of pi, we have to compare to
@@ -477,7 +477,7 @@ void compute_pi_by_area ()
                                           // long double) function
                                           // implemented.
          table.add_value("eval.pi", static_cast<double> (area));
-         table.add_value("error", fabs(area-pi));
+         table.add_value("error", std::fabs(area-pi));
        };
 
                                       // We want to compute
@@ -594,7 +594,7 @@ void compute_pi_by_perimeter ()
                                           // Then store the evaluated
                                           // values in the table...
          table.add_value("eval.pi", static_cast<double> (perimeter/2.));
-         table.add_value("error", fabs(perimeter/2.-pi));
+         table.add_value("error", std::fabs(perimeter/2.-pi));
        };
 
                                       // ...and end this function as
index ff7b1bc82541c90d2d1a1553e9e61f9f5f815872..e09b19f9da2fa250ec370bcd03085c00b03f44bd 100644 (file)
@@ -43,6 +43,7 @@
                                 // declaration:
 #include <algorithm>
 #include <iomanip>
+#include <cmath>
 
 
                                 // Then we declare a class which
@@ -383,7 +384,7 @@ void LaplaceProblem<dim>::assemble_and_solve ()
                                   // matrix and body forces are
                                   // integrated:
   const unsigned int gauss_degree
-    = std::max (static_cast<unsigned int>(ceil(1.*(mapping.get_degree()+1)/2)),
+    = std::max (static_cast<unsigned int>(std::ceil(1.*(mapping.get_degree()+1)/2)),
                2U);
   MatrixTools::create_laplace_matrix (mapping, dof_handler,
                                      QGauss<dim>(gauss_degree),
@@ -574,7 +575,7 @@ void LaplaceProblem<dim>::assemble_and_solve ()
                                   // Last task -- generate output:
   output_table.add_value ("cells", triangulation.n_active_cells());
   output_table.add_value ("|u|_1", norm);
-  output_table.add_value ("error", fabs(norm-sqrt(3.14159265358/2)));
+  output_table.add_value ("error", std::fabs(norm-std::sqrt(3.14159265358/2)));
 };
 
 

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.