diff --git a/CHANGELOG.md b/CHANGELOG.md index 328c0c6b1904aeeb2b18573d0c5f3765d4cb6fed..6af44487b28d043b5debac73a6b1ea09f21a4d74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ - Parallel computing framework for FEM by using PETSc, which also includes - Parallel input of partitioned mesh data. - Parallel output of solutions by using pvtu data format. + - New data structures for mesh properties are used everywhere. + - The penalty method to impose first-type boundary conditions was substituted. ### Infrastructure diff --git a/MathLib/LinAlg/Lis/LisTools.cpp b/MathLib/LinAlg/Lis/LisTools.cpp index 689f1b10e2a748e0902aeea38022984a759eba5b..c003b5f5765ac738c5fb4495797ba59b9fec2fbb 100644 --- a/MathLib/LinAlg/Lis/LisTools.cpp +++ b/MathLib/LinAlg/Lis/LisTools.cpp @@ -67,6 +67,26 @@ MathLib::CRSMatrix<double, typename LisMatrix::IndexType>* lis2crs(LisMatrix &a) return new MathLib::CRSMatrix<double,IndexType>(A->n, iA, jA, entries); } + +// This function resets the the column indices and the entries, respectively. +// The LIS_MATRIX must have reserved enough memory for each row already! +void crs2lis( + MathLib::CRSMatrix<double, typename LisMatrix::IndexType> const& mat, + LIS_MATRIX &A) +{ + LisMatrix::IndexType const*const jA(mat.getColIdxArray()); + double * entries(const_cast<double*>(mat.getEntryArray())); + + // reset the entries in the lis matrix + LisMatrix::IndexType cnt(0); + for (LIS_INT row_i = 0; row_i < A->n; ++row_i) { + for (LIS_INT j = 0; j < A->w_row[row_i - A->is]; ++j) { + A->w_index[row_i-A->is][j] = jA[cnt]; + A->w_value[row_i-A->is][j] = entries[cnt]; + cnt++; + } + } +} } // end namespace detail void applyKnownSolution(LisMatrix &eqsA, LisVector &eqsRHS, LisVector &/*eqsX*/, @@ -84,19 +104,8 @@ void applyKnownSolution(LisMatrix &eqsA, LisVector &eqsRHS, LisVector &/*eqsX*/, // The following function is defined in CRSTools-impl.h applyKnownSolution(crs_mat, eqsRHS, input_rows, input_vals); - LisMatrix::IndexType const*const jA(crs_mat->getColIdxArray()); - double * entries(const_cast<double*>(crs_mat->getEntryArray())); + detail::crs2lis(*crs_mat, eqsA.getRawMatrix()); - LIS_MATRIX &A = eqsA.getRawMatrix(); - // reset the entries in the lis matrix - LisMatrix::IndexType cnt(0); - for (LIS_INT row_i = 0; row_i < A->n; ++row_i) { - for (LIS_INT j = 0; j < A->w_row[row_i - A->is]; ++j) { - A->w_index[row_i-A->is][j] = jA[cnt]; - A->w_value[row_i-A->is][j] = entries[cnt]; - cnt++; - } - } delete crs_mat; }