Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Sassena
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DAPHNE4NFDI
Sassena
Commits
045f5fda
Commit
045f5fda
authored
9 months ago
by
Dan Vonk
Committed by
Daniel Vonk
9 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix memory leak in IAtomselection
parent
fec9d0bd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!19
Merge develop into main
,
!17
Add CUDA backend
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/core/sample/atomselection.hpp
+62
-50
62 additions, 50 deletions
src/core/sample/atomselection.hpp
with
62 additions
and
50 deletions
src/core/sample/atomselection.hpp
+
62
−
50
View file @
045f5fda
...
...
@@ -23,68 +23,80 @@ This file contains a class which defines different types of atomselections.
/**
Interface for atom selections.
*/
class
IAtomselection
{
protected:
friend
class
boost
::
serialization
::
access
;
template
<
class
Archive
>
void
serialize
(
Archive
&
ar
,
const
unsigned
int
version
)
{}
public
:
virtual
size_t
operator
[](
size_t
index
)
=
0
;
virtual
size_t
size
()
=
0
;
class
IAtomselection
{
protected:
friend
class
boost
::
serialization
::
access
;
template
<
class
Archive
>
void
serialize
(
Archive
&
ar
,
const
unsigned
int
version
)
{
}
public
:
virtual
size_t
operator
[](
size_t
index
)
=
0
;
virtual
size_t
size
()
=
0
;
virtual
~
IAtomselection
()
{};
};
/**
An atom selection which is implemented as an array of atom indexes. May use up
significant amount of memory.
*/
class
IndexAtomselection
:
public
IAtomselection
{
// make this class serializable to
// allow sample to be transmitted via MPI
friend
class
boost
::
serialization
::
access
;
template
<
class
Archive
>
void
serialize
(
Archive
&
ar
,
const
unsigned
int
version
)
{
ar
&
boost
::
serialization
::
base_object
<
IAtomselection
,
IndexAtomselection
>
(
*
this
);
ar
&
ids_
;
}
///////////////////
std
::
vector
<
size_t
>
ids_
;
public
:
IndexAtomselection
()
{}
IndexAtomselection
(
std
::
vector
<
size_t
>
ids
);
size_t
operator
[](
size_t
index
);
size_t
size
();
class
IndexAtomselection
:
public
IAtomselection
{
// make this class serializable to
// allow sample to be transmitted via MPI
friend
class
boost
::
serialization
::
access
;
template
<
class
Archive
>
void
serialize
(
Archive
&
ar
,
const
unsigned
int
version
)
{
ar
&
boost
::
serialization
::
base_object
<
IAtomselection
,
IndexAtomselection
>
(
*
this
);
ar
&
ids_
;
}
///////////////////
std
::
vector
<
size_t
>
ids_
;
public
:
IndexAtomselection
()
{
}
IndexAtomselection
(
std
::
vector
<
size_t
>
ids
);
size_t
operator
[](
size_t
index
);
size_t
size
();
};
/**
Selects atoms within the given range. No memory requirements and is used e.g.
for the system selection.
*/
class
RangeAtomselection
:
public
IAtomselection
{
// make this class serializable to
// allow sample to be transmitted via MPI
friend
class
boost
::
serialization
::
access
;
template
<
class
Archive
>
void
serialize
(
Archive
&
ar
,
const
unsigned
int
version
)
{
ar
&
boost
::
serialization
::
base_object
<
IAtomselection
,
RangeAtomselection
>
(
*
this
);
ar
&
from_
;
ar
&
to_
;
}
///////////////////
size_t
from_
;
size_t
to_
;
public
:
RangeAtomselection
()
:
from_
(
0
),
to_
(
0
)
{}
RangeAtomselection
(
size_t
from
,
size_t
to
);
size_t
operator
[](
size_t
index
);
size_t
size
();
class
RangeAtomselection
:
public
IAtomselection
{
// make this class serializable to
// allow sample to be transmitted via MPI
friend
class
boost
::
serialization
::
access
;
template
<
class
Archive
>
void
serialize
(
Archive
&
ar
,
const
unsigned
int
version
)
{
ar
&
boost
::
serialization
::
base_object
<
IAtomselection
,
RangeAtomselection
>
(
*
this
);
ar
&
from_
;
ar
&
to_
;
}
///////////////////
size_t
from_
;
size_t
to_
;
public
:
RangeAtomselection
()
:
from_
(
0
)
,
to_
(
0
)
{
}
RangeAtomselection
(
size_t
from
,
size_t
to
);
size_t
operator
[](
size_t
index
);
size_t
size
();
};
#endif
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment