Commit 29b70c57 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#1292 Fix warnings.

parent 0540b3a3
......@@ -72,7 +72,7 @@ namespace MoReFEM
}
// \todo #1292 Probably might be done with native Xtensor functions
const LocalMatrix& ExtractSubMatrix(const LocalMatrix& full_matrix,
const RefFEltInLocalOperator& ref_felt)
{
......@@ -83,7 +83,7 @@ namespace MoReFEM
const auto& row_range = ref_felt.GetLocalNodeIndexList();
const auto ref_felt_space_dim = static_cast<int>(ref_felt.GetFEltSpaceDimension());
const auto ref_felt_space_dim = static_cast<std::size_t>(ref_felt.GetFEltSpaceDimension());
#ifndef NDEBUG
// \todo #1292 Wrappers::Seldon::AssertBlockRowValidity(full_matrix, row_range);
......@@ -98,7 +98,7 @@ namespace MoReFEM
{
auto row_index = row_range[i];
for (int component = 0; component < ref_felt_space_dim; ++component)
for (auto component = 0ul; component < ref_felt_space_dim; ++component)
ret(i, component) = full_matrix(row_index, component);
}
......
......@@ -47,8 +47,8 @@ namespace MoReFEM
const auto& ref_felt = elementary_data.GetRefFElt(unknown);
const auto& test_ref_felt = elementary_data.GetTestRefFElt(test_unknown);
const int Nnode_for_unknown = static_cast<int>(ref_felt.Nnode());
const int Nnode_for_test_unknown = static_cast<int>(test_ref_felt.Nnode());
const auto Nnode_for_unknown = static_cast<std::size_t>(ref_felt.Nnode());
const auto Nnode_for_test_unknown = static_cast<std::size_t>(test_ref_felt.Nnode());
#ifndef NDEBUG
{
......@@ -97,12 +97,12 @@ namespace MoReFEM
const auto& infos_at_quad_pt_list = elementary_data.GetInformationsAtQuadraturePointList();
const int Nnode_for_unknown = static_cast<int>(ref_felt.Nnode());
const int Nnode_for_test_unknown = static_cast<int>(test_ref_felt.Nnode());
const auto Nnode_for_unknown = static_cast<std::size_t>(ref_felt.Nnode());
const auto Nnode_for_test_unknown = static_cast<std::size_t>(test_ref_felt.Nnode());
const int Ncomponent = static_cast<int>(ref_felt.Ncomponent());
const auto Ncomponent = static_cast<std::size_t>(ref_felt.Ncomponent());
assert(Ncomponent == static_cast<int>(test_ref_felt.Ncomponent()));
assert(Ncomponent == static_cast<std::size_t>(test_ref_felt.Ncomponent()));
for (const auto& infos_at_quad_pt : infos_at_quad_pt_list)
{
......@@ -130,13 +130,13 @@ namespace MoReFEM
// Then report it into the elementary matrix.
for (int m = 0; m < Nnode_for_test_unknown; ++m)
for (auto m = 0ul; m < Nnode_for_test_unknown; ++m)
{
for (int n = 0; n < Nnode_for_unknown; ++n)
for (auto n = 0ul; n < Nnode_for_unknown; ++n)
{
const double value = block_matrix(m, n);
for (int deriv_component = 0; deriv_component < Ncomponent; ++deriv_component)
for (auto deriv_component = 0ul; deriv_component < Ncomponent; ++deriv_component)
{
const auto shift = Nnode_for_test_unknown * deriv_component;
matrix_result(m + shift, n + shift) += value;
......
......@@ -216,8 +216,7 @@ namespace MoReFEM
std::vector<LocalRowContent> LocalMatrixContent(const LocalMatrix& matrix)
{
{
const auto Nrow = matrix.shape(0);
const auto Ncol = matrix.shape(1);
......@@ -226,11 +225,11 @@ namespace MoReFEM
std::vector<LocalRowContent> ret;
ret.reserve(static_cast<std::size_t>(Nrow));
for (auto row = 0; row < Nrow; ++row)
for (auto row = 0ul; row < Nrow; ++row)
{
LocalRowContent line_content;
for (auto col = 0; col < Ncol; ++col)
for (auto col = 0ul; col < Ncol; ++col)
{
const auto value = matrix(row, col);
......
......@@ -67,13 +67,13 @@ namespace MoReFEM
const auto Nunknown = source_unknown_list.size();
assert(Nunknown == target_unknown_list.size());
int shift_row = 0;
int shift_col = 0;
auto shift_row = 0;
auto shift_col = 0;
const auto dimension = source_data.GetFEltSpace().GetMeshDimension();
int Nnode_in_row = node_block.shape(0);
int Nnode_in_col = node_block.shape(1);
const auto Nnode_in_row = node_block.shape(0);
const auto Nnode_in_col = node_block.shape(1);
auto& local_projection_matrix = GetNonCstProjectionMatrix();
......@@ -93,11 +93,11 @@ namespace MoReFEM
}
#endif // NDEBUG
for (int component = 0; component < Ncomponent; ++component)
for (auto component = 0; component < Ncomponent; ++component)
{
for (auto row = 0; row < Nnode_in_row; ++row)
for (auto row = 0ul; row < Nnode_in_row; ++row)
{
for (auto col = 0; col < Nnode_in_col; ++col)
for (auto col = 0ul; col < Nnode_in_col; ++col)
local_projection_matrix(row + shift_row, col + shift_col) = node_block(row, col);
}
......
......@@ -41,12 +41,12 @@ namespace MoReFEM
assert(full_matrix.shape(0) >= Ncomponent);
assert(full_matrix.shape(1) >= Ncomponent);
const int first_row_index_in_full_matrix = static_cast<int>(row_component) * Ncomponent;
const int first_col_index_in_full_matrix = static_cast<int>(col_component) * Ncomponent;
const auto first_row_index_in_full_matrix = row_component * Ncomponent;
const auto first_col_index_in_full_matrix = col_component * Ncomponent;
for (int m = 0; m < Ncomponent; ++m)
for (auto m = 0ul; m < Ncomponent; ++m)
{
for (int n = 0; n < Ncomponent; ++n)
for (auto n = 0ul; n < Ncomponent; ++n)
{
assert(first_row_index_in_full_matrix + m < full_matrix.shape(0));
assert(first_col_index_in_full_matrix + n < full_matrix.shape(1));
......@@ -63,15 +63,15 @@ namespace MoReFEM
XtensorMatrix& column_matrix)
{
const auto Ncomponent = column_matrix.shape(0);
assert(static_cast<int>(row_component) < Ncomponent);
assert(static_cast<int>(column_matrix.shape(1)) == 1);
assert(static_cast<std::size_t>(row_component) < Ncomponent);
assert(static_cast<size_t>(column_matrix.shape(1)) == 1ul);
// >= and not > in the following assert because of the 1D case where this extraction is just a copy.
// Indeed the two matrices in this case are in fact scalars.
assert(full_column_matrix.shape(0) >= Ncomponent);
const int first_row_index_in_full_column_matrix = static_cast<int>(row_component) * Ncomponent;
const auto first_row_index_in_full_column_matrix = row_component * Ncomponent;
for (int m = 0; m < Ncomponent; ++m)
for (auto m = 0ul; m < Ncomponent; ++m)
{
assert(first_row_index_in_full_column_matrix + m < full_column_matrix.shape(0));
......@@ -85,15 +85,15 @@ namespace MoReFEM
XtensorMatrix& row_matrix)
{
const auto Ncomponent = row_matrix.shape(1);
assert(static_cast<int>(col_component) < Ncomponent);
assert(static_cast<int>(row_matrix.shape(0)) == 1);
assert(col_component < Ncomponent);
assert(row_matrix.shape(0) == 1);
// >= and not > in the following assert because of the 1D case where this extraction is just a copy.
// Indeed the two matrices in this case are in fact scalars.
assert(full_row_matrix.shape(0) >= Ncomponent);
const int first_col_index_in_full_row_matrix = static_cast<int>(col_component) * Ncomponent;
const auto first_col_index_in_full_row_matrix = static_cast<std::size_t>(col_component) * Ncomponent;
for (int m = 0; m < Ncomponent; ++m)
for (auto m = 0ul; m < Ncomponent; ++m)
{
assert(first_col_index_in_full_row_matrix + m < full_row_matrix.shape(0));
......
......@@ -109,9 +109,9 @@ namespace MoReFEM
const auto& dof_list = node.GetDofList();
const auto Ndof = static_cast<int>(dof_list.size());
const auto Ndof = dof_list.size();
for (auto dof_index = 0; dof_index < Ndof; ++dof_index)
for (auto dof_index = 0ul; dof_index < Ndof; ++dof_index)
{
const auto& dof_ptr = dof_list[static_cast<std::size_t>(dof_index)];
assert(!(!dof_ptr));
......
......@@ -112,10 +112,8 @@ namespace MoReFEM
const auto Nrow = matrix.shape(0);
const auto Ncol = matrix.shape(1);
bool is_non_zero = false;
for (int i = 0; i < Nrow && !is_non_zero; ++i)
for (int j = 0; j < Ncol && !is_non_zero; ++j)
for (auto i = 0ul; i < Nrow; ++i)
for (auto j = 0ul; j < Ncol; ++j)
if (!NumericNS::IsZero(matrix(i, j)))
return false;
......
......@@ -293,9 +293,9 @@ namespace MoReFEM
const auto Nrow = source.shape(0);
const auto Ncol = source.shape(1);
for (auto i = 0; i < Nrow; ++i)
for (auto i = 0ul; i < Nrow; ++i)
{
for (auto j = 0; j < Ncol; ++j)
for (auto j = 0ul; j < Ncol; ++j)
target(i, j) = factor * source(i, j);
}
......@@ -307,10 +307,7 @@ namespace MoReFEM
{
assert(target.shape(0) == source.shape(0));
const auto Nrow = source.shape(0);
for (int i = 0; i < Nrow; ++i)
target(i) = factor * source(i);
target = factor * source;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment