Skip to content

Commit

Permalink
Further steps in block solver simplification 2
Browse files Browse the repository at this point in the history
  • Loading branch information
raback committed Nov 15, 2024
1 parent 2403bc3 commit e44a453
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions fem/src/BlockSolve.F90
Original file line number Diff line number Diff line change
Expand Up @@ -4305,7 +4305,7 @@ SUBROUTINE BlockSolveInt(A,x,b,Solver)
INTEGER, POINTER :: VarPerm(:)
INTEGER, POINTER :: BlockPerm(:)
INTEGER, POINTER :: SlaveSolvers(:)
LOGICAL :: GotSlaveSolvers, SkipVar
LOGICAL :: GotSlaveSolvers, DoMyOwnVars


TYPE(Matrix_t), POINTER :: Amat, SaveCM
Expand Down Expand Up @@ -4352,7 +4352,7 @@ SUBROUTINE BlockSolveInt(A,x,b,Solver)
SlaveSolvers => ListGetIntegerArray( Params, &
'Block Solvers', GotSlaveSolvers )

SkipVar = .FALSE.
DoMyOwnVars = .FALSE.

IF( BlockDomain .OR. BlockHdiv .OR. BlockHcurl .OR. BlockAV .OR. BlockHorVer .OR. &
BlockCart .OR. BlockNodal ) THEN
Expand All @@ -4363,7 +4363,7 @@ SUBROUTINE BlockSolveInt(A,x,b,Solver)
ALLOCATE( BlockIndex(n) )
BlockIndex = 0
BlockDofs = 0
SkipVar = .TRUE.
DoMyOwnVars = .TRUE.

IF( BlockDomain ) THEN
CALL BlockPickDofsPhysical( PSolver, BlockIndex, BlockDofs )
Expand Down Expand Up @@ -4414,7 +4414,7 @@ SUBROUTINE BlockSolveInt(A,x,b,Solver)
BlockDofs = BlockDofs + 1
END IF

CALL BlockInitMatrix( Solver, TotMatrix, BlockDofs, VarDofs, SkipVar )
CALL BlockInitMatrix( Solver, TotMatrix, BlockDofs, VarDofs, DoMyOwnVars )

NoVar = TotMatrix % NoVar
TotMatrix % Solver => Solver
Expand All @@ -4433,26 +4433,24 @@ SUBROUTINE BlockSolveInt(A,x,b,Solver)

IF( .NOT. GotSlaveSolvers ) THEN
CALL Info('BlockSolveInt','Splitting monolithic matrix into pieces',Level=10)
IF( SkipVar ) THEN
IF( DoMyOwnVars ) THEN
CALL BlockPickMatrixPerm( Solver, BlockIndex, VarDofs )
IF(ASSOCIATED(BlockIndex)) THEN
CALL BlockInitVar( Solver, TotMatrix, BlockIndex )
DEALLOCATE(BlockIndex)
ELSE
CALL BlockInitVar( Solver, TotMatrix )
END IF
!DEALLOCATE( BlockIndex )
ELSE IF( BlockDummy .OR. VarDofs == 1 ) THEN
CALL Info('BlockSolveInt','Using the original matrix as the (1,1) block!',Level=10)
TotMatrix % SubMatrix(1,1) % Mat => SolverMatrix
TotMatrix % SubMatrix(1,1) % Mat % Complex = ListGetLogical(Params,'Linear System Complex',Found)
ELSE
CALL BlockPickMatrix( Solver, NoVar ) !VarDofs )
! Default splitting of matrices.
CALL BlockPickMatrix( Solver, NoVar )
VarDofs = NoVar
END IF

IF( SkipVar ) THEN
IF(ASSOCIATED(BlockIndex)) THEN
CALL BlockInitVar( Solver, TotMatrix, BlockIndex )
DEALLOCATE(BlockIndex)
ELSE
CALL BlockInitVar( Solver, TotMatrix )
END IF
END IF
CALL Info('BlockSolveInt','Block matrix system created',Level=12)
END IF

Expand Down Expand Up @@ -4606,7 +4604,7 @@ SUBROUTINE BlockSolveInt(A,x,b,Solver)
Solver % Matrix % ConstraintMatrix => SaveCM
END IF

IF( BlockHorVer .OR. BlockCart .OR. BlockDomain .OR. BlockHcurl .OR. BlockAV ) THEN
IF( DoMyOwnVars ) THEN
CALL BlockBackCopyVar( Solver, TotMatrix )
END IF

Expand All @@ -4618,6 +4616,7 @@ SUBROUTINE BlockSolveInt(A,x,b,Solver)
CALL Info('BlockSolveInt','-------------------------------------------------',Level=5)

END SUBROUTINE BlockSolveInt

END MODULE BlockSolve


Expand Down

0 comments on commit e44a453

Please sign in to comment.