deallog << "Addition: ";
VectorizedArray<Number> d = a + b;
for (unsigned int i=0; i<n_vectors; ++i)
- Assert (d[i] == 1, ExcInternalError());
+ AssertThrow (d[i] == 1, ExcInternalError());
deallog << "OK" << std::endl
<< "Subtraction: ";
VectorizedArray<Number> e = d - b;
for (unsigned int i=0; i<n_vectors; ++i)
- Assert (e[i] == a[i], ExcInternalError());
+ AssertThrow (e[i] == a[i], ExcInternalError());
deallog << "OK" << std::endl
<< "Multiplication: ";
d = a * c;
for (unsigned int i=0; i<n_vectors; ++i)
- Assert (d[i] == a[i] * c[i], ExcInternalError());
+ AssertThrow (d[i] == a[i] * c[i], ExcInternalError());
deallog << "OK" << std::endl
<< "Division: ";
e = d / a;
for (unsigned int i=0; i<n_vectors; ++i)
- Assert (e[i] == c[i], ExcInternalError());
+ AssertThrow (e[i] == c[i], ExcInternalError());
deallog << "OK" << std::endl
<< "Multiplication scalar: ";
a = 2. * a;
for (unsigned int i=0; i<n_vectors; ++i)
- Assert (a[i] == 4., ExcInternalError());
+ AssertThrow (a[i] == 4., ExcInternalError());
deallog << "OK" << std::endl
<< "Division scalar left: ";
d = 1. / a;
for (unsigned int i=0; i<n_vectors; ++i)
- Assert (d[i] == 0.25, ExcInternalError());
+ AssertThrow (d[i] == 0.25, ExcInternalError());
deallog << "OK" << std::endl
<< "Division scalar right: ";
e = d / 0.25;
for (unsigned int i=0; i<n_vectors; ++i)
- Assert (e[i] == 1, ExcInternalError());
+ AssertThrow (e[i] == 1, ExcInternalError());
deallog << "OK" << std::endl
<< "Unary operator -: ";
d = -c;
for (unsigned int i=0; i<n_vectors; ++i)
- Assert (d[i] == -(Number)i, ExcInternalError());
+ AssertThrow (d[i] == -(Number)i, ExcInternalError());
deallog << "OK" << std::endl
<< "Unary operator +: ";
d = c;
for (unsigned int i=0; i<n_vectors; ++i)
- Assert (d[i] == i, ExcInternalError());
+ AssertThrow (d[i] == i, ExcInternalError());
deallog << "OK" << std::endl
<< "Square root: ";
d = std::sqrt(c);
for (unsigned int i=0; i<n_vectors; ++i)
- Assert (std::fabs(d[i]-std::sqrt(Number(i)))<
+ AssertThrow (std::fabs(d[i]-std::sqrt(Number(i)))<
std::numeric_limits<Number>::epsilon(),
ExcInternalError());
d = -c;
d = std::abs(d);
for (unsigned int i=0; i<n_vectors; ++i)
- Assert (d[i] == Number(i), ExcInternalError());
+ AssertThrow (d[i] == Number(i), ExcInternalError());
deallog << "OK" << std::endl
<< "Maximum value: ";
d = std::max(a, c);
for (unsigned int i=0; i<n_vectors; ++i)
- Assert (d[i] == std::max(a[i], c[i]), ExcInternalError());
+ AssertThrow (d[i] == std::max(a[i], c[i]), ExcInternalError());
deallog << "OK" << std::endl
<< "Minimum value: ";
d = std::min(0.5 * a + b, c);
for (unsigned int i=0; i<n_vectors; ++i)
- Assert (d[i] == std::min(Number(0.5 * a[i] + b[i]), c[i]), ExcInternalError());
+ AssertThrow (d[i] == std::min(Number(0.5 * a[i] + b[i]), c[i]),
+ ExcInternalError());
deallog << "OK" << std::endl
<< "Sine: ";
e = std::sin(b);
for (unsigned int i=0; i<n_vectors; ++i)
- Assert (std::fabs(e[i]-std::sin(b[i])) <
- 10.*std::numeric_limits<Number>::epsilon(),
- ExcInternalError());
+ AssertThrow (std::fabs(e[i]-std::sin(b[i])) <
+ 10.*std::numeric_limits<Number>::epsilon(),
+ ExcInternalError());
deallog << "OK" << std::endl
<< "Cosine: ";
e = std::cos(c);
for (unsigned int i=0; i<n_vectors; ++i)
- Assert (std::fabs(e[i]-std::cos(c[i])) <
- 10.*std::numeric_limits<Number>::epsilon(),
- ExcInternalError());
+ AssertThrow (std::fabs(e[i]-std::cos(c[i])) <
+ 10.*std::numeric_limits<Number>::epsilon(),
+ ExcInternalError());
deallog << "OK" << std::endl
<< "Tangent: ";
d = std::tan(e);
for (unsigned int i=0; i<n_vectors; ++i)
- Assert (std::fabs(d[i]-std::tan(e[i])) <
- 10.*std::numeric_limits<Number>::epsilon(),
- ExcInternalError());
+ AssertThrow (std::fabs(d[i]-std::tan(e[i])) <
+ 10.*std::numeric_limits<Number>::epsilon(),
+ ExcInternalError());
deallog << "OK" << std::endl
<< "Exponential: ";
d = std::exp(c-a);
for (unsigned int i=0; i<n_vectors; ++i)
- Assert (std::fabs(d[i]-std::exp(c[i]-a[i])) <
- 10.*std::numeric_limits<Number>::epsilon(),
- ExcInternalError());
+ AssertThrow (std::fabs(d[i]-std::exp(c[i]-a[i])) <
+ 10.*std::numeric_limits<Number>::epsilon(),
+ ExcInternalError());
deallog << "OK" << std::endl
<< "Logarithm: ";
e = std::log(d);
for (unsigned int i=0; i<n_vectors; ++i)
- Assert (std::fabs(e[i]-(c[i]-a[i])) <
- 10.*std::numeric_limits<Number>::epsilon(),
- ExcInternalError());
+ AssertThrow (std::fabs(e[i]-(c[i]-a[i])) <
+ 10.*std::numeric_limits<Number>::epsilon(),
+ ExcInternalError());
deallog << "OK" << std::endl;
}
deallog << "Constructor: ";
for (unsigned int i=0; i<a.size(); ++i)
for (unsigned int d=0; d<n_vectors; ++d)
- Assert (a[i][d] == 0, ExcInternalError());
+ AssertThrow (a[i][d] == 0, ExcInternalError());
deallog << "OK" << std::endl;
a[2] = 1;
deallog << "Insertion: ";
for (unsigned int i=0; i<a.size(); ++i)
for (unsigned int d=0; d<n_vectors; ++d)
- Assert (a[i][d] == a_ref[i], ExcInternalError());
+ AssertThrow (a[i][d] == a_ref[i], ExcInternalError());
deallog << "OK" << std::endl;
a.resize(4);
deallog << "Shrinking: ";
for (unsigned int i=0; i<a.size(); ++i)
for (unsigned int d=0; d<n_vectors; ++d)
- Assert (a[i][d] == a_ref[i], ExcInternalError());
+ AssertThrow (a[i][d] == a_ref[i], ExcInternalError());
deallog << "OK" << std::endl;
a.reserve(100);
deallog << "Reserve: ";
for (unsigned int i=0; i<a.size(); ++i)
for (unsigned int d=0; d<n_vectors; ++d)
- Assert (a[i][d] == a_ref[i], ExcInternalError());
+ AssertThrow (a[i][d] == a_ref[i], ExcInternalError());
deallog << "OK" << std::endl;
a = b;
deallog << "Assignment: ";
for (unsigned int i=0; i<a.size(); ++i)
for (unsigned int d=0; d<n_vectors; ++d)
- Assert (a[i][d] == a_ref[i], ExcInternalError());
+ AssertThrow (a[i][d] == a_ref[i], ExcInternalError());
deallog << "OK" << std::endl;
// check setting elements for large vectors
deallog << "Check large initialization: ";
for (unsigned int i=0; i<100000; ++i)
for (unsigned int d=0; d<n_vectors; ++d)
- Assert (a[i][d] == 1., ExcInternalError());
+ AssertThrow (a[i][d] == 1., ExcInternalError());
deallog << "OK" << std::endl;
// check resize for large vectors
a.resize (400000);
for (unsigned int i=0; i<100000; ++i)
for (unsigned int d=0; d<n_vectors; ++d)
- Assert (a[i][d] == 1., ExcInternalError());
+ AssertThrow (a[i][d] == 1., ExcInternalError());
for (unsigned int i=100000; i<200000; ++i)
for (unsigned int d=0; d<n_vectors; ++d)
- Assert (a[i][d] == 2., ExcInternalError());
+ AssertThrow (a[i][d] == 2., ExcInternalError());
for (unsigned int i=200000; i<400000; ++i)
for (unsigned int d=0; d<n_vectors; ++d)
- Assert (a[i][d] == 0., ExcInternalError());
+ AssertThrow (a[i][d] == 0., ExcInternalError());
deallog << "OK" << std::endl;
}