Commit 2bbf10f7 authored by Thomas Witkowski's avatar Thomas Witkowski

Fixed some problems with nnz computation with coarse grid, still not finished.

parent 53c5f965
......@@ -31,16 +31,56 @@ namespace AMDiS {
using namespace std;
struct NnzStructure {
NnzStructure()
: dnnz(NULL),
onnz(NULL)
{}
void clear()
{
if (dnnz) {
delete [] dnnz;
dnnz = NULL;
}
if (onnz) {
delete [] onnz;
onnz = NULL;
}
}
void create(int nRows0, int nRows1 = -1)
{
if (nRows0 == 0)
return;
TEST_EXIT_DBG(nRows0 > 0)("Should not happen!\n");
dnnz = new int[nRows0];
for (int i = 0; i < nRows0; i++)
dnnz[i] = 0;
if (nRows1 > 0) {
onnz = new int[nRows1];
for (int i = 0; i < nRows1; i++)
onnz[i] = 0;
}
}
int *dnnz;
int *onnz;
};
class PetscSolverGlobalMatrix : public PetscSolver
{
public:
PetscSolverGlobalMatrix()
: PetscSolver(),
petscSolVec(PETSC_NULL),
matInteriorDiagNnz(NULL),
matInteriorOffdiagNnz(NULL),
matCoarseDiagNnz(NULL),
matCoarseOffdiagNnz(NULL),
lastMeshNnz(0),
zeroStartVector(false),
alwaysCreateNnzStructure(false)
......@@ -81,9 +121,9 @@ namespace AMDiS {
void createPetscNnzStructure(Matrix<DOFMatrix*> *mat);
void createPetscNnzStructureWithCoarseSpace(Matrix<DOFMatrix*> *mat,
ParallelDofMapping &dofMap,
int*& diagNnz,
int*& offdiagNnz,
ParallelDofMapping &rowDofMap,
ParallelDofMapping &colDofMap,
NnzStructure &nnz,
bool localMatrix = false);
/// Takes a DOF matrix and sends the values to the global PETSc matrix.
......@@ -108,11 +148,11 @@ namespace AMDiS {
protected:
/// Arrays definig the non zero pattern of Petsc's interior matrix.
int *matInteriorDiagNnz, *matInteriorOffdiagNnz;
NnzStructure nnzInterior;
NnzStructure nnzCoarse;
/// Arrays definig the non zero pattern of Petsc's coarse space matrix.
int *matCoarseDiagNnz, *matCoarseOffdiagNnz;
NnzStructure nnzIntCoarse, nnzCoarseInt;
Vec petscSolVec;
......
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