Skip to content
Snippets Groups Projects
Commit 36233f99 authored by Christoph Grüninger's avatar Christoph Grüninger
Browse files

Merge branch 'feature/fix-seq-solver-playground' into 'master'

Adjust sequential and both parallel cases in istl-solver-playground

See merge request !526
parents 1623ad6e 73caa1bc
No related branches found
No related tags found
1 merge request!526Adjust sequential and both parallel cases in istl-solver-playground
Pipeline #61066 passed
......@@ -174,4 +174,6 @@ int main(int argc, char** argv)
#if HAVE_MPI
MPI_Finalize();
#endif
return ret;
}
......@@ -80,13 +80,11 @@ void testIndices(MPI_Comm comm)
// build global indexset on first process
globalIndexSet.beginResize();
globalArray=new Array(Nx*Ny);
int k=0;
for(int j=0; j<Ny; j++)
for(int i=0; i<Nx; i++) {
globalIndexSet.add(i+j*Nx, Dune::ParallelLocalIndex<GridFlags> (i+j*Nx,owner,false));
globalArray->operator[](i+j*Nx)=-(i+j*Nx);
k++;
}
globalIndexSet.endResize();
......
......@@ -66,7 +66,11 @@ std::shared_ptr<OOCOMM> loadSystem(std::shared_ptr<Mat>& m,
std::shared_ptr<OOCOMM> oocomm;
if(distributed){
oocomm = std::make_shared<OOCOMM>(MPI_COMM_WORLD);
loadMatrixMarket(*m, matrixfilename, *oocomm);
if(matrixfilename != "laplacian"){
loadMatrixMarket(*m, matrixfilename, *oocomm);
}else{
setupLaplacian(*m, config.get("N", 20));
}
if(config.get("random_rhs", false)){
rhs->resize(m->N());
srand(42);
......@@ -98,16 +102,22 @@ template<class Mat, class Vec>
void loadSystem(std::shared_ptr<Mat>& m,
std::shared_ptr<Vec>& rhs,
const Dune::ParameterTree& config){
std::string matrixfilename = config.get<std::string>("matrix");
// generate Laplacian or load matrix
std::string matrixfilename = config.get<std::string>("matrix", "laplacian");
if(matrixfilename == "laplacian"){
setupLaplacian(*m, config.get("N", 20));
}else{
loadMatrixMarket(*m, matrixfilename);
}
// use random values or load right-hand side
std::string rhsfilename;
if(!config.get("random_rhs", false))
rhsfilename = config.get<std::string>("rhs");
loadMatrixMarket(*m, matrixfilename);
if(config.get("random_rhs", false)){
rhs->resize(m->N());
fillRandom(*rhs);
}else
}else{
rhsfilename = config.get<std::string>("rhs");
loadMatrixMarket(*rhs, rhsfilename);
}
}
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment