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

Function OPS_Adapter

SRC/element/adapter/Adapter.cpp:47–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45#include <elementAPI.h>
46
47void* OPS_Adapter()
48{
49 int ndf = OPS_GetNDF();
50 if (OPS_GetNumRemainingInputArgs() < 8) {
51 opserr << "WARNING insufficient arguments\n";
52 opserr << "Want: element adapter eleTag -node Ndi Ndj ... -dof dofNdi -dof dofNdj ... -stif Kij ipPort <-ssl> <-udp> <-doRayleigh> <-mass Mij>\n";
53 return 0;
54 }
55
56 // tags
57 int tag;
58 int numdata = 1;
59 if (OPS_GetIntInput(&numdata, &tag) < 0) {
60 opserr << "WARNING: invalid tag\n";
61 return 0;
62 }
63
64 // nodes
65 const char* type = OPS_GetString();
66 if (strcmp(type, "-node") != 0) {
67 opserr << "WARNING expecting -node Ndi Ndj ...\n";
68 return 0;
69 }
70 ID nodes(32);
71 int numNodes = 0;
72 while (OPS_GetNumRemainingInputArgs() > 0) {
73 int node;
74 numdata = 1;
75 int numArgs = OPS_GetNumRemainingInputArgs();
76 if (OPS_GetIntInput(&numdata, &node) < 0) {
77 if (numArgs > OPS_GetNumRemainingInputArgs()) {
78 // move current arg back by one
79 OPS_ResetCurrentInputArg(-1);
80 }
81 break;
82 }
83 nodes(numNodes++) = node;
84 }
85 nodes.resize(numNodes);
86
87 // dofs
88 int numDOF = 0;
89 ID *dofs = new ID[numNodes];
90 for (int i = 0; i < numNodes; i++) {
91 type = OPS_GetString();
92 if (strcmp(type, "-dof") != 0 && strcmp(type, "-dir") != 0) {
93 opserr << "WARNING expecting -dof dofNd"
94 << i + 1 << ", but got " << type << endln;
95 return 0;
96 }
97 ID dofsi(ndf);
98 int numDOFi = 0;
99 while (OPS_GetNumRemainingInputArgs() > 0) {
100 int dof;
101 numdata = 1;
102 int numArgs = OPS_GetNumRemainingInputArgs();
103 if (OPS_GetIntInput(&numdata, &dof) < 0) {
104 if (numArgs > OPS_GetNumRemainingInputArgs()) {

Callers 1

Calls 7

OPS_GetNDFFunction · 0.50
OPS_GetIntInputFunction · 0.50
OPS_GetStringFunction · 0.50
OPS_ResetCurrentInputArgFunction · 0.50
OPS_GetDoubleInputFunction · 0.50
resizeMethod · 0.45

Tested by

no test coverage detected