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

Function main

EXAMPLES/Example1/main.cpp:79–197  ·  view source on GitHub ↗

main routine

Source from the content-addressed store, hash-verified

77
78// main routine
79int main(int argc, char **argv)
80{
81 //
82 // now create a domain and a modelbuilder
83 // and build the model
84 //
85
86 Domain *theDomain = new Domain();
87
88 // create the nodes using constructor:
89 // Node(tag, ndof, crd1, crd2)
90 // and then add them to the domain
91
92 Node *node1 = new Node(1, 2, 0.0, 0.0);
93 Node *node2 = new Node(2, 2, 144.0, 0.0);
94 Node *node3 = new Node(3, 2, 168.0, 0.0);
95 Node *node4 = new Node(4, 2, 72.0, 96.0);
96 theDomain->addNode(node1);
97 theDomain->addNode(node2);
98 theDomain->addNode(node3);
99 theDomain->addNode(node4);
100
101 // create an elastic material using constriuctor:
102 // ElasticMaterialModel(tag, E)
103
104 UniaxialMaterial *theMaterial = new ElasticMaterial(1, 3000);
105
106 // create the truss elements using constructor:
107 // Truss(tag, dim, nd1, nd2, Material &,A)
108 // and then add them to the domain
109
110 Truss *truss1 = new Truss(1, 2, 1, 4, *theMaterial, 10.0);
111 Truss *truss2 = new Truss(2, 2, 2, 4, *theMaterial, 5.0);
112 Truss *truss3 = new Truss(3, 2, 3, 4, *theMaterial, 5.0);
113 theDomain->addElement(truss1);
114 theDomain->addElement(truss2);
115 theDomain->addElement(truss3);
116
117 // create the single-point constraint objects using constructor:
118 // SP_Constraint(tag, nodeTag, dofID, value)
119 // and then add them to the domain
120
121 SP_Constraint *sp1 = new SP_Constraint(1, 0, 0.0);
122 SP_Constraint *sp2 = new SP_Constraint(1, 1, 0.0);
123 SP_Constraint *sp3 = new SP_Constraint(2, 0, 0.0);
124 SP_Constraint *sp4 = new SP_Constraint(2, 1, 0.0);
125 SP_Constraint *sp5 = new SP_Constraint(3, 0, 0.0);
126 SP_Constraint *sp6 = new SP_Constraint(3, 1, 0.0);
127 theDomain->addSP_Constraint(sp1);
128 theDomain->addSP_Constraint(sp2);
129 theDomain->addSP_Constraint(sp3);
130 theDomain->addSP_Constraint(sp4);
131 theDomain->addSP_Constraint(sp5);
132 theDomain->addSP_Constraint(sp6);
133
134 // construct a linear time series object using constructor:
135 // LinearSeries()
136

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