Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nektar
Nektar
Commits
601aeabc
Commit
601aeabc
authored
Feb 06, 2016
by
Dave Moxey
Committed by
Spencer Sherwin
Mar 04, 2016
Browse files
Fix issue with context being deleted twice
parent
69b93d2e
Changes
1
Hide whitespace changes
Inline
Side-by-side
library/MultiRegions/GlobalLinSysPETSc.cpp
View file @
601aeabc
...
...
@@ -288,15 +288,15 @@ namespace Nektar
// size and a pointer to the linear system. We do this so that
// we can call a member function to the matrix-vector and
// preconditioning multiplication in a subclass.
ShellCtx
*
ctx
=
new
ShellCtx
();
ctx
->
nGlobal
=
nGlobal
;
ctx
->
nDir
=
nDir
;
ctx
->
linSys
=
this
;
ShellCtx
*
ctx
1
=
new
ShellCtx
(),
ctx2
=
new
ShellCtx
();
ctx
1
->
nGlobal
=
ctx2
->
nGlobal
=
nGlobal
;
ctx
1
->
nDir
=
ctx2
->
nDir
=
nDir
;
ctx
1
->
linSys
=
ctx2
->
linSys
=
this
;
// Set up MatShell object.
MatCreateShell
(
PETSC_COMM_WORLD
,
m_nLocal
,
m_nLocal
,
PETSC_DETERMINE
,
PETSC_DETERMINE
,
(
void
*
)
ctx
,
&
m_matrix
);
(
void
*
)
ctx
1
,
&
m_matrix
);
MatShellSetOperation
(
m_matrix
,
MATOP_MULT
,
(
void
(
*
)(
void
))
DoMatrixMultiply
);
MatShellSetOperation
(
m_matrix
,
MATOP_DESTROY
,
...
...
@@ -312,7 +312,7 @@ namespace Nektar
PCSetType
(
m_pc
,
PCSHELL
);
PCShellSetApply
(
m_pc
,
DoPreconditioner
);
PCShellSetDestroy
(
m_pc
,
DoDestroyPCCtx
);
PCShellSetContext
(
m_pc
,
ctx
);
PCShellSetContext
(
m_pc
,
ctx
2
);
}
else
{
...
...
@@ -452,12 +452,7 @@ namespace Nektar
void
*
ptr
;
MatShellGetContext
(
M
,
&
ptr
);
ShellCtx
*
ctx
=
(
ShellCtx
*
)
ptr
;
if
(
ctx
)
{
delete
ctx
;
}
delete
ctx
;
return
0
;
}
...
...
@@ -475,12 +470,7 @@ namespace Nektar
void
*
ptr
;
PCShellGetContext
(
pc
,
&
ptr
);
ShellCtx
*
ctx
=
(
ShellCtx
*
)
ptr
;
if
(
ctx
)
{
delete
ctx
;
}
delete
ctx
;
return
0
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment