Commit a377678b authored by Thomas Witkowski's avatar Thomas Witkowski

Work on blablablab

parent c8cd584a
......@@ -786,8 +786,8 @@ namespace AMDiS {
ofstream file;
file.open(filename.str().c_str());
file << "# First line contains number of DOFs, than each line has the format\n";
file << "# Local DOF index Global DOF index Is rank DOF x-coord y-coord z-coord\n";
// file << "# First line contains number of DOFs, than each line has the format\n";
// file << "# Local DOF index Global DOF index Is rank DOF x-coord y-coord z-coord\n";
file << coords.getUsedSize() << "\n";
DOFIterator<WorldVector<double> > it(&coords, USED_DOFS);
for (it.reset(); !it.end(); ++it) {
......@@ -801,9 +801,9 @@ namespace AMDiS {
// === Write to all elements in ranks mesh the included dofs. ===
file << "\n\n";
file << "# First line containes number of elements in mesh, second line contain the number of DOFs per element.\n";
file << "# Than, each entry contains of two lines. The first is the element index, the second line is a list with the local DOF indices of this element.\n";
// file << "\n\n";
// file << "# First line containes number of elements in mesh, second line contain the number of DOFs per element.\n";
// file << "# Than, each entry contains of two lines. The first is the element index, the second line is a list with the local DOF indices of this element.\n";
file << elDofMap.size() << "\n";
file << basisFcts->getNumber() << "\n";
for (ElDofMap::iterator it = elDofMap.begin(); it != elDofMap.end(); ++it) {
......
......@@ -639,22 +639,17 @@ namespace AMDiS {
double wtime = MPI::Wtime();
Vec tmpVecB;
VecCreateMPI(PETSC_COMM_WORLD,
nRankB * nComponents,
nOverallB * nComponents, &tmpVecB);
int nRowsRankPrimal = nRankPrimals * nComponents;
int nRowsOverallPrimal = nOverallPrimals * nComponents;
Vec tmpVecPrimal;
VecCreateMPI(PETSC_COMM_WORLD,
nRowsRankPrimal, nRowsOverallPrimal, &tmpVecPrimal);
Mat matPrimal;
MatCreateMPIAIJ(PETSC_COMM_WORLD,
nRowsRankPrimal, nRowsRankPrimal,
nRowsOverallPrimal, nRowsOverallPrimal,
10, PETSC_NULL, 10, PETSC_NULL, &matPrimal);
int nRowsRankB = nRankB * nComponents;
int nRowsOverallB = nOverallB * nComponents;
Mat matBPi;
MatCreateMPIAIJ(PETSC_COMM_WORLD,
nRowsRankB, nRowsRankPrimal,
nRowsOverallB, nRowsOverallPrimal,
30, PETSC_NULL, 30, PETSC_NULL, &matBPi);
Mat matPrimal;
PetscInt nCols;
const PetscInt *cols;
......@@ -671,7 +666,7 @@ namespace AMDiS {
if (values[j] != 0.0)
mat_b_primal_cols[cols[j]].push_back(make_pair(i, values[j]));
MatRestoreRow(mat_b_primal, i, &nCols, &cols, &values);
MatRestoreRow(mat_b_primal, row, &nCols, &cols, &values);
}
int maxLocalPrimal = mat_b_primal_cols.size();
......@@ -693,40 +688,26 @@ namespace AMDiS {
KSPSolve(ksp_b, tmpVec, tmpVec);
PetscScalar *tmpValuesB, *tmpValues;
VecGetArray(tmpVecB, &tmpValuesB);
PetscScalar *tmpValues;
VecGetArray(tmpVec, &tmpValues);
for (int i = 0; i < nRankB * nComponents; i++)
tmpValuesB[i] = tmpValues[i];
MatSetValue(matBPi,
rStartB * nComponents + i,
it->first,
tmpValues[i],
ADD_VALUES);
VecRestoreArray(tmpVec, &tmpValues);
VecRestoreArray(tmpVecB, &tmpValuesB);
MatMult(mat_primal_b, tmpVecB, tmpVecPrimal);
VecGetArray(tmpVecPrimal, &tmpValues);
for (int i = 0; i < nRowsRankPrimal; i++)
MatSetValue(matPrimal, rStartPrimals * nComponents + i,
it->first, tmpValues[i], ADD_VALUES);
VecRestoreArray(tmpVecPrimal, &tmpValues);
VecDestroy(&tmpVec);
}
for (int i = mat_b_primal_cols.size(); i < maxLocalPrimal; i++)
MatMult(mat_primal_b, tmpVecB, tmpVecPrimal);
VecDestroy(&tmpVecB);
VecDestroy(&tmpVecPrimal);
MatAssemblyBegin(matPrimal, MAT_FINAL_ASSEMBLY);
MatAssemblyEnd(matPrimal, MAT_FINAL_ASSEMBLY);
MatAssemblyBegin(matBPi, MAT_FINAL_ASSEMBLY);
MatAssemblyEnd(matBPi, MAT_FINAL_ASSEMBLY);
MatMatMult(mat_primal_b, matBPi, MAT_INITIAL_MATRIX, PETSC_DEFAULT, &matPrimal);
MatAXPY(mat_primal_primal, -1.0, matPrimal, DIFFERENT_NONZERO_PATTERN);
MatDestroy(&matPrimal);
MatDestroy(&matBPi);
MatInfo minfo;
MatGetInfo(mat_primal_primal, MAT_GLOBAL_SUM, &minfo);
......@@ -1031,7 +1012,7 @@ namespace AMDiS {
MatCreateMPIAIJ(PETSC_COMM_WORLD,
nRowsRankPrimal, nRowsRankB,
nRowsOverallPrimal, nRowsOverallB,
10, PETSC_NULL, 10, PETSC_NULL, &mat_primal_b);
15, PETSC_NULL, 15, PETSC_NULL, &mat_primal_b);
// === Create matrices for FETI-DP preconditioner. ===
......
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