//Assemble the stiffness matrix A in Ax = b for the strict interior of the problem grid from element connectivity
double coeff = <"some double">; //coefficient that enters matrixuic1 = (
unsigned int) c_gid1; // global cell id of first cell owning faceuic2 = (
unsigned int) c_gid2; // global cell id of second cell owning face //Skip innactive connections (physically, there is no flow across them) if( check_active_faces && !active_faces->test(ic) ) { continue;}
//Main diagonal elementsmatrix_A(uic1, uic1) += -coeff;
matrix_A(uic2, uic2) += -coeff;
//Off-diagonal elementsmatrix_A(uic1, uic2) += coeff;
matrix_A(uic2, uic1) += coeff;
}
// end - loop on connections ic// Assemble RHS
for (unsigned int i = 0; i < vector_b().size(); ++i) {
vector_b(i) = 0.0;
if( check_active_cells && !active_cells->test(i) ) {
matrix_A(i, i) = -1.0;
vector_b(i) = 1.0;
}
}
(skipping boundary conditions...not relevant here)
int nnz = 0;
itm2 i2 = i1.begin();
//Loop over each row's non-zero elements for(; i2 != i1.end(); ++i2) {cols[nnz] = (
int) i2.index2();vals[nnz] = *i2;
++nnz;
}
//Pass along cols, vals to "solver-package"...irrelvant here.. (infact commented out when noting performance times).
}
For most problems without too many inactive elements, time taken was about ~5-6 seconds.. for the degenerate case,
it was ~250 seconds!!! I am hoping someone can give me a reason why this happens and if possible, identify something
I am doing wrong? It was recommended that I try generalized_vector_of_vector - will that choice resolve such issues?
Greatly appreciate whatever help I can get! Once again, thanks a lot in advance for any useful help/advice...
Thanks,
Sunil Thomas.