If i understand you correctly, you are suggesting looping over the fully assembled vector, which is exactly what NRSolver does already.
We of course need to do that as well, but unfortunately, we need to element-internal forces to normalize with (this is just a split-up ebenorm). In the case of no external forces, the assembled internal forces are always zero at equilibrium.
I can't see any way around it. In the case of a single node
we need to obtain; ebeNorm = |F1| + |F2|, which can't be obtained in the assembled version, where we just know the sum F1+F2
I can see an alternative way to do this, and its easiest to explain in pseudo-code;
for ( int i = 1; i <= nelem; i++ ) {
element = domain->giveElement(i);
element->giveLocationArray(loc, eid, s);
this->giveElementCharacteristicVector(charVec, i, type, mode, tStep, domain);
if ( charVec.isNotEmpty() ) {
if ( element->giveRotationMatrix(R, eid) ) {
charVec.rotatedWith(R, 't');
}
answer.assemble(charVec, loc);
///////////////////////////////////////////////////////// Compute the squared norm for each dofid;
if (norms) { // Send NULL if you don't need the ebenorms.
element->giveMasterDofIDs(masterDofIDs); // Very similar function to "giveLocationArray", but stores dofids instead of equation numbers
for ( int j = 1; j <= charVec.giveSize(); j++) {
int dofid = masterDofIDs.at(j);
double val = charVec.at(j);
norms->at(dofid) += val*val;
}
}
//////////////////////////////////////////////////////// Old approach, just a single norm to compute;
//norm += charVec.computeSquaredNorm();
}
}
I don't think there would be much performance issues from this.