Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
c775bd19
Commit
c775bd19
authored
Nov 16, 2012
by
Peter Eastman
Browse files
Fixed error that required Context and Integrator to be deleted in a particular order
parent
cd6af26e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
2 deletions
+6
-2
openmmapi/include/openmm/Integrator.h
openmmapi/include/openmm/Integrator.h
+4
-1
openmmapi/src/Context.cpp
openmmapi/src/Context.cpp
+1
-0
openmmapi/src/ContextImpl.cpp
openmmapi/src/ContextImpl.cpp
+0
-1
platforms/cuda/src/CudaContext.cpp
platforms/cuda/src/CudaContext.cpp
+1
-0
No files found.
openmmapi/include/openmm/Integrator.h
View file @
c775bd19
...
@@ -54,6 +54,7 @@ class ContextImpl;
...
@@ -54,6 +54,7 @@ class ContextImpl;
class
OPENMM_EXPORT
Integrator
{
class
OPENMM_EXPORT
Integrator
{
public:
public:
virtual
~
Integrator
()
{
virtual
~
Integrator
()
{
cleanup
();
}
}
/**
/**
* Get the size of each time step, in picoseconds. If this integrator uses variable time steps,
* Get the size of each time step, in picoseconds. If this integrator uses variable time steps,
...
@@ -92,6 +93,7 @@ public:
...
@@ -92,6 +93,7 @@ public:
*/
*/
virtual
void
step
(
int
steps
)
=
0
;
virtual
void
step
(
int
steps
)
=
0
;
protected:
protected:
friend
class
Context
;
friend
class
ContextImpl
;
friend
class
ContextImpl
;
/**
/**
* This will be called by the Context when it is created. It informs the Integrator
* This will be called by the Context when it is created. It informs the Integrator
...
@@ -103,7 +105,8 @@ protected:
...
@@ -103,7 +105,8 @@ protected:
* This will be called by the Context when it is destroyed to let the Integrator do any necessary
* This will be called by the Context when it is destroyed to let the Integrator do any necessary
* cleanup. It will also get called again if the application calls reinitialize() on the Context.
* cleanup. It will also get called again if the application calls reinitialize() on the Context.
*/
*/
virtual
void
cleanup
()
=
0
;
virtual
void
cleanup
()
{
};
/**
/**
* Get the names of all Kernels used by this Integrator.
* Get the names of all Kernels used by this Integrator.
*/
*/
...
...
openmmapi/src/Context.cpp
View file @
c775bd19
...
@@ -216,6 +216,7 @@ void Context::reinitialize() {
...
@@ -216,6 +216,7 @@ void Context::reinitialize() {
System
&
system
=
impl
->
getSystem
();
System
&
system
=
impl
->
getSystem
();
Integrator
&
integrator
=
impl
->
getIntegrator
();
Integrator
&
integrator
=
impl
->
getIntegrator
();
Platform
&
platform
=
impl
->
getPlatform
();
Platform
&
platform
=
impl
->
getPlatform
();
integrator
.
cleanup
();
delete
impl
;
delete
impl
;
impl
=
new
ContextImpl
(
*
this
,
system
,
integrator
,
&
platform
,
properties
);
impl
=
new
ContextImpl
(
*
this
,
system
,
integrator
,
&
platform
,
properties
);
}
}
...
...
openmmapi/src/ContextImpl.cpp
View file @
c775bd19
...
@@ -122,7 +122,6 @@ ContextImpl::~ContextImpl() {
...
@@ -122,7 +122,6 @@ ContextImpl::~ContextImpl() {
updateStateDataKernel
=
Kernel
();
updateStateDataKernel
=
Kernel
();
applyConstraintsKernel
=
Kernel
();
applyConstraintsKernel
=
Kernel
();
virtualSitesKernel
=
Kernel
();
virtualSitesKernel
=
Kernel
();
integrator
.
cleanup
();
platform
->
contextDestroyed
(
*
this
);
platform
->
contextDestroyed
(
*
this
);
}
}
...
...
platforms/cuda/src/CudaContext.cpp
View file @
c775bd19
...
@@ -255,6 +255,7 @@ CudaContext::~CudaContext() {
...
@@ -255,6 +255,7 @@ CudaContext::~CudaContext() {
string
errorMessage
=
"Error deleting Context"
;
string
errorMessage
=
"Error deleting Context"
;
if
(
contextIsValid
)
if
(
contextIsValid
)
CHECK_RESULT
(
cuCtxDestroy
(
context
));
CHECK_RESULT
(
cuCtxDestroy
(
context
));
contextIsValid
=
false
;
}
}
void
CudaContext
::
initialize
()
{
void
CudaContext
::
initialize
()
{
...
...
Write
Preview
Markdown
is supported
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