00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 extern "C" {
00026 #include <tcl.h>
00027 #include <tk.h>
00028 }
00029
00030 #include <stdio.h>
00031 #include <string.h>
00032
00033 #include <PartitionedDomain.h>
00034 #include <MPI_MachineBroker.h>
00035 #include <ShadowSubdomain.h>
00036 #include <ActorSubdomain.h>
00037 #include <FEM_ObjectBroker.h>
00038
00039 extern PartitionedDomain theDomain;
00040
00041 extern int OPS_PARALLEL_PROCESSING;
00042 extern int OPS_NUM_SUBDOMAINS;
00043 extern bool OPS_PARTITIONED;
00044 extern FEM_ObjectBroker *OPS_OBJECT_BROKER;
00045 extern MachineBroker *OPS_MACHINE;
00046
00047 static MPI_MachineBroker *theMachineBroker = 0;
00048
00049 #include <Node.h>
00050 #include <Matrix.h>
00051
00052 int
00053 main(int argc, char **argv)
00054 {
00055 FEM_ObjectBroker theBroker;
00056 MPI_MachineBroker theMachine(&theBroker, argc, argv);
00057 theMachineBroker = &theMachine;
00058
00059 int rank = theMachine.getPID();
00060 int np = theMachine.getNP();
00061
00062
00063
00064
00065 if (rank != 0) {
00066
00067
00068
00069
00070 fprintf(stderr, "Slave Process Running\n");
00071 theMachine.runActors();
00072
00073 } else {
00074
00075
00076
00077
00078 fprintf(stderr, "Master Process Running OpenSees Interpreter\n");
00079
00080
00081
00082
00083 OPS_OBJECT_BROKER = &theBroker;
00084 OPS_MACHINE = &theMachine;
00085 OPS_PARALLEL_PROCESSING = np;
00086 OPS_NUM_SUBDOMAINS = np - 1;
00087 OPS_PARTITIONED = false;
00088 Channel **OPS_theChannels = 0;
00089 OPS_theChannels = new Channel *[OPS_NUM_SUBDOMAINS];
00090 Subdomain **OPS_theSubdomains = 0;
00091 OPS_theSubdomains = new Subdomain *[OPS_NUM_SUBDOMAINS];
00092
00093
00094 for (int i=1; i<=OPS_NUM_SUBDOMAINS; i++) {
00095 ShadowSubdomain *theSubdomain = new ShadowSubdomain(i,
00096 *OPS_MACHINE,
00097 *OPS_OBJECT_BROKER);
00098 theDomain.addSubdomain(theSubdomain);
00099 OPS_theChannels[i-1] = theSubdomain->getChannelPtr();
00100 OPS_theSubdomains[i-1] = theSubdomain;
00101 }
00102
00103 Subdomain *theSubdomain = OPS_theSubdomains[0];
00104 Node *node1 = new Node(1, 2, 0.0, 0.0);
00105 Node *node2 = new Node(2, 2, 144.0, 0.0);
00106 Node *node3 = new Node(3, 2, 168.0, 0.0);
00107 Node *node4 = new Node(4, 2, 72.0, 96.0);
00108 Matrix mass(2,2); mass(0,0)=1.0; mass(1,1)=2.0;
00109 node1->setMass(mass);
00110 node2->setMass(mass);
00111
00112 theSubdomain->addNode(node1);
00113 theSubdomain->addExternalNode(node2);
00114
00115 theDomain.addNode(node3);
00116 theDomain.addNode(node4);
00117 theDomain.Print(opserr);
00118
00119
00120 theDomain.clearAll();
00121
00122
00123 }
00124
00125
00126
00127
00128
00129 theMachine.shutdown();
00130
00131 fprintf(stderr, "Process Terminating %d\n", rank);
00132
00133 return 0;
00134 }
00135
00136 int OpenSeesExit(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv)
00137 {
00138
00139
00140
00141
00142 if (theMachineBroker != 0) {
00143 theMachineBroker->shutdown();
00144 fprintf(stderr, "Process Terminating\n");
00145 }
00146
00147 return 0;
00148 }