Skip to content

Commit 1bdc467

Browse files
committed
Merge branch 'master' of github.com:OpenSees/OpenSees
2 parents f2700bf + 9519f0d commit 1bdc467

3 files changed

Lines changed: 57 additions & 4 deletions

File tree

SRC/system_of_eqn/linearSOE/diagonal/MPIDiagonalSOE.cpp

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@
3333

3434

3535

36-
MPIDiagonalSOE::MPIDiagonalSOE(MPIDiagonalSolver &the_Solver)
36+
MPIDiagonalSOE::MPIDiagonalSOE(MPIDiagonalSolver &the_Solver, bool lumped)
3737
:LinearSOE(the_Solver, LinSOE_TAGS_MPIDiagonalSOE),
3838
size(0), A(0), B(0), X(0), sharedA(0), sharedB(0), maxSharedA(0), maxSharedB(0), isAfactored(false), updateA(true),
3939
vectX(0), vectB(0), dataShared(0),
4040
actualNeighbors(0),maxNeighbors(0),myNeighbors(0),myNeighborsSizes(0),
4141
myDOFsArray(0), myDOFsSharedArray(0),maxDOFsSharedArray(0),posLocKey(0),
4242
processID(0), numProcesses(0),
4343
numChannels(0), theChannels(0), localCol(0),
44-
myDOFs(0,32), myDOFsShared(0,16), numShared(0), theModel(0)
44+
myDOFs(0,32), myDOFsShared(0,16), numShared(0), theModel(0), lumpDiagonal(lumped)
4545
{
4646
MPI_Comm_rank(MPI_COMM_WORLD, &processID);
4747
the_Solver.setLinearSOE(*this);
@@ -424,6 +424,17 @@ MPIDiagonalSOE::addA(const Matrix &m, const ID &id, double fact)
424424
int pos = id(i);
425425
if (pos <size && pos >= 0) {
426426
A[pos] += m(i,i);
427+
428+
// Lump diagonal logic
429+
if (lumpDiagonal) {
430+
for (int j = 0; j < i; j++) {
431+
A[pos] += m(j, i) ;
432+
}
433+
for (int j = i + 1; j < id.Size(); j++) {
434+
A[pos] += m(j, i) ;
435+
}
436+
}
437+
427438
dof = myDOFs[pos];
428439
loc = myDOFsShared.getLocationOrdered(dof);
429440
if ( (loc >=0 ) && (loc < numShared )) {
@@ -437,6 +448,17 @@ MPIDiagonalSOE::addA(const Matrix &m, const ID &id, double fact)
437448
int pos = id(i);
438449
if (pos <size && pos >= 0) {
439450
A[pos] -= m(i,i);
451+
452+
// Lump diagonal logic
453+
if (lumpDiagonal) {
454+
for (int j = 0; j < i; j++) {
455+
A[pos] -= m(j, i) ;
456+
}
457+
for (int j = i + 1; j < id.Size(); j++) {
458+
A[pos] -= m(j, i) ;
459+
}
460+
}
461+
440462
dof = myDOFs[pos];
441463
loc = myDOFsShared.getLocationOrdered(dof);
442464
if ( (loc >=0 ) && (loc < numShared )) {
@@ -450,6 +472,17 @@ MPIDiagonalSOE::addA(const Matrix &m, const ID &id, double fact)
450472
int pos = id(i);
451473
if (pos <size && pos >= 0) {
452474
A[pos] += m(i,i) * fact;
475+
476+
// Lump diagonal logic
477+
if (lumpDiagonal) {
478+
for (int j = 0; j < i; j++) {
479+
A[pos] += m(j, i) * fact;
480+
}
481+
for (int j = i + 1; j < id.Size(); j++) {
482+
A[pos] += m(j, i) * fact;
483+
}
484+
}
485+
453486
dof = myDOFs[pos];
454487
loc = myDOFsShared.getLocationOrdered(dof);
455488
if ( (loc >=0 ) && (loc < numShared )) {

SRC/system_of_eqn/linearSOE/diagonal/MPIDiagonalSOE.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class MPIDiagonalSolver;
3030
class MPIDiagonalSOE : public LinearSOE
3131
{
3232
public:
33-
MPIDiagonalSOE(MPIDiagonalSolver &theSolver);
33+
MPIDiagonalSOE(MPIDiagonalSolver &theSolver, bool lumped=false);
3434
~MPIDiagonalSOE();
3535

3636
int getNumEqn(void) const;
@@ -101,6 +101,8 @@ class MPIDiagonalSOE : public LinearSOE
101101
ID myDOFsShared;
102102
int numShared,maxShared;
103103
AnalysisModel *theModel;
104+
105+
bool lumpDiagonal;
104106
};
105107

106108

SRC/system_of_eqn/linearSOE/diagonal/MPIDiagonalSolver.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,28 @@
1515
#include <MPIDiagonalSolver.h>
1616
#include <MPIDiagonalSOE.h>
1717
#include <Channel.h>
18-
18+
#include <elementAPI.h>
1919
//#include <essl.h>
2020

2121

22+
23+
void* OPS_MPIDiagonalSolver()
24+
{
25+
bool lumped = false;
26+
if (OPS_GetNumRemainingInputArgs() > 0) {
27+
std::string arg = OPS_GetString();
28+
if (arg == "lumped" || arg == "-lumped")
29+
lumped = true;
30+
}
31+
32+
opserr << "OPS_MPIDiagonalSolver lumped = " << (lumped ? "true" : "false" ) << endln;
33+
34+
MPIDiagonalSolver *theSolver = new MPIDiagonalSolver();
35+
return new MPIDiagonalSOE(*theSolver, lumped);
36+
}
37+
38+
39+
2240
MPIDiagonalSolver::MPIDiagonalSolver(int classTag)
2341
:LinearSOESolver(classTag),
2442
theSOE(0), minDiagTol(0.0)

0 commit comments

Comments
 (0)