From 19848eb0f27d558e2d03ae158304454f23034a9f Mon Sep 17 00:00:00 2001 From: Minjie Zhu Date: Sat, 2 Jan 2021 10:57:10 -0800 Subject: [PATCH 1/5] add dof to nodeMass --- SRC/interpreter/OpenSeesOutputCommands.cpp | 57 ++++++++++++++-------- 1 file changed, 37 insertions(+), 20 deletions(-) diff --git a/SRC/interpreter/OpenSeesOutputCommands.cpp b/SRC/interpreter/OpenSeesOutputCommands.cpp index c5492b9d8..dbffa069d 100644 --- a/SRC/interpreter/OpenSeesOutputCommands.cpp +++ b/SRC/interpreter/OpenSeesOutputCommands.cpp @@ -1656,39 +1656,56 @@ int OPS_nodeDOFs() return 0; } -int OPS_nodeMass() -{ +int OPS_nodeMass() { if (OPS_GetNumRemainingInputArgs() < 1) { - opserr << "WARNING want - nodeMass nodeTag?\n"; - return -1; + opserr << "WARNING want - nodeMass nodeTag? \n"; + return -1; } - int tag; - int numdata = 1; + int tag[2] = {0, -1}; + int numdata = OPS_GetNumRemainingInputArgs(); + if (numdata > 2) { + numdata = 2; + } - if (OPS_GetIntInput(&numdata, &tag) < 0) { - opserr << "WARNING nodeMass nodeTag?\n"; - return -1; + if (OPS_GetIntInput(&numdata, &tag[0]) < 0) { + opserr << "WARNING nodeMass nodeTag?\n"; + return -1; } + tag[1]--; - Domain* theDomain = OPS_GetDomain(); + Domain *theDomain = OPS_GetDomain(); if (theDomain == 0) return -1; - Node *theNode = theDomain->getNode(tag); + Node *theNode = theDomain->getNode(tag[0]); if (theNode == 0) { - opserr << "WARNING nodeMass node " << tag << " not found" << endln; - return -1; + opserr << "WARNING nodeMass node " << tag << " not found" << endln; + return -1; } int numDOF = theNode->getNumberDOF(); const Matrix &mass = theNode->getMass(); - std::vector data(numDOF); - for (int i = 0; i < numDOF; i++) - data[i] = mass(i,i); - - if (OPS_SetDoubleOutput(&numDOF, &data[0], false) < 0) { - opserr << "WARNING nodeMass failed to set mass\n"; - return -1; + if (tag[1] >= 0) { + if (tag[1] >= numDOF) { + opserr << "WARNING: nodeMass nodeTag? dof? - dof too large\n"; + return -1; + } + double value = mass(tag[1], tag[1]); + numdata = 1; + if (OPS_SetDoubleOutput(&numdata, &value, true) < 0) { + opserr << "WARNING: nodeMass - failed to set mass output\n"; + return -1; + } + } else { + std::vector data(numDOF); + for (int i = 0; i < numDOF; i++) { + data[i] = mass(i, i); + } + + if (OPS_SetDoubleOutput(&numDOF, &data[0], false) < 0) { + opserr << "WARNING nodeMass failed to set mass\n"; + return -1; + } } return 0; From d5a590194b4d7fde1bc7c8828cd8c59466935ed5 Mon Sep 17 00:00:00 2001 From: Minjie Zhu Date: Tue, 5 Jan 2021 17:03:15 -0800 Subject: [PATCH 2/5] remove __version__ from openseespy.opensees --- SRC/interpreter/PythonModule.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/SRC/interpreter/PythonModule.cpp b/SRC/interpreter/PythonModule.cpp index e016c22a3..7a4255d45 100644 --- a/SRC/interpreter/PythonModule.cpp +++ b/SRC/interpreter/PythonModule.cpp @@ -287,15 +287,15 @@ initopensees(void) Py_INCREF(st->error); PyModule_AddObject(pymodule, "OpenSeesError", st->error); - char version[10]; - const char *py_version = ".6"; - for (int i = 0; i < 5; ++i) { - version[i] = OPS_VERSION[i]; - } - for (int i = 0; i < 3; ++i) { - version[5 + i] = py_version[i]; - } - PyModule_AddStringConstant(pymodule, "__version__", version); + // char version[10]; + // const char *py_version = ".6"; + // for (int i = 0; i < 5; ++i) { + // version[i] = OPS_VERSION[i]; + // } + // for (int i = 0; i < 3; ++i) { + // version[5 + i] = py_version[i]; + // } + // PyModule_AddStringConstant(pymodule, "__version__", version); sserr.setError(st->error); From 908611be181094b04c60ba478ac1afe2f93b653b Mon Sep 17 00:00:00 2001 From: Minjie Zhu Date: Tue, 5 Jan 2021 17:05:21 -0800 Subject: [PATCH 3/5] remove timming code from triangle.c for faster 2D triangulation --- OTHER/Triangle/triangle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OTHER/Triangle/triangle.c b/OTHER/Triangle/triangle.c index df0f071c4..9830005a5 100644 --- a/OTHER/Triangle/triangle.c +++ b/OTHER/Triangle/triangle.c @@ -231,7 +231,7 @@ /* If yours is not a Unix system, define the NO_TIMER compiler switch to */ /* remove the Unix-specific timing code. */ -/* #define NO_TIMER */ +#define NO_TIMER /* To insert lots of self-checks for internal errors, define the SELF_CHECK */ /* symbol. This will slow down the program significantly. It is best to */ From 14f4f8160ce69a9159f2d3ad43766c3d06ee97f3 Mon Sep 17 00:00:00 2001 From: Minjie Zhu Date: Thu, 7 Jan 2021 17:01:20 -0800 Subject: [PATCH 4/5] RockingBC: ofstream should be opened, copy is error for gcc4.8 --- SRC/element/RockingBC/RockingBC.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SRC/element/RockingBC/RockingBC.cpp b/SRC/element/RockingBC/RockingBC.cpp index c15e75ca8..6fc555084 100644 --- a/SRC/element/RockingBC/RockingBC.cpp +++ b/SRC/element/RockingBC/RockingBC.cpp @@ -1424,10 +1424,10 @@ RockingBC::setResponse(const char **argv, int argc, OPS_Stream &output) else{ std::string fstr = argv[0]; - Yup_file = std::ofstream(fstr + "_Yup.txt"); - Up_file = std::ofstream(fstr + "_Up.txt"); - Ys_file = std::ofstream(fstr + "_Ys.txt"); - S_file = std::ofstream(fstr + "_S.txt"); + Yup_file.open(fstr + "_Yup.txt"); + Up_file.open(fstr + "_Up.txt"); + Ys_file.open(fstr + "_Ys.txt"); + S_file.open(fstr + "_S.txt"); theResponse = new ElementResponse(this, 20, Vector(1)); @@ -2473,7 +2473,7 @@ int RockingBC::NL_solve_dyn() void RockingBC::writedbgfile() { - std::ofstream NLFfile = std::ofstream("NLsolvefailure.txt"); + std::ofstream NLFfile("NLsolvefailure.txt"); if (useUelNM) { Ys_com = interval_join(Ysi_com); From 5a8e169e41e5b9dba4cf6b6883eb9e75a4a0883e Mon Sep 17 00:00:00 2001 From: Minjie Zhu Date: Thu, 7 Jan 2021 17:02:29 -0800 Subject: [PATCH 5/5] ASD_SMA_3K: should include cmath which has the needed versions of abs --- SRC/material/uniaxial/ASD_SMA_3K.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SRC/material/uniaxial/ASD_SMA_3K.cpp b/SRC/material/uniaxial/ASD_SMA_3K.cpp index c752aa64b..51bca590d 100644 --- a/SRC/material/uniaxial/ASD_SMA_3K.cpp +++ b/SRC/material/uniaxial/ASD_SMA_3K.cpp @@ -54,7 +54,7 @@ ASD_SMA_3K matTag? k1? k2? k3? sigF? beta? #include #include -#include +#include #include #include #include