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

Function main

SRC/tcl/mpiMainTest.cpp:52–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50#include <Matrix.h>
51
52int
53main(int argc, char **argv)
54{
55 FEM_ObjectBroker theBroker;
56 MPI_MachineBroker theMachine(&theBroker, argc, argv);
57 theMachineBroker = &theMachine;
58
59 int rank = theMachine.getPID();
60 int np = theMachine.getNP();
61
62 //
63 // depending on rank we do something
64 //
65 if (rank != 0) {
66
67 //
68 // on secondary processes we spin waiting to create & run actors
69 //
70 fprintf(stderr, "Secondary Process Running\n");
71 theMachine.runActors();
72
73 } else {
74
75 //
76 // on process 0 we create some ShadowSubdomains & then start the OpenSees interpreter
77 //
78 fprintf(stderr, "Primary Process Running OpenSees Interpreter\n");
79
80 //
81 // set some global parameters
82 //
83 OPS_OBJECT_BROKER = &theBroker;
84 OPS_MACHINE = &theMachine;
85 OPS_PARALLEL_PROCESSING = np;
86 OPS_NUM_SUBDOMAINS = np - 1;
87 OPS_PARTITIONED = false;
88 Channel **OPS_theChannels = 0;
89 OPS_theChannels = new Channel *[OPS_NUM_SUBDOMAINS];
90 Subdomain **OPS_theSubdomains = 0;
91 OPS_theSubdomains = new Subdomain *[OPS_NUM_SUBDOMAINS];
92
93 // start the remote actors
94 for (int i=1; i<=OPS_NUM_SUBDOMAINS; i++) {
95 ShadowSubdomain *theSubdomain = new ShadowSubdomain(i,
96 *OPS_MACHINE,
97 *OPS_OBJECT_BROKER);
98 theDomain.addSubdomain(theSubdomain);
99 OPS_theChannels[i-1] = theSubdomain->getChannelPtr();
100 OPS_theSubdomains[i-1] = theSubdomain;
101 }
102
103 Subdomain *theSubdomain = OPS_theSubdomains[0];
104 Node *node1 = new Node(1, 2, 0.0, 0.0);
105 Node *node2 = new Node(2, 2, 144.0, 0.0);
106 Node *node3 = new Node(3, 2, 168.0, 0.0);
107 Node *node4 = new Node(4, 2, 72.0, 96.0);
108 Matrix mass(2,2); mass(0,0)=1.0; mass(1,1)=2.0;
109 node1->setMass(mass);

Callers

nothing calls this directly

Calls 11

getPIDMethod · 0.80
getNPMethod · 0.80
runActorsMethod · 0.80
addSubdomainMethod · 0.80
shutdownMethod · 0.80
getChannelPtrMethod · 0.45
setMassMethod · 0.45
addNodeMethod · 0.45
addExternalNodeMethod · 0.45
PrintMethod · 0.45
clearAllMethod · 0.45

Tested by

no test coverage detected