operator+=(Vector &lhs,
const Vector &rhs)
{
- Assert (lhs.size() == rhs.size(),
- ExcDimensionMismatch(lhs.size(), rhs.size());
+ AssertDimension (lhs.size(), rhs.size());
for (unsigned int i=0; i<lhs.size(); ++i)
lhs(i) += rhs(i);
return lhs;
{
(void)component;
AssertIndexRange(component, 1);
- Assert(values.size() == points.size(),
- ExcDimensionMismatch(values.size(), points.size()));
+ AssertDimension(values.size(), points.size());
for (unsigned int i = 0; i < values.size(); ++i)
{
{
(void)component;
AssertIndexRange(component, 1);
- Assert(values.size() == points.size(),
- ExcDimensionMismatch(values.size(), points.size()));
+ AssertDimension(values.size(), points.size());
for (unsigned int i = 0; i < values.size(); ++i)
{
virtual void vector_value(const Point<dim> &p,
Vector<double> & values) const override
{
- Assert(values.size() == dim, ExcDimensionMismatch(values.size(), dim));
+ AssertDimension(values.size(), dim);
Assert(dim >= 2, ExcInternalError());
Point<dim> point_1, point_2;
{
const unsigned int n_points = points.size();
- Assert(value_list.size() == n_points,
- ExcDimensionMismatch(value_list.size(), n_points));
+ AssertDimension(value_list.size(), n_points);
for (unsigned int p = 0; p < n_points; ++p)
RightHandSide<dim>::vector_value(points[p], value_list[p]);
inline void BodyForce<dim>::vector_value(const Point<dim> & /*p*/,
Vector<double> &values) const
{
- Assert(values.size() == dim, ExcDimensionMismatch(values.size(), dim));
+ AssertDimension(values.size(), dim);
const double g = 9.81;
const double rho = 7700;
{
const unsigned int n_points = points.size();
- Assert(value_list.size() == n_points,
- ExcDimensionMismatch(value_list.size(), n_points));
+ AssertDimension(value_list.size(), n_points);
for (unsigned int p = 0; p < n_points; ++p)
BodyForce<dim>::vector_value(points[p], value_list[p]);
IncrementalBoundaryValues<dim>::vector_value(const Point<dim> & /*p*/,
Vector<double> &values) const
{
- Assert(values.size() == dim, ExcDimensionMismatch(values.size(), dim));
+ AssertDimension(values.size(), dim);
values = 0;
values(2) = -present_timestep * velocity;
{
const unsigned int n_points = points.size();
- Assert(value_list.size() == n_points,
- ExcDimensionMismatch(value_list.size(), n_points));
+ AssertDimension(value_list.size(), n_points);
for (unsigned int p = 0; p < n_points; ++p)
IncrementalBoundaryValues<dim>::vector_value(points[p], value_list[p]);
KInverse<dim>::value_list (const std::vector<Point<dim> > &points,
std::vector<Tensor<2,dim> > &values) const
{
- Assert (points.size() == values.size(),
- ExcDimensionMismatch (points.size(), values.size()));
+ AssertDimension (points.size(), values.size());
for (unsigned int p=0; p<points.size(); ++p)
{
KInverse<dim>::value_list (const std::vector<Point<dim> > &points,
std::vector<Tensor<2,dim> > &values) const
{
- Assert (points.size() == values.size(),
- ExcDimensionMismatch (points.size(), values.size()));
+ AssertDimension (points.size(), values.size());
for (unsigned int p=0; p<points.size(); ++p)
{
void ExactSolution<dim>::vector_value(const Point<dim> &p,
Vector<double> & values) const
{
- Assert(values.size() == dim + 1,
- ExcDimensionMismatch(values.size(), dim + 1));
+ AssertDimension(values.size(), dim + 1);
values(0) = alpha * p[1] * p[1] / 2 + beta - alpha * p[0] * p[0] / 2;
values(1) = alpha * p[0] * p[1];
value_list(const std::vector<Point<dim>> &points,
std::vector<Tensor<2, dim>> & values) const override
{
- Assert(points.size() == values.size(),
- ExcDimensionMismatch(points.size(), values.size()));
+ AssertDimension(points.size(), values.size());
for (unsigned int p = 0; p < points.size(); ++p)
{
value_list(const std::vector<Point<dim>> &points,
std::vector<Tensor<2, dim>> & values) const override
{
- Assert(points.size() == values.size(),
- ExcDimensionMismatch(points.size(), values.size()));
+ AssertDimension(points.size(), values.size());
for (unsigned int p = 0; p < points.size(); ++p)
{
virtual void vector_value(const Point<dim> & /*p*/,
Vector<double> &values) const override
{
- Assert(values.size() == 2, ExcDimensionMismatch(values.size(), 2));
+ AssertDimension(values.size(), 2);
values(0) = 1;
values(1) = 0;
vector_value_list(const std::vector<Point<dim>> &points,
std::vector<Vector<double>> & value_list) const override
{
- Assert(value_list.size() == points.size(),
- ExcDimensionMismatch(value_list.size(), points.size()));
+ AssertDimension(value_list.size(), points.size());
for (unsigned int p = 0; p < points.size(); ++p)
DirichletBoundaryValues<dim>::vector_value(points[p], value_list[p]);
const DataPostprocessorInputs::Vector<dim> &inputs,
std::vector<Vector<double>> & computed_quantities) const
{
- Assert(computed_quantities.size() == inputs.solution_values.size(),
- ExcDimensionMismatch(computed_quantities.size(),
- inputs.solution_values.size()));
+ AssertDimension(computed_quantities.size(), inputs.solution_values.size());
// The computation itself is straightforward: We iterate over each
// entry in the output vector and compute $|u|$ from the
// something called a "norm".)
for (unsigned int i = 0; i < computed_quantities.size(); ++i)
{
- Assert(computed_quantities[i].size() == 1,
- ExcDimensionMismatch(computed_quantities[i].size(), 1));
- Assert(inputs.solution_values[i].size() == 2,
- ExcDimensionMismatch(inputs.solution_values[i].size(), 2));
+ AssertDimension(computed_quantities[i].size(), 1);
+ AssertDimension(inputs.solution_values[i].size(), 2);
const std::complex<double> u(inputs.solution_values[i](0),
inputs.solution_values[i](1));
const unsigned int /*component*/ = 0) const override
{
(void)points;
- Assert(values.size() == points.size(),
- ExcDimensionMismatch(values.size(), points.size()));
+ AssertDimension(values.size(), points.size());
std::fill(values.begin(), values.end(), 0.);
}
std::vector<double> & values,
const unsigned int /*component*/ = 0) const override
{
- Assert(values.size() == points.size(),
- ExcDimensionMismatch(values.size(), points.size()));
+ AssertDimension(values.size(), points.size());
for (unsigned int i = 0; i < values.size(); ++i)
{
void value_list(const std::vector<Point<dim>> &points,
std::vector<Point<dim>> & values) const
{
- Assert(values.size() == points.size(),
- ExcDimensionMismatch(values.size(), points.size()));
+ AssertDimension(values.size(), points.size());
for (unsigned int i = 0; i < points.size(); ++i)
{
const unsigned int) const
{
const unsigned int n_points = points.size();
- Assert(values.size() == n_points,
- ExcDimensionMismatch(values.size(), n_points));
+ AssertDimension(values.size(), n_points);
for (unsigned int i = 0; i < n_points; ++i)
values[i] = Velocity<dim>::value(points[i]);
}
(void)component;
AssertIndexRange(component, 1);
const unsigned int n_points = points.size();
- Assert(values.size() == n_points,
- ExcDimensionMismatch(values.size(), n_points));
+ AssertDimension(values.size(), n_points);
for (unsigned int i = 0; i < n_points; ++i)
values[i] = Pressure<dim>::value(points[i]);
}
void KInverse<dim>::value_list(const std::vector<Point<dim>> &points,
std::vector<Tensor<2, dim>> & values) const
{
- Assert(points.size() == values.size(),
- ExcDimensionMismatch(points.size(), values.size()));
+ AssertDimension(points.size(), values.size());
for (unsigned int p = 0; p < points.size(); ++p)
{
const DataPostprocessorInputs::Vector<dim> &inputs,
std::vector<Vector<double>> & computed_quantities) const
{
- Assert(computed_quantities.size() == inputs.solution_values.size(),
- ExcDimensionMismatch(computed_quantities.size(),
- inputs.solution_values.size()));
+ AssertDimension(computed_quantities.size(), inputs.solution_values.size());
for (unsigned int q = 0; q < computed_quantities.size(); ++q)
{
- Assert(computed_quantities[q].size() == 1,
- ExcDimensionMismatch(computed_quantities[q].size(), 1));
- Assert(inputs.solution_values[q].size() == 2,
- ExcDimensionMismatch(inputs.solution_values[q].size(), 2));
+ AssertDimension(computed_quantities[q].size(), 1);
+ AssertDimension(inputs.solution_values[q].size(), 2);
const std::complex<double> psi(inputs.solution_values[q](0),
inputs.solution_values[q](1));
const DataPostprocessorInputs::Vector<dim> &inputs,
std::vector<Vector<double>> & computed_quantities) const
{
- Assert(computed_quantities.size() == inputs.solution_values.size(),
- ExcDimensionMismatch(computed_quantities.size(),
- inputs.solution_values.size()));
+ AssertDimension(computed_quantities.size(), inputs.solution_values.size());
double max_phase = -numbers::PI;
for (unsigned int q = 0; q < computed_quantities.size(); ++q)
{
- Assert(computed_quantities[q].size() == 1,
- ExcDimensionMismatch(computed_quantities[q].size(), 1));
- Assert(inputs.solution_values[q].size() == 2,
- ExcDimensionMismatch(inputs.solution_values[q].size(), 2));
+ AssertDimension(computed_quantities[q].size(), 1);
+ AssertDimension(inputs.solution_values[q].size(), 2);
max_phase =
std::max(max_phase,
void Coefficient<dim>::value_list(const std::vector<Point<dim>> &points,
std::vector<Tensor<2, dim>> & values) const
{
- Assert(points.size() == values.size(),
- ExcDimensionMismatch(points.size(), values.size()));
+ AssertDimension(points.size(), values.size());
for (unsigned int p = 0; p < points.size(); ++p)
values[p] = unit_symmetric_tensor<dim>();
}
std::vector<double> & values,
const unsigned int component) const
{
- Assert(values.size() == points.size(),
- ExcDimensionMismatch(values.size(), points.size()));
+ AssertDimension(values.size(), points.size());
for (unsigned int i = 0; i < points.size(); ++i)
values[i] = RightHandSide<dim>::value(points[i], component);
std::vector<double> & values,
const unsigned int component) const
{
- Assert(values.size() == points.size(),
- ExcDimensionMismatch(values.size(), points.size()));
+ AssertDimension(values.size(), points.size());
for (unsigned int i = 0; i < points.size(); ++i)
values[i] = BoundaryValues<dim>::value(points[i], component);
void right_hand_side(const std::vector<Point<dim>> &points,
std::vector<Tensor<1, dim>> & values)
{
- Assert(values.size() == points.size(),
- ExcDimensionMismatch(values.size(), points.size()));
+ AssertDimension(values.size(), points.size());
Assert(dim >= 2, ExcNotImplemented());
// The rest of the function implements computing force values. We will use
// this macro call declares and defines a class
// <code>ExcDimensionMismatch</code> inheriting from ExceptionBase which
// implements all necessary error output functions.
+ //
+ // @note This exception is similarly used inside the
+ // <code>AssertDimension</code> macro, which is a handy wrapper to the
+ // check the dimensions of two given objects.
};
// The following two functions implement the interface described above. The