Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
a8550cd0
Commit
a8550cd0
authored
Nov 23, 2008
by
Mark Olesen
Browse files
List - adjusted transfer(DynamicList) and added transfer(SortableList)
parent
8b72dbed
Changes
4
Hide whitespace changes
Inline
Side-by-side
applications/test/DynamicList/DynamicListTest.C
View file @
a8550cd0
...
...
@@ -100,6 +100,15 @@ int main(int argc, char *argv[])
Info
<<
"<dlB>"
<<
dlB
<<
"</dlB>"
<<
nl
<<
"sizes: "
<<
" "
<<
dlB
.
size
()
<<
"/"
<<
dlB
.
allocSize
()
<<
endl
;
// try with a normal list:
List
<
label
>
lstA
;
lstA
.
transfer
(
dlB
);
Info
<<
"Transferred to normal list"
<<
endl
;
Info
<<
"<lstA>"
<<
lstA
<<
"</lstA>"
<<
nl
<<
"sizes: "
<<
" "
<<
lstA
.
size
()
<<
endl
;
Info
<<
"<dlB>"
<<
dlB
<<
"</dlB>"
<<
nl
<<
"sizes: "
<<
" "
<<
dlB
.
size
()
<<
"/"
<<
dlB
.
allocSize
()
<<
endl
;
return
0
;
}
...
...
applications/test/sort/sortListTest.C
View file @
a8550cd0
...
...
@@ -70,6 +70,13 @@ int main(int argc, char *argv[])
Info
<<
"sorted: "
<<
b
<<
endl
;
Info
<<
"indices: "
<<
b
.
indices
()
<<
endl
;
labelList
flatten
;
flatten
.
transfer
(
b
);
Info
<<
"flatten: "
<<
flatten
<<
endl
;
Info
<<
"sorted: "
<<
b
<<
endl
;
Info
<<
"indices: "
<<
b
.
indices
()
<<
endl
;
Info
<<
"End
\n
"
<<
endl
;
return
0
;
...
...
src/OpenFOAM/containers/Lists/List/List.C
View file @
a8550cd0
...
...
@@ -432,14 +432,20 @@ void Foam::List<T>::transfer(DynamicList<T, SizeInc, SizeMult, SizeDiv>& a)
{
// shrink the allocated space to the number of elements used
a
.
shrink
();
a
.
allocSize_
=
0
;
if
(
this
->
v_
)
delete
[]
this
->
v_
;
this
->
size_
=
a
.
size_
;
this
->
v_
=
a
.
v_
;
transfer
(
static_cast
<
List
<
T
>&>
(
a
));
}
a
.
size_
=
0
;
a
.
v_
=
0
;
a
.
allocSize_
=
0
;
// Transfer the contents of the argument SortableList into this List
// and anull the argument list
template
<
class
T
>
void
Foam
::
List
<
T
>::
transfer
(
SortableList
<
T
>&
a
)
{
// shrink away the sort indices
a
.
shrink
();
transfer
(
static_cast
<
List
<
T
>&>
(
a
));
}
...
...
src/OpenFOAM/containers/Lists/List/List.H
View file @
a8550cd0
...
...
@@ -63,7 +63,8 @@ template<class T, label Size> class FixedList;
template
<
class
T
>
class
PtrList
;
template
<
class
T
>
class
SLList
;
template
<
class
T
,
unsigned
SizeInc
,
unsigned
SizeMult
,
unsigned
SizeDiv
>
class
DynamicList
;
class
DynamicList
;
template
<
class
T
>
class
SortableList
;
template
<
class
T
>
class
IndirectList
;
template
<
class
T
>
class
BiIndirectList
;
...
...
@@ -173,6 +174,10 @@ public:
template
<
unsigned
SizeInc
,
unsigned
SizeMult
,
unsigned
SizeDiv
>
void
transfer
(
DynamicList
<
T
,
SizeInc
,
SizeMult
,
SizeDiv
>&
);
//- Transfer the contents of the argument List into this List
// and annull the argument list.
void
transfer
(
SortableList
<
T
>&
);
//- Return subscript-checked element of UList.
inline
T
&
newElmt
(
const
label
);
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment