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 )) {
0 commit comments