mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
commit
2829ee1f9b
@ -17,7 +17,6 @@
|
||||
#ifndef OPM_DILU_HEADER_INCLUDED
|
||||
#define OPM_DILU_HEADER_INCLUDED
|
||||
|
||||
#include <config.h>
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
#include <opm/common/TimingMacros.hpp>
|
||||
#include <opm/simulators/linalg/PreconditionerWithUpdate.hpp>
|
||||
|
@ -15,13 +15,11 @@
|
||||
void checkAllIndices(const std::vector<std::size_t>& ordering)
|
||||
{
|
||||
std::vector<int> counters(ordering.size(), 0);
|
||||
for(auto index: ordering)
|
||||
{
|
||||
for (auto index : ordering) {
|
||||
++counters[index];
|
||||
}
|
||||
|
||||
for(auto count: counters)
|
||||
{
|
||||
for (auto count : counters) {
|
||||
BOOST_CHECK(count == 1);
|
||||
}
|
||||
}
|
||||
@ -32,28 +30,22 @@ BOOST_AUTO_TEST_CASE(TestWelschPowell)
|
||||
using Graph = Dune::Amg::MatrixGraph<Matrix>;
|
||||
int N = 10;
|
||||
Matrix matrix(N*N, N*N, 5, 0.4, Matrix::implicit);
|
||||
for( int j = 0; j < N; j++)
|
||||
{
|
||||
for(int i = 0; i < N; i++)
|
||||
{
|
||||
for (int j = 0; j < N; j++) {
|
||||
for (int i = 0; i < N; i++) {
|
||||
auto index = j * 10 + i;
|
||||
matrix.entry(index,index) = 1;
|
||||
|
||||
if ( i > 0 )
|
||||
{
|
||||
if (i > 0) {
|
||||
matrix.entry(index,index-1) = 1;
|
||||
}
|
||||
if ( i < N - 1)
|
||||
{
|
||||
if (i < N - 1) {
|
||||
matrix.entry(index,index+1) = 1;
|
||||
}
|
||||
|
||||
if ( j > 0 )
|
||||
{
|
||||
if (j > 0) {
|
||||
matrix.entry(index,index-N) = 1;
|
||||
}
|
||||
if ( j < N - 1)
|
||||
{
|
||||
if (j < N - 1) {
|
||||
matrix.entry(index,index+N) = 1;
|
||||
}
|
||||
|
||||
@ -71,12 +63,10 @@ BOOST_AUTO_TEST_CASE(TestWelschPowell)
|
||||
|
||||
// Check for checkerboard coloring
|
||||
|
||||
for( int j = 0, index = 0; j < N; j++)
|
||||
{
|
||||
for (int j = 0, index = 0; j < N; j++) {
|
||||
auto expectedColor = firstCornerColor;
|
||||
|
||||
for(int i = 0; i < N; i++)
|
||||
{
|
||||
for (int i = 0; i < N; i++) {
|
||||
BOOST_CHECK(colors[index] == expectedColor);
|
||||
index++;
|
||||
expectedColor = (expectedColor + 1) % 2;
|
||||
@ -90,8 +80,7 @@ BOOST_AUTO_TEST_CASE(TestWelschPowell)
|
||||
verticesPerColor.begin()+verticesPerColor.size()-1,
|
||||
colorIndex.begin()+1);
|
||||
|
||||
for (auto vertex : graph)
|
||||
{
|
||||
for (auto vertex : graph) {
|
||||
BOOST_CHECK(colorIndex[colors[vertex]]++ == newOrder[vertex]);
|
||||
}
|
||||
checkAllIndices(newOrder);
|
||||
@ -123,12 +112,10 @@ BOOST_AUTO_TEST_CASE(TestColoredDiluParallelisms3x3Matrix)
|
||||
for (auto row = testMatrix.createbegin(); row != testMatrix.createend(); ++row) {
|
||||
if (row.index() == 0) {
|
||||
row.insert(row.index());
|
||||
}
|
||||
else if (row.index() == 1) {
|
||||
} else if (row.index() == 1) {
|
||||
row.insert(row.index());
|
||||
row.insert(row.index() + 1);
|
||||
}
|
||||
else if (row.index() == 2) {
|
||||
} else if (row.index() == 2) {
|
||||
row.insert(row.index() - 1);
|
||||
row.insert(row.index());
|
||||
}
|
||||
@ -191,20 +178,16 @@ BOOST_AUTO_TEST_CASE(TestColoredDiluParallelisms5x5Simple)
|
||||
row.insert(row.index());
|
||||
row.insert(row.index()+1);
|
||||
row.insert(row.index()+2);
|
||||
}
|
||||
else if (row.index() == 1) {
|
||||
} else if (row.index() == 1) {
|
||||
row.insert(row.index());
|
||||
row.insert(row.index() - 1);
|
||||
}
|
||||
else if (row.index() == 2) {
|
||||
} else if (row.index() == 2) {
|
||||
row.insert(row.index() - 2);
|
||||
row.insert(row.index());
|
||||
row.insert(row.index() + 1);
|
||||
}
|
||||
else if (row.index() == 3) {
|
||||
} else if (row.index() == 3) {
|
||||
row.insert(row.index());
|
||||
}
|
||||
else if (row.index() == 4) {
|
||||
} else if (row.index() == 4) {
|
||||
row.insert(row.index() - 1);
|
||||
row.insert(row.index());
|
||||
}
|
||||
@ -274,13 +257,11 @@ BOOST_AUTO_TEST_CASE(TestColoredDiluParallelisms5x5Tridiagonal)
|
||||
if (row.index() == 0) {
|
||||
row.insert(row.index());
|
||||
row.insert(row.index()+1);
|
||||
}
|
||||
else if (row.index() > 0 && row.index() < 4) {
|
||||
} else if (row.index() > 0 && row.index() < 4) {
|
||||
row.insert(row.index() - 1);
|
||||
row.insert(row.index());
|
||||
row.insert(row.index() + 1);
|
||||
}
|
||||
else if (row.index() == 4) {
|
||||
} else if (row.index() == 4) {
|
||||
row.insert(row.index() - 1);
|
||||
row.insert(row.index());
|
||||
}
|
||||
@ -353,22 +334,18 @@ BOOST_AUTO_TEST_CASE(TestColoredDiluParallelisms5x5Complex)
|
||||
row.insert(row.index()+1);
|
||||
row.insert(row.index()+2);
|
||||
row.insert(row.index()+4);
|
||||
}
|
||||
else if (row.index() == 1) {
|
||||
} else if (row.index() == 1) {
|
||||
row.insert(row.index() - 1);
|
||||
row.insert(row.index());
|
||||
row.insert(row.index() + 2);
|
||||
}
|
||||
else if (row.index() == 2) {
|
||||
} else if (row.index() == 2) {
|
||||
row.insert(row.index() - 2);
|
||||
row.insert(row.index());
|
||||
row.insert(row.index() + 2);
|
||||
}
|
||||
else if (row.index() == 3) {
|
||||
} else if (row.index() == 3) {
|
||||
row.insert(row.index() - 2);
|
||||
row.insert(row.index());
|
||||
}
|
||||
else if (row.index() == 4) {
|
||||
} else if (row.index() == 4) {
|
||||
row.insert(row.index() - 4);
|
||||
row.insert(row.index() - 2);
|
||||
row.insert(row.index());
|
||||
|
Loading…
Reference in New Issue
Block a user