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
833 additions
and
0 deletions
+833
-0
OpenFOAM-v2112/applications/test/findTimes/Make/options
OpenFOAM-v2112/applications/test/findTimes/Make/options
+2
-0
OpenFOAM-v2112/applications/test/findTimes/Test-findTimes.C
OpenFOAM-v2112/applications/test/findTimes/Test-findTimes.C
+59
-0
OpenFOAM-v2112/applications/test/flatOutput1/Make/files
OpenFOAM-v2112/applications/test/flatOutput1/Make/files
+3
-0
OpenFOAM-v2112/applications/test/flatOutput1/Make/options
OpenFOAM-v2112/applications/test/flatOutput1/Make/options
+2
-0
OpenFOAM-v2112/applications/test/flatOutput1/Test-flatOuput1.C
...OAM-v2112/applications/test/flatOutput1/Test-flatOuput1.C
+103
-0
OpenFOAM-v2112/applications/test/foamCellZoneToVTK/Make/files
...FOAM-v2112/applications/test/foamCellZoneToVTK/Make/files
+3
-0
OpenFOAM-v2112/applications/test/foamCellZoneToVTK/Make/options
...AM-v2112/applications/test/foamCellZoneToVTK/Make/options
+7
-0
OpenFOAM-v2112/applications/test/foamCellZoneToVTK/foamCellZoneToVTK.C
...2/applications/test/foamCellZoneToVTK/foamCellZoneToVTK.C
+161
-0
OpenFOAM-v2112/applications/test/foamEnv/Make/files
OpenFOAM-v2112/applications/test/foamEnv/Make/files
+3
-0
OpenFOAM-v2112/applications/test/foamEnv/Make/options
OpenFOAM-v2112/applications/test/foamEnv/Make/options
+2
-0
OpenFOAM-v2112/applications/test/foamEnv/Test-foamEnv.C
OpenFOAM-v2112/applications/test/foamEnv/Test-foamEnv.C
+79
-0
OpenFOAM-v2112/applications/test/foamMeshToTet-vtk/Make/files
...FOAM-v2112/applications/test/foamMeshToTet-vtk/Make/files
+4
-0
OpenFOAM-v2112/applications/test/foamMeshToTet-vtk/Make/options
...AM-v2112/applications/test/foamMeshToTet-vtk/Make/options
+7
-0
OpenFOAM-v2112/applications/test/foamMeshToTet-vtk/foamMeshToTet-vtk.C
...2/applications/test/foamMeshToTet-vtk/foamMeshToTet-vtk.C
+96
-0
OpenFOAM-v2112/applications/test/foamMeshToTet-vtk/writeVTKtetMesh.C
...112/applications/test/foamMeshToTet-vtk/writeVTKtetMesh.C
+204
-0
OpenFOAM-v2112/applications/test/foamToMetisGraph/Make/files
OpenFOAM-v2112/applications/test/foamToMetisGraph/Make/files
+3
-0
OpenFOAM-v2112/applications/test/foamToMetisGraph/Make/options
...OAM-v2112/applications/test/foamToMetisGraph/Make/options
+2
-0
OpenFOAM-v2112/applications/test/foamToMetisGraph/foamToMetisGraph.C
...112/applications/test/foamToMetisGraph/foamToMetisGraph.C
+88
-0
OpenFOAM-v2112/applications/test/foamVersion/Make/files
OpenFOAM-v2112/applications/test/foamVersion/Make/files
+3
-0
OpenFOAM-v2112/applications/test/foamVersion/Make/options
OpenFOAM-v2112/applications/test/foamVersion/Make/options
+2
-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/findTimes/Make/options
0 → 100644
View file @
55e5a777
/* EXE_INC = -I$(LIB_SRC)/finiteVolume/lnInclude */
/* EXE_LIBS = -lfiniteVolume */
OpenFOAM-v2112/applications/test/findTimes/Test-findTimes.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-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/>.
Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "timeSelector.H"
using
namespace
Foam
;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
noParallel
();
// timeSelector::addOptions();
timeSelector
::
addOptions
(
true
,
true
);
#include "setRootCase.H"
#include "createTime.H"
Info
<<
"Times found:"
<<
runTime
.
times
()
<<
endl
;
instantList
timeDirs
=
timeSelector
::
select0
(
runTime
,
args
);
Info
<<
"Times selected:"
<<
timeDirs
<<
endl
;
Info
<<
"
\n
End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/flatOutput1/Make/files
0 → 100644
View file @
55e5a777
Test-flatOuput1.C
EXE = $(FOAM_USER_APPBIN)/Test-flatOuput1
OpenFOAM-v2112/applications/test/flatOutput1/Make/options
0 → 100644
View file @
55e5a777
/* EXE_INC = */
/* EXE_LIBS = */
OpenFOAM-v2112/applications/test/flatOutput1/Test-flatOuput1.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/>.
Description
Simple test of FlatOutput
\*---------------------------------------------------------------------------*/
#include "wordList.H"
#include "ListOps.H"
#include "FlatOutput.H"
#include "IOstreams.H"
#include "macros.H"
using
namespace
Foam
;
// For testing various pre-defined formatting
#define printFlatOutput(Content, Format) \
STRINGIFY(Format) << ": " << flatOutput(Content, FlatOutput::Format{})
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int
main
(
int
argc
,
char
*
argv
[])
{
wordList
words1
{
"ab"
,
"cd"
,
"ef"
,
"gh"
,
"ij"
,
"kl"
,
"mn"
,
"op"
,
"qr"
,
"st"
,
"uv"
,
"wx"
,
"yz"
};
{
Info
<<
nl
<<
"regular"
<<
nl
<<
"#----------------"
<<
nl
;
Info
<<
nl
<<
"operator<< "
<<
words1
<<
nl
;
Info
<<
nl
<<
"writeList: "
;
words1
.
writeList
(
Info
)
<<
nl
;
}
Info
<<
nl
<<
"Using c++ "
<<
int
(
__cplusplus
)
<<
nl
;
{
Info
<<
nl
<<
"flatOutput"
<<
nl
<<
"#----------------"
<<
nl
;
Info
<<
nl
<<
"operator<< "
<<
flatOutput
(
words1
)
<<
nl
;
Info
<<
nl
<<
"write: "
;
flatOutput
(
words1
).
write
(
Info
)
<<
nl
;
Info
<<
nl
<<
printFlatOutput
(
words1
,
BareComma
)
<<
nl
;
Info
<<
nl
<<
printFlatOutput
(
words1
,
BareSpace
)
<<
nl
;
Info
<<
nl
<<
printFlatOutput
(
words1
,
BraceComma
)
<<
nl
;
Info
<<
nl
<<
printFlatOutput
(
words1
,
BraceSpace
)
<<
nl
;
Info
<<
nl
<<
printFlatOutput
(
words1
,
ParenComma
)
<<
nl
;
Info
<<
nl
<<
printFlatOutput
(
words1
,
ParenSpace
)
<<
nl
;
Info
<<
nl
<<
printFlatOutput
(
words1
,
PointyComma
)
<<
nl
;
Info
<<
nl
<<
printFlatOutput
(
words1
,
PointySpace
)
<<
nl
;
Info
<<
nl
<<
printFlatOutput
(
words1
,
SquareComma
)
<<
nl
;
Info
<<
nl
<<
printFlatOutput
(
words1
,
SquareSpace
)
<<
nl
;
}
Info
<<
"
\n
End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/foamCellZoneToVTK/Make/files
0 → 100644
View file @
55e5a777
foamCellZoneToVTK.C
EXE = $(FOAM_USER_APPBIN)/foamCellZoneToVTK
OpenFOAM-v2112/applications/test/foamCellZoneToVTK/Make/options
0 → 100644
View file @
55e5a777
EXE_INC = \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfileFormats \
-lmeshTools
OpenFOAM-v2112/applications/test/foamCellZoneToVTK/foamCellZoneToVTK.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
foamCellZoneToVTK.C
Description
Write tet-decomposed OpenFOAM mesh in VTK format.
For diagnostic purposes.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "Time.H"
#include "polyMesh.H"
#include "foamVtkInternalMeshWriter.H"
using
namespace
Foam
;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addNote
(
"Write OpenFOAM cellZone mesh to VTK"
);
argList
::
addOption
(
"cellZone"
,
"name"
,
"Convert mesh subset corresponding to specified cellZone"
);
argList
::
addBoolOption
(
"list"
,
"List names of cellZones and exit"
);
timeSelector
::
addOptions
();
#include "setRootCase.H"
word
cellZoneName
;
args
.
readIfPresent
(
"cellZone"
,
cellZoneName
);
const
bool
optList
=
args
.
found
(
"list"
);
if
(
optList
)
{
if
(
!
cellZoneName
.
empty
())
{
Info
<<
"specify -list or -cellZone, but not both!"
<<
nl
;
return
1
;
}
}
else
if
(
cellZoneName
.
empty
())
{
Info
<<
"Did not specify a cellZone!!"
<<
nl
;
return
1
;
}
#include "createTime.H"
instantList
timeDirs
=
timeSelector
::
select0
(
runTime
,
args
);
fileName
exportName
(
"zonemesh-"
+
cellZoneName
);
#include "createPolyMesh.H"
forAll
(
timeDirs
,
timei
)
{
runTime
.
setTime
(
timeDirs
[
timei
],
timei
);
polyMesh
::
readUpdateState
state
=
mesh
.
readUpdate
();
if
(
!
timei
||
state
!=
polyMesh
::
UNCHANGED
)
{
fileName
meshName
(
exportName
);
if
(
state
!=
polyMesh
::
UNCHANGED
)
{
meshName
+=
'_'
+
runTime
.
timeName
();
}
if
(
optList
)
{
Info
<<
"cellZones:"
<<
nl
;
for
(
const
word
&
name
:
mesh
.
cellZones
().
names
())
{
Info
<<
" "
<<
name
<<
nl
;
}
}
else
{
const
cellZone
*
zonePtr
=
mesh
.
cellZones
().
cfindZone
(
cellZoneName
);
Info
<<
"cellZone "
<<
cellZoneName
;
if
(
!
zonePtr
)
{
Info
<<
" ... not found"
<<
nl
;
continue
;
}
Info
<<
nl
;
const
cellZone
&
zn
=
*
zonePtr
;
// Define a subset
vtk
::
vtuCells
vtuCells
;
vtuCells
.
reset
(
mesh
,
zn
);
vtk
::
internalMeshWriter
writer
(
mesh
,
vtuCells
,
fileName
(
mesh
.
time
().
globalPath
()
/
meshName
)
);
writer
.
writeGeometry
();
writer
.
beginCellData
();
writer
.
writeProcIDs
();
Info
<<
"Wrote "
<<
writer
.
output
().
name
()
<<
nl
;
}
}
}
Info
<<
"
\n
End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/foamEnv/Make/files
0 → 100644
View file @
55e5a777
Test-foamEnv.C
EXE = $(FOAM_USER_APPBIN)/Test-foamEnv
OpenFOAM-v2112/applications/test/foamEnv/Make/options
0 → 100644
View file @
55e5a777
/* EXE_INC = */
/* EXE_LIBS = */
OpenFOAM-v2112/applications/test/foamEnv/Test-foamEnv.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/>.
Application
Test-etcFiles
Description
Test etcFiles functionality.
Similar to foamEtcFile script, but automatically prunes nonexistent
directories from the list.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "OSspecific.H"
using
namespace
Foam
;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
noBanner
();
argList
::
noParallel
();
argList
::
noFunctionObjects
();
argList
::
removeOption
(
"case"
);
argList
::
addArgument
(
"env..."
);
argList
::
addNote
(
"Simple test/report OpenFOAM environment"
);
argList
args
(
argc
,
argv
,
false
,
true
);
for
(
int
argi
=
1
;
argi
<
args
.
size
();
++
argi
)
{
const
std
::
string
envName
(
args
[
argi
]);
if
(
hasEnv
(
envName
))
{
Info
<<
"Have env "
<<
envName
.
c_str
()
<<
"="
<<
getEnv
(
envName
)
<<
nl
;
}
else
{
Info
<<
"No env "
<<
envName
.
c_str
()
<<
nl
;
}
}
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/foamMeshToTet-vtk/Make/files
0 → 100644
View file @
55e5a777
foamMeshToTet-vtk.C
writeVTKtetMesh.C
EXE = $(FOAM_USER_APPBIN)/foamMeshToTet-vtk
OpenFOAM-v2112/applications/test/foamMeshToTet-vtk/Make/options
0 → 100644
View file @
55e5a777
EXE_INC = \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfileFormats \
-lmeshTools
OpenFOAM-v2112/applications/test/foamMeshToTet-vtk/foamMeshToTet-vtk.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
foamMeshToTet-vtk
Description
Write tet-decomposed OpenFOAM mesh in VTK format.
For diagnostic purposes.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "Time.H"
#include "polyMesh.H"
namespace
Foam
{
void
writeVTKtetMesh
(
const
fileName
&
output
,
const
polyMesh
&
mesh
);
}
using
namespace
Foam
;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addNote
(
"Write tet-decomposed OpenFOAM mesh in VTK"
);
argList
::
noParallel
();
timeSelector
::
addOptions
();
#include "setRootCase.H"
#include "createTime.H"
instantList
timeDirs
=
timeSelector
::
select0
(
runTime
,
args
);
fileName
exportName
=
"tetmesh"
;
if
(
args
.
found
(
"case"
))
{
exportName
+=
'-'
+
args
.
globalCaseName
();
}
#include "createPolyMesh.H"
forAll
(
timeDirs
,
timei
)
{
runTime
.
setTime
(
timeDirs
[
timei
],
timei
);
polyMesh
::
readUpdateState
state
=
mesh
.
readUpdate
();
if
(
!
timei
||
state
!=
polyMesh
::
UNCHANGED
)
{
fileName
meshName
(
exportName
);
if
(
state
!=
polyMesh
::
UNCHANGED
)
{
meshName
+=
'_'
+
runTime
.
timeName
();
}
writeVTKtetMesh
(
meshName
,
mesh
);
}
}
Info
<<
"
\n
End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/foamMeshToTet-vtk/writeVTKtetMesh.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/>.
\*---------------------------------------------------------------------------*/
#include "polyMesh.H"
#include "Fstream.H"
#include "tetMatcher.H"
#include "foamVtkInternalMeshWriter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
{
void
writeVTKtetMesh
(
const
fileName
&
output
,
const
polyMesh
&
mesh_
)
{
#if WM_LABEL_SIZE == 64
# define FOAM_VTK_LABEL_NAME "vtktypeint64"
#else
# define FOAM_VTK_LABEL_NAME "int"
#endif
const
faceList
&
faces
=
mesh_
.
faces
();
const
labelList
&
faceOwner
=
mesh_
.
faceOwner
();
label
nTets
=
0
;
for
(
label
facei
=
0
;
facei
<
mesh_
.
nInternalFaces
();
++
facei
)
{
nTets
+=
2
*
faces
[
facei
].
nTriangles
();
}
for
(
label
facei
=
mesh_
.
nInternalFaces
();
facei
<
mesh_
.
nFaces
();
++
facei
)
{
nTets
+=
faces
[
facei
].
nTriangles
();
}
const
label
nPoints
=
(
mesh_
.
nPoints
()
+
mesh_
.
nCells
());
OFstream
os
(
output
+
".vtk"
);
Info
<<
"Write: "
<<
os
.
name
()
<<
nl
;
os
<<
"# vtk DataFile Version 5.1"
<<
nl
<<
"tet-mesh"
<<
nl
<<
"ASCII"
<<
nl
<<
"DATASET UNSTRUCTURED_GRID"
<<
nl
<<
nl
;
os
<<
"POINTS "
<<
nPoints
<<
" float"
<<
nl
;
for
(
const
point
&
p
:
mesh_
.
points
())
{
os
<<
float
(
p
.
x
())
<<
' '
<<
float
(
p
.
y
())
<<
' '
<<
float
(
p
.
z
())
<<
nl
;
}
for
(
const
point
&
p
:
mesh_
.
cellCentres
())
{
os
<<
float
(
p
.
x
())
<<
' '
<<
float
(
p
.
y
())
<<
' '
<<
float
(
p
.
z
())
<<
nl
;
}
os
<<
nl
;
os
<<
"CELLS "
<<
(
1
+
nTets
)
<<
' '
<<
(
4
*
nTets
)
<<
nl
;
os
<<
"OFFSETS "
<<
FOAM_VTK_LABEL_NAME
<<
nl
<<
0
;
// begin offset = 0
{
label
offset
=
0
;
for
(
label
teti
=
0
;
teti
<
nTets
;
++
teti
)
{
offset
+=
4
;
os
<<
' '
<<
offset
;
}
os
<<
nl
<<
nl
;
}
labelList
nLocalTets
(
mesh_
.
nCells
(),
Zero
);
os
<<
nl
<<
"CONNECTIVITY "
<<
FOAM_VTK_LABEL_NAME
<<
nl
;
for
(
label
celli
=
0
;
celli
<
mesh_
.
nCells
();
++
celli
)
{
const
cell
&
cFaces
=
mesh_
.
cells
()[
celli
];
if
(
tetMatcher
::
test
(
mesh_
,
celli
))
{
// Tet: no cell-centre decomposition
const
label
facei
=
cFaces
[
0
];
const
face
&
f0
=
faces
[
facei
];
// Get the other point from f1. Tbd: check if not duplicate face
// (ACMI / ignoreBoundaryFaces_).
const
face
&
f1
=
faces
[
cFaces
[
1
]];
label
apexi
=
-
1
;
forAll
(
f1
,
fp
)
{
apexi
=
f1
[
fp
];
if
(
!
f0
.
found
(
apexi
))
{
break
;
}
}
const
label
p0
=
f0
[
0
];
label
p1
=
f0
[
1
];
label
p2
=
f0
[
2
];
if
(
faceOwner
[
facei
]
==
celli
)
{
std
::
swap
(
p1
,
p2
);
}
++
nLocalTets
[
celli
];
os
<<
p0
<<
' '
<<
p1
<<
' '
<<
p2
<<
' '
<<
apexi
<<
nl
;
}
else
{
for
(
const
label
facei
:
cFaces
)
{
const
face
&
f
=
faces
[
facei
];
label
fp0
=
mesh_
.
tetBasePtIs
()[
facei
];
// Fallback
if
(
fp0
<
0
)
{
fp0
=
0
;
}
const
label
p0
=
f
[
fp0
];
label
fp
=
f
.
fcIndex
(
fp0
);
for
(
label
i
=
2
;
i
<
f
.
size
();
++
i
)
{
label
p1
=
f
[
fp
];
fp
=
f
.
fcIndex
(
fp
);
label
p2
=
f
[
fp
];
if
(
faceOwner
[
facei
]
==
celli
)
{
std
::
swap
(
p1
,
p2
);
}
++
nLocalTets
[
celli
];
os
<<
p0
<<
' '
<<
p1
<<
' '
<<
p2
<<
' '
<<
(
mesh_
.
nPoints
()
+
celli
)
<<
nl
;
}
}
}
}
os
<<
nl
<<
"CELL_TYPES "
<<
nTets
<<
nl
;
for
(
label
teti
=
0
;
teti
<
nTets
;
++
teti
)
{
if
(
teti
)
os
<<
' '
;
os
<<
vtk
::
cellType
::
VTK_TETRA
;
}
os
<<
nl
;
os
<<
nl
<<
"CELL_DATA "
<<
nTets
<<
nl
<<
"FIELD FieldData "
<<
1
<<
nl
;
os
<<
"cellID "
<<
1
<<
' '
<<
nTets
<<
" int"
<<
nl
;
forAll
(
nLocalTets
,
celli
)
{
label
n
=
nLocalTets
[
celli
];
while
(
n
--
)
{
os
<<
' '
<<
celli
;
}
os
<<
nl
;
}
}
}
// End namespace Foam
// ************************************************************************* //
OpenFOAM-v2112/applications/test/foamToMetisGraph/Make/files
0 → 100644
View file @
55e5a777
foamToMetisGraph.C
EXE = $(FOAM_USER_APPBIN)/foamToMetisGraph
OpenFOAM-v2112/applications/test/foamToMetisGraph/Make/options
0 → 100644
View file @
55e5a777
/* EXE_INC = */
/* EXE_LIBS = */
OpenFOAM-v2112/applications/test/foamToMetisGraph/foamToMetisGraph.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 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
Create a metis graph file representation of an OpenFOAM mesh
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "polyMesh.H"
#include "OFstream.H"
using
namespace
Foam
;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
noParallel
();
argList
::
noFunctionObjects
();
argList
::
addNote
(
"Create a metis graph file representation for an OpenFOAM mesh"
);
#include "setRootCase.H"
#include "createTime.H"
#include "createPolyMesh.H"
const
labelListList
&
cellCells
=
mesh
.
cellCells
();
// No. of Nodes = nCells
// No. of Edges connecting Nodes = nInternalFaces
OFstream
os
(
args
.
caseName
()
+
".graph"
,
IOstream
::
ASCII
);
os
<<
"%% metis graph file, of an OpenFOAM mesh %%"
<<
nl
<<
"%% nCells="
<<
mesh
.
nCells
()
<<
" nFaces="
<<
mesh
.
nFaces
()
<<
" nInternalFaces="
<<
mesh
.
nInternalFaces
()
<<
nl
;
os
<<
cellCells
.
size
()
<<
" "
<<
mesh
.
nInternalFaces
()
<<
nl
;
for
(
const
auto
&
edges
:
cellCells
)
{
forAll
(
edges
,
i
)
{
if
(
i
)
os
<<
" "
;
os
<<
edges
[
i
]
+
1
;
// index starts at 1.
}
os
<<
nl
;
}
Info
<<
"Wrote graph with "
<<
mesh
.
nCells
()
<<
" nodes and "
<<
mesh
.
nInternalFaces
()
<<
" edges to "
<<
os
.
name
()
<<
nl
;
Info
<<
nl
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/foamVersion/Make/files
0 → 100644
View file @
55e5a777
Test-foamVersion.C
EXE = $(FOAM_USER_APPBIN)/Test-foamVersion
OpenFOAM-v2112/applications/test/foamVersion/Make/options
0 → 100644
View file @
55e5a777
/* EXE_INC = */
/* EXE_LIBS = */
Prev
1
…
26
27
28
29
30
31
32
33
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