In the following code, I found no reference of MPtr in anywhere of the soft.
A bug? It happened many times in other similar methods.
It seems strange because MPtr should be returned or referenced guessed from the method name.
int FullGenEigenSOE::addM(const Matrix &m, const ID &id, double fact)
{
// check for quick return
if (fact == 0.0)
return 0;
// check that m and id are of similar size
int idSize = id.Size();
if (idSize != m.noRows() && idSize != m.noCols()) {
opserr << "FullGenEigenSOE::addM() - Matrix and ID not of similar sizes\n";
return -1;
}
if (fact == 1.0) { // do not need to multiply
for (int i=0; i<idSize; i++) {
int col = id(i);
if (col < size && col >= 0) {
double *startColiPtr = M + col*size;
for (int j=0; j<idSize; j++) {
int row = id(j);
if (row <size && row >= 0) {
double *MPtr = startColiPtr + row;
*MPtr += m(j,i);
}
} // for j
}
} // for i
} else {
for (int i=0; i<idSize; i++) {
int col = id(i);
if (col < size && col >= 0) {
double *startColiPtr = M + col*size;
for (int j=0; j<idSize; j++) {
int row = id(j);
if (row <size && row >= 0) {
double *MPtr = startColiPtr + row;
*MPtr += m(j,i)*fact;
}
} // for j
}
} // for i
}
return 0;
}
A bug?There are no reference of temp varible MPtr!
Moderators: silvia, selimgunay, Moderators