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
{
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<dim>::isotropic_refinement]);
}
else
// as in symmetric_tensor_10
for (unsigned int i=0; i<dim; ++i)
for (unsigned int j=0; j<dim; ++j)
- t[i][j] = 1. * myrand() / RAND_MAX;
+ t[i][j] = 1. * Testing::rand() / RAND_MAX;
for (unsigned int i=0; i<dim; ++i)
for (unsigned int j=0; j<dim; ++j)
double rand_2 ()
{
- return 1.*myrand()/RAND_MAX*4-2.;
+ return 1.*Testing::rand()/RAND_MAX*4-2.;
}
// repetitions of previous ones
for (unsigned int i=0; i<9*is1.size()/10; ++i)
{
- is1.add_index (myrand() % is1.size());
- is2.add_index (myrand() % is2.size());
+ is1.add_index (Testing::rand() % is1.size());
+ is2.add_index (Testing::rand() % is2.size());
}
IndexSet is3 = is1 & is2;
// repetitions of previous ones
for (unsigned int i=0; i<9*is1.size()/10; ++i)
{
- is1.add_index (myrand() % is1.size());
- is2.add_index (myrand() % is2.size());
+ is1.add_index (Testing::rand() % is1.size());
+ is2.add_index (Testing::rand() % is2.size());
}
IndexSet is3 = is1;
// 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());
}
is1.compress();
// 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());
is1.compress();
// 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<types::global_dof_index> indices;
is1.fill_index_vector (indices);
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);
}
// 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<bool> zeros_and_ones(is1.size());
is1.fill_binary_vector (zeros_and_ones);
for (unsigned int i=0; i<p.size(); ++i)
{
Polynomial<double> 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);
for (unsigned int i=0; i<p.size(); ++i)
{
Polynomial<double> 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);
for (unsigned int i=0; i<p.size(); ++i)
{
Polynomial<double> 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);
{
Polynomial<double> 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)))
for (unsigned int i=0; i<p.size(); ++i)
{
Polynomial<double> 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);
Polynomial<double> 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)))
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.size(); ++i)
{
Monomial<double> zero (0,0);
for (unsigned int j=0; j<p.size(); ++j)
{
- double x = (double)myrand()/RAND_MAX;
+ double x = (double)Testing::rand()/RAND_MAX;
p[j].value (x, values);
Polynomial<double> q = p[j];
q += zero;
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:
{
SymmetricTensor<2,dim> S;
for (unsigned int i=0; i<S.n_independent_components; ++i)
- S[S.unrolled_to_component_indices (i)] = myrand() % 10;
+ S[S.unrolled_to_component_indices (i)] = Testing::rand() % 10;
deallog << "S = " << S << std::endl;
deallog << "first invariant = " << first_invariant(S) << std::endl;
{
SymmetricTensor<2,dim> S;
for (unsigned int i=0; i<S.n_independent_components; ++i)
- S[S.unrolled_to_component_indices (i)] = myrand() % 10;
+ S[S.unrolled_to_component_indices (i)] = Testing::rand() % 10;
Tensor<1,dim> x;
for (unsigned int i=0; i<dim; ++i)
- x[i] = myrand() % 10;
+ x[i] = Testing::rand() % 10;
deallog << "S = " << S << std::endl;
deallog << "x = " << x << std::endl;
// the iterator and compare it with the exact value
Vector<double> src(m.n()), dst(m.m()), dst_ref(m.m());
for (unsigned int i=0; i<src.size(); ++i)
- src(i) = (double)myrand()/RAND_MAX;
+ src(i) = (double)Testing::rand()/RAND_MAX;
for (unsigned int i=0; i<m.m(); ++i)
{
double sum = 0;
for (unsigned int d = 0; d < dim; ++d)
{
for (unsigned int c = 0; c < p_order; ++c)
- coeff[c] = (double) myrand() / (double) RAND_MAX;
+ coeff[c] = (double) Testing::rand() / (double) RAND_MAX;
base.push_back (Polynomials::Polynomial<double> (coeff));
}
}
Vector<double> estimated_error_per_cell (n_cells);
for (unsigned int i = 0; i < n_cells; ++i)
- estimated_error_per_cell(i) = (double) myrand() / (double) RAND_MAX;
+ estimated_error_per_cell(i) = (double) Testing::rand() / (double) RAND_MAX;
GridRefinement::refine_and_coarsen_fixed_number (triangulation,
estimated_error_per_cell,
{
for (int j=0; j<1000; ++j)
{
- Point<3> p ((myrand()%1000)/1000.0,(rand()%1000)/1000.0,(rand()%1000)/1000.0);
+ Point<3> p ((Testing::rand()%1000)/1000.0,(rand()%1000)/1000.0,(rand()%1000)/1000.0);
if (!inside(tria, p))
deallog << "NOT INSIDE" << std::endl;
GridTools::find_active_cell_around_point(tria, p);
cell != tria.end(); ++cell)
for (unsigned int f=0; f<GeometryInfo<3>::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();
}
for (unsigned int i=0; i<A.m(); ++i)
for (unsigned int j=0; j<A.n(); ++j)
{
- double rnd = myrand();
+ double rnd = Testing::rand();
rnd /= RAND_MAX;
A(i,j) = (i==j) ? A.m()+rnd : rnd;
}
// 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);
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);
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);
// values between 0 and 1.
Vector<double> 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
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.);
}
// refine one-fifth of cells randomly
std::vector<bool> flags (triangulation.n_active_cells(), false);
for (unsigned int k=0; k<flags.size()/5 + 1; ++k)
- flags[myrand() % flags.size()] = true;
+ flags[Testing::rand() % flags.size()] = true;
// make sure there's at least one that
// will be refined
flags[0] = true;
// refine one-fifth of cells randomly
std::vector<bool> flags (triangulation.n_active_cells(), false);
for (unsigned int k=0; k<flags.size()/5 + 1; ++k)
- flags[myrand() % flags.size()] = true;
+ flags[Testing::rand() % flags.size()] = true;
// make sure there's at least one that
// will be refined
flags[0] = true;
for (typename hp::DoFHandler<dim>::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);
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);
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);
// refine one-fifth of cells randomly
std::vector<bool> flags (triangulation.n_active_cells(), false);
for (unsigned int k=0; k<flags.size()/5 + 1; ++k)
- flags[myrand() % flags.size()] = true;
+ flags[Testing::rand() % flags.size()] = true;
// make sure there's at least one that
// will be refined
flags[0] = true;
// refine one-fifth of cells randomly
std::vector<bool> flags (triangulation.n_active_cells(), false);
for (unsigned int k=0; k<flags.size()/5 + 1; ++k)
- flags[myrand() % flags.size()] = true;
+ flags[Testing::rand() % flags.size()] = true;
// make sure there's at least one that
// will be refined
flags[0] = true;
// refine one-fifth of cells randomly
std::vector<bool> flags (tr.n_active_cells(), false);
for (unsigned int k=0; k<flags.size()/5 + 1; ++k)
- flags[myrand() % flags.size()] = true;
+ flags[Testing::rand() % flags.size()] = true;
// make sure there's at least one that
// will be refined
flags[0] = true;
// refine one-fifth of cells randomly
std::vector<bool> flags (tr.n_active_cells(), false);
for (unsigned int k=0; k<flags.size()/5 + 1; ++k)
- flags[myrand() % flags.size()] = true;
+ flags[Testing::rand() % flags.size()] = true;
// make sure there's at least one that
// will be refined
flags[0] = true;
// refine one fifth of all cells each
// time (but at least one)
for (unsigned int i=0; i<tr.n_active_cells() / 5 + 1; ++i)
- flags[myrand() % flags.size()] = true;
+ flags[Testing::rand() % flags.size()] = true;
// refine tr and tr2
unsigned int index=0;
{
std::vector<bool> 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;
}
{
std::vector<bool> flags (tr.n_active_cells());
for (unsigned int j=0; j<flags.size(); ++j)
- flags[j] = (myrand() < 0.2*RAND_MAX);
+ flags[j] = (Testing::rand() < 0.2*RAND_MAX);
InterGridMap<Triangulation<dim> > intergrid_map;
intergrid_map.make_mapping (tr, tr2);
// time (but at least one)
for (unsigned int i=0; i<tr.n_active_cells() / 5 + 1; ++i)
{
- const unsigned int x = myrand() % flags.size();
+ const unsigned int x = Testing::rand() % flags.size();
deallog << "Refining cell " << x << std::endl;
flags[x] = true;
}
// refine one-fifth of cells randomly
std::vector<bool> flags (tr.n_active_cells(), false);
for (unsigned int k=0; k<flags.size()/5 + 1; ++k)
- flags[myrand() % flags.size()] = true;
+ flags[Testing::rand() % flags.size()] = true;
// make sure there's at least one that
// will be refined
flags[0] = true;
// refine 10% of cells randomly
std::vector<bool> flags (tr.n_active_cells(), false);
for (unsigned int k=0; k<flags.size()/10 + 1; ++k)
- flags[myrand() % flags.size()] = true;
+ flags[Testing::rand() % flags.size()] = true;
// make sure there's at least one that
// will be refined
flags[0] = true;
// refine one-tenth of cells randomly
std::vector<bool> flags (tr.n_active_cells(), false);
for (unsigned int k=0; k<flags.size()/30 + 1; ++k)
- flags[myrand() % flags.size()] = true;
+ flags[Testing::rand() % flags.size()] = true;
// make sure there's at least one that
// will be refined
flags[0] = true;
// refine one fifth of all cells each
// time (but at least one)
for (unsigned int i=0; i<tr.n_active_cells() / 5 + 1; ++i)
- flags[myrand() % flags.size()] = true;
+ flags[Testing::rand() % flags.size()] = true;
// refine tr and tr2
unsigned int index=0;
{
std::vector<bool> 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;
}
{
std::vector<bool> flags (tr.n_active_cells());
for (unsigned int j=0; j<flags.size(); ++j)
- flags[j] = (myrand() < 0.2*RAND_MAX);
+ flags[j] = (Testing::rand() < 0.2*RAND_MAX);
InterGridMap<Triangulation<dim> > intergrid_map;
intergrid_map.make_mapping (tr, tr2);
// time (but at least one)
for (unsigned int i=0; i<tr.n_active_cells() / 5 + 1; ++i)
{
- const unsigned int x = myrand() % flags.size();
+ const unsigned int x = Testing::rand() % flags.size();
deallog << "Refining cell " << x << std::endl;
flags[x] = true;
}
deallog << "Refining cells ... " << std::endl;
for (unsigned int i=0; i<tr.n_active_cells() / 50 + 1; ++i)
{
- const unsigned int x = myrand() % flags.size();
+ const unsigned int x = Testing::rand() % flags.size();
flags[x] = true;
}
// refine one-fifth of cells randomly
std::vector<bool> flags (triangulation.n_active_cells(), false);
for (unsigned int k=0; k<flags.size()/5 + 1; ++k)
- flags[myrand() % flags.size()] = true;
+ flags[Testing::rand() % flags.size()] = true;
// make sure there's at least one that
// will be refined
flags[0] = true;
// refine one-fifth of cells randomly
std::vector<bool> flags (triangulation.n_active_cells(), false);
for (unsigned int k=0; k<flags.size()/5 + 1; ++k)
- flags[myrand() % flags.size()] = true;
+ flags[Testing::rand() % flags.size()] = true;
// make sure there's at least one that
// will be refined
flags[0] = true;
cell = tr.begin();
cell != tr.end(); ++cell)
{
- if (cell->has_children() && !(myrand() % 3))
+ if (cell->has_children() && !(Testing::rand() % 3))
for (unsigned int c=0; c<GeometryInfo<dim>::max_children_per_cell; ++c)
if (!cell->child(c)->has_children())
cell->child(c)->set_coarsen_flag();
cell = tr.begin_active();
cell != tr.end(); ++cell)
{
- if (!(myrand() % 3))
+ if (!(Testing::rand() % 3))
{
cell->clear_coarsen_flag();
cell->set_refine_flag();
{
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<double> (coeff));
// 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);
}
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.);
}
hp::DoFHandler<dim> dof(tr);
for (typename hp::DoFHandler<dim>::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);
hp::DoFHandler<dim> dof(tr);
for (typename hp::DoFHandler<dim>::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);
Vector<double> tmp1(dofs_per_cell), tmp2(dofs_per_cell);
for (unsigned int i=0; i<dofs_per_cell; ++i)
- tmp1(i) = 1.*myrand()/RAND_MAX;
+ tmp1(i) = 1.*Testing::rand()/RAND_MAX;
cg.solve (mass_matrix, tmp2, tmp1, PreconditionIdentity());
deallog << "Degree=" << degree
Vector<double> tmp1(dofs_per_cell), tmp2(dofs_per_cell);
for (unsigned int i=0; i<dofs_per_cell; ++i)
- tmp1(i) = 1.*myrand()/RAND_MAX;
+ tmp1(i) = 1.*Testing::rand()/RAND_MAX;
cg.solve (mass_matrix, tmp2, tmp1, PreconditionIdentity());
deallog << "Degree=" << degree
{
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<double> (coeff));
// 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);
}
// Fill solution vector with random values between 0 and 1.
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.
cell = dof_handler.begin_active(),
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);
cell = dof_handler.begin_active(),
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);
for (typename hp::DoFHandler<dim>::active_cell_iterator
cell = dof_handler.begin_active();
cell != dof_handler.end(); ++cell)
- cell->set_active_fe_index (myrand() % fe.size());
+ cell->set_active_fe_index (Testing::rand() % fe.size());
dof_handler.distribute_dofs (fe);
deallog << "n_dofs=" << dof_handler.n_dofs() << std::endl;
typename hp::DoFHandler<dim>::active_cell_iterator cell = dof_handler.begin_active (),
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);
// same value it has in
// hp_hanging_nodes_02
for (unsigned int i=0; i<64; ++i)
- myrand();
+ Testing::rand();
test<3> ();
return 0;
for (typename hp::DoFHandler<dim>::active_cell_iterator
cell = dof_handler.begin_active();
cell != dof_handler.end(); ++cell)
- cell->set_active_fe_index (myrand() % fe.size());
+ cell->set_active_fe_index (Testing::rand() % fe.size());
dof_handler.distribute_dofs (fe);
// loop over all lines and make sure that
for (typename hp::DoFHandler<dim>::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);
for (typename hp::DoFHandler<dim>::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);
for (typename hp::DoFHandler<dim>::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);
for (typename hp::DoFHandler<dim>::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);
for (typename hp::DoFHandler<dim>::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);
for (typename hp::DoFHandler<dim>::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);
for (typename hp::DoFHandler<dim>::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);
for (typename hp::DoFHandler<dim>::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);
for (typename hp::DoFHandler<dim>::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);
for (typename hp::DoFHandler<dim>::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);
for (typename hp::DoFHandler<dim>::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);
for (typename hp::DoFHandler<dim>::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);
for (typename hp::DoFHandler<dim>::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);
for (typename hp::DoFHandler<dim>::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);
for (typename hp::DoFHandler<dim>::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);
for (typename hp::DoFHandler<dim>::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);
for (typename hp::DoFHandler<dim>::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);
for (typename hp::DoFHandler<dim>::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);
for (typename hp::DoFHandler<dim>::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);
for (typename hp::DoFHandler<dim>::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);
for (typename hp::DoFHandler<dim>::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);
// refine one-fifth of cells randomly
std::vector<bool> flags (triangulation.n_active_cells(), false);
for (unsigned int k=0; k<flags.size()/5 + 1; ++k)
- flags[myrand() % flags.size()] = true;
+ flags[Testing::rand() % flags.size()] = true;
// make sure there's at least one that
// will be refined
flags[0] = true;
for (typename hp::DoFHandler<dim>::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);
for (typename hp::DoFHandler<dim>::active_cell_iterator
cell = dof_handler.begin_active();
cell != dof_handler.end(); ++cell)
- cell->set_active_fe_index (rand() % fe.size());
+ cell->set_active_fe_index (Testing::rand() % fe.size());
dof_handler.distribute_dofs (fe);
deallog << "n_dofs=" << dof_handler.n_dofs() << std::endl;
cell = triangulation.begin_active();
cell != triangulation.end();
++cell)
- if (rand() % 4 == 0)
+ if (Testing::rand() % 4 == 0)
cell->set_refine_flag ();
triangulation.execute_coarsening_and_refinement ();
}
cell = triangulation.begin_active();
cell != triangulation.end();
++cell)
- if (rand() % 4 == 0)
- cell->set_refine_flag (RefinementCase<dim>(rand() % RefinementCase<dim>::isotropic_refinement + 1));
+ if (Testing::rand() % 4 == 0)
+ cell->set_refine_flag (RefinementCase<dim>(Testing::rand() % RefinementCase<dim>::isotropic_refinement + 1));
triangulation.execute_coarsening_and_refinement ();
}
{
for (; cell != endc; ++cell)
{
- cell->set_active_fe_index ((int)(4.0 * (double) myrand() / (double) RAND_MAX));
+ cell->set_active_fe_index ((int)(4.0 * (double) Testing::rand() / (double) RAND_MAX));
}
}
else
for (typename hp::DoFHandler<dim>::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);
for (typename hp::DoFHandler<dim>::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);
hp::DoFHandler<dim> dof(tr);
for (typename hp::DoFHandler<dim>::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);
for (typename hp::DoFHandler<dim>::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);
for (typename hp::DoFHandler<dim>::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);
if (counter < 15)
cell->set_active_fe_index(1);
else
- cell->set_active_fe_index(myrand()%max_degree);
+ cell->set_active_fe_index(Testing::rand()%max_degree);
if (counter < 15)
celldg->set_active_fe_index(1);
else
- celldg->set_active_fe_index(myrand()%max_degree);
+ celldg->set_active_fe_index(Testing::rand()%max_degree);
}
}
{
if (counter > 120)
cell->set_coarsen_flag();
- else if (myrand() % 3 == 0)
+ else if (Testing::rand() % 3 == 0)
cell->set_refine_flag();
- else if (myrand() % 3 == 3)
+ else if (Testing::rand() % 3 == 3)
cell->set_coarsen_flag();
}
if (counter > 20 && counter < 90)
cell->set_active_fe_index(0);
else
- cell->set_active_fe_index(myrand()%max_degree);
+ cell->set_active_fe_index(Testing::rand()%max_degree);
if (counter > 20 && counter < 90)
celldg->set_active_fe_index(0);
else
- celldg->set_active_fe_index(myrand()%max_degree);
+ celldg->set_active_fe_index(Testing::rand()%max_degree);
}
}
unsigned int cell_no = 0;
for (; cell != endc; ++cell)
{
- cell->set_active_fe_index (myrand() % fe.size());
+ cell->set_active_fe_index (Testing::rand() % fe.size());
deallog << "Cell " << cell << " has fe_index=" << cell->active_fe_index()
<< std::endl;
++cell_no;
unsigned int cell_no = 0;
for (; cell != endc; ++cell)
{
- cell->set_active_fe_index (myrand() % fe.size());
+ cell->set_active_fe_index (Testing::rand() % fe.size());
deallog << "Cell " << cell << " has fe_index=" << cell->active_fe_index()
<< std::endl;
++cell_no;
hp::DoFHandler<dim> dof(tr);
for (typename hp::DoFHandler<dim>::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);
hp::DoFHandler<dim> dof(tr);
for (typename hp::DoFHandler<dim>::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);
hp::DoFHandler<dim> dof(tr);
for (typename hp::DoFHandler<dim>::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);
hp::DoFHandler<dim> dof(tr);
for (typename hp::DoFHandler<dim>::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);
hp::DoFHandler<dim> dof(tr);
for (typename hp::DoFHandler<dim>::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);
hp::DoFHandler<dim> dof(tr);
for (typename hp::DoFHandler<dim>::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);
hp::DoFHandler<dim> dof(tr);
for (typename hp::DoFHandler<dim>::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);
hp::DoFHandler<dim> dof(tr);
for (typename hp::DoFHandler<dim>::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);
hp::DoFHandler<dim> dof(tr);
for (typename hp::DoFHandler<dim>::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);
hp::DoFHandler<dim> dof(tr);
for (typename hp::DoFHandler<dim>::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);
hp::DoFHandler<dim> dof(tr);
for (typename hp::DoFHandler<dim>::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);
hp::DoFHandler<dim> dof(tr);
for (typename hp::DoFHandler<dim>::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);
for (unsigned int i=0; i<A.m(); ++i)
for (unsigned int j=0; j<A.n(); ++j)
{
- double rnd = myrand();
+ double rnd = Testing::rand();
rnd /= RAND_MAX;
A(i,j) = (i==j) ? A.m()+rnd : rnd;
}
for (unsigned int i=0; i<n; ++i)
{
for (unsigned int j=0; j<n; ++j)
- A(i,j) = myrand();
+ A(i,j) = Testing::rand();
for (unsigned int j=0; j<m; ++j)
{
- B(i,j) = Bt(j,i) = myrand();
- D(j,i) = Dt(i,j) = myrand();
+ B(i,j) = Bt(j,i) = Testing::rand();
+ D(j,i) = Dt(i,j) = Testing::rand();
}
}
for (unsigned int i=0; i<m; ++i)
for (unsigned int j=0; j<m; ++j)
- C(i,j) = myrand();
+ C(i,j) = Testing::rand();
// Compare first Schur complement
// with mmult.
FullMatrix<number> matrix(n, n);
for (unsigned int i=0; i<n; ++i)
for (unsigned int j=0; j<n; ++j)
- matrix(i,j) = -0.1 + 0.2 * myrand()/RAND_MAX;
+ matrix(i,j) = -0.1 + 0.2 * Testing::rand()/RAND_MAX;
// put diagonal entries of different strengths. these are very challenging
// for GMRES and will usually take a lot of iterations until the Krylov
FullMatrix<number> matrix(n, n);
for (unsigned int i=0; i<n; ++i)
for (unsigned int j=0; j<n; ++j)
- matrix(i,j) = -0.1 + 0.2 * myrand()/RAND_MAX;
+ matrix(i,j) = -0.1 + 0.2 * Testing::rand()/RAND_MAX;
// put diagonal entries of different strengths. these are very challenging
// for GMRES and will usually take a lot of iterations until the Krylov
Vector<double> in (size), out(size);
for (unsigned int i=0; i<size; ++i)
- in(i) = (double)myrand()/RAND_MAX;
+ in(i) = (double)Testing::rand()/RAND_MAX;
PreconditionChebyshev<FullMatrixModified,Vector<double> > prec;
PreconditionChebyshev<FullMatrixModified,Vector<double> >::AdditionalData
for (unsigned int i=0; i<3; ++i)
{
for (unsigned int j=0; j<dim; ++j)
- v(j) = 1. * myrand()/RAND_MAX;
+ v(j) = 1. * Testing::rand()/RAND_MAX;
A.vmult (tmp1, v);
ilu.vmult (tmp2, tmp1);
for (unsigned int i=0; i<3; ++i)
{
for (unsigned int j=0; j<dim; ++j)
- v(j) = 1. * myrand()/RAND_MAX;
+ v(j) = 1. * Testing::rand()/RAND_MAX;
A.Tvmult (tmp1, v);
ilu.Tvmult (tmp2, tmp1);
for (unsigned int i=0; i<n; ++i)
{
for (unsigned int j=0; j<n; ++j)
- A.set(i,j,myrand());
+ A.set(i,j,Testing::rand());
for (unsigned int j=0; j<n; ++j)
- B.set(i,j,myrand());
+ B.set(i,j,Testing::rand());
}
// now form the matrix-matrix product and
Vector<double> x(n), y(n), z(n), tmp(n);
for (unsigned int j=0; j<n; ++j)
- x(j) = myrand();
+ x(j) = Testing::rand();
// then test for correctness
C.vmult (y, x);
for (unsigned int i=0; i<n; ++i)
{
for (unsigned int j=0; j<n; ++j)
- A.set(i,j,myrand());
+ A.set(i,j,Testing::rand());
for (unsigned int j=0; j<n; ++j)
- B.set(i,j,myrand());
+ B.set(i,j,Testing::rand());
}
Vector<double> v(n);
for (unsigned int j=0; j<n; ++j)
- v(j) = myrand();
+ v(j) = Testing::rand();
// now form the matrix-matrix product and
// initialize a test rhs
Vector<double> x(n), y(n), z(n), tmp(n);
for (unsigned int j=0; j<n; ++j)
- x(j) = myrand();
+ x(j) = Testing::rand();
// then test for correctness
C.vmult (y, x);
for (unsigned int i=0; i<n; ++i)
{
for (unsigned int j=0; j<n; ++j)
- A.set(i,j,myrand());
+ A.set(i,j,Testing::rand());
for (unsigned int j=0; j<n; ++j)
- B.set(i,j,myrand());
+ B.set(i,j,Testing::rand());
}
// now form the matrix-matrix product and
Vector<double> x(n), y(n), z(n), tmp(n);
for (unsigned int j=0; j<n; ++j)
- x(j) = myrand();
+ x(j) = Testing::rand();
// then test for correctness
C.vmult (y, x);
for (unsigned int i=0; i<n; ++i)
{
for (unsigned int j=0; j<n; ++j)
- A.set(i,j,myrand());
+ A.set(i,j,Testing::rand());
for (unsigned int j=0; j<n; ++j)
- B.set(i,j,myrand());
+ B.set(i,j,Testing::rand());
}
Vector<double> v(n);
for (unsigned int j=0; j<n; ++j)
- v(j) = myrand();
+ v(j) = Testing::rand();
// now form the matrix-matrix product and
// initialize a test rhs
Vector<double> x(n), y(n), z(n), tmp(n);
for (unsigned int j=0; j<n; ++j)
- x(j) = myrand();
+ x(j) = Testing::rand();
// then test for correctness
C.vmult (y, x);
for (unsigned int i=0; i<3; ++i)
{
for (unsigned int j=0; j<dim; ++j)
- v(j) = 1. * myrand()/RAND_MAX;
+ v(j) = 1. * Testing::rand()/RAND_MAX;
A.vmult (tmp1, v);
mic.vmult (tmp2, tmp1);
{
for (unsigned int test=0; test<20; ++test)
{
- const unsigned int size = myrand() % 100000;
+ const unsigned int size = Testing::rand() % 100000;
Vector<number> vec (size);
for (unsigned int i=0; i<size; ++i)
- vec(i) = static_cast<number>(myrand())/static_cast<number>(RAND_MAX);
+ vec(i) = static_cast<number>(Testing::rand())/static_cast<number>(RAND_MAX);
const typename Vector<number>::real_type norm = vec.l2_norm();
for (unsigned int i=0; i<30; ++i)
Assert (vec.l2_norm() == norm, ExcInternalError());
{
if (constraints.is_constrained(i))
continue;
- const double entry = myrand()/(double)RAND_MAX;
+ const double entry = Testing::rand()/(double)RAND_MAX;
in_dist(i) = entry;
}
for (unsigned int i=0; i<(M+1)/2; ++i)
for (unsigned int j=0; j<N; ++j)
{
- shape[i][j] = -1. + 2. * (double)myrand()/RAND_MAX;
+ shape[i][j] = -1. + 2. * (double)Testing::rand()/RAND_MAX;
if (type == 1)
shape[M-1-i][N-1-j] = -shape[i][j];
else
double x[N], x_ref[N], y[M], y_ref[M];
for (unsigned int i=0; i<N; ++i)
- x[i] = (double)myrand()/RAND_MAX;
+ x[i] = (double)Testing::rand()/RAND_MAX;
// compute reference
for (unsigned int i=0; i<M; ++i)
for (unsigned int i=0; i<M; ++i)
- y[i] = (double)myrand()/RAND_MAX;
+ y[i] = (double)Testing::rand()/RAND_MAX;
// compute reference
for (unsigned int i=0; i<N; ++i)
for (unsigned int i=0; i<(M+1)/2; ++i)
for (unsigned int j=0; j<N; ++j)
{
- shape[i][j] = -1. + 2. * (double)myrand()/RAND_MAX;
+ shape[i][j] = -1. + 2. * (double)Testing::rand()/RAND_MAX;
if (type == 1)
shape[M-1-i][N-1-j] = -shape[i][j];
else
double x[N], x_ref[N], y[M], y_ref[M];
for (unsigned int i=0; i<N; ++i)
- x[i] = (double)myrand()/RAND_MAX;
+ x[i] = (double)Testing::rand()/RAND_MAX;
// compute reference
for (unsigned int i=0; i<M; ++i)
for (unsigned int i=0; i<M; ++i)
- y[i] = (double)myrand()/RAND_MAX;
+ y[i] = (double)Testing::rand()/RAND_MAX;
// compute reference
for (unsigned int i=0; i<N; ++i)
{
if (constraints.is_constrained(i))
continue;
- const double entry = rand()/(double)RAND_MAX;
+ const double entry = Testing::rand()/(double)RAND_MAX;
solution(i) = entry;
}
{
if (constraints.is_constrained(i))
continue;
- const double entry = myrand()/(double)RAND_MAX;
+ const double entry = Testing::rand()/(double)RAND_MAX;
solution(i) = entry;
}
constraints.distribute(solution);
{
if (constraints.is_constrained(i))
continue;
- const double entry = myrand()/(double)RAND_MAX;
+ const double entry = Testing::rand()/(double)RAND_MAX;
solution(i) = entry;
}
{
if (constraints[no]->is_constrained(i))
continue;
- const double entry = myrand()/(double)RAND_MAX;
+ const double entry = Testing::rand()/(double)RAND_MAX;
src[no](i) = entry;
}
{
if (constraints[no]->is_constrained(i))
continue;
- const double entry = myrand()/(double)RAND_MAX;
+ const double entry = Testing::rand()/(double)RAND_MAX;
src[no](i) = entry;
}
{
if (constraints.is_constrained(i))
continue;
- const double entry = myrand()/(double)RAND_MAX;
+ const double entry = Testing::rand()/(double)RAND_MAX;
solution(i) = entry;
}
constraints.distribute(solution);
{
if (constraints.is_constrained(i))
continue;
- const double entry = myrand()/(double)RAND_MAX;
+ const double entry = Testing::rand()/(double)RAND_MAX;
solution(i) = entry;
}
constraints.distribute(solution);
// create vector with random entries
for (unsigned int i=0; i<dof.n_dofs(); ++i)
{
- const double entry = myrand()/(double)RAND_MAX;
+ const double entry = Testing::rand()/(double)RAND_MAX;
solution_dist(i) = entry;
}
{
if (constraints.is_constrained(i))
continue;
- const double entry = myrand()/(double)RAND_MAX;
+ const double entry = Testing::rand()/(double)RAND_MAX;
solution(i) = entry;
}
// and their gradients
for (unsigned int q=0; q<n_q_points; ++q)
{
- values[q][j] = myrand()/(double)RAND_MAX;
+ values[q][j] = Testing::rand()/(double)RAND_MAX;
for (unsigned int d=0; d<dim; ++d)
- gradients[q*dim+d][j] = -1. + 2. * (myrand()/(double)RAND_MAX);
+ gradients[q*dim+d][j] = -1. + 2. * (Testing::rand()/(double)RAND_MAX);
}
fe_val.reinit (data.get_cell_iterator(cell,j));
data.get_cell_iterator(cell,j)->get_dof_indices(dof_indices);
// and their gradients
for (unsigned int q=0; q<n_q_points0; ++q)
{
- values0[q][j] = myrand()/(double)RAND_MAX;
+ values0[q][j] = Testing::rand()/(double)RAND_MAX;
for (unsigned int d=0; d<dim; ++d)
- gradients0[q*dim+d][j] = -1. + 2. * (myrand()/(double)RAND_MAX);
+ gradients0[q*dim+d][j] = -1. + 2. * (Testing::rand()/(double)RAND_MAX);
}
fe_val0.reinit (data.get_cell_iterator(cell,j,0));
data.get_cell_iterator(cell,j,0)->get_dof_indices(dof_indices0);
for (unsigned int q=0; q<n_q_points1; ++q)
{
- values1[q][j] = myrand()/(double)RAND_MAX;
+ values1[q][j] = Testing::rand()/(double)RAND_MAX;
for (unsigned int d=0; d<dim; ++d)
- gradients1[q*dim+d][j] = -1. + 2. * (myrand()/(double)RAND_MAX);
+ gradients1[q*dim+d][j] = -1. + 2. * (Testing::rand()/(double)RAND_MAX);
}
for (unsigned int i=0; i<dofs_per_cell1; ++i)
{
// and their gradients
for (unsigned int q=0; q<n_q_points0; ++q)
{
- values0[q][j] = myrand()/(double)RAND_MAX;
+ values0[q][j] = Testing::rand()/(double)RAND_MAX;
for (unsigned int d=0; d<dim; ++d)
- gradients0[q*dim+d][j] = -1. + 2. * (myrand()/(double)RAND_MAX);
+ gradients0[q*dim+d][j] = -1. + 2. * (Testing::rand()/(double)RAND_MAX);
}
fe_val0.reinit (data.get_cell_iterator(cell,j,0));
data.get_cell_iterator(cell,j,0)->get_dof_indices(dof_indices0);
for (unsigned int q=0; q<n_q_points1; ++q)
{
- values1[q][j] = myrand()/(double)RAND_MAX;
+ values1[q][j] = Testing::rand()/(double)RAND_MAX;
for (unsigned int d=0; d<dim; ++d)
- gradients1[q*dim+d][j] = -1. + 2. * (myrand()/(double)RAND_MAX);
+ gradients1[q*dim+d][j] = -1. + 2. * (Testing::rand()/(double)RAND_MAX);
}
for (unsigned int i=0; i<dofs_per_cell1; ++i)
{
owned_set.nth_index_in_set (i);
if (constraints.is_constrained(glob_index))
continue;
- in.local_element(i) = (double)myrand()/RAND_MAX;
+ in.local_element(i) = (double)Testing::rand()/RAND_MAX;
}
mf.vmult (out, in);
owned_set.nth_index_in_set (i);
if (constraints.is_constrained(glob_index))
continue;
- in.local_element(i) = (double)myrand()/RAND_MAX;
+ in.local_element(i) = (double)Testing::rand()/RAND_MAX;
}
mf.vmult (ref, in);
owned_set.nth_index_in_set (i);
if (constraints.is_constrained(glob_index))
continue;
- in[0].local_element(i) = (double)myrand()/RAND_MAX;
- in[1].local_element(i) = (double)myrand()/RAND_MAX;
+ in[0].local_element(i) = (double)Testing::rand()/RAND_MAX;
+ in[1].local_element(i) = (double)Testing::rand()/RAND_MAX;
}
mf.vmult (out, in);
owned_set.nth_index_in_set (i);
if (constraints.is_constrained(glob_index))
continue;
- in.block(0).local_element(i) = (double)myrand()/RAND_MAX;
- in.block(1).local_element(i) = (double)myrand()/RAND_MAX;
+ in.block(0).local_element(i) = (double)Testing::rand()/RAND_MAX;
+ in.block(1).local_element(i) = (double)Testing::rand()/RAND_MAX;
}
mf.vmult (out, in);
{
if (constraints.is_constrained(i))
continue;
- const double entry = rand()/(double)RAND_MAX;
+ const double entry = Testing::rand()/(double)RAND_MAX;
in(i) = entry;
in_dist(i) = entry;
}
for (unsigned int i=0; i<dim; ++i)
for (unsigned int j=0; j<system_rhs.block(i).size(); ++j)
{
- const double val = -1. + 2.*(double)myrand()/double(RAND_MAX);
+ const double val = -1. + 2.*(double)Testing::rand()/double(RAND_MAX);
system_rhs.block(i)(j) = val;
}
constraints.condense(system_rhs);
for (unsigned int i=0; i<dim; ++i)
for (unsigned int j=0; j<system_rhs.block(i).size(); ++j)
{
- const double val = -1. + 2.*(double)myrand()/double(RAND_MAX);
+ const double val = -1. + 2.*(double)Testing::rand()/double(RAND_MAX);
system_rhs.block(i)(j) = val;
}
constraints.condense(system_rhs);
endc = dof.end();
for (; cell!=endc; ++cell)
{
- const unsigned int fe_index = myrand() % max_degree;
+ const unsigned int fe_index = Testing::rand() % max_degree;
cell->set_active_fe_index (fe_index);
}
}
for (unsigned int i=0; i<dof.n_dofs(); ++i)
{
if (constraints.is_constrained(i) == false)
- src(i) = (double)myrand()/RAND_MAX;
+ src(i) = (double)Testing::rand()/RAND_MAX;
}
// now perform matrix-vector product and check
for (unsigned int i=0; i<dof.n_dofs(); ++i)
{
if (constraints.is_constrained(i) == false)
- src(i) = (double)myrand()/RAND_MAX;
+ src(i) = (double)Testing::rand()/RAND_MAX;
}
// now perform matrix-vector product and check
for (unsigned int i=0; i<dof.n_dofs(level); ++i)
{
if (mg_constraints[level].is_constrained(i) == false)
- src(i) = (double)myrand()/RAND_MAX;
+ src(i) = (double)Testing::rand()/RAND_MAX;
}
// now perform matrix-vector product and check
for (unsigned int i=0; i<dim+1; ++i)
for (unsigned int j=0; j<system_rhs.block(i).size(); ++j)
{
- const double val = -1. + 2.*(double)myrand()/double(RAND_MAX);
+ const double val = -1. + 2.*(double)Testing::rand()/double(RAND_MAX);
system_rhs.block(i)(j) = val;
vec1[i](j) = val;
}
for (unsigned int j=0; j<system_rhs.block(0).size(); ++j)
if (constraints_u.is_constrained(j) == false)
{
- const double val = -1 + 2.*(double)myrand()/double(RAND_MAX);
+ const double val = -1 + 2.*(double)Testing::rand()/double(RAND_MAX);
system_rhs.block(0)(j) = val;
}
for (unsigned int j=0; j<system_rhs.block(1).size(); ++j)
if (constraints_p.is_constrained(j) == false)
{
- const double val = -1 + 2.*(double)myrand()/double(RAND_MAX);
+ const double val = -1 + 2.*(double)Testing::rand()/double(RAND_MAX);
system_rhs.block(1)(j) = val;
}
{
if (constraints.is_constrained(i))
continue;
- const double entry = myrand()/(double)RAND_MAX;
+ const double entry = Testing::rand()/(double)RAND_MAX;
solution(i) = entry;
}
{
if (constraints.is_constrained(i))
continue;
- const double entry = myrand()/(double)RAND_MAX;
+ const double entry = Testing::rand()/(double)RAND_MAX;
in_dist(i) = entry;
}
cell = tria.begin_active (),
endc = tria.end();
for (; cell!=endc; ++cell)
- if (myrand() % (7-i) == 0)
+ if (Testing::rand() % (7-i) == 0)
cell->set_refine_flag();
tria.execute_coarsening_and_refinement();
}
endc = dof.end();
for (; cell!=endc; ++cell)
{
- const unsigned int fe_index = myrand() % max_degree;
+ const unsigned int fe_index = Testing::rand() % max_degree;
cell->set_active_fe_index (fe_index);
}
}
for (unsigned int i=0; i<dof.n_dofs(); ++i)
{
if (constraints.is_constrained(i) == false)
- src(i) = (double)myrand()/RAND_MAX;
+ src(i) = (double)Testing::rand()/RAND_MAX;
}
// now perform 30 matrix-vector products in
{
if (constraints.is_constrained(i))
continue;
- const double entry = myrand()/(double)RAND_MAX;
+ const double entry = Testing::rand()/(double)RAND_MAX;
solution(i) = entry;
}
endc = tr.end();
for (; cell!=endc; ++cell)
- if (myrand()%42==1)
+ if (Testing::rand()%42==1)
cell->set_refine_flag ();
tr.execute_coarsening_and_refinement ();
// refine one-fifth of cells randomly
std::vector<bool> flags (triangulation.n_active_cells(), false);
for (unsigned int k=0; k<flags.size()/5 + 1; ++k)
- flags[myrand() % flags.size()] = true;
+ flags[Testing::rand() % flags.size()] = true;
// make sure there's at least one that
// will be refined
flags[0] = true;
// refine one-fifth of cells randomly
std::vector<bool> flags (triangulation.n_active_cells(), false);
for (unsigned int k=0; k<flags.size()/5 + 1; ++k)
- flags[myrand() % flags.size()] = true;
+ flags[Testing::rand() % flags.size()] = true;
// make sure there's at least one that
// will be refined
flags[0] = true;
// refine one-fifth of cells randomly
std::vector<bool> flags (triangulation.n_active_cells(), false);
for (unsigned int k=0; k<flags.size()/5 + 1; ++k)
- flags[myrand() % flags.size()] = true;
+ flags[Testing::rand() % flags.size()] = true;
// make sure there's at least one that
// will be refined
flags[0] = true;
endc = tr.end();
for (; cell!=endc; ++cell)
- if (myrand()%42==1)
+ if (Testing::rand()%42==1)
cell->set_refine_flag ();
tr.execute_coarsening_and_refinement ();
endc = tr.end();
for (; cell!=endc; ++cell)
- if (myrand()%42==1)
+ if (Testing::rand()%42==1)
cell->set_refine_flag ();
tr.execute_coarsening_and_refinement ();
endc = tr.end();
for (; cell!=endc; ++cell)
- if (myrand()%42==1)
+ if (Testing::rand()%42==1)
cell->set_refine_flag ();
tr.execute_coarsening_and_refinement ();
endc = tr.end();
for (; cell!=endc; ++cell)
- if (myrand()%42==1)
+ if (Testing::rand()%42==1)
cell->set_refine_flag ();
tr.execute_coarsening_and_refinement ();
for (; cell!=endc; ++cell)
if (!cell->is_artificial() && !cell->is_ghost())
{
- if (myrand()%12==1)
+ if (Testing::rand()%12==1)
cell->set_refine_flag ();
- else if (myrand()%7==1)
+ else if (Testing::rand()%7==1)
cell->set_coarsen_flag ();
}
}
std::vector<bool> flags (tr.n_locally_owned_active_cells(), false);
for (unsigned int i=0; i<tr.n_locally_owned_active_cells() / 5 + 1; ++i)
{
- const unsigned int x = myrand() % flags.size();
+ const unsigned int x = Testing::rand() % flags.size();
flags[x] = true;
}
std::vector<bool> flags (tr.n_locally_owned_active_cells(), false);
for (unsigned int i=0; i<tr.n_locally_owned_active_cells() / 5 + 1; ++i)
{
- const unsigned int x = myrand() % flags.size();
+ const unsigned int x = Testing::rand() % flags.size();
flags[x] = true;
}
std::vector<bool> flags (tr.n_locally_owned_active_cells(), false);
for (unsigned int i=0; i<tr.n_locally_owned_active_cells() / 5 + 1; ++i)
{
- const unsigned int x = myrand() % flags.size();
+ const unsigned int x = Testing::rand() % flags.size();
flags[x] = true;
}
// will be refined.
for (unsigned int i=0; i<tr.n_active_cells() / 5 + 1; ++i)
{
- const unsigned int x = myrand() % flags.size();
+ const unsigned int x = Testing::rand() % flags.size();
flags[x] = true;
}
endc = tr.end();
for (; cell!=endc; ++cell)
- if (myrand()%42==1)
+ if (Testing::rand()%42==1)
cell->set_refine_flag ();
tr.execute_coarsening_and_refinement ();
endc = tr.end();
for (; cell!=endc; ++cell)
- if (myrand()%42==1)
+ if (Testing::rand()%42==1)
cell->set_refine_flag ();
tr.execute_coarsening_and_refinement ();
endc = tr.end();
for (; cell!=endc; ++cell)
- if (myrand()%42==1)
+ if (Testing::rand()%42==1)
cell->set_refine_flag ();
tr.execute_coarsening_and_refinement ();
for (; cell!=endc; ++cell)
if (!cell->is_artificial() && !cell->is_ghost())
{
- if (myrand()%12==1)
+ if (Testing::rand()%12==1)
cell->set_refine_flag ();
- else if (myrand()%7==1)
+ else if (Testing::rand()%7==1)
cell->set_coarsen_flag ();
}
}
// will be refined.
for (unsigned int i=0; i<tr.n_active_cells() / 5 + 1; ++i)
{
- const unsigned int x = myrand() % flags.size();
+ const unsigned int x = Testing::rand() % flags.size();
flags[x] = true;
}
for (unsigned int i=0; i<col_partitioning.n_elements(); ++i)
{
const unsigned int global_index = col_partitioning.nth_index_in_set(i);
- dx(global_index) = (double)myrand()/RAND_MAX;
+ dx(global_index) = (double)Testing::rand()/RAND_MAX;
x(global_index) = dx(global_index);
}
dy = 1.;
for (unsigned int i=0; i<row_partitioning.n_elements(); ++i)
{
const unsigned int global_index = row_partitioning.nth_index_in_set(i);
- dy(global_index) = (double)myrand()/RAND_MAX;
+ dy(global_index) = (double)Testing::rand()/RAND_MAX;
y(global_index) = dy(global_index);
}
dx = 1.;
for (unsigned int i=0; i<col_partitioning.n_elements(); ++i)
{
const unsigned int global_index = col_partitioning.nth_index_in_set(i);
- dx(global_index) = (double)myrand()/RAND_MAX;
+ dx(global_index) = (double)Testing::rand()/RAND_MAX;
x(global_index) = dx(global_index);
}
dy = 1.;
{
if (i>=5)
{
- const double s = myrand();
+ const double s = Testing::rand();
m.add (i,i-5, s);
norm_sqr += s*s;
++nnz;
if (i<N-5)
{
- const double s = myrand();
+ const double s = Testing::rand();
m.add (i,i+5, s);
norm_sqr += s*s;
++nnz;
}
- const double s = myrand();
+ const double s = Testing::rand();
m.add (i,i,s);
norm_sqr += s*s;
++nnz;
{
if (i>=5)
{
- const double s = myrand();
+ const double s = Testing::rand();
m.add (i,i-5, s);
norm_sqr += s*s;
++nnz;
if (i<N-5)
{
- const double s = myrand();
+ const double s = Testing::rand();
m.add (i,i+5, s);
norm_sqr += s*s;
++nnz;
}
- const double s = myrand();
+ const double s = Testing::rand();
m.add (i,i,s);
norm_sqr += s*s;
++nnz;
{
if (i>=5)
{
- const double s = myrand();
+ const double s = Testing::rand();
m.add (i,i-5, s);
norm_sqr += s*s;
++nnz;
if (i<N-5)
{
- const double s = myrand();
+ const double s = Testing::rand();
m.add (i,i+5, s);
norm_sqr += s*s;
++nnz;
}
- const double s = myrand();
+ const double s = Testing::rand();
m.add (i,i,s);
norm_sqr += s*s;
++nnz;
// now remove the entries of row N/2. set
// diagonal entries to rnd
- const double rnd = myrand();
+ const double rnd = Testing::rand();
for (unsigned int i=0; i<N; ++i)
{
const double s = m.el(N/2,i);
{
if (i>=5)
{
- const double s = myrand();
+ const double s = Testing::rand();
m.add (i,i-5, s);
norm_sqr += s*s;
++nnz;
if (i<N-5)
{
- const double s = myrand();
+ const double s = Testing::rand();
m.add (i,i+5, s);
norm_sqr += s*s;
++nnz;
}
- const double s = myrand();
+ const double s = Testing::rand();
m.add (i,i,s);
norm_sqr += s*s;
++nnz;
// now remove the entries of rows N/2 and
// N/3. set diagonal entries to rnd
- const double rnd = myrand();
+ const double rnd = Testing::rand();
for (size_type i=0; i<N; ++i)
{
const double s = m.el(N/2,i);
{
// pick a random element among the
// unused indices
- const unsigned int k = myrand() % (N-i);
+ const unsigned int k = Testing::rand() % (N-i);
permutation[i] = unused_indices[k];
// then swap this used element to the
const unsigned int j=permutation[j_];
const unsigned int global = i*N+j;
- matrix.add(global, global, myrand());
+ matrix.add(global, global, Testing::rand());
if (j>0)
{
- matrix.add(global-1, global, myrand());
- matrix.add(global, global-1, myrand());
+ matrix.add(global-1, global, Testing::rand());
+ matrix.add(global, global-1, Testing::rand());
}
if (j<N-1)
{
- matrix.add(global+1, global, myrand());
- matrix.add(global, global+1, myrand());
+ matrix.add(global+1, global, Testing::rand());
+ matrix.add(global, global+1, Testing::rand());
}
if (i>0)
{
- matrix.add(global-N, global, myrand());
- matrix.add(global, global-N, myrand());
+ matrix.add(global-N, global, Testing::rand());
+ matrix.add(global, global-N, Testing::rand());
}
if (i<N-1)
{
- matrix.add(global+N, global, myrand());
- matrix.add(global, global+N, myrand());
+ matrix.add(global+N, global, Testing::rand());
+ matrix.add(global, global+N, Testing::rand());
}
}
matrix.compress (VectorOperation::add);
// Cygwin has a different implementation for rand() which causes many tests to fail.
// This here is a reimplementation that gives the same sequence of numbers as a program
// that uses rand() on a typical linux machine.
-int myrand(bool reseed=false, int seed=1) throw()
+// we put this into a namespace to not conflict with stdlib
+namespace Testing
+{
+int rand(bool reseed=false, int seed=1) throw()
{
static int r[32];
static int k;
}
// reseed our random number generator
-void mysrand(int seed) throw()
+void srand(int seed) throw()
{
- myrand(true, seed);
+ rand(true, seed);
+}
}
-
-
// given the name of a file, copy it to deallog
// and then delete it
{
if (i>=5)
{
- const double s = myrand();
+ const double s = Testing::rand();
m.set (i,i-5, s);
norm_sqr += s*s;
++nnz;
if (i<N-5)
{
- const double s = myrand();
+ const double s = Testing::rand();
m.set (i,i+5, s);
norm_sqr += s*s;
++nnz;
}
- const double s = myrand();
+ const double s = Testing::rand();
m.set (i,i,s);
norm_sqr += s*s;
++nnz;
{
if (i>=5)
{
- const double s = myrand();
+ const double s = Testing::rand();
m.set (i,i-5, s);
norm_sqr += s*s;
++nnz;
if (i<N-5)
{
- const double s = myrand();
+ const double s = Testing::rand();
m.set (i,i+5, s);
norm_sqr += s*s;
++nnz;
}
- const double s = myrand();
+ const double s = Testing::rand();
m.set (i,i,s);
norm_sqr += s*s;
++nnz;
{
if (i>=5)
{
- const double s = myrand();
+ const double s = Testing::rand();
m.set (i,i-5, s);
norm_sqr += s*s;
++nnz;
if (i<N-5)
{
- const double s = myrand();
+ const double s = Testing::rand();
m.set (i,i+5, s);
norm_sqr += s*s;
++nnz;
}
- const double s = myrand();
+ const double s = Testing::rand();
m.set (i,i,s);
norm_sqr += s*s;
++nnz;
// now remove the entries of row N/2. set
// diagonal entries to rnd
- const double rnd = myrand();
+ const double rnd = Testing::rand();
for (unsigned int i=0; i<N; ++i)
{
const double s = m.el(N/2,i);
{
if (i>=5)
{
- const double s = myrand();
+ const double s = Testing::rand();
m.set (i,i-5, s);
norm_sqr += s*s;
++nnz;
if (i<N-5)
{
- const double s = myrand();
+ const double s = Testing::rand();
m.set (i,i+5, s);
norm_sqr += s*s;
++nnz;
}
- const double s = myrand();
+ const double s = Testing::rand();
m.set (i,i,s);
norm_sqr += s*s;
++nnz;
// now remove the entries of rows N/2 and
// N/3. set diagonal entries to rnd
- const double rnd = myrand();
+ const double rnd = Testing::rand();
for (unsigned int i=0; i<N; ++i)
{
const double s = m.el(N/2,i);
{
// pick a random element among the
// unused indices
- const unsigned int k = myrand() % (N-i);
+ const unsigned int k = Testing::rand() % (N-i);
permutation[i] = unused_indices[k];
// then swap this used element to the
const unsigned int j=permutation[j_];
const unsigned int global = i*N+j;
- matrix.set(global, global, myrand());
+ matrix.set(global, global, Testing::rand());
if (j>0)
{
- matrix.set(global-1, global, myrand());
- matrix.set(global, global-1, myrand());
+ matrix.set(global-1, global, Testing::rand());
+ matrix.set(global, global-1, Testing::rand());
}
if (j<N-1)
{
- matrix.set(global+1, global, myrand());
- matrix.set(global, global+1, myrand());
+ matrix.set(global+1, global, Testing::rand());
+ matrix.set(global, global+1, Testing::rand());
}
if (i>0)
{
- matrix.set(global-N, global, myrand());
- matrix.set(global, global-N, myrand());
+ matrix.set(global-N, global, Testing::rand());
+ matrix.set(global, global-N, Testing::rand());
}
if (i<N-1)
{
- matrix.set(global+N, global, myrand());
- matrix.set(global, global+N, myrand());
+ matrix.set(global+N, global, Testing::rand());
+ matrix.set(global, global+N, Testing::rand());
}
}
matrix.compress (VectorOperation::insert);