Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
HPCAPPs
OpenFOAM-GPU-v2.0
Commits
55e5a777
Commit
55e5a777
authored
Oct 17, 2024
by
shunbo
Browse files
initial commit
parents
Changes
677
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
906 additions
and
0 deletions
+906
-0
OpenFOAM-v2112/applications/test/00-dummy/library/dummyLib.H
OpenFOAM-v2112/applications/test/00-dummy/library/dummyLib.H
+103
-0
OpenFOAM-v2112/applications/test/00-dummy/library/mpi/Make/files
...M-v2112/applications/test/00-dummy/library/mpi/Make/files
+4
-0
OpenFOAM-v2112/applications/test/00-dummy/library/mpi/Make/options
...v2112/applications/test/00-dummy/library/mpi/Make/options
+11
-0
OpenFOAM-v2112/applications/test/00-dummy/library/mpi/dummyMpiLib.C
...2112/applications/test/00-dummy/library/mpi/dummyMpiLib.C
+76
-0
OpenFOAM-v2112/applications/test/00-machine-sizes/Make/files
OpenFOAM-v2112/applications/test/00-machine-sizes/Make/files
+3
-0
OpenFOAM-v2112/applications/test/00-machine-sizes/Make/options
...OAM-v2112/applications/test/00-machine-sizes/Make/options
+6
-0
OpenFOAM-v2112/applications/test/00-machine-sizes/Test-machine-sizes.cpp
...applications/test/00-machine-sizes/Test-machine-sizes.cpp
+81
-0
OpenFOAM-v2112/applications/test/BinSum/Make/files
OpenFOAM-v2112/applications/test/BinSum/Make/files
+3
-0
OpenFOAM-v2112/applications/test/BinSum/Make/options
OpenFOAM-v2112/applications/test/BinSum/Make/options
+2
-0
OpenFOAM-v2112/applications/test/BinSum/Test-BinSum.C
OpenFOAM-v2112/applications/test/BinSum/Test-BinSum.C
+77
-0
OpenFOAM-v2112/applications/test/Circulator/Make/files
OpenFOAM-v2112/applications/test/Circulator/Make/files
+3
-0
OpenFOAM-v2112/applications/test/Circulator/Make/options
OpenFOAM-v2112/applications/test/Circulator/Make/options
+2
-0
OpenFOAM-v2112/applications/test/Circulator/Test-Circulator.C
...FOAM-v2112/applications/test/Circulator/Test-Circulator.C
+183
-0
OpenFOAM-v2112/applications/test/CompactIOList/Make/files
OpenFOAM-v2112/applications/test/CompactIOList/Make/files
+3
-0
OpenFOAM-v2112/applications/test/CompactIOList/Make/options
OpenFOAM-v2112/applications/test/CompactIOList/Make/options
+2
-0
OpenFOAM-v2112/applications/test/CompactIOList/Test-CompactIOList.C
...2112/applications/test/CompactIOList/Test-CompactIOList.C
+180
-0
OpenFOAM-v2112/applications/test/CompactListList/Make/files
OpenFOAM-v2112/applications/test/CompactListList/Make/files
+3
-0
OpenFOAM-v2112/applications/test/CompactListList/Make/options
...FOAM-v2112/applications/test/CompactListList/Make/options
+2
-0
OpenFOAM-v2112/applications/test/CompactListList/Test-CompactListList.C
.../applications/test/CompactListList/Test-CompactListList.C
+159
-0
OpenFOAM-v2112/applications/test/DLList/Make/files
OpenFOAM-v2112/applications/test/DLList/Make/files
+3
-0
No files found.
Too many changes to show.
To preserve performance only
677 of 677+
files are displayed.
Plain diff
Email patch
OpenFOAM-v2112/applications/test/00-dummy/library/dummyLib.H
0 → 100644
View file @
55e5a777
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::Detail::dummy
Description
No useful purpose other than to use the wmake framework to generate
a dummy library for testing/packaging purposes
Note
Pure C++ without any OpenFOAM classes or libraries.
SourceFiles
dummyLib.C
\*---------------------------------------------------------------------------*/
#ifndef testing_dummyLib_H
#define testing_dummyLib_H
#include <string>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
{
namespace
Detail
{
/*---------------------------------------------------------------------------*\
Class dummyLib Declaration
\*---------------------------------------------------------------------------*/
struct
dummyLib
{
//- Compile-time value of WM_ARCH
static
const
std
::
string
arch
;
//- Compile-time value of WM_COMPILER
static
const
std
::
string
compiler
;
//- Compile-time of WM_PRECISION_OPTION
static
const
std
::
string
precision
;
//- Compile-time of WM_LABEL_SIZE
static
const
int
label_size
;
//- Compile-time equivalent to WM_PRECISION_OPTION
static
const
int
scalar_size
;
//- Compile-time equivalent to WM_PRECISION_OPTION
static
const
int
solveScalar_size
;
//- Compile-time value of WM_ARCH + WM_COMPILER
static
const
std
::
string
archComp
;
//- Compile-time value of WM_ARCH + WM_COMPILER, precision, label-size
static
const
std
::
string
archCompBase
;
//- DIY Compile-time value of WM_OPTIONS
static
const
std
::
string
archCompFull
;
//- Compiled/linked with mpi?
static
bool
hasMPI
();
//- Print ranks (trivial mpi test). Return true for master only.
static
bool
printMPI
();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
}
// End namespace Detail
}
// End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
OpenFOAM-v2112/applications/test/00-dummy/library/mpi/Make/files
0 → 100644
View file @
55e5a777
/* Install into central FOAM_MPI_LIBBIN for 'fake' builds (test packaging) */
dummyMpiLib.C
LIB = $(FOAM_MPI_LIBBIN)/libTestDummyMpi
OpenFOAM-v2112/applications/test/00-dummy/library/mpi/Make/options
0 → 100644
View file @
55e5a777
/* Disable normal project defaults */
PROJECT_INC =
PROJECT_LIBS =
include $(GENERAL_RULES)/mpi-rules
EXE_INC = \
-I.. \
$(PFLAGS) $(PINC) $(c++LESSWARN) -DFOAM_MPI=\"$(FOAM_MPI)\"
LIB_LIBS = $(PLIBS)
OpenFOAM-v2112/applications/test/00-dummy/library/mpi/dummyMpiLib.C
0 → 100644
View file @
55e5a777
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "dummyLib.H"
#include <iostream>
#include <mpi.h>
// * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * * //
bool
Foam
::
Detail
::
dummyLib
::
hasMPI
()
{
return
true
;
}
bool
Foam
::
Detail
::
dummyLib
::
printMPI
()
{
int
rank
=
0
,
nprocs
=
0
;
MPI_Init
(
nullptr
,
nullptr
);
MPI_Comm_size
(
MPI_COMM_WORLD
,
&
nprocs
);
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
rank
);
// Hello world
std
::
cout
<<
(
std
::
string
(
"mpi rank "
)
+
std
::
to_string
(
rank
)
+
'/'
+
std
::
to_string
(
nprocs
)
+
'\n'
);
MPI_Finalize
();
#ifdef FOAM_MPI
if
(
rank
==
0
)
{
std
::
cout
<<
(
std
::
string
(
"FOAM_MPI="
)
+
std
::
string
(
FOAM_MPI
)
+
'\n'
);
}
#endif
return
rank
==
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/00-machine-sizes/Make/files
0 → 100644
View file @
55e5a777
Test-machine-sizes.cpp
EXE = $(FOAM_USER_APPBIN)/Test-machine-sizes
OpenFOAM-v2112/applications/test/00-machine-sizes/Make/options
0 → 100644
View file @
55e5a777
/* Disable normal project defaults */
PROJECT_INC =
PROJECT_LIBS =
/* EXE_INC = */
/* EXE_LIBS = */
OpenFOAM-v2112/applications/test/00-machine-sizes/Test-machine-sizes.cpp
0 → 100644
View file @
55e5a777
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Test the sizeof for basic types.
Can be compiled and run without any OpenFOAM libraries.
g++ -std=c++11 -oTest-machine-sizes Test-machine-sizes.cpp
\*---------------------------------------------------------------------------*/
#include <climits>
#include <cstdint>
#include <cstdlib>
#include <iostream>
#include <limits>
#include <typeinfo>
template
<
class
T
>
void
print
(
const
char
*
name
,
bool
showLimits
=
true
)
{
std
::
cout
<<
"name=
\"
"
<<
name
<<
"
\"
sizeof="
<<
sizeof
(
T
);
if
(
showLimits
)
{
std
::
cout
<<
"
\"
max
\"
="
<<
std
::
numeric_limits
<
T
>::
max
();
}
std
::
cout
<<
'\n'
;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int
main
(
int
argc
,
char
*
argv
[])
{
std
::
cout
<<
"machine sizes
\n
---
\n\n
"
;
print
<
short
>
(
"short"
);
print
<
int
>
(
"int"
);
print
<
long
>
(
"long"
);
print
<
unsigned
long
>
(
"unsigned long"
);
print
<
std
::
size_t
>
(
"std::size_t"
);
print
<
long
long
>
(
"long long"
);
print
<
float
>
(
"float"
);
print
<
double
>
(
"double"
);
print
<
long
double
>
(
"long double"
);
std
::
cout
<<
"
\n
---
\n
End
\n\n
"
;
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/BinSum/Make/files
0 → 100644
View file @
55e5a777
Test-BinSum.C
EXE = $(FOAM_USER_APPBIN)/Test-BinSum
OpenFOAM-v2112/applications/test/BinSum/Make/options
0 → 100644
View file @
55e5a777
/* EXE_INC = -I$(LIB_SRC)/finiteVolume/lnInclude */
/* EXE_LIBS = -lfiniteVolume */
OpenFOAM-v2112/applications/test/BinSum/Test-BinSum.C
0 → 100644
View file @
55e5a777
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2013 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
Test-BinSum
Description
Test BinSum container
\*---------------------------------------------------------------------------*/
#include "List.H"
#include "BinSum.H"
#include "IOstreams.H"
#include "Random.H"
#include "scalarField.H"
using
namespace
Foam
;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
Random
rndGen
(
0
);
scalarField
samples
(
10000000
);
forAll
(
samples
,
i
)
{
samples
[
i
]
=
rndGen
.
sample01
<
scalar
>
();
}
const
scalar
min
=
0
;
const
scalar
max
=
1
;
const
scalar
delta
=
0
.
1
;
BinSum
<
scalar
,
scalarField
>
count
(
min
,
max
,
delta
);
BinSum
<
scalar
,
scalarField
>
sum
(
min
,
max
,
delta
);
forAll
(
samples
,
i
)
{
count
.
add
(
samples
[
i
],
1
);
sum
.
add
(
samples
[
i
],
samples
[
i
]);
}
Info
<<
"sum : "
<<
sum
<<
endl
;
Info
<<
"count : "
<<
count
<<
endl
;
Info
<<
"average: "
<<
sum
/
count
<<
endl
;
Info
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/Circulator/Make/files
0 → 100644
View file @
55e5a777
Test-Circulator.C
EXE = $(FOAM_USER_APPBIN)/Test-Circulator
OpenFOAM-v2112/applications/test/Circulator/Make/options
0 → 100644
View file @
55e5a777
/* EXE_INC = */
/* EXE_LIBS = */
OpenFOAM-v2112/applications/test/Circulator/Test-Circulator.C
0 → 100644
View file @
55e5a777
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2015 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
Test-circulator
Description
\*---------------------------------------------------------------------------*/
#include "List.H"
#include "ListOps.H"
#include "face.H"
#include "Circulator.H"
#include "ConstCirculator.H"
using
namespace
Foam
;
void
printCompare
(
const
face
&
a
,
const
face
&
b
)
{
Info
<<
"Compare "
<<
a
<<
" and "
<<
b
<<
" Match = "
<<
face
::
compare
(
a
,
b
)
<<
endl
;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int
main
(
int
argc
,
char
*
argv
[])
{
Info
<<
"Test the implementation of a circular iterator"
<<
nl
<<
endl
;
Info
<<
"Test const circulator. First go forwards, then backwards."
<<
nl
<<
endl
;
face
f
(
identity
(
4
));
ConstCirculator
<
face
>
cStart
(
f
);
if
(
cStart
.
size
())
do
{
Info
<<
"Iterate forwards over face (prev/curr/next) : "
<<
cStart
.
prev
()
<<
" / "
<<
cStart
()
<<
" / "
<<
cStart
.
next
()
<<
endl
;
}
while
(
cStart
.
circulate
(
CirculatorBase
::
CLOCKWISE
));
if
(
cStart
.
size
())
do
{
Info
<<
"Iterate backwards over face : "
<<
cStart
()
<<
endl
;
}
while
(
cStart
.
circulate
(
CirculatorBase
::
ANTICLOCKWISE
));
Info
<<
nl
<<
nl
<<
"Test non-const circulator"
<<
nl
<<
endl
;
Circulator
<
face
>
cStart2
(
f
);
Info
<<
"Face before : "
<<
f
<<
endl
;
if
(
cStart2
.
size
())
do
{
Info
<<
"Iterate forwards over face (prev/curr/next) : "
<<
cStart2
.
prev
()
<<
" / "
<<
cStart2
()
<<
" / "
<<
cStart2
.
next
()
<<
endl
;
}
while
(
cStart2
.
circulate
(
CirculatorBase
::
CLOCKWISE
));
if
(
cStart2
.
size
())
do
{
Info
<<
"Iterate forwards over face, adding 1 to each element : "
<<
cStart2
();
cStart2
()
+=
1
;
Info
<<
" -> "
<<
cStart2
()
<<
endl
;
}
while
(
cStart2
.
circulate
(
CirculatorBase
::
CLOCKWISE
));
Info
<<
"Face after : "
<<
f
<<
endl
;
Info
<<
nl
<<
nl
<<
"Compare two faces: "
<<
endl
;
face
a
(
identity
(
5
));
printCompare
(
a
,
a
);
face
b
(
reverseList
(
a
));
printCompare
(
a
,
b
);
face
c
(
a
);
c
[
4
]
=
3
;
printCompare
(
a
,
c
);
face
d
(
rotateList
(
a
,
2
));
printCompare
(
a
,
d
);
face
g
(
labelList
(
5
,
1
));
face
h
(
g
);
printCompare
(
g
,
h
);
g
[
0
]
=
2
;
h
[
3
]
=
2
;
printCompare
(
g
,
h
);
g
[
4
]
=
3
;
h
[
4
]
=
3
;
printCompare
(
g
,
h
);
face
face1
(
identity
(
1
));
printCompare
(
face1
,
face1
);
face
face2
(
identity
(
1
,
2
));
printCompare
(
face1
,
face2
);
Info
<<
nl
<<
nl
<<
"Zero face"
<<
nl
<<
endl
;
face
fZero
;
Circulator
<
face
>
cZero
(
fZero
);
if
(
cZero
.
size
())
do
{
Info
<<
"Iterate forwards over face : "
<<
cZero
()
<<
endl
;
}
while
(
cZero
.
circulate
(
CirculatorBase
::
CLOCKWISE
));
fZero
=
face
(
identity
(
5
));
// circulator was invalidated so reset
cZero
=
Circulator
<
face
>
(
fZero
);
do
{
Info
<<
"Iterate forwards over face : "
<<
cZero
()
<<
endl
;
}
while
(
cZero
.
circulate
(
CirculatorBase
::
CLOCKWISE
));
Info
<<
nl
<<
nl
<<
"Simultaneously go forwards/backwards over face "
<<
f
<<
nl
<<
endl
;
ConstCirculator
<
face
>
circForward
(
f
);
ConstCirculator
<
face
>
circBackward
(
f
);
if
(
circForward
.
size
()
&&
circBackward
.
size
())
do
{
Info
<<
"Iterate over face forwards : "
<<
circForward
()
<<
", backwards : "
<<
circBackward
()
<<
endl
;
}
while
(
circForward
.
circulate
(
CirculatorBase
::
CLOCKWISE
),
circBackward
.
circulate
(
CirculatorBase
::
ANTICLOCKWISE
)
);
Info
<<
"
\n
End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/CompactIOList/Make/files
0 → 100644
View file @
55e5a777
Test-CompactIOList.C
EXE = $(FOAM_USER_APPBIN)/Test-CompactIOList
OpenFOAM-v2112/applications/test/CompactIOList/Make/options
0 → 100644
View file @
55e5a777
/* EXE_INC = */
/* EXE_LIBS = */
OpenFOAM-v2112/applications/test/CompactIOList/Test-CompactIOList.C
0 → 100644
View file @
55e5a777
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
testCompactIOList
Description
Simple demonstration and test application for the CompactIOList container
\*---------------------------------------------------------------------------*/
#include "IOstreams.H"
#include "argList.H"
#include "Time.H"
#include "polyMesh.H"
using
namespace
Foam
;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int
main
(
int
argc
,
char
*
argv
[])
{
#include "setRootCase.H"
#include "createTime.H"
IOstream
::
streamFormat
format
=
IOstream
::
BINARY
;
// IOstream::streamFormat format = IOstream::ASCII;
const
label
size
=
20000000
;
// Old format
// ~~~~~~~~~~
{
// Construct big faceList in old format
faceIOList
faces2
(
IOobject
(
"faces2"
,
runTime
.
constant
(),
polyMesh
::
meshSubDir
,
runTime
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
,
false
),
size
);
const
face
f
(
identity
(
4
));
forAll
(
faces2
,
i
)
{
faces2
[
i
]
=
f
;
}
Info
<<
"Constructed faceList in = "
<<
runTime
.
cpuTimeIncrement
()
<<
" s"
<<
nl
<<
endl
;
faces2
.
writeObject
(
IOstreamOption
(
format
),
true
);
Info
<<
"Written old format faceList in = "
<<
runTime
.
cpuTimeIncrement
()
<<
" s"
<<
nl
<<
endl
;
// Read
faceIOList
faces3
(
IOobject
(
"faces2"
,
runTime
.
constant
(),
polyMesh
::
meshSubDir
,
runTime
,
IOobject
::
MUST_READ
,
IOobject
::
NO_WRITE
,
false
)
);
Info
<<
"Read old format "
<<
faces3
.
size
()
<<
" faceList in = "
<<
runTime
.
cpuTimeIncrement
()
<<
" s"
<<
nl
<<
endl
;
}
// New format
// ~~~~~~~~~~
{
// Construct big faceList in new format
faceCompactIOList
faces2
(
IOobject
(
"faces2"
,
runTime
.
constant
(),
polyMesh
::
meshSubDir
,
runTime
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
,
false
),
size
);
const
face
f
(
identity
(
4
));
forAll
(
faces2
,
i
)
{
faces2
[
i
]
=
f
;
}
Info
<<
"Constructed new format faceList in = "
<<
runTime
.
cpuTimeIncrement
()
<<
" s"
<<
nl
<<
endl
;
faces2
.
writeObject
(
IOstreamOption
(
format
),
true
);
Info
<<
"Written new format faceList in = "
<<
runTime
.
cpuTimeIncrement
()
<<
" s"
<<
nl
<<
endl
;
// Read
faceCompactIOList
faces3
(
IOobject
(
"faces2"
,
runTime
.
constant
(),
polyMesh
::
meshSubDir
,
runTime
,
IOobject
::
MUST_READ
,
IOobject
::
NO_WRITE
,
false
)
);
Info
<<
"Read new format "
<<
faces3
.
size
()
<<
" faceList in = "
<<
runTime
.
cpuTimeIncrement
()
<<
" s"
<<
nl
<<
endl
;
}
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/CompactListList/Make/files
0 → 100644
View file @
55e5a777
Test-CompactListList.C
EXE = $(FOAM_USER_APPBIN)/Test-CompactListList
OpenFOAM-v2112/applications/test/CompactListList/Make/options
0 → 100644
View file @
55e5a777
/* EXE_INC = */
/* EXE_LIBS = */
OpenFOAM-v2112/applications/test/CompactListList/Test-CompactListList.C
0 → 100644
View file @
55e5a777
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
CompactListListTest
Description
Simple demonstration and test application for the CompactListList class.
\*---------------------------------------------------------------------------*/
#include "CompactListList.H"
#include "IOstreams.H"
#include "StringStream.H"
#include "faceList.H"
using
namespace
Foam
;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int
main
(
int
argc
,
char
*
argv
[])
{
{
// null construct
CompactListList
<
label
>
cll1
;
Info
<<
"cll1:"
<<
cll1
<<
endl
;
// Resize and assign row by row
labelList
row0
(
2
,
Zero
);
labelList
row1
(
3
,
label
(
1
));
labelList
rowSizes
(
2
);
rowSizes
[
0
]
=
row0
.
size
();
rowSizes
[
1
]
=
row1
.
size
();
cll1
.
resize
(
rowSizes
);
cll1
[
0
].
deepCopy
(
row0
);
cll1
[
1
].
deepCopy
(
row1
);
Info
<<
"cll1:"
<<
cll1
<<
endl
;
forAll
(
cll1
.
m
(),
i
)
{
Info
<<
"i:"
<<
i
<<
" whichRow:"
<<
cll1
.
whichRow
(
i
)
<<
endl
;
}
}
List
<
List
<
label
>>
lll
(
5
);
lll
[
0
].
setSize
(
3
,
0
);
lll
[
1
].
setSize
(
2
,
1
);
lll
[
2
].
setSize
(
6
,
2
);
lll
[
3
].
setSize
(
0
,
3
);
lll
[
4
].
setSize
(
1
,
4
);
CompactListList
<
label
>
cll2
(
lll
);
Info
<<
"cll2 = "
<<
cll2
<<
endl
;
forAll
(
cll2
,
i
)
{
Info
<<
cll2
[
i
]
<<
endl
;
}
Info
<<
endl
;
Info
<<
"cll2(2, 3) = "
<<
cll2
(
2
,
3
)
<<
nl
<<
endl
;
cll2
(
2
,
3
)
=
999
;
Info
<<
"cll2(2, 3) = "
<<
cll2
(
2
,
3
)
<<
nl
<<
endl
;
Info
<<
"cll2 as List<List<label >> "
<<
cll2
()
<<
endl
;
cll2
.
setSize
(
3
);
Info
<<
"cll2 = "
<<
cll2
<<
endl
;
cll2
.
setSize
(
0
);
Info
<<
"cll2 = "
<<
cll2
<<
endl
;
List
<
label
>
rowSizes
(
5
);
rowSizes
[
0
]
=
2
;
rowSizes
[
1
]
=
0
;
rowSizes
[
2
]
=
1
;
rowSizes
[
3
]
=
3
;
rowSizes
[
4
]
=
2
;
CompactListList
<
label
>
cll3
(
rowSizes
,
1
);
Info
<<
"cll3 = "
<<
cll3
<<
endl
;
CompactListList
<
label
>
cll4
;
cll4
.
transfer
(
cll3
);
Info
<<
"cll3 = "
<<
cll3
<<
endl
;
Info
<<
"cll4 = "
<<
cll4
<<
endl
;
{
// IO
OStringStream
ostr
;
ostr
<<
cll4
;
IStringStream
istr
(
ostr
.
str
());
CompactListList
<
label
>
cll5
(
istr
);
Info
<<
"cll5 = "
<<
cll5
<<
endl
;
}
{
// IO
cll4
.
clear
();
OStringStream
ostr
;
ostr
<<
cll4
;
IStringStream
istr
(
ostr
.
str
());
CompactListList
<
label
>
cll5
(
istr
);
Info
<<
"cll5 = "
<<
cll5
<<
endl
;
}
{
faceList
fcs
(
2
);
fcs
[
0
]
=
face
(
labelList
(
1
,
label
(
111
)));
fcs
[
1
]
=
face
(
labelList
(
2
,
label
(
222
)));
CompactListList
<
label
,
face
>
compactFcs
(
fcs
);
Info
<<
"comactFcs:"
<<
compactFcs
<<
endl
;
faceList
fcs2
=
compactFcs
();
Info
<<
"fcs2:"
<<
fcs2
<<
endl
;
}
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/DLList/Make/files
0 → 100644
View file @
55e5a777
Test-DLList.C
EXE = $(FOAM_USER_APPBIN)/Test-DLList
Prev
1
2
3
4
5
6
7
8
9
10
…
34
Next
Write
Preview
Markdown
is supported
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