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
1472 additions
and
0 deletions
+1472
-0
OpenFOAM-v2112/applications/test/exprTraits/Make/options
OpenFOAM-v2112/applications/test/exprTraits/Make/options
+2
-0
OpenFOAM-v2112/applications/test/exprTraits/Test-exprTraits.C
...FOAM-v2112/applications/test/exprTraits/Test-exprTraits.C
+108
-0
OpenFOAM-v2112/applications/test/extendedStencil/Make/files
OpenFOAM-v2112/applications/test/extendedStencil/Make/files
+3
-0
OpenFOAM-v2112/applications/test/extendedStencil/Make/options
...FOAM-v2112/applications/test/extendedStencil/Make/options
+6
-0
OpenFOAM-v2112/applications/test/extendedStencil/Test-ExtendedStencil.C
.../applications/test/extendedStencil/Test-ExtendedStencil.C
+560
-0
OpenFOAM-v2112/applications/test/extendedStencil/Test-ExtendedStencil2.C
...applications/test/extendedStencil/Test-ExtendedStencil2.C
+208
-0
OpenFOAM-v2112/applications/test/externalFileCoupler/Allclean
...FOAM-v2112/applications/test/externalFileCoupler/Allclean
+10
-0
OpenFOAM-v2112/applications/test/externalFileCoupler/Allrun
OpenFOAM-v2112/applications/test/externalFileCoupler/Allrun
+20
-0
OpenFOAM-v2112/applications/test/externalFileCoupler/Make/files
...AM-v2112/applications/test/externalFileCoupler/Make/files
+3
-0
OpenFOAM-v2112/applications/test/externalFileCoupler/Make/options
...-v2112/applications/test/externalFileCoupler/Make/options
+5
-0
OpenFOAM-v2112/applications/test/externalFileCoupler/Test-externalFileCoupler.C
...tions/test/externalFileCoupler/Test-externalFileCoupler.C
+123
-0
OpenFOAM-v2112/applications/test/faceHashing/Make/files
OpenFOAM-v2112/applications/test/faceHashing/Make/files
+3
-0
OpenFOAM-v2112/applications/test/faceHashing/Make/options
OpenFOAM-v2112/applications/test/faceHashing/Make/options
+3
-0
OpenFOAM-v2112/applications/test/faceHashing/Test-faceHashing.C
...AM-v2112/applications/test/faceHashing/Test-faceHashing.C
+153
-0
OpenFOAM-v2112/applications/test/faces/Make/files
OpenFOAM-v2112/applications/test/faces/Make/files
+3
-0
OpenFOAM-v2112/applications/test/faces/Make/options
OpenFOAM-v2112/applications/test/faces/Make/options
+2
-0
OpenFOAM-v2112/applications/test/faces/Test-faces.C
OpenFOAM-v2112/applications/test/faces/Test-faces.C
+237
-0
OpenFOAM-v2112/applications/test/fft/Allwmake
OpenFOAM-v2112/applications/test/fft/Allwmake
+15
-0
OpenFOAM-v2112/applications/test/fft/Make/files
OpenFOAM-v2112/applications/test/fft/Make/files
+3
-0
OpenFOAM-v2112/applications/test/fft/Make/options
OpenFOAM-v2112/applications/test/fft/Make/options
+5
-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/exprTraits/Make/options
0 → 100644
View file @
55e5a777
/* EXE_INC = */
/* EXE_LIBS = */
OpenFOAM-v2112/applications/test/exprTraits/Test-exprTraits.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) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
Description
Basic tests of expression traits
\*---------------------------------------------------------------------------*/
#include "IOstreams.H"
#include "ITstream.H"
#include "exprTraits.H"
#include "uLabel.H"
#include "error.H"
#include "stringList.H"
#include "exprScanToken.H"
using
namespace
Foam
;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template
<
class
T
>
void
printTraits
()
{
const
auto
typeCode
=
exprTypeTraits
<
T
>::
value
;
Info
<<
"type "
<<
pTraits
<
T
>::
typeName
<<
" code:"
<<
int
(
typeCode
)
<<
" name:"
<<
exprTypeTraits
<
T
>::
name
;
if
(
pTraits
<
T
>::
typeName
!=
word
(
exprTypeTraits
<
T
>::
name
))
{
Info
<<
" (UNSUPPORTED)"
;
}
Info
<<
endl
;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
()
{
Info
<<
nl
<<
"Traits:"
<<
nl
;
printTraits
<
word
>
();
printTraits
<
string
>
();
printTraits
<
bool
>
();
printTraits
<
label
>
();
printTraits
<
scalar
>
();
printTraits
<
vector
>
();
printTraits
<
tensor
>
();
printTraits
<
symmTensor
>
();
printTraits
<
sphericalTensor
>
();
const
auto
getName
=
nameOp
<
expressions
::
valueTypeCode
>
();
Info
<<
nl
;
Info
<<
"Name of typeCode: "
<<
Foam
::
name
(
expressions
::
valueTypeCode
::
type_scalar
)
<<
nl
;
Info
<<
"Name of typeCode: "
<<
getName
(
expressions
::
valueTypeCode
::
type_bool
)
<<
nl
;
{
expressions
::
scanToken
tok
;
expressions
::
scanToken
tok2
;
Info
<<
nl
<<
"sizeof(scanToken): "
<<
sizeof
(
tok
)
<<
nl
;
Info
<<
" type:"
<<
int
(
tok
.
type_
)
<<
nl
;
Info
<<
" ptr:"
<<
Foam
::
name
(
tok
.
name_
)
<<
nl
;
Info
<<
" type:"
<<
int
(
tok2
.
type_
)
<<
nl
;
Info
<<
" ptr:"
<<
Foam
::
name
(
tok2
.
name_
)
<<
nl
;
tok
.
setWord
(
"hello"
);
Info
<<
" type:"
<<
int
(
tok
.
type_
)
<<
nl
;
Info
<<
" ptr:"
<<
Foam
::
name
(
tok
.
name_
)
<<
nl
;
tok2
=
tok
;
Info
<<
" type:"
<<
int
(
tok2
.
type_
)
<<
nl
;
Info
<<
" ptr:"
<<
Foam
::
name
(
tok2
.
name_
)
<<
nl
;
tok2
.
destroy
();
Info
<<
" type:"
<<
int
(
tok2
.
type_
)
<<
nl
;
Info
<<
" ptr:"
<<
Foam
::
name
(
tok2
.
name_
)
<<
nl
;
}
Info
<<
nl
<<
"Done"
<<
nl
;
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/extendedStencil/Make/files
0 → 100644
View file @
55e5a777
Test-ExtendedStencil.C
EXE = $(FOAM_USER_APPBIN)/Test-ExtendedStencil
OpenFOAM-v2112/applications/test/extendedStencil/Make/options
0 → 100644
View file @
55e5a777
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume
OpenFOAM-v2112/applications/test/extendedStencil/Test-ExtendedStencil.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
testExtendedStencil
Description
Test app for determining extended stencil.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "fvMesh.H"
#include "volFields.H"
#include "Time.H"
#include "fvCFD.H"
#include "OFstream.H"
#include "meshTools.H"
//#include "FECCellToFaceStencil.H"
//#include "CFCCellToFaceStencil.H"
//#include "CPCCellToFaceStencil.H"
//#include "CECCellToFaceStencil.H"
//#include "extendedCentredCellToFaceStencil.H"
//#include "extendedUpwindCellToFaceStencil.H"
//#include "centredCFCCellToFaceStencilObject.H"
//#include "centredFECCellToFaceStencilObject.H"
//#include "centredCPCCellToFaceStencilObject.H"
//#include "centredCECCellToFaceStencilObject.H"
//#include "upwindFECCellToFaceStencilObject.H"
//#include "upwindCPCCellToFaceStencilObject.H"
//#include "upwindCECCellToFaceStencilObject.H"
//#include "upwindCFCCellToFaceStencilObject.H"
//#include "centredCFCFaceToCellStencilObject.H"
#include "centredCECCellToCellStencilObject.H"
#include "centredCFCCellToCellStencilObject.H"
#include "centredCPCCellToCellStencilObject.H"
using
namespace
Foam
;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void
writeStencilOBJ
(
const
fileName
&
fName
,
const
point
&
fc
,
const
List
<
point
>&
stencilCc
)
{
OFstream
str
(
fName
);
label
vertI
=
0
;
meshTools
::
writeOBJ
(
str
,
fc
);
vertI
++
;
forAll
(
stencilCc
,
i
)
{
meshTools
::
writeOBJ
(
str
,
stencilCc
[
i
]);
vertI
++
;
str
<<
"l 1 "
<<
vertI
<<
nl
;
}
}
// Stats
void
writeStencilStats
(
const
labelListList
&
stencil
)
{
label
sumSize
=
0
;
label
nSum
=
0
;
label
minSize
=
labelMax
;
label
maxSize
=
labelMin
;
forAll
(
stencil
,
i
)
{
const
labelList
&
sCells
=
stencil
[
i
];
if
(
sCells
.
size
()
>
0
)
{
sumSize
+=
sCells
.
size
();
nSum
++
;
minSize
=
min
(
minSize
,
sCells
.
size
());
maxSize
=
max
(
maxSize
,
sCells
.
size
());
}
}
reduce
(
sumSize
,
sumOp
<
label
>
());
reduce
(
nSum
,
sumOp
<
label
>
());
sumSize
/=
nSum
;
reduce
(
minSize
,
minOp
<
label
>
());
reduce
(
maxSize
,
maxOp
<
label
>
());
Info
<<
"Stencil size :"
<<
nl
<<
" average : "
<<
sumSize
<<
nl
<<
" min : "
<<
minSize
<<
nl
<<
" max : "
<<
maxSize
<<
nl
<<
endl
;
}
// Main program:
int
main
(
int
argc
,
char
*
argv
[])
{
#include "addTimeOptions.H"
#include "setRootCase.H"
#include "createTime.H"
// Get times list
instantList
Times
=
runTime
.
times
();
#include "checkTimeOptions.H"
runTime
.
setTime
(
Times
[
startTime
],
startTime
);
#include "createMesh.H"
// Force calculation of extended edge addressing
const
labelListList
&
edgeFaces
=
mesh
.
edgeFaces
();
const
labelListList
&
edgeCells
=
mesh
.
edgeCells
();
const
labelListList
&
pointCells
=
mesh
.
pointCells
();
Info
<<
"dummy:"
<<
edgeFaces
.
size
()
+
edgeCells
.
size
()
+
pointCells
.
size
()
<<
endl
;
// Centred, semi-extended stencil (edge cells only)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// {
// //const FECCellToFaceStencil cfcStencil(mesh);
// //const extendedCentredCellToFaceStencil addressing
// //(
// // cfcStencil
// //);
// const extendedCentredStencil& addressing =
// centredFECCellToFaceStencilObject::New
// (
// mesh
// );
//
// Info<< "faceEdgeCell:" << endl;
// writeStencilStats(addressing.stencil());
//
// // Collect stencil cell centres
// List<List<point>> stencilPoints(mesh.nFaces());
// addressing.collectData
// (
// mesh.C(),
// stencilPoints
// );
//
// forAll(stencilPoints, facei)
// {
// writeStencilOBJ
// (
// runTime.path()/"faceEdgeCell" + Foam::name(facei) + ".obj",
// mesh.faceCentres()[facei],
// stencilPoints[facei]
// );
// }
// }
// // Centred, face stencil
// // ~~~~~~~~~~~~~~~~~~~~~
//
// {
// const extendedCentredCellToFaceStencil& addressing =
// centredCFCCellToFaceStencilObject::New
// (
// mesh
// );
//
// Info<< "cellFaceCell:" << endl;
// writeStencilStats(addressing.stencil());
//
//
// //// Do some interpolation.
// //{
// // const labelListList& stencil = addressing.stencil();
// // List<List<scalar>> stencilWeights(stencil.size());
// // forAll(stencil, facei)
// // {
// // const labelList& fStencil = stencil[facei];
// //
// // if (fStencil.size() > 0)
// // {
// // // Uniform weights
// // stencilWeights[facei] = scalarList
// // (
// // fStencil.size(),
// // 1.0/fStencil.size()
// // );
// // }
// // }
// //
// // tmp<surfaceVectorField> tfc
// // (
// // addressing.weightedSum(mesh.C(), stencilWeights)
// // );
// //}
//
//
// // Collect stencil cell centres
// List<List<point>> stencilPoints(mesh.nFaces());
// addressing.collectData
// (
// mesh.C(),
// stencilPoints
// );
//
// forAll(stencilPoints, facei)
// {
// if (stencilPoints[facei].size() >= 15)
// {
// writeStencilOBJ
// (
// runTime.path()/"centredFace" + Foam::name(facei) + ".obj",
// mesh.faceCentres()[facei],
// stencilPoints[facei]
// );
// }
// }
// }
// // Centred, point stencil
// // ~~~~~~~~~~~~~~~~~~~~~~
//
// {
// //const extendedCentredCellToFaceStencil& addressing =
// //centredCPCStencilObject::New
// //(
// // mesh
// //);
// //
// //Info<< "cellPointCell:" << endl;
// //writeStencilStats(addressing.stencil());
// //
// //
// //// Collect stencil cell centres
// //List<List<point>> stencilPoints(mesh.nFaces());
// //addressing.collectData
// //(
// // mesh.C(),
// // stencilPoints
// //);
// //
// //forAll(stencilPoints, facei)
// //{
// // writeStencilOBJ
// // (
// // runTime.path()/"centredPoint" + Foam::name(facei) + ".obj",
// // mesh.faceCentres()[facei],
// // stencilPoints[facei]
// // );
// //}
// }
// // Centred, edge stencil
// // ~~~~~~~~~~~~~~~~~~~~~~
//
// {
// //const extendedCentredCellToFaceStencil& addressing =
// //centredCECStencilObject::New
// //(
// // mesh
// //);
// //
// //Info<< "cellEdgeCell:" << endl;
// //writeStencilStats(addressing.stencil());
// //
// //
// //// Collect stencil cell centres
// //List<List<point>> stencilPoints(mesh.nFaces());
// //addressing.collectData
// //(
// // mesh.C(),
// // stencilPoints
// //);
// //
// //forAll(stencilPoints, facei)
// //{
// // writeStencilOBJ
// // (
// // runTime.path()/"centredEdge" + Foam::name(facei) + ".obj",
// // mesh.faceCentres()[facei],
// // stencilPoints[facei]
// // );
// //}
// }
// Upwind, semi-extended stencil
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//{
// const extendedUpwindCellToFaceStencil& addressing =
// upwindFECCellToFaceStencilObject::New
// (
// mesh,
// 0.5
// );
//
// Info<< "upwind-faceEdgeCell:" << endl;
// writeStencilStats(addressing.ownStencil());
//
// {
// // Collect stencil cell centres
// List<List<point>> ownPoints(mesh.nFaces());
// addressing.collectData
// (
// addressing.ownMap(),
// addressing.ownStencil(),
// mesh.C(),
// ownPoints
// );
//
// forAll(ownPoints, facei)
// {
// writeStencilOBJ
// (
// runTime.path()/"ownFEC" + Foam::name(facei) + ".obj",
// mesh.faceCentres()[facei],
// ownPoints[facei]
// );
// }
// }
// {
// // Collect stencil cell centres
// List<List<point>> neiPoints(mesh.nFaces());
// addressing.collectData
// (
// addressing.neiMap(),
// addressing.neiStencil(),
// mesh.C(),
// neiPoints
// );
//
// forAll(neiPoints, facei)
// {
// writeStencilOBJ
// (
// runTime.path()/"neiFEC" + Foam::name(facei) + ".obj",
// mesh.faceCentres()[facei],
// neiPoints[facei]
// );
// }
// }
//}
// Upwind, extended stencil
// ~~~~~~~~~~~~~~~~~~~~~~~~
//{
// const extendedUpwindCellToFaceStencil& addressing =
// upwindCFCCellToFaceStencilObject::New
// (
// mesh,
// 0.5
// );
//
// Info<< "upwind-cellFaceCell:" << endl;
// writeStencilStats(addressing.ownStencil());
//
// {
// // Collect stencil cell centres
// List<List<point>> ownPoints(mesh.nFaces());
// addressing.collectData
// (
// addressing.ownMap(),
// addressing.ownStencil(),
// mesh.C(),
// ownPoints
// );
//
// forAll(ownPoints, facei)
// {
// writeStencilOBJ
// (
// runTime.path()/"ownCFC" + Foam::name(facei) + ".obj",
// mesh.faceCentres()[facei],
// ownPoints[facei]
// );
// }
// }
// {
// // Collect stencil cell centres
// List<List<point>> neiPoints(mesh.nFaces());
// addressing.collectData
// (
// addressing.neiMap(),
// addressing.neiStencil(),
// mesh.C(),
// neiPoints
// );
//
// forAll(neiPoints, facei)
// {
// writeStencilOBJ
// (
// runTime.path()/"neiCFC" + Foam::name(facei) + ".obj",
// mesh.faceCentres()[facei],
// neiPoints[facei]
// );
// }
// }
//}
//---- CELL CENTRED STENCIL -----
// Centred, cell stencil
// ~~~~~~~~~~~~~~~~~~~~~
{
const
extendedCentredCellToCellStencil
&
addressing
=
centredCECCellToCellStencilObject
::
New
(
mesh
);
Info
<<
"cellCellCell:"
<<
endl
;
writeStencilStats
(
addressing
.
stencil
());
// Collect stencil cell centres
List
<
List
<
point
>>
stencilPoints
(
mesh
.
nCells
());
addressing
.
collectData
(
mesh
.
C
(),
stencilPoints
);
forAll
(
stencilPoints
,
celli
)
{
writeStencilOBJ
(
runTime
.
path
()
/
"centredCECCell"
+
Foam
::
name
(
celli
)
+
".obj"
,
mesh
.
cellCentres
()[
celli
],
stencilPoints
[
celli
]
);
}
}
{
const
extendedCentredCellToCellStencil
&
addressing
=
centredCPCCellToCellStencilObject
::
New
(
mesh
);
Info
<<
"cellCellCell:"
<<
endl
;
writeStencilStats
(
addressing
.
stencil
());
// Collect stencil cell centres
List
<
List
<
point
>>
stencilPoints
(
mesh
.
nCells
());
addressing
.
collectData
(
mesh
.
C
(),
stencilPoints
);
forAll
(
stencilPoints
,
celli
)
{
writeStencilOBJ
(
runTime
.
path
()
/
"centredCPCCell"
+
Foam
::
name
(
celli
)
+
".obj"
,
mesh
.
cellCentres
()[
celli
],
stencilPoints
[
celli
]
);
}
}
{
const
extendedCentredCellToCellStencil
&
addressing
=
centredCFCCellToCellStencilObject
::
New
(
mesh
);
Info
<<
"cellCellCell:"
<<
endl
;
writeStencilStats
(
addressing
.
stencil
());
// Collect stencil cell centres
List
<
List
<
point
>>
stencilPoints
(
mesh
.
nCells
());
addressing
.
collectData
(
mesh
.
C
(),
stencilPoints
);
forAll
(
stencilPoints
,
celli
)
{
writeStencilOBJ
(
runTime
.
path
()
/
"centredCFCCell"
+
Foam
::
name
(
celli
)
+
".obj"
,
mesh
.
cellCentres
()[
celli
],
stencilPoints
[
celli
]
);
}
}
//XXXXXX
// // Evaluate
// List<List<scalar>> stencilData(faceStencils.size());
// collectStencilData
// (
// distMap,
// faceStencils,
// vf,
// stencilData
// );
// for (label faci = 0; faci < mesh.nInternalFaces(); faci++)
// {
// const scalarList& stData = stencilData[facei];
// const scalarList& stWeight = fit[facei];
//
// forAll(stData, i)
// {
// sf[facei] += stWeight[i]*stData[i];
// }
// }
// See finiteVolume/lnInclude/leastSquaresGrad.C
//XXXXXX
Pout
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/extendedStencil/Test-ExtendedStencil2.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-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
testExtendedStencil2
Description
Test app for determining extended cell-to-cell stencil.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "fvMesh.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "Time.H"
#include "OFstream.H"
#include "meshTools.H"
#include "CFCCellToCellStencil.H"
using
namespace
Foam
;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void
writeStencilOBJ
(
const
fileName
&
fName
,
const
point
&
fc
,
const
List
<
point
>&
stencilCc
)
{
OFstream
str
(
fName
);
label
vertI
=
0
;
meshTools
::
writeOBJ
(
str
,
fc
);
vertI
++
;
forAll
(
stencilCc
,
i
)
{
meshTools
::
writeOBJ
(
str
,
stencilCc
[
i
]);
vertI
++
;
str
<<
"l 1 "
<<
vertI
<<
nl
;
}
}
// Stats
void
writeStencilStats
(
const
labelListList
&
stencil
)
{
label
sumSize
=
0
;
label
nSum
=
0
;
label
minSize
=
labelMax
;
label
maxSize
=
labelMin
;
forAll
(
stencil
,
i
)
{
const
labelList
&
sCells
=
stencil
[
i
];
if
(
sCells
.
size
()
>
0
)
{
sumSize
+=
sCells
.
size
();
nSum
++
;
minSize
=
min
(
minSize
,
sCells
.
size
());
maxSize
=
max
(
maxSize
,
sCells
.
size
());
}
}
reduce
(
sumSize
,
sumOp
<
label
>
());
reduce
(
nSum
,
sumOp
<
label
>
());
sumSize
/=
nSum
;
reduce
(
minSize
,
minOp
<
label
>
());
reduce
(
maxSize
,
maxOp
<
label
>
());
Info
<<
"Stencil size :"
<<
nl
<<
" average : "
<<
sumSize
<<
nl
<<
" min : "
<<
minSize
<<
nl
<<
" max : "
<<
maxSize
<<
nl
<<
endl
;
}
// Main program:
int
main
(
int
argc
,
char
*
argv
[])
{
#include "addTimeOptions.H"
#include "setRootCase.H"
#include "createTime.H"
// Get times list
instantList
Times
=
runTime
.
times
();
#include "checkTimeOptions.H"
runTime
.
setTime
(
Times
[
startTime
],
startTime
);
#include "createMesh.H"
//---- CELL CENTRED STENCIL -----
// Centred, cell stencil
// ~~~~~~~~~~~~~~~~~~~~~
{
// Full stencil. This is per local cell a set of global indices, either
// into cells or also boundary faces.
CFCCellToCellStencil
stencil
(
mesh
);
// Construct exchange map and renumber stencil
List
<
Map
<
label
>>
compactMap
(
Pstream
::
nProcs
());
mapDistribute
map
(
stencil
.
globalNumbering
(),
stencil
,
compactMap
);
// Print some stats
Info
<<
"cellFaceCell:"
<<
endl
;
writeStencilStats
(
stencil
);
// Collect the data in stencil form
List
<
List
<
vector
>>
stencilPoints
;
{
const
volVectorField
&
fld
=
mesh
.
C
();
// 1. Construct cell data in compact addressing
List
<
point
>
compactFld
(
map
.
constructSize
(),
Zero
);
// Insert my internal values
forAll
(
fld
,
celli
)
{
compactFld
[
celli
]
=
fld
[
celli
];
}
// Insert my boundary values
label
nCompact
=
fld
.
size
();
forAll
(
fld
.
boundaryField
(),
patchi
)
{
const
fvPatchField
<
vector
>&
pfld
=
fld
.
boundaryField
()[
patchi
];
forAll
(
pfld
,
i
)
{
compactFld
[
nCompact
++
]
=
pfld
[
i
];
}
}
// Do all swapping
map
.
distribute
(
compactFld
);
// 2. Pull to stencil
stencilPoints
.
setSize
(
stencil
.
size
());
forAll
(
stencil
,
celli
)
{
const
labelList
&
compactCells
=
stencil
[
celli
];
stencilPoints
[
celli
].
setSize
(
compactCells
.
size
());
forAll
(
compactCells
,
i
)
{
stencilPoints
[
celli
][
i
]
=
compactFld
[
compactCells
[
i
]];
}
}
}
forAll
(
stencilPoints
,
celli
)
{
writeStencilOBJ
(
runTime
.
path
()
/
"centredCell"
+
Foam
::
name
(
celli
)
+
".obj"
,
mesh
.
cellCentres
()[
celli
],
stencilPoints
[
celli
]
);
}
}
Pout
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/externalFileCoupler/Allclean
0 → 100644
View file @
55e5a777
#!/bin/sh
cd
"
${
0
%/*
}
"
||
exit
# Run from this directory
#------------------------------------------------------------------------------
# Remove old junk
rm
-f
comms/OpenFOAM.lock
rmdir
comms
#------------------------------------------------------------------------------
OpenFOAM-v2112/applications/test/externalFileCoupler/Allrun
0 → 100644
View file @
55e5a777
#!/bin/sh
cd
"
${
0
%/*
}
"
||
exit
# Run from this directory
#------------------------------------------------------------------------------
# Cleanup old junk that may prevent things from starting
rm
-f
comms/OpenFOAM.lock
# If this exits prematurely, trigger the external solver to stop
trap
'[ -e comms/OpenFOAM.lock ] && echo "status=done" > comms/OpenFOAM.lock'
EXIT TERM INT
Test-externalFileCoupler
-slave
-max
50 &
Test-externalFileCoupler
-max
25
# Give some time for the slave to find updated file
sleep
2
[
-d
comms
]
&&
echo
"status=done"
>
comms/OpenFOAM.lock
#------------------------------------------------------------------------------
OpenFOAM-v2112/applications/test/externalFileCoupler/Make/files
0 → 100644
View file @
55e5a777
Test-externalFileCoupler.C
EXE = $(FOAM_USER_APPBIN)/Test-externalFileCoupler
OpenFOAM-v2112/applications/test/externalFileCoupler/Make/options
0 → 100644
View file @
55e5a777
EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lmeshTools
OpenFOAM-v2112/applications/test/externalFileCoupler/Test-externalFileCoupler.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) 2017-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
Test-externalFileCoupler
Description
Test of master/slave communication etc.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "externalFileCoupler.H"
using
namespace
Foam
;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
noBanner
();
argList
::
noParallel
();
argList
::
addOption
(
"sleep"
,
"N"
,
"sleep to add between calls"
);
argList
::
addOption
(
"max"
,
"N"
,
"max number of calls (default: 1000)"
);
argList
::
addBoolOption
(
"slave"
,
"run as slave"
);
#include "setRootCase.H"
const
label
maxCount
=
args
.
getOrDefault
<
label
>
(
"max"
,
1000
);
const
label
sleeping
=
args
.
getOrDefault
<
label
>
(
"sleep"
,
0
);
externalFileCoupler
coupler
;
if
(
args
.
found
(
"slave"
))
{
const
word
role
=
"slave"
;
const
word
other
=
"master"
;
Info
<<
"Running as "
<<
role
<<
" max="
<<
maxCount
<<
" (sleep "
<<
sleeping
<<
')'
<<
endl
;
for
(
label
count
=
0
;
count
<
maxCount
;
++
count
)
{
// Wait for master, but stop if status=done was seen
Info
<<
role
<<
'['
<<
count
<<
"] wait for "
<<
other
<<
endl
;
if
(
!
coupler
.
waitForMaster
())
{
Info
<<
role
<<
": stopping. status=done was detected"
<<
endl
;
break
;
}
if
(
sleeping
)
{
sleep
(
sleeping
);
}
// Info<< role << ": switch to " << other << endl;
coupler
.
useMaster
();
}
Info
<<
role
<<
": exiting"
<<
endl
;
}
else
{
const
word
role
=
"master"
;
const
word
other
=
"slave"
;
Info
<<
"Running as "
<<
role
<<
" max="
<<
maxCount
<<
" (sleep "
<<
sleeping
<<
')'
<<
endl
;
for
(
label
count
=
0
;
count
<
maxCount
;
++
count
)
{
// Wait for slave, but stop if status=done was seen
Info
<<
role
<<
'['
<<
count
<<
"] wait for "
<<
other
<<
endl
;
if
(
!
coupler
.
waitForSlave
())
{
Info
<<
role
<<
": stopping. status=done was detected"
<<
endl
;
break
;
}
if
(
sleeping
)
{
sleep
(
sleeping
);
}
// Info<< role << ": switch to " << other << endl;
coupler
.
useSlave
();
}
// shudown - slave should notice and terminate
Info
<<
role
<<
": exiting"
<<
endl
;
}
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/faceHashing/Make/files
0 → 100644
View file @
55e5a777
Test-faceHashing.C
EXE = $(FOAM_USER_APPBIN)/Test-faceHashing
OpenFOAM-v2112/applications/test/faceHashing/Make/options
0 → 100644
View file @
55e5a777
EXE_INC = ${c++LESSWARN}
/* EXE_LIBS = */
OpenFOAM-v2112/applications/test/faceHashing/Test-faceHashing.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) 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/>.
Application
Test-faceHashing
Description
Basic tests of face/triFace hashing
\*---------------------------------------------------------------------------*/
#include "IOstreams.H"
#include "IOobject.H"
#include "IFstream.H"
#include "faceList.H"
#include "triFaceList.H"
#include "HashSet.H"
#include "HashTable.H"
using
namespace
Foam
;
template
<
class
HashSetType
,
class
FaceListType
>
void
checkHashSet
(
const
HashSetType
&
hs
,
const
FaceListType
&
faces
)
{
Info
<<
hs
<<
nl
;
for
(
const
auto
&
f
:
faces
)
{
Info
<<
" "
<<
f
<<
" found="
<<
hs
.
found
(
f
)
<<
nl
;
}
Info
<<
nl
;
}
void
checkHashes
(
const
faceList
&
faces
)
{
face
::
hasher
op1
;
face
::
symmHasher
op2
;
Info
<<
"face hasher/symmHasher: "
<<
faces
.
size
()
<<
" faces"
<<
nl
;
for
(
const
face
&
f
:
faces
)
{
Info
<<
" "
<<
f
<<
" symmhash="
<<
op2
(
f
)
<<
" hash="
<<
op1
(
f
)
<<
nl
;
}
Info
<<
nl
;
}
void
checkHashes
(
const
triFaceList
&
faces
)
{
triFace
::
hasher
op1
;
Info
<<
"triFace hasher: "
<<
faces
.
size
()
<<
" faces"
<<
nl
;
for
(
const
triFace
&
f
:
faces
)
{
Info
<<
" "
<<
f
<<
" hash="
<<
op1
(
f
)
<<
nl
;
}
Info
<<
nl
;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int
main
(
int
argc
,
char
*
argv
[])
{
{
faceList
faces
({
face
{
0
,
1
,
2
,
3
},
// regular
face
{
0
,
3
,
2
,
1
},
// flip
face
{
2
,
3
,
0
,
1
},
// rotate
face
{
2
,
1
,
0
,
3
},
// rotate (flip)
face
{
2
,
0
,
1
,
3
},
// permute
face
{
2
,
1
,
0
,
3
},
// permute
});
checkHashes
(
faces
);
HashSet
<
face
,
face
::
hasher
>
hs1
;
HashSet
<
face
,
face
::
symmHasher
>
hs2
;
hs1
.
insert
(
faces
);
hs2
.
insert
(
faces
);
Info
<<
"hashset (hasher)"
<<
nl
;
checkHashSet
(
hs1
,
faces
);
Info
<<
nl
;
hs1
.
erase
(
faces
[
0
]);
Info
<<
"remove "
<<
faces
[
0
]
<<
nl
;
Info
<<
"hashset (hasher)"
<<
nl
;
checkHashSet
(
hs1
,
faces
);
Info
<<
nl
;
Info
<<
"hashset (symmHasher)"
<<
nl
;
checkHashSet
(
hs2
,
faces
);
Info
<<
nl
;
hs2
.
erase
(
faces
[
0
]);
Info
<<
"remove "
<<
faces
[
0
]
<<
nl
;
Info
<<
"hashset (symmHasher)"
<<
nl
;
checkHashSet
(
hs2
,
faces
);
Info
<<
nl
;
}
{
triFaceList
faces
({
triFace
{
0
,
1
,
2
},
// regular
triFace
{
0
,
2
,
1
},
// flip
triFace
{
2
,
0
,
1
},
// rotate
});
checkHashes
(
faces
);
HashSet
<
triFace
>
hs1
;
hs1
.
insert
(
faces
);
Info
<<
"hashset (symmHasher)"
<<
nl
;
checkHashSet
(
hs1
,
faces
);
Info
<<
nl
;
}
Info
<<
"
\n
End
\n
"
<<
nl
;
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/faces/Make/files
0 → 100644
View file @
55e5a777
Test-faces.C
EXE = $(FOAM_USER_APPBIN)/Test-faces
OpenFOAM-v2112/applications/test/faces/Make/options
0 → 100644
View file @
55e5a777
/* EXE_INC = */
/* EXE_LIBS = */
OpenFOAM-v2112/applications/test/faces/Test-faces.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) 2016-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/>.
Application
Test-faces
Description
Simple tests for various faces
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "labelledTri.H"
#include "faceList.H"
#include "triFaceList.H"
#include "pointList.H"
#include "ListOps.H"
using
namespace
Foam
;
template
<
class
Face
>
void
faceInfo
(
const
Face
&
f
,
const
UList
<
point
>&
points
)
{
Info
<<
f
<<
" points:"
<<
f
.
points
(
points
)
<<
" normal:"
<<
f
.
unitNormal
(
points
);
}
template
<
class
Face
>
void
testSign
(
const
Face
&
f
,
const
UList
<
point
>&
points
,
const
UList
<
point
>&
testPoints
)
{
for
(
const
point
&
p
:
testPoints
)
{
Info
<<
" point:"
<<
p
<<
" sign="
<<
f
.
sign
(
p
,
points
)
<<
nl
;
}
}
template
<
class
Face
>
void
testEdges
(
const
Face
&
f
)
{
const
label
nEdges
=
f
.
nEdges
();
Info
<<
"face: "
<<
f
<<
nl
<<
"flip: "
<<
f
.
reverseFace
()
<<
nl
<<
" fc edges:"
<<
flatOutput
(
f
.
edges
())
<<
nl
<<
" rc edges:"
<<
flatOutput
(
f
.
rcEdges
())
<<
nl
;
Info
<<
" forward edges"
<<
nl
;
for
(
label
edgei
=
0
;
edgei
<
nEdges
;
++
edgei
)
{
Info
<<
" "
<<
edgei
<<
" : "
<<
f
.
edge
(
edgei
)
<<
nl
;
}
Info
<<
" reverse edges"
<<
nl
;
for
(
label
edgei
=
0
;
edgei
<
nEdges
;
++
edgei
)
{
Info
<<
" "
<<
edgei
<<
" : "
<<
f
.
rcEdge
(
edgei
)
<<
nl
;
}
}
void
testCompare
(
const
triFace
&
a
,
const
triFace
&
b
)
{
Info
<<
"compare: "
<<
a
<<
" with "
<<
b
<<
" == "
<<
triFace
::
compare
(
a
,
b
)
<<
nl
;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int
main
(
int
argc
,
char
*
argv
[])
{
pointList
points1
({
{
0
,
0
,
0
},
{
-
1
,
-
1
,
1
},
{
1
,
-
1
,
-
1
},
{
1
,
1
,
-
1
},
{
-
1
,
1
,
1
}
});
pointList
points2
=
ListOps
::
create
<
point
>
(
points1
,
[](
const
point
&
p
){
return
point
(
p
.
x
(),
p
.
y
(),
-
p
.
z
());
}
);
pointList
testPoints
({
{
-
2
,
-
2
,
-
2
},
{
-
2
,
-
2
,
2
},
{
0
,
0
,
0
},
{
2
,
2
,
-
2
},
{
2
,
2
,
2
}
});
face
f1
({
1
,
2
,
3
,
4
});
Info
<<
"face:"
;
faceInfo
(
f1
,
points1
);
Info
<<
nl
;
testSign
(
f1
,
points1
,
testPoints
);
Info
<<
"face:"
;
faceInfo
(
f1
,
points2
);
Info
<<
nl
;
testSign
(
f1
,
points2
,
testPoints
);
Info
<<
nl
;
triFace
t1
({
1
,
2
,
3
});
Info
<<
"triFace:"
;
faceInfo
(
t1
,
points1
);
Info
<<
nl
;
testSign
(
t1
,
points1
,
testPoints
);
Info
<<
"triFace:"
;
faceInfo
(
t1
,
points2
);
Info
<<
nl
;
testSign
(
t1
,
points2
,
testPoints
);
Info
<<
nl
;
f1
=
t1
;
Info
<<
"face:"
<<
f1
<<
nl
;
f1
=
t1
.
triFaceFace
();
Info
<<
"face:"
<<
f1
<<
nl
;
#if 0
// Expect failure, but triggers abort which cannot be caught
const bool oldThrowingError = FatalError.throwing(true);
try
{
labelledTri l1({1, 2, 3, 10, 24});
Info<< "labelled:" << l1 << nl;
}
catch (const Foam::error& err)
{
WarningInFunction
<< "Caught FatalError " << err << nl << endl;
}
FatalError.throwing(oldThrowingError);
#endif
labelledTri
l2
({
1
,
2
,
3
});
Info
<<
"labelled:"
<<
l2
<<
nl
;
labelledTri
l3
({
1
,
2
,
3
,
10
});
Info
<<
"labelled:"
<<
l3
<<
nl
;
t1
.
flip
();
l3
.
flip
();
Info
<<
"flip:"
<<
t1
<<
nl
;
Info
<<
"flip:"
<<
l3
<<
nl
;
{
triFaceList
faceList1
({
triFace
{
1
,
2
,
3
},
triFace
{
4
,
2
,
100
},
triFace
{
1
,
3
,
2
},
});
Info
<<
nl
<<
"Test edges"
<<
nl
;
for
(
const
auto
&
f
:
faceList1
)
{
testEdges
(
f
);
Info
<<
nl
;
}
}
{
faceList
faceList1
({
face
{
1
,
2
,
3
,
4
},
face
{
1
,
4
,
3
,
2
},
face
{
4
,
2
,
100
,
8
,
35
},
});
Info
<<
nl
<<
"Test edges"
<<
nl
;
for
(
const
auto
&
f
:
faceList1
)
{
testEdges
(
f
);
Info
<<
nl
;
}
}
{
triFaceList
faceList1
({
triFace
{
1
,
2
,
3
},
triFace
{
1
,
3
,
2
},
triFace
{
3
,
1
,
2
},
triFace
{
4
,
5
,
1
},
});
Info
<<
nl
<<
"Test triFace compare"
<<
nl
;
for
(
const
triFace
&
a
:
faceList1
)
{
for
(
const
triFace
&
b
:
faceList1
)
{
testCompare
(
a
,
b
);
}
}
Info
<<
nl
;
}
Info
<<
"
\n
End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/fft/Allwmake
0 → 100644
View file @
55e5a777
#!/bin/sh
cd
"
${
0
%/*
}
"
||
exit
# Run from this directory
.
${
WM_PROJECT_DIR
:?
}
/wmake/scripts/AllwmakeParseArguments
# (error catching)
.
${
WM_PROJECT_DIR
:?
}
/wmake/scripts/have_fftw
#------------------------------------------------------------------------------
if
have_fftw
then
wmake
$targetType
else
echo
"==> skip test (no FFTW)"
fi
#------------------------------------------------------------------------------
OpenFOAM-v2112/applications/test/fft/Make/files
0 → 100644
View file @
55e5a777
Test-fft.C
EXE = $(FOAM_USER_APPBIN)/Test-fft
OpenFOAM-v2112/applications/test/fft/Make/options
0 → 100644
View file @
55e5a777
EXE_INC = \
-I$(LIB_SRC)/randomProcesses/lnInclude
EXE_LIBS = \
-lrandomProcesses
Prev
1
…
23
24
25
26
27
28
29
30
31
…
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