Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openfoam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
openfoam
Commits
b496cf9c
Commit
b496cf9c
authored
16 years ago
by
mattijs
Browse files
Options
Downloads
Patches
Plain Diff
fixes for running with range checking on List
parent
bdec40f4
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H
+3
-9
3 additions, 9 deletions
src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H
src/OpenFOAM/containers/Lists/DynamicList/DynamicListI.H
+14
-16
14 additions, 16 deletions
src/OpenFOAM/containers/Lists/DynamicList/DynamicListI.H
with
17 additions
and
25 deletions
src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H
+
3
−
9
View file @
b496cf9c
...
...
@@ -26,7 +26,7 @@ Class
Foam::DynamicList
Description
A 1D vector of objects of type \<T\>
which
resizes itself as necessary to
A 1D vector of objects of type \<T\>
that
resizes itself as necessary to
accept the new objects.
Internal storage is a compact array and the list can be shrunk to compact
...
...
@@ -149,7 +149,7 @@ public:
//- Append an element at the end of the list
inline
void
append
(
const
T
&
e
);
//- Re
turn
and re
move
the top element
//- Re
move
and re
turn
the top element
inline
T
remove
();
//- Return non-const access to an element,
...
...
@@ -159,15 +159,9 @@ public:
//- Assignment of all entries to the given value
inline
void
operator
=
(
const
T
&
);
//- Assignment from List<T>
//- Assignment from List<T>
. Also handles assignment from DynamicList.
inline
void
operator
=
(
const
List
<
T
>&
);
//- Assignment from DynamicList<T>
inline
void
operator
=
(
const
DynamicList
<
T
,
SizeInc
,
SizeMult
,
SizeDiv
>&
);
// IOstream operators
...
...
This diff is collapsed.
Click to expand it.
src/OpenFOAM/containers/Lists/DynamicList/DynamicListI.H
+
14
−
16
View file @
b496cf9c
...
...
@@ -85,8 +85,10 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::setSize
}
else
{
label
nextFree
=
List
<
T
>::
size
();
allocSize_
=
s
;
List
<
T
>::
setSize
(
allocSize_
);
List
<
T
>::
size
()
=
nextFree
;
}
}
...
...
@@ -104,8 +106,10 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::setSize
}
else
{
label
nextFree
=
List
<
T
>::
size
();
allocSize_
=
s
;
List
<
T
>::
setSize
(
allocSize_
,
t
);
List
<
T
>::
size
()
=
nextFree
;
}
}
...
...
@@ -166,8 +170,7 @@ Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::transfer
)
{
allocSize_
=
l
.
allocSize
();
List
<
T
>::
transfer
(
l
);
// take over storage
l
.
allocSize_
=
0
;
List
<
T
>::
transfer
(
l
);
// take over storage. Null l.
}
...
...
@@ -189,9 +192,9 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::append(const T& e)
List
<
T
>::
setSize
(
allocSize_
);
}
this
->
operator
[](
nextFree
-
1
)
=
e
;
List
<
T
>::
size
()
=
nextFree
;
this
->
operator
[](
nextFree
-
1
)
=
e
;
}
...
...
@@ -206,7 +209,13 @@ inline T Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::remove()
)
<<
"List is empty"
<<
abort
(
FatalError
);
}
return
List
<
T
>::
operator
[](
--
List
<
T
>::
size
());
label
nextFree
=
List
<
T
>::
size
()
-
1
;
const
T
&
val
=
List
<
T
>::
operator
[](
nextFree
);
List
<
T
>::
size
()
=
nextFree
;
return
val
;
}
...
...
@@ -260,15 +269,4 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
}
template
<
class
T
,
unsigned
SizeInc
,
unsigned
SizeMult
,
unsigned
SizeDiv
>
inline
void
Foam
::
DynamicList
<
T
,
SizeInc
,
SizeMult
,
SizeDiv
>::
operator
=
(
const
DynamicList
<
T
,
SizeInc
,
SizeMult
,
SizeDiv
>&
l
)
{
List
<
T
>::
operator
=
(
l
);
allocSize_
=
l
.
allocSize
();
}
// ************************************************************************* //
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