copy_data());
std::cout << "result: " << result << std::endl;
- Assert(result == v.size(), ExcMessage("uhuh!"));
+ Assert((unsigned int)result == v.size(), ExcMessage("uhuh!"));
}
deallog << std::endl;
std::vector<Number> return_values(n_points);
f.value_list(points, return_values /*, component = 0*/);
- for (int i = 0; i < n_points; ++i)
+ for (unsigned int i = 0; i < n_points; ++i)
{
deallog << return_values[i] << ' ';
}
deallog << std::endl;
f.value_list(points, return_values, std::min(n_component - 1, 3u));
- for (int i = 0; i < n_points; ++i)
+ for (unsigned int i = 0; i < n_points; ++i)
{
deallog << return_values[i] << ' ';
}
std::vector<Vector<Number>> return_values(n_points,
Vector<Number>(n_component));
f.vector_value_list(points, return_values);
- for (int p = 0; p < n_points; ++p)
+ for (unsigned int p = 0; p < n_points; ++p)
{
for (unsigned int c = 0; c < n_component; ++c)
deallog << return_values[p][c] << ' ';
Point<dim> forbidden = Utilities::unpack<Point<dim>>(
point_compressed.cbegin(), point_compressed.cend(), false);
}
- catch (boost::archive::archive_exception)
+ catch (const boost::archive::archive_exception &)
{
deallog << "unpacking compressed point without decompression failed!"
<< std::endl;
Utilities::unpack(
array_compressed.cbegin(), array_compressed.cend(), forbidden, false);
}
- catch (boost::archive::archive_exception)
+ catch (const boost::archive::archive_exception &)
{
deallog << "unpacking compressed array without decompression failed!"
<< std::endl;
Point<dim> forbidden = Utilities::unpack<Point<dim>>(
point_uncompressed.cbegin(), point_uncompressed.cend(), true);
}
- catch (boost::archive::archive_exception)
+ catch (const boost::archive::archive_exception &)
{
deallog << "unpacking uncompressed point with decompression failed!"
<< std::endl;
forbidden,
true);
}
- catch (boost::archive::archive_exception)
+ catch (const boost::archive::archive_exception &)
{
deallog << "unpacking uncompressed array with decompression failed!"
<< std::endl;
<< " Point: " << p;
deallog << std::endl; // Flush deallog buffer
}
- catch (GridTools::ExcPointNotFound<2>)
+ catch (const GridTools::ExcPointNotFound<2> &)
{
deallog
<< "The first call to the function find_closest_vertex() has thrown "
// do some local refinement
Point<dim> p0;
p0 *= 0.;
- for (int i = 0; i < n_refinements; ++i)
+ for (unsigned int i = 0; i < n_refinements; ++i)
{
typename Triangulation<dim>::active_cell_iterator cell;
for (cell = tria2.begin_active(); cell != tria2.end(); ++cell)
if (hanging_node_dofs[dof])
AssertThrow(constraints.is_constrained(dof), ExcInternalError());
- AssertThrow(std::count(hanging_node_dofs.begin(),
- hanging_node_dofs.end(),
- true) == constraints.n_constraints(),
+ AssertThrow((unsigned int)std::count(hanging_node_dofs.begin(),
+ hanging_node_dofs.end(),
+ true) == constraints.n_constraints(),
ExcInternalError());
output_bool_vector(hanging_node_dofs);
}
if (is_hanging_node_constrained[dof])
AssertThrow(constraints.is_constrained(dof), ExcInternalError());
- AssertThrow(std::count(is_hanging_node_constrained.begin(),
- is_hanging_node_constrained.end(),
- true) == constraints.n_constraints(),
+ AssertThrow((unsigned int)(std::count(is_hanging_node_constrained.begin(),
+ is_hanging_node_constrained.end(),
+ true)) == constraints.n_constraints(),
ExcInternalError());
deallog << "OK" << std::endl;
for (auto cell : tr.cell_iterators())
AssertThrow((cell->user_flag_set() == !cell->has_children()) ||
- (l != cell->level()),
+ (l != (unsigned int)cell->level()),
ExcInternalError());
}
QGauss<dim> quadrature(8);
deallog << "orthogonality: " << std::endl;
- for (int k1 = 0; k1 < N; k1++)
- for (int k2 = 0; k2 < N; k2++)
+ for (unsigned int k1 = 0; k1 < N; k1++)
+ for (unsigned int k2 = 0; k2 < N; k2++)
{
double ortho = 0;
for (unsigned int q = 0; q < quadrature.size(); ++q)
void
check()
{
- int nFails = 0;
- int maxDim = 10;
+ unsigned int nFails = 0;
+ unsigned int maxDim = 10;
for (unsigned int i = 1; i <= maxDim; ++i)
{
for (unsigned int j = 1; j <= maxDim; ++j)
// Check that all the vertices are within the sphere
// (sphere with thickness 100. *std::numeric_limits<double>::epsilon())
- for (int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+ for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
AssertThrow(std::fabs(center.distance(tria.begin_active()->vertex(v))) <
radius + 100. * std::numeric_limits<double>::epsilon(),
ExcInternalError());
// a saddle surface
Point<3> distort_twisted(Point<3> p)
{
- if (p(2) > 0.5 && (p(0) > 0.5 ^ p(1) > 0.5))
+ if (p(2) > 0.5 && ((p(0) > 0.5) ^ (p(1) > 0.5)))
{
p(2) += 1;
}
deallog << mapping_point[d] << " ";
deallog << std::endl;
}
- catch (typename Mapping<dim, spacedim>::ExcTransformationFailed)
+ catch (const typename Mapping<dim, spacedim>::ExcTransformationFailed &)
{
deallog << "No MappingQ transform possible for this cell and point."
<< std::endl;
tria.refine_global(4);
Vector<float> indicator(tria.n_active_cells());
- for (int i = 0; i != indicator.size(); ++i)
+ for (unsigned int i = 0; i != indicator.size(); ++i)
{
indicator[i] = i;
}
deallog << "n_active_cells: " << tria.n_active_cells() << std::endl;
indicator.reinit(tria.n_active_cells());
- for (int i = 0; i != indicator.size(); ++i)
+ for (unsigned int i = 0; i != indicator.size(); ++i)
{
indicator[i] = i;
}
test_leak<Vector<double>>();
test_leak<Vector<float>>();
}
- catch (StandardExceptions::ExcMemoryLeak e)
+ catch (const StandardExceptions::ExcMemoryLeak &e)
{
deallog << "Exception: " << e.get_exc_name() << std::endl;
}
cell != triangulation.end();
++cell)
if (cell->is_locally_owned() &&
- (cell->center().norm() < 0.5 &&
- (cell->level() < 5 || cell->center().norm() > 0.45) ||
+ ((cell->center().norm() < 0.5 &&
+ (cell->level() < 5 || cell->center().norm() > 0.45)) ||
(dim == 2 && cell->center().norm() > 1.2)))
cell->set_refine_flag();
triangulation.execute_coarsening_and_refinement();
{
mapping.transform_real_to_unit_cell(cell, point);
}
- catch (typename Mapping<dim>::ExcTransformationFailed)
+ catch (const typename Mapping<dim>::ExcTransformationFailed &)
{
deallog << "Transformation for point " << point << " on cell with "
<< "center " << cell->center() << " is not invertible"
cell != triangulation.end();
++cell)
if (cell->is_locally_owned() &&
- (cell->center().norm() < 0.5 &&
- (cell->level() < 5 || cell->center().norm() > 0.45) ||
+ ((cell->center().norm() < 0.5 &&
+ (cell->level() < 5 || cell->center().norm() > 0.45)) ||
(dim == 2 && cell->center().norm() > 1.2)))
cell->set_refine_flag();
triangulation.execute_coarsening_and_refinement();
distributed_stokes_rhs,
preconditioner_cheap);
}
- catch (SolverControl::NoConvergence)
+ catch (const SolverControl::NoConvergence &)
{
deallog
<< "********************************************************************"
void
test()
{
- unsigned int myid = Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);
- const unsigned int numprocs = Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD);
+ unsigned int myid = Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);
+ const int numprocs = Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD);
{
Vector<int> values(2);
sums[0] = 1;
sums[1] = 2;
Utilities::MPI::sum(sums, MPI_COMM_WORLD, sums);
- Assert(sums[0] == numprocs, ExcInternalError());
- Assert(sums[1] == 2 * numprocs, ExcInternalError());
+ Assert((unsigned int)sums[0] == numprocs, ExcInternalError());
+ Assert((unsigned int)sums[1] == 2 * numprocs, ExcInternalError());
if (myid == 0)
deallog << sums[0] << ' ' << sums[1] << std::endl;
IndexSet local_relevant_3(global_size);
local_relevant_3.add_index(2);
- if (myid > 0 < my_start)
+ if (myid > 0 && my_start > 0)
local_relevant_3.add_range(my_start - 10, my_start);
Utilities::MPI::Partitioner x(local_owned, MPI_COMM_WORLD);
x.set_ghost_indices(local_relevant_3, v.ghost_indices());
IndexSet local_relevant_3(global_size);
local_relevant_3.add_index(2);
- if (myid > 0 < my_start)
+ if (myid > 0 && my_start > 0)
local_relevant_3.add_range(my_start - 10, my_start);
Utilities::MPI::Partitioner x(local_owned, MPI_COMM_WORLD);
x.set_ghost_indices(local_relevant_3, v.ghost_indices());
// set local values
if (myid < 8)
{
- types::global_dof_index n_elements = 2;
- types::global_dof_index indices[n_elements];
+ constexpr types::global_dof_index n_elements = 2;
+ types::global_dof_index indices[n_elements];
indices[0] = myid * 2;
indices[1] = myid * 2 + 1;
float values[2];
{
norm = v_tmp.linfty_norm();
}
- catch (TrilinosWrappers::MPI::Vector::ExcTrilinosError e)
+ catch (const TrilinosWrappers::MPI::Vector::ExcTrilinosError &e)
{
deallog << e.get_exc_name() << std::endl;
exc = true;
if (my_id == 0)
{
deallog << "Distributed:" << std::endl;
- for (unsigned int i = begin_index; i < end_index; ++i)
+ for (int i = begin_index; i < end_index; ++i)
deallog << i << ": " << distributed(i) << std::endl;
deallog << "Ghosted:" << std::endl;
- for (unsigned int i = local_begin; i < local_end; ++i)
+ for (int i = local_begin; i < local_end; ++i)
deallog << i << ": " << ghosted(i) << std::endl;
}
// verify correct value
- for (unsigned int i = begin_index; i < end_index; ++i)
+ for (int i = begin_index; i < end_index; ++i)
Assert(distributed(i) == 3, ExcInternalError());
- for (unsigned int i = local_begin; i < local_end; ++i)
+ for (int i = local_begin; i < local_end; ++i)
Assert(ghosted(i) == 3, ExcInternalError());
}
do_rotate(tria);
}
+template <int dim>
+typename Triangulation<dim>::quad_iterator
+get_quad_iterator(const typename Triangulation<dim>::active_cell_iterator &cell,
+ const unsigned int quad);
+
+template <>
+typename Triangulation<2>::quad_iterator
+get_quad_iterator<2>(
+ const typename Triangulation<2>::active_cell_iterator &cell,
+ const unsigned int /*quad*/)
+{
+ return *reinterpret_cast<const typename Triangulation<2>::quad_iterator *>(
+ &cell);
+}
+
+template <>
+typename Triangulation<3>::quad_iterator
+get_quad_iterator<3>(
+ const typename Triangulation<3>::active_cell_iterator &cell,
+ const unsigned int quad)
+{
+ return cell->quad(quad);
+}
+
template <int dim>
void
for (unsigned int e = 0; e < GeometryInfo<dim>::quads_per_cell; ++e)
{
const typename Triangulation<dim>::quad_iterator quad =
- (dim > 2 ?
- cell->quad(e) :
- *reinterpret_cast<
- const typename Triangulation<dim>::quad_iterator *>(&cell));
+ get_quad_iterator<dim>(cell, e);
deallog << " Quad " << e << ", projected point=";
#include "../tests.h"
+template <int dim>
+typename Triangulation<dim>::quad_iterator
+get_quad_iterator(const typename Triangulation<dim>::active_cell_iterator &cell,
+ const unsigned int quad);
+
+template <>
+typename Triangulation<2>::quad_iterator
+get_quad_iterator<2>(
+ const typename Triangulation<2>::active_cell_iterator &cell,
+ const unsigned int /*quad*/)
+{
+ return *reinterpret_cast<const typename Triangulation<2>::quad_iterator *>(
+ &cell);
+}
+
+template <>
+typename Triangulation<3>::quad_iterator
+get_quad_iterator<3>(
+ const typename Triangulation<3>::active_cell_iterator &cell,
+ const unsigned int quad)
+{
+ return cell->quad(quad);
+}
+
template <int dim>
void
for (unsigned int e = 0; e < GeometryInfo<dim>::quads_per_cell; ++e)
{
const typename Triangulation<dim>::quad_iterator quad =
- (dim > 2 ?
- cell->quad(e) :
- *reinterpret_cast<
- const typename Triangulation<dim>::quad_iterator *>(&cell));
+ get_quad_iterator<dim>(cell, e);
deallog << " Quad " << e << ", projected point=";
v.compress(VectorOperation::insert);
PETScWrappers::MPI::Vector v2(MPI_COMM_WORLD, s, s);
- for (int k = 0; k < v2.size(); ++k)
+ for (int k = 0; (unsigned int)k < v2.size(); ++k)
v2(k) = PetscScalar(k, -k);
v2.compress(VectorOperation::insert);
for (unsigned int i = 0; i < n; ++i)
sp.add(mati[i], matj[i]);
- for (unsigned int i = 0; i < dim; ++i)
+ for (int i = 0; i < dim; ++i)
sp.add(i, i);
sp.compress();
TrilinosWrappers::MPI::Vector x2(owned, MPI_COMM_WORLD);
TrilinosWrappers::MPI::Vector b(owned, MPI_COMM_WORLD);
- for (unsigned int i = 0; i < dim; ++i)
+ for (int i = 0; i < dim; ++i)
mat.set(i, i, 1.0);
{
deallog.push("Jacobi");
- static constexpr std::array<int, 2> lower{49, 100};
- TrilinosWrappers::PreconditionJacobi preconditioner;
+ static constexpr std::array<unsigned int, 2> lower{49, 100};
+ TrilinosWrappers::PreconditionJacobi preconditioner;
solution = 0;
SolverControl solver_control(1000, 1e-10);
SolverCG<> solver(solver_control);
{
deallog.push("SSOR");
- static constexpr std::array<int, 2> lower{40, 77};
- TrilinosWrappers::PreconditionSSOR preconditioner;
+ static constexpr std::array<unsigned int, 2> lower{40, 77};
+ TrilinosWrappers::PreconditionSSOR preconditioner;
solution = 0;
SolverControl solver_control(1000, 1e-10);
SolverCG<> solver(solver_control);
{
deallog.push("SOR");
- static constexpr std::array<int, 2> lower{31, 62};
- TrilinosWrappers::PreconditionSOR preconditioner;
+ static constexpr std::array<unsigned int, 2> lower{31, 62};
+ TrilinosWrappers::PreconditionSOR preconditioner;
solution = 0;
SolverControl solver_control(1000, 1e-5);
SolverBicgstab<> solver(solver_control);
{
deallog.push("BlockJacobi");
- static constexpr std::array<int, 2> lower{73, 145};
+ static constexpr std::array<unsigned int, 2> lower{73, 145};
TrilinosWrappers::PreconditionBlockJacobi preconditioner;
TrilinosWrappers::PreconditionBlockJacobi::AdditionalData data;
data.block_size = 16;
{
deallog.push("BlockSSOR");
- static constexpr std::array<int, 2> lower{30, 59};
+ static constexpr std::array<unsigned int, 2> lower{30, 59};
TrilinosWrappers::PreconditionBlockSSOR preconditioner;
TrilinosWrappers::PreconditionBlockSSOR::AdditionalData data;
data.block_size = 16;
{
deallog.push("BlockSOR");
- static constexpr std::array<int, 2> lower{18, 37};
+ static constexpr std::array<unsigned int, 2> lower{18, 37};
TrilinosWrappers::PreconditionBlockSOR preconditioner;
TrilinosWrappers::PreconditionBlockSOR::AdditionalData data;
data.block_size = 16;
{
deallog.push("IC");
- static constexpr std::array<int, 2> lower{49, 67};
- TrilinosWrappers::PreconditionIC preconditioner;
+ static constexpr std::array<unsigned int, 2> lower{49, 67};
+ TrilinosWrappers::PreconditionIC preconditioner;
solution = 0;
SolverControl solver_control(1000, 1e-10);
SolverCG<> solver(solver_control);
}
{
- static constexpr std::array<int, 2> lower{30, 56};
+ static constexpr std::array<unsigned int, 2> lower{30, 56};
deallog.push("ILU");
TrilinosWrappers::PreconditionILU preconditioner;
solution = 0;
{
deallog.push("ILUT");
- static constexpr std::array<int, 2> lower{11, 19};
+ static constexpr std::array<unsigned int, 2> lower{11, 19};
TrilinosWrappers::PreconditionILUT preconditioner;
TrilinosWrappers::PreconditionILUT::AdditionalData data;
data.ilut_drop = 1e-6;
{
deallog.push("Chebyshev");
- static constexpr std::array<int, 2> lower{23, 46};
+ static constexpr std::array<unsigned int, 2> lower{23, 46};
TrilinosWrappers::PreconditionChebyshev preconditioner;
TrilinosWrappers::PreconditionChebyshev::AdditionalData data;
data.max_eigenvalue = 2.5;
check_solver_within_range(
solver.solve(system_matrix, solution, system_rhs, preconditioner),
solver_control.last_step(),
- 1,
- 1);
+ 1U,
+ 1U);
deallog.pop();
}