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

Function OPS_model

SRC/interpreter/OpenSeesCommands.cpp:1336–1400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1334}
1335
1336int OPS_model()
1337{
1338 // num args
1339 if(OPS_GetNumRemainingInputArgs() < 3) {
1340 opserr<<"WARNING insufficient args: model -ndm ndm <-ndf ndf>\n";
1341 return -1;
1342 }
1343
1344 // model type
1345 const char* modeltype = OPS_GetString();
1346 if (strcmp(modeltype,"basic")!=0 && strcmp(modeltype,"Basic")!=0 &&
1347 strcmp(modeltype,"BasicBuilder")!=0 && strcmp(modeltype,"basicBuilder")!=0) {
1348 opserr<<"WARNING only basic builder is available at this time\n";
1349 return -1;
1350 }
1351
1352 // ndm
1353 const char* ndmopt = OPS_GetString();
1354 if (strcmp(ndmopt,"-ndm") != 0) {
1355 opserr<<"WARNING first option must be -ndm\n";
1356 return -1;
1357 }
1358 int numdata = 1;
1359 int ndm = 0;
1360 if (OPS_GetIntInput(&numdata, &ndm) < 0) {
1361 opserr<<"WARNING failed to read ndm\n";
1362 return -1;
1363 }
1364 if (ndm!=1 && ndm!=2 && ndm!=3) {
1365 opserr<<"ERROR ndm msut be 1, 2 or 3\n";
1366 return -1;
1367 }
1368
1369 // ndf
1370 int ndf = 0;
1371 if (OPS_GetNumRemainingInputArgs() > 1) {
1372 const char* ndfopt = OPS_GetString();
1373 if (strcmp(ndfopt,"-ndf") != 0) {
1374 opserr<<"WARNING second option must be -ndf\n";
1375 return -1;
1376 }
1377 if (OPS_GetIntInput(&numdata, &ndf) < 0) {
1378 opserr<<"WARNING failed to read ndf\n";
1379 return -1;
1380 }
1381 }
1382
1383 // set ndf
1384 if(ndf <= 0) {
1385 if (ndm == 1)
1386 ndf = 1;
1387 else if (ndm == 2)
1388 ndf = 3;
1389 else if (ndm == 3)
1390 ndf = 6;
1391 }
1392
1393 // set ndm and ndf

Callers 2

Tcl_ops_modelFunction · 0.85
Py_ops_modelFunction · 0.85

Calls 5

setNDFMethod · 0.80
setNDMMethod · 0.80
OPS_GetStringFunction · 0.70
OPS_GetIntInputFunction · 0.70

Tested by

no test coverage detected