Skip to content
Snippets Groups Projects

Feature/glace boundary conditions

18 files
+ 1116
471
Compare changes
  • Side-by-side
  • Inline

Files

@@ -28,14 +28,16 @@ class SparseMatrixDescriptor
return m_id_value_map.size();
}
const DataType& operator[](const IndexType& j) const
const DataType&
operator[](const IndexType& j) const
{
auto i_value = m_id_value_map.find(j);
Assert(i_value != m_id_value_map.end());
return i_value->second;
}
DataType& operator[](const IndexType& j)
DataType&
operator[](const IndexType& j)
{
auto i_value = m_id_value_map.find(j);
if (i_value != m_id_value_map.end()) {
@@ -51,7 +53,7 @@ class SparseMatrixDescriptor
operator<<(std::ostream& os, const SparseRowDescriptor& row)
{
for (auto [j, value] : row.m_id_value_map) {
os << ' ' << j << ':' << value;
os << ' ' << static_cast<size_t>(j) << ':' << value;
}
return os;
}
@@ -73,24 +75,30 @@ class SparseMatrixDescriptor
SparseRowDescriptor&
row(const IndexType i)
{
Assert(i < m_row_array.size());
return m_row_array[i];
}
const SparseRowDescriptor&
row(const IndexType i) const
{
Assert(i < m_row_array.size());
return m_row_array[i];
}
DataType&
operator()(const IndexType& i, const IndexType& j)
{
Assert(i < m_row_array.size());
Assert(j < m_row_array.size());
return m_row_array[i][j];
}
const DataType&
operator()(const IndexType& i, const IndexType& j) const
{
Assert(i < m_row_array.size());
Assert(j < m_row_array.size());
const auto& r = m_row_array[i]; // split to ensure const-ness of call
return r[j];
}
@@ -99,7 +107,7 @@ class SparseMatrixDescriptor
operator<<(std::ostream& os, const SparseMatrixDescriptor& M)
{
for (IndexType i = 0; i < M.m_row_array.size(); ++i) {
os << i << " |" << M.m_row_array[i] << '\n';
os << static_cast<size_t>(i) << " |" << M.m_row_array[i] << '\n';
}
return os;
}
Loading