From eccd8f143f1a5c5ba3f81c636f119301a8adb3e0 Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Mon, 20 May 2024 09:02:38 -0700 Subject: [PATCH] Update MultilinearBackbone.cpp --- .../uniaxial/backbone/MultilinearBackbone.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/SRC/material/uniaxial/backbone/MultilinearBackbone.cpp b/SRC/material/uniaxial/backbone/MultilinearBackbone.cpp index c80f254330..66a818ee89 100644 --- a/SRC/material/uniaxial/backbone/MultilinearBackbone.cpp +++ b/SRC/material/uniaxial/backbone/MultilinearBackbone.cpp @@ -102,14 +102,12 @@ MultilinearBackbone::MultilinearBackbone(int tag, int num, bool error = false; - int i; - - for (i = 1; i <= numPoints; i++) { + for (int i = 1; i <= numPoints; i++) { e[i] = def(i-1); s[i] = force(i-1); } - for (i = 1; i <= numPoints; i++) + for (int i = 1; i <= numPoints; i++) if (e[i] < e[i-1]) error = true; @@ -121,10 +119,11 @@ MultilinearBackbone::MultilinearBackbone(int tag, int num, opserr << "MultilinearBackbone::MultilinearBackbone -- input backbone is not unique (one-to-one)" << endln; } - - for (i = 1; i <= numPoints; i++) { - E[i-1] = (s[i]-s[i-1])/(e[i]-e[i-1]); - c[i] = c[i-1] + 0.5*(s[i]-s[i-1])*(e[i]-e[i-1]); + else { + for (int i = 1; i <= numPoints; i++) { + E[i-1] = (s[i]-s[i-1])/(e[i]-e[i-1]); + c[i] = c[i-1] + 0.5*(s[i]-s[i-1])*(e[i]-e[i-1]); + } } }