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

Method solve

SRC/system_of_eqn/linearSOE/diagonal/DistributedDiagonalSolver.cpp:68–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66
67
68int
69DistributedDiagonalSolver::solve(void)
70{
71 int size = theSOE->size;
72 int processID = theSOE->processID;
73
74 Channel **theChannels = theSOE->theChannels;
75 int numChannels = theSOE->numChannels;
76
77 int numShared = theSOE->numShared;
78 ID &myDOFs = theSOE->myDOFs;
79 ID &myDOFsShared = theSOE->myDOFsShared;
80
81 double *X = theSOE->X;
82 double *B = theSOE->B;
83 double *A = theSOE->A;
84 double *dataShared = theSOE->dataShared;
85 Vector *vectShared = theSOE->vectShared;
86
87 //
88 // first copy A & B contributions to sharedData
89 //
90
91 for (int i=0; i<numShared; i++)
92 dataShared[i] = 0.0;
93
94 // assuming numShared < size .. could do an if statement
95
96 for (int i=0; i<numShared; i++) {
97 int dof = myDOFsShared(i);
98 int loc = myDOFs.getLocation(dof);
99 if (loc >= 0) {
100 dataShared[i] = A[loc];
101 dataShared[i+numShared] = B[loc];
102 }
103 }
104
105 //
106 // use P0 to gather & send back out
107 //
108
109 if (numShared != 0) {
110 if (processID != 0) {
111 Channel *theChannel = theChannels[0];
112 theChannel->sendVector(0, 0, *vectShared);
113 theChannel->recvVector(0, 0, *vectShared);
114 }
115 else {
116
117 static Vector otherShared(1);
118 otherShared.resize(2*numShared);
119 for (int i=0; i<numChannels; i++) {
120 Channel *theChannel = theChannels[i];
121 theChannel->recvVector(0, 0, otherShared);
122 *vectShared += otherShared;
123 }
124 for (int i=0; i<numChannels; i++) {
125 Channel *theChannel = theChannels[i];

Callers

nothing calls this directly

Calls 4

getLocationMethod · 0.45
sendVectorMethod · 0.45
recvVectorMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected