Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
90a8332f
Commit
90a8332f
authored
Sep 05, 2013
by
mattijs
Browse files
ENH: foamToEnsight: add cellZone support
parent
1c930f94
Changes
5
Hide whitespace changes
Inline
Side-by-side
applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C
View file @
90a8332f
...
...
@@ -39,6 +39,31 @@ using namespace Foam;
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
template
<
class
Type
>
tmp
<
GeometricField
<
Type
,
fvPatchField
,
volMesh
>
>
volField
(
const
fvMeshSubset
&
meshSubsetter
,
const
GeometricField
<
Type
,
fvPatchField
,
volMesh
>&
vf
)
{
if
(
meshSubsetter
.
hasSubMesh
())
{
tmp
<
GeometricField
<
Type
,
fvPatchField
,
volMesh
>
>
tfld
(
meshSubsetter
.
interpolate
(
vf
)
);
tfld
().
checkOut
();
tfld
().
rename
(
vf
.
name
());
return
tfld
;
}
else
{
return
vf
;
}
}
template
<
class
Type
>
Field
<
Type
>
map
(
...
...
@@ -680,7 +705,7 @@ void ensightPointField
template
<
class
Type
>
void
ensightField
(
const
IOobject
&
fieldObject
,
const
GeometricField
<
Type
,
fvPatchField
,
volMesh
>&
vf
,
const
ensightMesh
&
eMesh
,
const
fileName
&
postProcPath
,
const
word
&
prepend
,
...
...
@@ -690,14 +715,11 @@ void ensightField
Ostream
&
ensightCaseFile
)
{
// Read field
GeometricField
<
Type
,
fvPatchField
,
volMesh
>
vf
(
fieldObject
,
eMesh
.
mesh
());
if
(
nodeValues
)
{
tmp
<
GeometricField
<
Type
,
pointPatchField
,
pointMesh
>
>
pfld
(
volPointInterpolation
::
New
(
eMesh
.
mesh
()).
interpolate
(
vf
)
volPointInterpolation
::
New
(
vf
.
mesh
()).
interpolate
(
vf
)
);
pfld
().
rename
(
vf
.
name
());
...
...
applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.H
View file @
90a8332f
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011
-2013
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -35,13 +35,24 @@ SourceFiles
#define ensightField_H
#include
"ensightMesh.H"
#include
"fvMeshSubset.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Wrapper to get hold of the field or the subsetted field
template
<
class
Type
>
Foam
::
tmp
<
Foam
::
GeometricField
<
Type
,
Foam
::
fvPatchField
,
Foam
::
volMesh
>
>
volField
(
const
Foam
::
fvMeshSubset
&
,
const
Foam
::
GeometricField
<
Type
,
Foam
::
fvPatchField
,
Foam
::
volMesh
>&
vf
);
template
<
class
Type
>
void
ensightField
(
const
Foam
::
IOobject
&
fieldObject
,
const
Foam
::
GeometricField
<
Type
,
Foam
::
fvPatchField
,
Foam
::
volMesh
>&
vf
,
const
Foam
::
ensightMesh
&
eMesh
,
const
Foam
::
fileName
&
postProcPath
,
const
Foam
::
word
&
prepend
,
...
...
applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C
View file @
90a8332f
...
...
@@ -57,14 +57,6 @@ void Foam::ensightMesh::correct()
nFaceZonePrims_
=
0
;
boundaryFaceToBeIncluded_
.
clear
();
const
cellShapeList
&
cellShapes
=
mesh_
.
cellShapes
();
const
cellModel
&
tet
=
*
(
cellModeller
::
lookup
(
"tet"
));
const
cellModel
&
pyr
=
*
(
cellModeller
::
lookup
(
"pyr"
));
const
cellModel
&
prism
=
*
(
cellModeller
::
lookup
(
"prism"
));
const
cellModel
&
wedge
=
*
(
cellModeller
::
lookup
(
"wedge"
));
const
cellModel
&
hex
=
*
(
cellModeller
::
lookup
(
"hex"
));
if
(
!
noPatches_
)
{
// Patches are output. Check that they're synced.
...
...
@@ -111,6 +103,16 @@ void Foam::ensightMesh::correct()
}
else
{
const
cellShapeList
&
cellShapes
=
mesh_
.
cellShapes
();
const
cellModel
&
tet
=
*
(
cellModeller
::
lookup
(
"tet"
));
const
cellModel
&
pyr
=
*
(
cellModeller
::
lookup
(
"pyr"
));
const
cellModel
&
prism
=
*
(
cellModeller
::
lookup
(
"prism"
));
const
cellModel
&
wedge
=
*
(
cellModeller
::
lookup
(
"wedge"
));
const
cellModel
&
hex
=
*
(
cellModeller
::
lookup
(
"hex"
));
// Count the shapes
labelList
&
tets
=
meshCellSets_
.
tets
;
labelList
&
pyrs
=
meshCellSets_
.
pyrs
;
...
...
@@ -926,8 +928,10 @@ void Foam::ensightMesh::writeAllNSided
}
void
Foam
::
ensightMesh
::
writeAll
Internal
Points
void
Foam
::
ensightMesh
::
writeAllPoints
(
const
label
ensightPartI
,
const
word
&
ensightPartName
,
const
pointField
&
uniquePoints
,
const
label
nPoints
,
ensightStream
&
ensightGeometryFile
...
...
@@ -937,49 +941,8 @@ void Foam::ensightMesh::writeAllInternalPoints
if
(
Pstream
::
master
())
{
ensightGeometryFile
.
writePartHeader
(
1
);
ensightGeometryFile
.
write
(
"internalMesh"
);
ensightGeometryFile
.
write
(
"coordinates"
);
ensightGeometryFile
.
write
(
nPoints
);
for
(
direction
d
=
0
;
d
<
vector
::
nComponents
;
d
++
)
{
ensightGeometryFile
.
write
(
uniquePoints
.
component
(
d
));
for
(
int
slave
=
1
;
slave
<
Pstream
::
nProcs
();
slave
++
)
{
IPstream
fromSlave
(
Pstream
::
scheduled
,
slave
);
scalarField
pointsComponent
(
fromSlave
);
ensightGeometryFile
.
write
(
pointsComponent
);
}
}
}
else
{
for
(
direction
d
=
0
;
d
<
vector
::
nComponents
;
d
++
)
{
OPstream
toMaster
(
Pstream
::
scheduled
,
Pstream
::
masterNo
());
toMaster
<<
uniquePoints
.
component
(
d
);
}
}
}
void
Foam
::
ensightMesh
::
writeAllPatchPoints
(
const
label
ensightPatchI
,
const
word
&
patchName
,
const
pointField
&
uniquePoints
,
const
label
nPoints
,
ensightStream
&
ensightGeometryFile
)
const
{
barrier
();
if
(
Pstream
::
master
())
{
ensightGeometryFile
.
writePartHeader
(
ensightPatchI
);
ensightGeometryFile
.
write
(
patchName
.
c_str
());
ensightGeometryFile
.
writePartHeader
(
ensightPartI
);
ensightGeometryFile
.
write
(
ensightPartName
.
c_str
());
ensightGeometryFile
.
write
(
"coordinates"
);
ensightGeometryFile
.
write
(
nPoints
);
...
...
@@ -998,11 +961,7 @@ void Foam::ensightMesh::writeAllPatchPoints
{
for
(
direction
d
=
0
;
d
<
vector
::
nComponents
;
d
++
)
{
OPstream
toMaster
(
Pstream
::
scheduled
,
Pstream
::
masterNo
()
);
OPstream
toMaster
(
Pstream
::
scheduled
,
Pstream
::
masterNo
());
toMaster
<<
uniquePoints
.
component
(
d
);
}
}
...
...
@@ -1076,8 +1035,10 @@ void Foam::ensightMesh::write
const
pointField
uniquePoints
(
mesh_
.
points
(),
uniquePointMap_
);
writeAll
Internal
Points
writeAllPoints
(
1
,
"internalMesh"
,
uniquePoints
,
nPoints
,
ensightGeometryFile
...
...
@@ -1166,7 +1127,7 @@ void Foam::ensightMesh::write
inplaceRenumber
(
pointToGlobal
,
patchFaces
[
i
]);
}
writeAllP
atchP
oints
writeAllPoints
(
ensightPatchI
++
,
patchName
,
...
...
@@ -1271,7 +1232,7 @@ void Foam::ensightMesh::write
inplaceRenumber
(
pointToGlobal
,
faceZoneMasterFaces
[
i
]);
}
writeAllP
atchP
oints
writeAllPoints
(
ensightPatchI
++
,
faceZoneName
,
...
...
applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.H
View file @
90a8332f
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-201
2
OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-201
3
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -244,17 +244,10 @@ private:
ensightStream
&
ensightGeometryFile
)
const
;
void
writeAll
Internal
Points
void
writeAllPoints
(
const
pointField
&
uniquePoints
,
const
label
nPoints
,
ensightStream
&
ensightGeometryFile
)
const
;
void
writeAllPatchPoints
(
label
ensightPatchI
,
const
word
&
patchName
,
const
label
ensightPartI
,
const
word
&
ensightPartName
,
const
pointField
&
uniquePoints
,
const
label
nPoints
,
ensightStream
&
ensightGeometryFile
...
...
applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C
View file @
90a8332f
...
...
@@ -46,6 +46,9 @@ Usage
\param -faceZones zoneList \n
Specify faceZones to write, with wildcards
\param -cellZone zoneName \n
Specify single cellZone to write (not lagrangian)
Note
Parallel support for cloud data is not supported
- writes to \a EnSight directory to avoid collisions with foamToEnsightParts
...
...
@@ -72,6 +75,9 @@ Note
#include
"fvc.H"
#include
"cellSet.H"
#include
"fvMeshSubset.H"
using
namespace
Foam
;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -128,6 +134,12 @@ int main(int argc, char *argv[])
"wordReList"
,
"specify faceZones to write - eg '( slice
\"
mfp-.*
\"
)'."
);
argList
::
addOption
(
"cellZone"
,
"word"
,
"specify cellZone to write"
);
#include
"setRootCase.H"
...
...
@@ -212,9 +224,28 @@ int main(int argc, char *argv[])
zonePatterns
=
wordReList
(
args
.
optionLookup
(
"faceZones"
)());
}
word
cellZoneName
;
const
bool
doCellZone
=
args
.
optionReadIfPresent
(
"cellZone"
,
cellZoneName
);
fvMeshSubset
meshSubsetter
(
mesh
);
if
(
doCellZone
)
{
Info
<<
"Converting cellZone "
<<
cellZoneName
<<
" only (puts outside faces into patch "
<<
mesh
.
boundaryMesh
()[
0
].
name
()
<<
")"
<<
endl
;
const
cellZone
&
cz
=
mesh
.
cellZones
()[
cellZoneName
];
cellSet
c0
(
mesh
,
"c0"
,
labelHashSet
(
cz
));
meshSubsetter
.
setLargeCellSubset
(
c0
,
0
);
}
ensightMesh
eMesh
(
mesh
,
(
meshSubsetter
.
hasSubMesh
()
?
meshSubsetter
.
subMesh
()
:
meshSubsetter
.
baseMesh
()
),
args
.
optionFound
(
"noPatches"
),
selectedPatches
,
patchPatterns
,
...
...
@@ -349,6 +380,17 @@ int main(int argc, char *argv[])
Info
<<
"Translating time = "
<<
runTime
.
timeName
()
<<
nl
;
polyMesh
::
readUpdateState
meshState
=
mesh
.
readUpdate
();
if
(
timeIndex
!=
0
&&
meshSubsetter
.
hasSubMesh
())
{
Info
<<
"Converting cellZone "
<<
cellZoneName
<<
" only (puts outside faces into patch "
<<
mesh
.
boundaryMesh
()[
0
].
name
()
<<
")"
<<
endl
;
const
cellZone
&
cz
=
mesh
.
cellZones
()[
cellZoneName
];
cellSet
c0
(
mesh
,
"c0"
,
labelHashSet
(
cz
));
meshSubsetter
.
setLargeCellSubset
(
c0
,
0
);
}
if
(
meshState
!=
polyMesh
::
UNCHANGED
)
{
...
...
@@ -406,9 +448,10 @@ int main(int argc, char *argv[])
if
(
volFieldTypes
[
i
]
==
volScalarField
::
typeName
)
{
volScalarField
vf
(
fieldObject
,
mesh
);
ensightField
<
scalar
>
(
fieldObject
,
volField
(
meshSubsetter
,
vf
)
,
eMesh
,
ensightDir
,
prepend
,
...
...
@@ -420,9 +463,10 @@ int main(int argc, char *argv[])
}
else
if
(
volFieldTypes
[
i
]
==
volVectorField
::
typeName
)
{
volVectorField
vf
(
fieldObject
,
mesh
);
ensightField
<
vector
>
(
fieldObject
,
volField
(
meshSubsetter
,
vf
)
,
eMesh
,
ensightDir
,
prepend
,
...
...
@@ -434,9 +478,10 @@ int main(int argc, char *argv[])
}
else
if
(
volFieldTypes
[
i
]
==
volSphericalTensorField
::
typeName
)
{
volSphericalTensorField
vf
(
fieldObject
,
mesh
);
ensightField
<
sphericalTensor
>
(
fieldObject
,
volField
(
meshSubsetter
,
vf
)
,
eMesh
,
ensightDir
,
prepend
,
...
...
@@ -448,9 +493,10 @@ int main(int argc, char *argv[])
}
else
if
(
volFieldTypes
[
i
]
==
volSymmTensorField
::
typeName
)
{
volSymmTensorField
vf
(
fieldObject
,
mesh
);
ensightField
<
symmTensor
>
(
fieldObject
,
volField
(
meshSubsetter
,
vf
)
,
eMesh
,
ensightDir
,
prepend
,
...
...
@@ -462,9 +508,10 @@ int main(int argc, char *argv[])
}
else
if
(
volFieldTypes
[
i
]
==
volTensorField
::
typeName
)
{
volTensorField
vf
(
fieldObject
,
mesh
);
ensightField
<
tensor
>
(
fieldObject
,
volField
(
meshSubsetter
,
vf
)
,
eMesh
,
ensightDir
,
prepend
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment