Skip to content
Snippets Groups Projects
Commit c3c26dfc authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Fixed memory bug in arh reader.

parent 5a800fbe
No related merge requests found
......@@ -110,7 +110,7 @@ namespace AMDiS {
TEST_EXIT(file.is_open())
("Cannot open file %s\n", filename.c_str());
string typeId = "";
string typeId(4, ' ');
uint32_t nMacroElements = 0;
uint32_t nValueVectors = 0;
uint32_t nAllValues = 0;
......
......@@ -58,6 +58,8 @@ namespace AMDiS {
}
#endif
exit(0);
ofstream file;
file.open(filename.c_str(), ios::out | ios::binary | ios::trunc);
......
......@@ -84,6 +84,17 @@ namespace AMDiS {
MatAssemblyBegin(matIntInt, MAT_FINAL_ASSEMBLY);
MatAssemblyEnd(matIntInt, MAT_FINAL_ASSEMBLY);
if (printMatInfo) {
MatInfo matInfo;
MatGetInfo(matIntInt, MAT_GLOBAL_SUM, &matInfo);
MSG("Matrix info:\n");
MSG(" memory usage: %e MB\n", matInfo.memory / (1024.0 * 1024.0));
MSG(" mallocs: %d\n", static_cast<int>(matInfo.mallocs));
MSG(" nz allocated: %d\n", static_cast<int>(matInfo.nz_allocated));
MSG(" nz used: %d\n", static_cast<int>(matInfo.nz_used));
MSG(" nz unneeded: %d\n", static_cast<int>(matInfo.nz_unneeded));
}
// === Remove Dirichlet BC DOFs. ===
......
......@@ -41,11 +41,13 @@ namespace AMDiS {
petscSolVec(PETSC_NULL),
lastMeshNnz(0),
zeroStartVector(false),
alwaysCreateNnzStructure(false)
alwaysCreateNnzStructure(false),
printMatInfo(false)
{
Parameters::get("parallel->use zero start vector", zeroStartVector);
Parameters::get("parallel->always create nnz structure",
alwaysCreateNnzStructure);
Parameters::get("parallel->print matrix info", printMatInfo);
}
void fillPetscMatrix(Matrix<DOFMatrix*> *mat);
......@@ -118,6 +120,10 @@ namespace AMDiS {
/// operators using DOFVectors from old timestep containing many zeros due to
/// some phase fields.
bool alwaysCreateNnzStructure;
/// If true, after parallel assembling, information about the matrix
/// are printed.
bool printMatInfo;
};
......
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