Skip to content
Snippets Groups Projects
Commit 7f6db806 authored by Max Kahnt's avatar Max Kahnt
Browse files

Add test for resize from SumOperator.

parent 9ad664ba
No related branches found
No related tags found
1 merge request!19Feature/resize in matrix vector
Pipeline #
......@@ -170,6 +170,30 @@ bool check()
return passed;
}
bool checkResize() try {
std::cout << "Checking resize from SumOperator ... ";
using namespace Dune;
using Block = FieldMatrix<double, 2, 6>;
using SparseMatrix = BCRSMatrix<Block>;
SparseMatrix sparseMatrix;
MatrixIndexSet indices(3,4);
indices.exportIdx(sparseMatrix);
using LowRankFactor = Matrix<Block>;
SumOperator<SparseMatrix, LowRankOperator<LowRankFactor>> sumOp;
sumOp.sparseMatrix() = sparseMatrix;
sumOp.lowRankMatrix().lowRankFactor() = LowRankFactor(5,6); // "weird" sizes should not matter
BlockVector<Dune::FieldVector<double, 2>> vector;
MatrixVector::resize(vector, sumOp);
if(vector.size() != 3)
DUNE_THROW(Exception, "Resize yields unexpected vector size.");
std::cout << "passed" << std::endl;
return true;
} catch(Dune::Exception e) {
std::cout << " FAILED." << std::endl;
std::cout << "Exception was: " << e << std::endl;
return false;
}
int main(int argc, char** argv)
{
Dune::MPIHelper::instance(argc, argv);
......@@ -194,5 +218,7 @@ int main(int argc, char** argv)
passed = passed and check<Dune::BCRSMatrix<Block3>, Dune::Matrix<Block2> >();
passed = passed and check<Dune::BCRSMatrix<Block3>, Dune::Matrix<Block3> >();
passed = passed and checkResize();
return passed ? 0 : 1;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment