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

Function OPS_nodeDisp

SRC/interpreter/OpenSeesOutputCommands.cpp:193–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191}
192
193int OPS_nodeDisp()
194{
195 if (OPS_GetNumRemainingInputArgs() < 1) {
196 opserr << "WARNING insufficient args: nodeDisp nodeTag <dof ...>\n";
197 return -1;
198 }
199
200 // tag and dof
201 int data[2] = {0, -1};
202 int numdata = OPS_GetNumRemainingInputArgs();
203 if (numdata > 2) {
204 numdata = 2;
205 }
206
207 if (OPS_GetIntInput(&numdata, data) < 0) {
208 opserr<<"WARNING nodeDisp - failed to read int inputs\n";
209 return -1;
210 }
211 data[1]--;
212
213 // get response
214 Domain* theDomain = OPS_GetDomain();
215 if (theDomain == 0) return -1;
216 const Vector *nodalResponse = theDomain->getNodeResponse(data[0], Disp);
217
218 if (nodalResponse == 0) {
219 opserr << "WARNING no response is found\n";
220 return -1;
221 }
222
223 // set outputs
224 int size = nodalResponse->Size();
225 if (data[1] >= 0) {
226 if (data[1] >= size) {
227 opserr << "WARNING nodeDisp nodeTag? dof? - dofTag? too large\n";
228 return -1;
229 }
230
231 double value = (*nodalResponse)(data[1]);
232 numdata = 1;
233
234 if (OPS_SetDoubleOutput(&numdata, &value, true) < 0) {
235 opserr<<"WARNING nodeDisp - failed to read double inputs\n";
236 return -1;
237 }
238
239
240 } else {
241
242 std::vector<double> values(size);
243 for (int i=0; i<size; i++) {
244 values[i] = (*nodalResponse)(i);
245 }
246 if (OPS_SetDoubleOutput(&size, &values[0], false) < 0) {
247 opserr<<"WARNING nodeDisp - failed to read double inputs\n";
248 return -1;
249 }
250 }

Callers 2

Tcl_ops_nodeDispFunction · 0.85
Py_ops_nodeDispFunction · 0.85

Calls 6

OPS_GetIntInputFunction · 0.70
OPS_GetDomainFunction · 0.70
OPS_SetDoubleOutputFunction · 0.70
getNodeResponseMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected