Skip to content

Commit

Permalink
Merge pull request #662 from zhuminjie/domainCommit
Browse files Browse the repository at this point in the history
get/set Domain commit Tag
  • Loading branch information
mhscott committed Sep 9, 2021
2 parents 587e944 + a4bfc17 commit b57156b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
22 changes: 22 additions & 0 deletions SRC/interpreter/OpenSeesCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3064,6 +3064,28 @@ int OPS_systemSize()
return 0;
}

int OPS_domainCommitTag() {
if (cmds == 0) {
return 0;
}

int commitTag = cmds->getDomain()->getCommitTag();
int numdata = 1;
if (OPS_GetNumRemainingInputArgs() > 0) {
if (OPS_GetIntInput(&numdata, &commitTag) < 0) {
opserr << "WARNING: failed to get commitTag\n";
return -1;
}
cmds->getDomain()->setCommitTag(commitTag);
}
if (OPS_SetIntOutput(&numdata, &commitTag, true) < 0) {
opserr << "WARNING failed to set commitTag\n";
return 0;
}

return 0;
}

void* OPS_ParallelRCM() {

#ifdef _PARALLEL_INTERPRETERS
Expand Down
1 change: 1 addition & 0 deletions SRC/interpreter/OpenSeesCommands.h
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ int OPS_numFact();
int OPS_numIter();
int* OPS_GetNumEigen();
int OPS_systemSize();
int OPS_domainCommitTag();

void* OPS_KrylovNewton();
void* OPS_RaphsonNewton();
Expand Down
12 changes: 12 additions & 0 deletions SRC/interpreter/PythonWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2315,6 +2315,17 @@ static PyObject *Py_ops_pc(PyObject *self, PyObject *args) {
return wrapper->getResults();
}

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

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

return wrapper->getResults();
}

/////////////////////////////////////////////////
////////////// Add Python commands //////////////
/////////////////////////////////////////////////
Expand Down Expand Up @@ -2505,6 +2516,7 @@ PythonWrapper::addOpenSeesCommands()
addCommand("unloadingRule", &Py_ops_unloadingRule);
addCommand("partition", &Py_ops_partition);
addCommand("pressureConstraint", &Py_ops_pc);
addCommand("domainCommitTag", &Py_ops_domainCommitTag);

PyMethodDef method = {NULL,NULL,0,NULL};
methodsOpenSees.push_back(method);
Expand Down

0 comments on commit b57156b

Please sign in to comment.