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
fa3acc99
Commit
fa3acc99
authored
Jan 26, 2018
by
Mark OLESEN
Browse files
ENH: make CompactListList swapable and move construct/assignable
parent
a0148ac0
Changes
5
Hide whitespace changes
Inline
Side-by-side
applications/test/CompactListList/Test-CompactListList.C
View file @
fa3acc99
...
...
@@ -47,8 +47,8 @@ int main(int argc, char *argv[])
Info
<<
"cll1:"
<<
cll1
<<
endl
;
// Resize and assign row by row
labelList
row0
(
2
,
0
);
labelList
row1
(
3
,
1
);
labelList
row0
(
2
,
label
(
0
)
);
labelList
row1
(
3
,
label
(
1
)
);
labelList
rowSizes
(
2
);
rowSizes
[
0
]
=
row0
.
size
();
...
...
@@ -140,8 +140,8 @@ int main(int argc, char *argv[])
{
faceList
fcs
(
2
);
fcs
[
0
]
=
face
(
labelList
(
1
,
111
));
fcs
[
1
]
=
face
(
labelList
(
2
,
222
));
fcs
[
0
]
=
face
(
labelList
(
1
,
label
(
111
))
)
;
fcs
[
1
]
=
face
(
labelList
(
2
,
label
(
222
))
)
;
CompactListList
<
label
,
face
>
compactFcs
(
fcs
);
Info
<<
"comactFcs:"
<<
compactFcs
<<
endl
;
...
...
applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C
View file @
fa3acc99
...
...
@@ -41,7 +41,6 @@ SeeAlso
#include
"fvMesh.H"
#include
"Time.H"
#include
"volFields.H"
#include
"CompactListList.H"
#include
"unitConversion.H"
#include
"pairPatchAgglomeration.H"
#include
"labelListIOList.H"
...
...
src/OpenFOAM/containers/Lists/CompactListList/CompactListList.C
View file @
fa3acc99
...
...
@@ -81,7 +81,7 @@ template<class T, class Container>
Foam
::
CompactListList
<
T
,
Container
>::
CompactListList
(
const
labelUList
&
rowSizes
,
const
T
&
t
const
T
&
val
)
:
size_
(
rowSizes
.
size
()),
...
...
@@ -95,7 +95,7 @@ Foam::CompactListList<T, Container>::CompactListList
offsets_
[
i
+
1
]
=
sumSize
;
}
m_
.
setSize
(
sumSize
,
t
);
m_
.
setSize
(
sumSize
,
val
);
}
...
...
@@ -109,19 +109,6 @@ Foam::CompactListList<T, Container>::CompactListList
}
template
<
class
T
,
class
Container
>
Foam
::
CompactListList
<
T
,
Container
>::
CompactListList
(
CompactListList
<
T
,
Container
>&
lst
,
bool
reuse
)
:
size_
(
lst
.
size
()),
offsets_
(
lst
.
offsets_
,
reuse
),
m_
(
lst
.
m_
,
reuse
)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template
<
class
T
,
class
Container
>
...
...
@@ -218,15 +205,27 @@ void Foam::CompactListList<T, Container>::clear()
}
template
<
class
T
,
class
Container
>
void
Foam
::
CompactListList
<
T
,
Container
>::
swap
(
CompactListList
<
T
,
Container
>&
lst
)
{
Foam
::
Swap
(
size_
,
lst
.
size_
);
offsets_
.
swap
(
lst
.
offsets_
);
m_
.
swap
(
lst
.
m_
);
}
template
<
class
T
,
class
Container
>
void
Foam
::
CompactListList
<
T
,
Container
>::
transfer
(
CompactListList
<
T
,
Container
>&
a
CompactListList
<
T
,
Container
>&
lst
)
{
size_
=
a
.
size_
;
offsets_
.
transfer
(
a
.
offsets_
);
m_
.
transfer
(
a
.
m_
);
size_
=
lst
.
size_
;
offsets_
.
transfer
(
lst
.
offsets_
);
m_
.
transfer
(
lst
.
m_
);
}
...
...
src/OpenFOAM/containers/Lists/CompactListList/CompactListList.H
View file @
fa3acc99
...
...
@@ -119,11 +119,17 @@ public:
//- Construct given list of row-sizes
CompactListList
(
const
labelUList
&
rowSizes
,
const
T
&
);
//- Copy construct
inline
CompactListList
(
const
CompactListList
<
T
,
Container
>&
lst
);
//- Move construct
inline
CompactListList
(
CompactListList
<
T
,
Container
>&&
lst
);
//- Construct by transferring the parameter contents
explicit
CompactListList
(
const
Xfer
<
CompactListList
<
T
,
Container
>>&
);
//- Construct as copy or re-use as specified.
CompactListList
(
CompactListList
<
T
,
Container
>&
,
bool
reuse
);
inline
CompactListList
(
CompactListList
<
T
,
Container
>&
lst
,
bool
reuse
);
//- Construct from Istream.
CompactListList
(
Istream
&
);
...
...
@@ -189,13 +195,17 @@ public:
//- Return sizes (to be used e.g. for construction)
labelList
sizes
()
const
;
//- Swap contents
void
swap
(
CompactListList
<
T
,
Container
>&
lst
);
//- Transfer the contents of the argument CompactListList
// into this CompactListList and annul the argument list.
void
transfer
(
CompactListList
<
T
,
Container
>&
);
void
transfer
(
CompactListList
<
T
,
Container
>&
lst
);
//- Transfer the contents to the Xfer container
inline
Xfer
<
CompactListList
<
T
,
Container
>>
xfer
();
// Other
//- Return index into m
...
...
@@ -226,7 +236,13 @@ public:
List
<
Container
>
operator
()()
const
;
//- Assignment of all entries to the given value
inline
void
operator
=
(
const
T
&
);
inline
void
operator
=
(
const
T
&
val
);
//- Copy assignment
inline
void
operator
=
(
const
CompactListList
<
T
,
Container
>&
lst
);
//- Move assignment
inline
void
operator
=
(
CompactListList
<
T
,
Container
>&&
lst
);
// Istream operator
...
...
src/OpenFOAM/containers/Lists/CompactListList/CompactListListI.H
View file @
fa3acc99
...
...
@@ -53,12 +53,47 @@ inline Foam::CompactListList<T, Container>::CompactListList
(
const
label
mRows
,
const
label
nData
,
const
T
&
t
const
T
&
val
)
:
size_
(
mRows
),
offsets_
(
mRows
+
1
,
0
),
m_
(
nData
,
t
)
m_
(
nData
,
val
)
{}
template
<
class
T
,
class
Container
>
inline
Foam
::
CompactListList
<
T
,
Container
>::
CompactListList
(
const
CompactListList
<
T
,
Container
>&
lst
)
:
size_
(
lst
.
size
()),
offsets_
(
lst
.
offsets_
),
m_
(
lst
.
m_
)
{}
template
<
class
T
,
class
Container
>
inline
Foam
::
CompactListList
<
T
,
Container
>::
CompactListList
(
CompactListList
<
T
,
Container
>&&
lst
)
{
transfer
(
lst
);
}
template
<
class
T
,
class
Container
>
inline
Foam
::
CompactListList
<
T
,
Container
>::
CompactListList
(
CompactListList
<
T
,
Container
>&
lst
,
bool
reuse
)
:
size_
(
lst
.
size
()),
offsets_
(
lst
.
offsets_
,
reuse
),
m_
(
lst
.
m_
,
reuse
)
{}
...
...
@@ -220,7 +255,7 @@ inline Foam::UList<T> Foam::CompactListList<T, Container>::operator[]
const
label
i
)
{
label
start
=
offsets_
[
i
];
const
label
start
=
offsets_
[
i
];
return
UList
<
T
>
(
m_
.
begin
()
+
start
,
offsets_
[
i
+
1
]
-
start
);
}
...
...
@@ -232,7 +267,7 @@ Foam::CompactListList<T, Container>::operator[]
const
label
i
)
const
{
label
start
=
offsets_
[
i
];
const
label
start
=
offsets_
[
i
];
return
UList
<
T
>
(
const_cast
<
T
*>
(
m_
.
begin
()
+
start
),
...
...
@@ -264,9 +299,31 @@ inline const T& Foam::CompactListList<T, Container>::operator()
template
<
class
T
,
class
Container
>
inline
void
Foam
::
CompactListList
<
T
,
Container
>::
operator
=
(
const
T
&
t
)
inline
void
Foam
::
CompactListList
<
T
,
Container
>::
operator
=
(
const
T
&
val
)
{
m_
=
val
;
}
template
<
class
T
,
class
Container
>
inline
void
Foam
::
CompactListList
<
T
,
Container
>::
operator
=
(
const
CompactListList
<
T
,
Container
>&
lst
)
{
size_
=
lst
.
size_
;
offsets_
=
lst
.
offsets_
,
m_
=
lst
.
m_
;
}
template
<
class
T
,
class
Container
>
inline
void
Foam
::
CompactListList
<
T
,
Container
>::
operator
=
(
CompactListList
<
T
,
Container
>&&
lst
)
{
m_
=
t
;
transfer
(
lst
)
;
}
...
...
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