mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: minor adjustment of test case
This commit is contained in:
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -22,16 +22,18 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Application
|
Application
|
||||||
Tuple2Test
|
Test-Tuple2
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "Pair.H"
|
||||||
#include "Tuple2.H"
|
#include "Tuple2.H"
|
||||||
#include "label.H"
|
#include "label.H"
|
||||||
#include "scalar.H"
|
#include "scalar.H"
|
||||||
#include "List.H"
|
#include "List.H"
|
||||||
|
#include "ListOps.H"
|
||||||
#include "ops.H"
|
#include "ops.H"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
@ -75,7 +77,7 @@ int main()
|
|||||||
indexedScalar t2(1, 3.2);
|
indexedScalar t2(1, 3.2);
|
||||||
|
|
||||||
Info<< "tuple: "
|
Info<< "tuple: "
|
||||||
<< t2 << " "
|
<< t2 << " => "
|
||||||
<< t2.first() << " " << t2.second() << nl;
|
<< t2.first() << " " << t2.second() << nl;
|
||||||
|
|
||||||
// As list. Generated so that we have duplicate indices
|
// As list. Generated so that we have duplicate indices
|
||||||
@ -110,7 +112,28 @@ int main()
|
|||||||
Info<< "special sorted tuples - sort on value, reverse on index:"
|
Info<< "special sorted tuples - sort on value, reverse on index:"
|
||||||
<< nl << list1 << nl;
|
<< nl << list1 << nl;
|
||||||
|
|
||||||
Info<< "End\n" << endl;
|
|
||||||
|
Info<< nl << nl << "Pairs" << nl;
|
||||||
|
|
||||||
|
typedef Pair<label> indexedLabel;
|
||||||
|
|
||||||
|
indexedLabel pr(1, 3);
|
||||||
|
|
||||||
|
Info<< "pair: "
|
||||||
|
<< pr << " => "
|
||||||
|
<< pr.first() << " " << pr.second() << nl;
|
||||||
|
|
||||||
|
List<indexedLabel> list2 = ListOps::create<indexedLabel>
|
||||||
|
(
|
||||||
|
list1,
|
||||||
|
[](const indexedScalar& t2) {
|
||||||
|
return indexedLabel(t2.first(), t2.second());
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Unsorted pairs:" << nl << list2 << nl;
|
||||||
|
|
||||||
|
Info<< "\nEnd\n" << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user