From: heister Date: Fri, 22 Nov 2013 14:42:37 +0000 (+0000) Subject: rework r31759 to my liking and fix a few more places X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b9e336ad7b2e9f2144edf00bcd7dbb35daa3d90;p=dealii-svn.git rework r31759 to my liking and fix a few more places git-svn-id: https://svn.dealii.org/trunk@31761 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/aniso/anisotropic_crash.cc b/tests/aniso/anisotropic_crash.cc index 9429c1d5b7..35f33a1635 100644 --- a/tests/aniso/anisotropic_crash.cc +++ b/tests/aniso/anisotropic_crash.cc @@ -55,7 +55,7 @@ int main() Triangulation<2>::active_cell_iterator cell = tri.begin_active(), end = tri.end(); for ( ; cell != end; ++cell ) { - switch (myrand()%4) + switch (Testing::rand()%4) { /// If a randomly drawn /// number is 0 or 1 we diff --git a/tests/aniso/refine_and_coarsen_anisotropic.cc b/tests/aniso/refine_and_coarsen_anisotropic.cc index be0f76b27a..85f1d215dd 100644 --- a/tests/aniso/refine_and_coarsen_anisotropic.cc +++ b/tests/aniso/refine_and_coarsen_anisotropic.cc @@ -81,10 +81,10 @@ void test_isotropic (int type, std::ostream *logfile) { cell = tria.begin_active(); for (; cell!=endc; ++cell) - if (myrand()%5==0) + if (Testing::rand()%5==0) { - if (myrand()%2==0) - cell->set_refine_flag(ref_cases[myrand()% + if (Testing::rand()%2==0) + cell->set_refine_flag(ref_cases[Testing::rand()% RefinementCase::isotropic_refinement]); } else diff --git a/tests/base/full_tensor_10.cc b/tests/base/full_tensor_10.cc index 3f45efeeda..5d9d4598b6 100644 --- a/tests/base/full_tensor_10.cc +++ b/tests/base/full_tensor_10.cc @@ -33,7 +33,7 @@ void test () // as in symmetric_tensor_10 for (unsigned int i=0; i indices; is1.fill_index_vector (indices); diff --git a/tests/base/index_set_20.cc b/tests/base/index_set_20.cc index 7e985b391d..0a3021a70b 100644 --- a/tests/base/index_set_20.cc +++ b/tests/base/index_set_20.cc @@ -86,8 +86,8 @@ void test() IndexSet b(size); for (unsigned int i=0; i<9*a.size()/10; ++i) { - a.add_index (myrand() % a.size()); - b.add_index (myrand() % a.size()); + a.add_index (Testing::rand() % a.size()); + b.add_index (Testing::rand() % a.size()); } testor(a, b, false); } diff --git a/tests/base/index_set_22.cc b/tests/base/index_set_22.cc index ea0ffe37b7..906d4eb1e1 100644 --- a/tests/base/index_set_22.cc +++ b/tests/base/index_set_22.cc @@ -35,7 +35,7 @@ void test () // set, some of which may be // repetitions of previous ones for (unsigned int i=0; i<9*is1.size()/10; ++i) - is1.add_index (myrand() % is1.size()); + is1.add_index (Testing::rand() % is1.size()); std::vector zeros_and_ones(is1.size()); is1.fill_binary_vector (zeros_and_ones); diff --git a/tests/base/polynomial_lagrange_ops.cc b/tests/base/polynomial_lagrange_ops.cc index 4a4d662f23..75898a59d3 100644 --- a/tests/base/polynomial_lagrange_ops.cc +++ b/tests/base/polynomial_lagrange_ops.cc @@ -37,8 +37,8 @@ void check_scale (const std::vector > &p) for (unsigned int i=0; i q = p[i]; - double x = (double)myrand()/RAND_MAX; - double factor = 5.*(double)myrand()/RAND_MAX; + double x = (double)Testing::rand()/RAND_MAX; + double factor = 5.*(double)Testing::rand()/RAND_MAX; q.scale (factor); double value1 = p[i].value (factor * x); double value2 = q .value (x); @@ -62,8 +62,8 @@ void check_shift (const std::vector > &p) for (unsigned int i=0; i q = p[i]; - double x = (double)myrand()/RAND_MAX; - double a = 10.*(-1.+2.*(double)myrand()/RAND_MAX); + double x = (double)Testing::rand()/RAND_MAX; + double a = 10.*(-1.+2.*(double)Testing::rand()/RAND_MAX); q.shift (a); double value1 = p[i].value (x+a); double value2 = q .value (x); @@ -83,8 +83,8 @@ void check_mult_scalar (const std::vector > &p) for (unsigned int i=0; i q = p[i]; - double x = (double)myrand()/RAND_MAX; - double a = (double)myrand()/RAND_MAX; + double x = (double)Testing::rand()/RAND_MAX; + double a = (double)Testing::rand()/RAND_MAX; q *= a; double value1 = p[i].value (x) * a; double value2 = q .value (x); @@ -107,7 +107,7 @@ void check_mult (const std::vector > &p) { Polynomial q = p[i]; q *= p[j]; - double x = (double)myrand()/RAND_MAX; + double x = (double)Testing::rand()/RAND_MAX; double value1 = p[i].value (x) * p[j].value(x); double value2 = q .value (x); if (std::fabs(value1-value2) > std::max(1e-13,1e-13*std::fabs(value1))) @@ -139,7 +139,7 @@ void check_expand (const std::vector > &p) for (unsigned int i=0; i q = p[i]; - double x = (double)myrand()/RAND_MAX; + double x = (double)Testing::rand()/RAND_MAX; q += zero; double value1 = p[i].value (x); double value2 = q .value (x); @@ -166,7 +166,7 @@ void check_mult_expand (const std::vector > &p) Polynomial q = p[i]; q += zero; q *= p[j]; - double x = (double)myrand()/RAND_MAX; + double x = (double)Testing::rand()/RAND_MAX; double value1 = p[i].value (x) * p[j].value(x); double value2 = q .value (x); if (std::fabs(value1-value2) > std::max(1e-10,1e-10*std::fabs(value1))) diff --git a/tests/base/polynomial_lagrange_order.cc b/tests/base/polynomial_lagrange_order.cc index 9899f14182..0f55292bc5 100644 --- a/tests/base/polynomial_lagrange_order.cc +++ b/tests/base/polynomial_lagrange_order.cc @@ -68,7 +68,7 @@ void check_constant (const std::vector > &p) deallog << "Representation of one at random points"; for (unsigned int j=0; j<12; ++j) { - double x = (double)myrand()/RAND_MAX; + double x = (double)Testing::rand()/RAND_MAX; double value = 0; for (unsigned int i=0; i > &p, Monomial zero (0,0); for (unsigned int j=0; j q = p[j]; q += zero; diff --git a/tests/base/symmetric_tensor_19.cc b/tests/base/symmetric_tensor_19.cc index 64d7b96a60..fe782feb38 100644 --- a/tests/base/symmetric_tensor_19.cc +++ b/tests/base/symmetric_tensor_19.cc @@ -112,7 +112,7 @@ void test () for (unsigned int j=0; j<3; ++j) for (unsigned int k=0; k<3; ++k) for (unsigned int l=0; l<3; ++l) - A[i][j][k][l] = 1.*myrand()/RAND_MAX; + A[i][j][k][l] = 1.*Testing::rand()/RAND_MAX; break; default: diff --git a/tests/base/symmetric_tensor_25.cc b/tests/base/symmetric_tensor_25.cc index 46026f214f..e9bf54a9ce 100644 --- a/tests/base/symmetric_tensor_25.cc +++ b/tests/base/symmetric_tensor_25.cc @@ -33,7 +33,7 @@ void check () { SymmetricTensor<2,dim> S; for (unsigned int i=0; i::faces_per_cell; ++f) { - if (cell->face(f)->at_boundary() && (myrand()%5)==1) + if (cell->face(f)->at_boundary() && (Testing::rand()%5)==1) cell->set_refine_flag(); } diff --git a/tests/bits/full_matrix_56.cc b/tests/bits/full_matrix_56.cc index b5c0546b7c..daf064bfaa 100644 --- a/tests/bits/full_matrix_56.cc +++ b/tests/bits/full_matrix_56.cc @@ -45,7 +45,7 @@ void random_matrix(FullMatrix &A) for (unsigned int i=0; i::run () // points inside a radius of 0.9) for (int i=0; i<1000; i++) { - double r = sqrt((0.9*myrand()/RAND_MAX)); - double phi = 2*3.14*(1.0*myrand()/RAND_MAX); + double r = sqrt((0.9*Testing::rand()/RAND_MAX)); + double phi = 2*3.14*(1.0*Testing::rand()/RAND_MAX); double x = r*cos(phi); double y = r*sin(phi); Point<2> p(x,y); diff --git a/tests/bits/point_value_hp_01.cc b/tests/bits/point_value_hp_01.cc index 683840a2b3..b99d1564ed 100644 --- a/tests/bits/point_value_hp_01.cc +++ b/tests/bits/point_value_hp_01.cc @@ -123,7 +123,7 @@ check () endc = dof_handler.end(); for (; cell!=endc; ++cell) { - cell->set_active_fe_index (myrand() % fe.size()); + cell->set_active_fe_index (Testing::rand() % fe.size()); } dof_handler.distribute_dofs (fe); diff --git a/tests/bits/point_value_hp_02.cc b/tests/bits/point_value_hp_02.cc index 6d27e90f51..9b7d41d7cd 100644 --- a/tests/bits/point_value_hp_02.cc +++ b/tests/bits/point_value_hp_02.cc @@ -132,7 +132,7 @@ check () endc = dof_handler.end(); for (; cell!=endc; ++cell) { - cell->set_active_fe_index (myrand() % fe.size()); + cell->set_active_fe_index (Testing::rand() % fe.size()); } dof_handler.distribute_dofs (fe); diff --git a/tests/bits/rt_2.cc b/tests/bits/rt_2.cc index 2a41f81990..308b5d3b23 100644 --- a/tests/bits/rt_2.cc +++ b/tests/bits/rt_2.cc @@ -158,7 +158,7 @@ int main () // values between 0 and 1. Vector solution(dof_handler.n_dofs ()); for (unsigned int i = 0; i < dof_handler.n_dofs (); ++i) - solution(i) = (double) myrand() / (double) RAND_MAX; + solution(i) = (double) Testing::rand() / (double) RAND_MAX; // Now check if the function is // continuous in normal direction diff --git a/tests/bits/step-15.cc b/tests/bits/step-15.cc index b74fac85e6..31b7279a8f 100644 --- a/tests/bits/step-15.cc +++ b/tests/bits/step-15.cc @@ -85,7 +85,7 @@ double InitializationValues::value (const Point<1> &p, const unsigned int) const { const double base = std::pow(p(0), 1./3.); - const double random = 2.*myrand()/RAND_MAX-1; + const double random = 2.*Testing::rand()/RAND_MAX-1; return std::max (base+.1*random, 0.); } diff --git a/tests/deal.II/coarsening_02.cc b/tests/deal.II/coarsening_02.cc index 7454364b96..df24077c2b 100644 --- a/tests/deal.II/coarsening_02.cc +++ b/tests/deal.II/coarsening_02.cc @@ -85,7 +85,7 @@ void test() // refine one-fifth of cells randomly std::vector flags (triangulation.n_active_cells(), false); for (unsigned int k=0; k flags (triangulation.n_active_cells(), false); for (unsigned int k=0; k::active_cell_iterator cell = dof_handler.begin_active(); cell != dof_handler.end(); ++cell) - cell->set_active_fe_index (myrand() % fe_collection.size()); + cell->set_active_fe_index (Testing::rand() % fe_collection.size()); dof_handler.distribute_dofs(fe_collection); diff --git a/tests/deal.II/constraints_local_to_global.cc b/tests/deal.II/constraints_local_to_global.cc index 22d806f836..a171d265b8 100644 --- a/tests/deal.II/constraints_local_to_global.cc +++ b/tests/deal.II/constraints_local_to_global.cc @@ -90,7 +90,7 @@ void test () if (counter % 42 == 0) local_mat(i,j) = 0; else - local_mat (i,j) = (double)myrand() / RAND_MAX; + local_mat (i,j) = (double)Testing::rand() / RAND_MAX; cell->get_dof_indices (local_dof_indices); constraints.distribute_local_to_global (local_mat, local_dof_indices, sparse); diff --git a/tests/deal.II/constraints_local_to_global_chunk.cc b/tests/deal.II/constraints_local_to_global_chunk.cc index 5d2bfa6b6d..b9ad731dac 100644 --- a/tests/deal.II/constraints_local_to_global_chunk.cc +++ b/tests/deal.II/constraints_local_to_global_chunk.cc @@ -94,7 +94,7 @@ void test (unsigned int chunk_size) if (counter % 42 == 0) local_mat(i,j) = 0; else - local_mat (i,j) = (double)myrand() / RAND_MAX; + local_mat (i,j) = (double)Testing::rand() / RAND_MAX; cell->get_dof_indices (local_dof_indices); constraints.distribute_local_to_global (local_mat, local_dof_indices, sparse); diff --git a/tests/deal.II/dof_handler_number_cache.cc b/tests/deal.II/dof_handler_number_cache.cc index 5e8ee38ae3..72744cd7ba 100644 --- a/tests/deal.II/dof_handler_number_cache.cc +++ b/tests/deal.II/dof_handler_number_cache.cc @@ -57,7 +57,7 @@ void test() // refine one-fifth of cells randomly std::vector flags (triangulation.n_active_cells(), false); for (unsigned int k=0; k flags (triangulation.n_active_cells(), false); for (unsigned int k=0; k flags (tr.n_active_cells(), false); for (unsigned int k=0; k flags (tr.n_active_cells(), false); for (unsigned int k=0; k flags (tr.n_active_cells(), false); { - const unsigned int x = myrand() % flags.size(); + const unsigned int x = Testing::rand() % flags.size(); deallog << "Refining cell " << x << std::endl; flags[x] = true; } diff --git a/tests/distributed_grids/2d_refinement_03.cc b/tests/distributed_grids/2d_refinement_03.cc index e9b78a1912..b4079a2621 100644 --- a/tests/distributed_grids/2d_refinement_03.cc +++ b/tests/distributed_grids/2d_refinement_03.cc @@ -83,7 +83,7 @@ void test(std::ostream & /*out*/) { std::vector flags (tr.n_active_cells()); for (unsigned int j=0; j > intergrid_map; intergrid_map.make_mapping (tr, tr2); diff --git a/tests/distributed_grids/2d_refinement_05.cc b/tests/distributed_grids/2d_refinement_05.cc index 83a8ad1f1a..5c1ac4d15a 100644 --- a/tests/distributed_grids/2d_refinement_05.cc +++ b/tests/distributed_grids/2d_refinement_05.cc @@ -61,7 +61,7 @@ void test(std::ostream & /*out*/) // time (but at least one) for (unsigned int i=0; i flags (tr.n_active_cells(), false); for (unsigned int k=0; k flags (tr.n_active_cells(), false); for (unsigned int k=0; k flags (tr.n_active_cells(), false); for (unsigned int k=0; k flags (tr.n_active_cells(), false); { - const unsigned int x = myrand() % flags.size(); + const unsigned int x = Testing::rand() % flags.size(); deallog << "Refining cell " << x << std::endl; flags[x] = true; } diff --git a/tests/distributed_grids/3d_refinement_03.cc b/tests/distributed_grids/3d_refinement_03.cc index 2b41275641..a38f8d9925 100644 --- a/tests/distributed_grids/3d_refinement_03.cc +++ b/tests/distributed_grids/3d_refinement_03.cc @@ -63,7 +63,7 @@ void test(std::ostream & /*out*/) { std::vector flags (tr.n_active_cells()); for (unsigned int j=0; j > intergrid_map; intergrid_map.make_mapping (tr, tr2); diff --git a/tests/distributed_grids/3d_refinement_05.cc b/tests/distributed_grids/3d_refinement_05.cc index 03b7552abb..c8536fd96d 100644 --- a/tests/distributed_grids/3d_refinement_05.cc +++ b/tests/distributed_grids/3d_refinement_05.cc @@ -62,7 +62,7 @@ void test(std::ostream & /*out*/) // time (but at least one) for (unsigned int i=0; i flags (triangulation.n_active_cells(), false); for (unsigned int k=0; k flags (triangulation.n_active_cells(), false); for (unsigned int k=0; khas_children() && !(myrand() % 3)) + if (cell->has_children() && !(Testing::rand() % 3)) for (unsigned int c=0; c::max_children_per_cell; ++c) if (!cell->child(c)->has_children()) cell->child(c)->set_coarsen_flag(); @@ -94,7 +94,7 @@ void test(std::ostream & /*out*/) cell = tr.begin_active(); cell != tr.end(); ++cell) { - if (!(myrand() % 3)) + if (!(Testing::rand() % 3)) { cell->clear_coarsen_flag(); cell->set_refine_flag(); diff --git a/tests/fail/abf_approximation_01.cc b/tests/fail/abf_approximation_01.cc index d98354cfcb..6419a1bc72 100644 --- a/tests/fail/abf_approximation_01.cc +++ b/tests/fail/abf_approximation_01.cc @@ -293,7 +293,7 @@ public: { for (unsigned int i=0; i < deg; ++i) { - double c = ((double) myrand()) / ((double) RAND_MAX + 1); + double c = ((double) Testing::rand()) / ((double) RAND_MAX + 1); coeff[i] = c; } polys.push_back (Polynomials::Polynomial (coeff)); @@ -518,7 +518,7 @@ int main () // Try arbitrary deformation ... for (unsigned int i=0; i < deformation.size (); ++i) { - double c = ((double) myrand()) / ((double) RAND_MAX + 1); + double c = ((double) Testing::rand()) / ((double) RAND_MAX + 1); deformation (i) = 0.35 * (c - 0.5); } diff --git a/tests/fail/hp-step-15.cc b/tests/fail/hp-step-15.cc index 6d050878a8..a76e365331 100644 --- a/tests/fail/hp-step-15.cc +++ b/tests/fail/hp-step-15.cc @@ -86,7 +86,7 @@ double InitializationValues::value (const Point<1> &p, const unsigned int) const { const double base = std::pow(p(0), 1./3.); - const double random = 2.*myrand()/RAND_MAX-1; + const double random = 2.*Testing::rand()/RAND_MAX-1; return std::max (base+.1*random, 0.); } diff --git a/tests/fail/vectors_boundary_rhs_hp_02.cc b/tests/fail/vectors_boundary_rhs_hp_02.cc index 590e3b7197..8dc62a8b24 100644 --- a/tests/fail/vectors_boundary_rhs_hp_02.cc +++ b/tests/fail/vectors_boundary_rhs_hp_02.cc @@ -91,7 +91,7 @@ check () hp::DoFHandler dof(tr); for (typename hp::DoFHandler::active_cell_iterator cell = dof.begin_active(); cell!=dof.end(); ++cell) - cell->set_active_fe_index (myrand() % element.size()); + cell->set_active_fe_index (Testing::rand() % element.size()); dof.distribute_dofs(element); diff --git a/tests/fail/vectors_rhs_hp_02.cc b/tests/fail/vectors_rhs_hp_02.cc index 577b2870ff..71712cddc5 100644 --- a/tests/fail/vectors_rhs_hp_02.cc +++ b/tests/fail/vectors_rhs_hp_02.cc @@ -91,7 +91,7 @@ check () hp::DoFHandler dof(tr); for (typename hp::DoFHandler::active_cell_iterator cell = dof.begin_active(); cell!=dof.end(); ++cell) - cell->set_active_fe_index (myrand() % element.size()); + cell->set_active_fe_index (Testing::rand() % element.size()); dof.distribute_dofs(element); diff --git a/tests/fe/rt_8.cc b/tests/fe/rt_8.cc index a4526be072..fa2c573579 100644 --- a/tests/fe/rt_8.cc +++ b/tests/fe/rt_8.cc @@ -87,7 +87,7 @@ test (const unsigned int degree) Vector tmp1(dofs_per_cell), tmp2(dofs_per_cell); for (unsigned int i=0; i