Commit 1bbb9e23 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#984 Devise tiny test program to check behaviour of MatSetValues().

parent 1ed52d99
......@@ -9,6 +9,9 @@
#include <cstdlib>
#include <iostream>
#include "ThirdParty/Wrappers/Petsc/Petsc.hpp"
#include "ModelInstances/UnderDevelopment/Poromechanics/Crtp/FluidmassData.hpp"
......@@ -19,8 +22,45 @@ using namespace HappyHeart;
int main(int argc, char ** argv)
{
Wrappers::Mpi::InitEnvironment(argc, argv);
Wrappers::Mpi mpi(0, Wrappers::MpiNS::Comm::World);
Wrappers::Petsc::Petsc petsc(__FILE__, __LINE__);
std::vector<std::vector<PetscInt>> nnz
{
{ 0 },
{ 1, 2 },
{ 3 },
{ 1, 2 }
};
Wrappers::Petsc::MatrixPattern pattern(nnz);
Wrappers::Petsc::Matrix matrix;
matrix.InitSequentialMatrix(4, 4,
pattern,
mpi,
__FILE__, __LINE__);
matrix.View(mpi, __FILE__, __LINE__);
std::vector<PetscInt> row { 1, 3 };
std::vector<PetscInt> col { 1, 2 };
std::vector<PetscScalar> val { 1., 1. };
matrix.SetValues(row,
col,
val.data(),
INSERT_VALUES,
__FILE__, __LINE__);
matrix.Assembly(__FILE__, __LINE__);
matrix.View(mpi, __FILE__, __LINE__);
return EXIT_SUCCESS;
......
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