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

Function main

EXAMPLES/ShadowTruss/ClientMain.cpp:75–211  ·  view source on GitHub ↗

main routine

Source from the content-addressed store, hash-verified

73
74// main routine
75int main(int argc, char **argv)
76{
77 if (argc != 3) {
78 opserr << "invalid usage - require \"example1 portNumber? machineInetAddress?\"\n";
79 exit(-1);
80 }
81
82 TCP_Socket *theChannel = new TCP_Socket(atoi(argv[1]), argv[2]);
83 FEM_ObjectBroker *theBroker = new FEM_ObjectBroker();
84
85 //
86 // now create a domain and a modelbuilder
87 // and build the model
88 //
89
90 Domain *theDomain = new Domain();
91
92 // create the nodes using constructor:
93 // Node(tag, ndof, crd1, crd2)
94 // and then add them to the domain
95
96 Node *node1 = new Node(1, 2, 0.0, 0.0);
97 Node *node2 = new Node(2, 2, 144.0, 0.0);
98 Node *node3 = new Node(3, 2, 168.0, 0.0);
99 Node *node4 = new Node(4, 2, 72.0, 96.0);
100 theDomain->addNode(node1);
101 theDomain->addNode(node2);
102 theDomain->addNode(node3);
103 theDomain->addNode(node4);
104
105 // create an elastic material using constriuctor:
106 // ElasticMaterialModel(tag, E)
107
108 UniaxialMaterial *theMaterial = new ElasticMaterial(1, 3000);
109
110 // create the truss elements using constructor:
111 // Truss(tag, dim, nd1, nd2, Material &,A)
112 // and then add them to the domain
113
114 Truss *truss1 = new Truss(1, 2, 1, 4, *theMaterial, 10.0);
115 Truss *truss2 = new Truss(2, 2, 2, 4, *theMaterial, 5.0);
116
117 // NOTE:
118 // for element 3 we use a ShadowTruss object instead of a regular truss.
119 // THIS IS THE ONLY DIFFERENCE BETWEEN THIS .exe AND THE ONE IN OpenSees/Example1
120
121 // so instead of this line:
122 // Truss *truss3 = new Truss(3, 2, 3, 4, *theMaterial, 5.0);
123 // we have this line:
124 ShadowTruss *truss3 = new ShadowTruss(3, 3, 4, *theMaterial, 5.0, 0.0, *theChannel, *theBroker);
125 theDomain->addElement(truss1);
126 theDomain->addElement(truss2);
127 theDomain->addElement(truss3);
128
129 // create the single-point constraint objects using constructor:
130 // SP_Constraint(tag, nodeTag, dofID, value)
131 // and then add them to the domain
132

Callers

nothing calls this directly

Calls 9

exitFunction · 0.85
setTimeSeriesMethod · 0.80
addNodeMethod · 0.45
addElementMethod · 0.45
addSP_ConstraintMethod · 0.45
addLoadPatternMethod · 0.45
addNodalLoadMethod · 0.45
analyzeMethod · 0.45
clearAllMethod · 0.45

Tested by

no test coverage detected