From 6258bff30db9095ee262d61df3627e5b8c78acc0 Mon Sep 17 00:00:00 2001 From: wolf Date: Mon, 24 Sep 2001 16:25:39 +0000 Subject: [PATCH] Changes necessary for compilation with Compaq's cxx git-svn-id: https://svn.dealii.org/branches/Branch-3-2@5053 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/source/multithread_info.cc | 2 +- deal.II/base/source/table_handler.cc | 1 + deal.II/deal.II/source/grid/grid_tools.cc | 5 +- deal.II/deal.II/source/numerics/matrices.cc | 62 ++++++++++++++++++--- deal.II/examples/step-10/step-10.cc | 6 +- deal.II/examples/step-11/step-11.cc | 5 +- 6 files changed, 64 insertions(+), 17 deletions(-) diff --git a/deal.II/base/source/multithread_info.cc b/deal.II/base/source/multithread_info.cc index 8b0b883a1f..00ab313f0a 100644 --- a/deal.II/base/source/multithread_info.cc +++ b/deal.II/base/source/multithread_info.cc @@ -52,7 +52,7 @@ unsigned int MultithreadInfo::get_n_cpus() } -#elif defined(__sun__) +#elif defined(__sun__) || defined(__osf__) unsigned int MultithreadInfo::get_n_cpus() diff --git a/deal.II/base/source/table_handler.cc b/deal.II/base/source/table_handler.cc index bb0cbef3f7..cbf5a6d0eb 100644 --- a/deal.II/base/source/table_handler.cc +++ b/deal.II/base/source/table_handler.cc @@ -17,6 +17,7 @@ #include #include #include +#include //TODO:[WB] (compiler) use i/ostringstream instead of i/ostrstream if they become available diff --git a/deal.II/deal.II/source/grid/grid_tools.cc b/deal.II/deal.II/source/grid/grid_tools.cc index c9e04e827c..82c4954ab2 100644 --- a/deal.II/deal.II/source/grid/grid_tools.cc +++ b/deal.II/deal.II/source/grid/grid_tools.cc @@ -17,6 +17,7 @@ #include #include #include +#include #if deal_II_dimension != 1 @@ -67,7 +68,7 @@ GridTools::diameter (const Triangulation &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 diff --git a/deal.II/deal.II/source/numerics/matrices.cc b/deal.II/deal.II/source/numerics/matrices.cc index adf4e2b593..a605371058 100644 --- a/deal.II/deal.II/source/numerics/matrices.cc +++ b/deal.II/deal.II/source/numerics/matrices.cc @@ -87,9 +87,17 @@ void MatrixCreator::create_mass_matrix (const Mapping &mapping, Threads::ThreadMutex mutex; // then assemble in parallel + typedef void (*create_mass_matrix_1_t) (const Mapping &mapping, + const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const Function * const coefficient, + const IteratorRange range, + Threads::ThreadMutex &mutex); + create_mass_matrix_1_t p = &MatrixCreator::template create_mass_matrix_1; for (unsigned int thread=0; thread) + 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 &mapping, Threads::ThreadMutex mutex; // then assemble in parallel + typedef void (*create_mass_matrix_2_t) (const Mapping &mapping, + const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function * const coefficient, + const IteratorRange range, + Threads::ThreadMutex &mutex); + create_mass_matrix_2_t p = &MatrixCreator::template create_mass_matrix_2; for (unsigned int thread=0; thread) + 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 &mapping, Threads::ThreadMutex mutex; // then assemble in parallel + typedef void (*create_boundary_mass_matrix_1_t) + (const Mapping &mapping, + const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const typename FunctionMap::type &boundary_functions, + Vector &rhs_vector, + std::vector &dof_to_boundary_mapping, + const Function * const coefficient, + const IteratorRange range, + Threads::ThreadMutex &mutex); + create_boundary_mass_matrix_1_t p = &MatrixCreator::template create_boundary_mass_matrix_1; for (unsigned int thread=0; thread) + 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 &mapping, Threads::ThreadMutex mutex; // then assemble in parallel + typedef void (*create_laplace_matrix_1_t) (const Mapping &mapping, + const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const Function * const coefficient, + const IteratorRange range, + Threads::ThreadMutex &mutex); + create_laplace_matrix_1_t p = &MatrixCreator::template create_laplace_matrix_1; for (unsigned int thread=0; thread) + 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 &mapping, Threads::ThreadMutex mutex; // then assemble in parallel + typedef void (*create_laplace_matrix_2_t) (const Mapping &mapping, + const DoFHandler &dof, + const Quadrature &q, + SparseMatrix &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function * const coefficient, + const IteratorRange range, + Threads::ThreadMutex &mutex); + create_laplace_matrix_2_t p = &MatrixCreator::template create_laplace_matrix_2; for (unsigned int thread=0; thread) + Threads::encapsulate(p) .collect_args (mapping, dof, q, matrix, rhs, rhs_vector, coefficient, thread_ranges[thread], mutex)); diff --git a/deal.II/examples/step-10/step-10.cc b/deal.II/examples/step-10/step-10.cc index 7062c8d6b3..6070e89f61 100644 --- a/deal.II/examples/step-10/step-10.cc +++ b/deal.II/examples/step-10/step-10.cc @@ -26,7 +26,7 @@ // And this again is C++: #include - +#include // 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 (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 (perimeter/2.)); - table.add_value("error", fabs(perimeter/2.-pi)); + table.add_value("error", std::fabs(perimeter/2.-pi)); }; // ...and end this function as diff --git a/deal.II/examples/step-11/step-11.cc b/deal.II/examples/step-11/step-11.cc index ff7b1bc825..e09b19f9da 100644 --- a/deal.II/examples/step-11/step-11.cc +++ b/deal.II/examples/step-11/step-11.cc @@ -43,6 +43,7 @@ // declaration: #include #include +#include // Then we declare a class which @@ -383,7 +384,7 @@ void LaplaceProblem::assemble_and_solve () // matrix and body forces are // integrated: const unsigned int gauss_degree - = std::max (static_cast(ceil(1.*(mapping.get_degree()+1)/2)), + = std::max (static_cast(std::ceil(1.*(mapping.get_degree()+1)/2)), 2U); MatrixTools::create_laplace_matrix (mapping, dof_handler, QGauss(gauss_degree), @@ -574,7 +575,7 @@ void LaplaceProblem::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))); }; -- 2.39.5