MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / ops_addNodalMass

Function ops_addNodalMass

SRC/interpreter/PythonModelBuilder.cpp:891–929  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

889}
890
891PyObject *ops_addNodalMass(PyObject *self, PyObject *args)
892{
893 // check model builder
894 if(pBuilder.isSet() == false) {
895 PyErr_SetString(PyExc_RuntimeError,"ERROR builder has not been set");
896 return NULL;
897 }
898
899 OPS_ResetCommandLine(PyTuple_Size(args), 0, args);
900
901 // check input
902 int ndf = OPS_GetNDF();
903 if(OPS_GetNumRemainingInputArgs() < ndf+1) {
904 PyErr_SetString(PyExc_RuntimeError,"insufficient arguments");
905 return NULL;
906 }
907
908 // get node tag
909 int nodeTag;
910 int numData = 1;
911 if(OPS_GetIntInput(&numData,&nodeTag) < 0) return NULL;
912
913 // mass terms
914 Matrix mass(ndf,ndf);
915 Vector massvec(ndf);
916 if(OPS_GetDoubleInput(&ndf,&massvec[0]) < 0) return NULL;
917 for(int i=0; i<ndf; i++) {
918 mass(i,i) = massvec[i];
919 }
920
921 // set mass
922 Domain *theDomain = OPS_GetDomain();
923 if(theDomain->setMass(mass,nodeTag) < 0) {
924 PyErr_SetString(PyExc_RuntimeError,"ERROR failed to set mass");
925 return NULL;
926 }
927
928 return Py_BuildValue("i", nodeTag);
929}
930
931PyObject *ops_addGroundMotion(PyObject *self, PyObject *args)
932{

Callers

nothing calls this directly

Calls 8

OPS_ResetCommandLineFunction · 0.85
isSetMethod · 0.80
OPS_GetNDFFunction · 0.70
OPS_GetIntInputFunction · 0.70
OPS_GetDoubleInputFunction · 0.70
OPS_GetDomainFunction · 0.70
setMassMethod · 0.45

Tested by

no test coverage detected