Skip to content

Commit

Permalink
Merge pull request #492 from zhuminjie/bugFixes
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
zhuminjie committed Jan 8, 2021
2 parents 3dcea10 + 5a8e169 commit 68f912f
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 36 deletions.
2 changes: 1 addition & 1 deletion OTHER/Triangle/triangle.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
10 changes: 5 additions & 5 deletions SRC/element/RockingBC/RockingBC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down Expand Up @@ -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);
Expand Down
57 changes: 37 additions & 20 deletions SRC/interpreter/OpenSeesOutputCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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? <dof>\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<double> 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<double> 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;
Expand Down
18 changes: 9 additions & 9 deletions SRC/interpreter/PythonModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion SRC/material/uniaxial/ASD_SMA_3K.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ ASD_SMA_3K matTag? k1? k2? k3? sigF? beta?
#include <Information.h>
#include <Parameter.h>

#include <math.h>
#include <cmath>
#include <float.h>
#include <elementAPI.h>
#include <iostream>
Expand Down

0 comments on commit 68f912f

Please sign in to comment.