Skip to content

Commit

Permalink
Adding getCrdTransfTags to Python
Browse files Browse the repository at this point in the history
  • Loading branch information
mhscott committed Nov 12, 2021
1 parent dba6384 commit 04bfdca
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions SRC/interpreter/OpenSeesCommands.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ int OPS_setNodePressure();
int OPS_nodeBounds();
int OPS_setPrecision();
int OPS_getEleTags();
int OPS_getCrdTransfTags();
int OPS_getNodeTags();
int OPS_getParamTags();
int OPS_getParamValue();
Expand Down
20 changes: 20 additions & 0 deletions SRC/interpreter/OpenSeesOutputCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#include <ElementalLoadIter.h>
#include <Element.h>
#include <ElementIter.h>
#include <CrdTransf.h>
#include <map>
#include <set>
#include <Recorder.h>
Expand Down Expand Up @@ -2004,6 +2005,25 @@ int OPS_getEleTags()
return 0;
}

int OPS_getCrdTransfTags()
{
// Defined in CrdTransf.cpp
ID transfTags = OPS_getAllCrdTransfTags();

int size = transfTags.Size();
int *data = 0;
if (size > 0) {
data = &transfTags[0];
}

if (OPS_SetIntOutput(&size, data, false) < 0) {
opserr << "WARNING failed to set outputs\n";
return -1;
}

return 0;
}

int OPS_getNodeTags() {
Domain *theDomain = OPS_GetDomain();
if (theDomain == 0) return -1;
Expand Down
13 changes: 13 additions & 0 deletions SRC/interpreter/PythonWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1415,6 +1415,18 @@ static PyObject *Py_ops_getEleTags(PyObject *self, PyObject *args)
return wrapper->getResults();
}

static PyObject *Py_ops_getCrdTransfTags(PyObject *self, PyObject *args)
{
wrapper->resetCommandLine(PyTuple_Size(args), 1, args);

if (OPS_getCrdTransfTags() < 0) {
opserr<<(void*)0;
return NULL;
}

return wrapper->getResults();
}

static PyObject *Py_ops_getNodeTags(PyObject *self, PyObject *args)
{
wrapper->resetCommandLine(PyTuple_Size(args), 1, args);
Expand Down Expand Up @@ -2497,6 +2509,7 @@ PythonWrapper::addOpenSeesCommands()
addCommand("convertBinaryToText", &Py_ops_convertBinaryToText);
addCommand("convertTextToBinary", &Py_ops_convertTextToBinary);
addCommand("getEleTags", &Py_ops_getEleTags);
addCommand("getCrdTransfTags", &Py_ops_getCrdTransfTags);
addCommand("getNodeTags", &Py_ops_getNodeTags);
addCommand("getParamTags", &Py_ops_getParamTags);
addCommand("getParamValue", &Py_ops_getParamValue);
Expand Down
9 changes: 9 additions & 0 deletions SRC/interpreter/TclWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,14 @@ static int Tcl_ops_getEleTags(ClientData clientData, Tcl_Interp *interp, int arg
return TCL_OK;
}

static int Tcl_ops_getCrdTransfTags(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv) {
wrapper->resetCommandLine(argc, 1, argv);

if (OPS_getCrdTransfTags() < 0) return TCL_ERROR;

return TCL_OK;
}

static int Tcl_ops_getNodeTags(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv) {
wrapper->resetCommandLine(argc, 1, argv);

Expand Down Expand Up @@ -1673,6 +1681,7 @@ TclWrapper::addOpenSeesCommands(Tcl_Interp* interp)
addCommand(interp,"convertBinaryToText", &Tcl_ops_convertBinaryToText);
addCommand(interp,"convertTextToBinary", &Tcl_ops_convertTextToBinary);
addCommand(interp,"getEleTags", &Tcl_ops_getEleTags);
addCommand(interp,"getCrdTransfTags", &Tcl_ops_getCrdTransfTags);
addCommand(interp,"getNodeTags", &Tcl_ops_getNodeTags);
addCommand(interp,"getParamTags", &Tcl_ops_getParamTags);
addCommand(interp,"getParamValue", &Tcl_ops_getParamValue);
Expand Down

0 comments on commit 04bfdca

Please sign in to comment.