Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Rémi Cailletaud
yade
Commits
5b6667b8
Commit
5b6667b8
authored
Jan 29, 2013
by
Anton Gladky
Browse files
Resize interactionsOnBody, if it is necessary. (Closes: LP:1105177)
parent
83832e0b
Changes
2
Hide whitespace changes
Inline
Side-by-side
pkg/dem/Law2_ScGeom_CapillaryPhys_Capillarity.cpp
View file @
5b6667b8
...
...
@@ -553,6 +553,7 @@ bool BodiesMenisciiList::prepare(Scene * scene)
bool
BodiesMenisciiList
::
insert
(
const
shared_ptr
<
Interaction
>&
interaction
)
{
checkLengthBuffer
(
interaction
);
interactionsOnBody
[
interaction
->
getId1
()].
push_back
(
interaction
);
interactionsOnBody
[
interaction
->
getId2
()].
push_back
(
interaction
);
return
true
;
...
...
@@ -561,11 +562,19 @@ bool BodiesMenisciiList::insert(const shared_ptr< Interaction >& interaction)
bool
BodiesMenisciiList
::
remove
(
const
shared_ptr
<
Interaction
>&
interaction
)
{
checkLengthBuffer
(
interaction
);
interactionsOnBody
[
interaction
->
getId1
()].
remove
(
interaction
);
interactionsOnBody
[
interaction
->
getId2
()].
remove
(
interaction
);
return
true
;
}
void
BodiesMenisciiList
::
checkLengthBuffer
(
const
shared_ptr
<
Interaction
>&
interaction
)
{
Body
::
id_t
maxBodyId
=
std
::
max
(
interaction
->
getId1
(),
interaction
->
getId2
());
if
(
unsigned
(
maxBodyId
)
>=
interactionsOnBody
.
size
())
{
interactionsOnBody
.
resize
(
maxBodyId
+
1
);
}
}
list
<
shared_ptr
<
Interaction
>
>&
BodiesMenisciiList
::
operator
[]
(
int
index
)
{
return
interactionsOnBody
[
index
];
...
...
pkg/dem/Law2_ScGeom_CapillaryPhys_Capillarity.hpp
View file @
5b6667b8
...
...
@@ -70,13 +70,14 @@ class BodiesMenisciiList
public:
BodiesMenisciiList
();
BodiesMenisciiList
(
Scene
*
body
);
bool
prepare
(
Scene
*
scene
);
bool
insert
(
const
shared_ptr
<
Interaction
>&
interaction
);
bool
remove
(
const
shared_ptr
<
Interaction
>&
interaction
);
list
<
shared_ptr
<
Interaction
>
>&
operator
[]
(
int
index
);
BodiesMenisciiList
(
Scene
*
);
bool
prepare
(
Scene
*
);
bool
insert
(
const
shared_ptr
<
Interaction
>&
);
bool
remove
(
const
shared_ptr
<
Interaction
>&
);
list
<
shared_ptr
<
Interaction
>
>&
operator
[]
(
int
);
int
size
();
void
display
();
void
checkLengthBuffer
(
const
shared_ptr
<
Interaction
>&
);
bool
initialized
;
...
...
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