Skip to content

Commit

Permalink
Merge pull request #569 from kasiz/setnodepressure
Browse files Browse the repository at this point in the history
Setnodepressure
  • Loading branch information
mhscott committed Apr 8, 2021
2 parents ca623c8 + d0d286d commit 5344d77
Show file tree
Hide file tree
Showing 3 changed files with 48 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 @@ -254,6 +254,7 @@ int OPS_eleNodes();
int OPS_nodeDOFs();
int OPS_nodeMass();
int OPS_nodePressure();
int OPS_setNodePressure();
int OPS_nodeBounds();
int OPS_setPrecision();
int OPS_getEleTags();
Expand Down
34 changes: 34 additions & 0 deletions SRC/interpreter/OpenSeesOutputCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1749,6 +1749,40 @@ int OPS_nodePressure()
return 0;
}

int OPS_setNodePressure()
{
if (OPS_GetNumRemainingInputArgs() < 2) {
opserr << "WARNING: want - setNodePressure nodeTag? Pressure?\n";
return -1;
}

int tag;
int numdata = 1;

if (OPS_GetIntInput(&numdata, &tag) < 0) {
opserr << "WARNING: setNodePressure invalid tag\n";
return -1;
}

Domain* theDomain = OPS_GetDomain();
if (theDomain == 0) return -1;

double pressure = 0.0;

if (OPS_GetDoubleInput(&numdata, &pressure) < 0) {
opserr << "WARNING: setNodePressure invalid pressure\n";
return -1;
}

Pressure_Constraint* thePC = theDomain->getPressure_Constraint(tag);
if(thePC != 0) {
thePC->setPressure(pressure);
}

return 0;
}


int OPS_nodeBounds()
{

Expand Down
13 changes: 13 additions & 0 deletions SRC/interpreter/PythonWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,18 @@ static PyObject *Py_ops_nodePressure(PyObject *self, PyObject *args)
return wrapper->getResults();
}

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

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

return wrapper->getResults();
}

static PyObject *Py_ops_nodeBounds(PyObject *self, PyObject *args)
{
wrapper->resetCommandLine(PyTuple_Size(args), 1, args);
Expand Down Expand Up @@ -2321,6 +2333,7 @@ PythonWrapper::addOpenSeesCommands()
addCommand("nodeDOFs", &Py_ops_nodeDOFs);
addCommand("nodeMass", &Py_ops_nodeMass);
addCommand("nodePressure", &Py_ops_nodePressure);
addCommand("setNodePressure", &Py_ops_setNodePressure);
addCommand("nodeBounds", &Py_ops_nodeBounds);
addCommand("start", &Py_ops_startTimer);
addCommand("stop", &Py_ops_stopTimer);
Expand Down

0 comments on commit 5344d77

Please sign in to comment.