Skip to content

Commit

Permalink
Add abs error printout to TacsPrintErrorComponents
Browse files Browse the repository at this point in the history
  • Loading branch information
A-CGray committed Jun 1, 2023
1 parent 90b1a72 commit eaf712c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/elements/TACSElementVerification.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,14 @@ double TacsGetMaxRelError(TacsScalar *a, TacsScalar *b, int size,
*/
void TacsPrintErrorComponents(FILE *fp, const char *descript, TacsScalar *a,
TacsScalar *b, int size) {
fprintf(fp, "%*s[ ] %15s %15s %15s\n", (int)strlen(descript), "Val",
"Analytic", "Approximate", "Rel. Error");
fprintf(fp, "%*s[ ] %15s %15s %15s %15s\n", (int)strlen(descript), "Val",
"Analytic", "Approximate", "Rel. Error", "Abs. Error");
for (int i = 0; i < size; i++) {
if (a[i] != 0.0) {
fprintf(fp, "%s[%3d] %15.6e %15.6e %15.4e\n", descript, i,
fprintf(fp, "%s[%3d] %15.6e %15.6e %15.4e %15.4e\n", descript, i,
TacsRealPart(a[i]), TacsRealPart(b[i]),
fabs(TacsRealPart((a[i] - b[i]) / a[i])));
fabs(TacsRealPart((a[i] - b[i]) / a[i])),
fabs(TacsRealPart(a[i] - b[i])));
} else {
fprintf(fp, "%s[%3d] %15.6e %15.6e\n", descript, i, TacsRealPart(a[i]),
TacsRealPart(b[i]));
Expand Down

0 comments on commit eaf712c

Please sign in to comment.