mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop
This commit is contained in:
3
applications/test/faces/Make/files
Normal file
3
applications/test/faces/Make/files
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Test-faces.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_USER_APPBIN)/Test-faces
|
||||||
0
applications/test/faces/Make/options
Normal file
0
applications/test/faces/Make/options
Normal file
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -21,54 +21,63 @@ License
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Application
|
||||||
|
Test-faces
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Template to write generalized field components
|
Simple tests for various faces
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "ensightParts.H"
|
#include "argList.H"
|
||||||
|
#include "labelledTri.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Main program:
|
||||||
|
|
||||||
template<class Type>
|
int main(int argc, char *argv[])
|
||||||
void Foam::ensightParts::writeField
|
|
||||||
(
|
|
||||||
ensightFile& os,
|
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& field
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
// find offset to patch parts (ie, the first face data)
|
face f1{ 1, 2, 3, 4 };
|
||||||
label patchOffset = 0;
|
Info<< "face:" << f1 << nl;
|
||||||
forAll(partsList_, partI)
|
|
||||||
{
|
|
||||||
if (partsList_[partI].isFaceData())
|
|
||||||
{
|
|
||||||
patchOffset = partI;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
forAll(partsList_, partI)
|
triFace t1{ 1, 2, 3 };
|
||||||
{
|
Info<< "triFace:" << t1 << nl;
|
||||||
label patchi = partI - patchOffset;
|
|
||||||
|
|
||||||
if (partsList_[partI].isCellData())
|
f1 = t1;
|
||||||
{
|
Info<< "face:" << f1 << nl;
|
||||||
partsList_[partI].writeField
|
|
||||||
(
|
f1 = t1.triFaceFace();
|
||||||
os,
|
Info<< "face:" << f1 << nl;
|
||||||
field
|
|
||||||
);
|
// expect these to fail
|
||||||
}
|
FatalError.throwExceptions();
|
||||||
else if (patchi < field.boundaryField().size())
|
try
|
||||||
{
|
{
|
||||||
partsList_[partI].writeField
|
labelledTri l1{ 1, 2, 3, 10, 24 };
|
||||||
(
|
Info<< "labelled:" << l1 << nl;
|
||||||
os,
|
|
||||||
field.boundaryField()[patchi]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
catch (Foam::error& err)
|
||||||
|
{
|
||||||
|
WarningInFunction
|
||||||
|
<< "Caught FatalError " << err << nl << endl;
|
||||||
|
}
|
||||||
|
FatalError.dontThrowExceptions();
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -34,6 +34,8 @@ Description
|
|||||||
#include "labelList.H"
|
#include "labelList.H"
|
||||||
#include "DynamicList.H"
|
#include "DynamicList.H"
|
||||||
#include "face.H"
|
#include "face.H"
|
||||||
|
#include "pointField.H"
|
||||||
|
#include "DynamicField.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -45,7 +47,10 @@ using namespace Foam;
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
List<label> lstA(10);
|
List<label> lstA(10);
|
||||||
List<label> lstC(IStringStream("(1 2 3 4)")());
|
List<label> lstC
|
||||||
|
{
|
||||||
|
1, 2, 3, 4
|
||||||
|
};
|
||||||
|
|
||||||
forAll(lstA, i)
|
forAll(lstA, i)
|
||||||
{
|
{
|
||||||
@ -128,6 +133,57 @@ int main(int argc, char *argv[])
|
|||||||
Info<< "f1: " << f1 << endl;
|
Info<< "f1: " << f1 << endl;
|
||||||
Info<< "f3: " << f3 << endl;
|
Info<< "f3: " << f3 << endl;
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
Info<<"\nTest xfer with fields:" << endl;
|
||||||
|
List<point> list1
|
||||||
|
{
|
||||||
|
{ 0, 1, 2 },
|
||||||
|
{ 3, 4, 5 },
|
||||||
|
{ 6, 7, 8 },
|
||||||
|
{ 9, 10, 11 },
|
||||||
|
};
|
||||||
|
|
||||||
|
// Field from Xfer<List>
|
||||||
|
pointField field1(list1.xfer());
|
||||||
|
Info<<nl
|
||||||
|
<< "xfer construct from List" << nl
|
||||||
|
<<"input (list) = " << list1 << nl
|
||||||
|
<<"output (field) = " << field1 << nl;
|
||||||
|
|
||||||
|
|
||||||
|
// Field from Xfer<List> ... again
|
||||||
|
pointField field2(field1.xfer());
|
||||||
|
Info<<nl
|
||||||
|
<<"xfer construct from Field (as List): " << nl
|
||||||
|
<<"input (field) = " << field1 << nl
|
||||||
|
<<"output (field) = " << field2 << nl;
|
||||||
|
|
||||||
|
|
||||||
|
// Field from Xfer<Field>
|
||||||
|
pointField field3(xferMove(field2));
|
||||||
|
Info<<nl
|
||||||
|
<<"xfer construct from Field (as Field): " << nl
|
||||||
|
<<"input (field) = " << field2 << nl
|
||||||
|
<<"output (field) = " << field3 << nl;
|
||||||
|
|
||||||
|
|
||||||
|
// Field from Xfer<Field> .. again
|
||||||
|
pointField field4(xferCopy(field3));
|
||||||
|
Info<<nl
|
||||||
|
<<"xfer copy construct from Field (as Field): " << nl
|
||||||
|
<<"input (field) = " << field3 << nl
|
||||||
|
<<"output (field) = " << field4 << nl;
|
||||||
|
|
||||||
|
|
||||||
|
DynamicField<point> dyfield1(xferCopy(field4));
|
||||||
|
Info<<nl
|
||||||
|
<<"xfer copy construct from Field (as Field): " << nl
|
||||||
|
<<"input (field) = " << field4 << nl
|
||||||
|
<<"output (dyn-field) = " << dyfield1 << nl;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@ cd ${0%/*} || exit 1 # Run from this directory
|
|||||||
|
|
||||||
# Parse arguments for compilation (at least for error catching)
|
# Parse arguments for compilation (at least for error catching)
|
||||||
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
||||||
|
|
||||||
# Get version info and arch-path
|
# Get version info and arch-path
|
||||||
. $WM_PROJECT_DIR/etc/config.sh/functions
|
. $WM_PROJECT_DIR/etc/config.sh/functions
|
||||||
_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ccmio)
|
_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ccmio)
|
||||||
|
|||||||
17
applications/utilities/mesh/conversion/ccm/Allwmake
Executable file
17
applications/utilities/mesh/conversion/ccm/Allwmake
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd ${0%/*} || exit 1 # Run from this directory
|
||||||
|
|
||||||
|
# Parse arguments for compilation (at least for error catching)
|
||||||
|
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
||||||
|
|
||||||
|
# Only build if libraries already exist
|
||||||
|
if [ -e $FOAM_LIBBIN/libccm.so ]
|
||||||
|
then
|
||||||
|
echo "Building optional ccm conversion components."
|
||||||
|
wmake $targetType ccmToFoam
|
||||||
|
wmake $targetType foamToCcm
|
||||||
|
else
|
||||||
|
echo "Skipping optional ccm conversion components (no libccm.so)."
|
||||||
|
fi
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
ccmToFoam.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/ccmToFoam
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/conversion/lnInclude \
|
||||||
|
-I$(LIB_SRC)/conversion/ccm/lnInclude \
|
||||||
|
-I$(LIB_SRC)/fileFormats/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-lgenericPatchFields \
|
||||||
|
-lmeshTools \
|
||||||
|
-lconversion -lccm
|
||||||
314
applications/utilities/mesh/conversion/ccm/ccmToFoam/ccmToFoam.C
Normal file
314
applications/utilities/mesh/conversion/ccm/ccmToFoam/ccmToFoam.C
Normal file
@ -0,0 +1,314 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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
|
||||||
|
ccmToFoam
|
||||||
|
|
||||||
|
Group
|
||||||
|
grpMeshConversionUtilities
|
||||||
|
|
||||||
|
Description
|
||||||
|
Reads CCM files as written by PROSTAR/STARCCM and writes an
|
||||||
|
OPENFOAM polyMesh.
|
||||||
|
|
||||||
|
Usage
|
||||||
|
\b ccmToFoam [OPTION] ccmMesh
|
||||||
|
|
||||||
|
Options:
|
||||||
|
- \par -ascii
|
||||||
|
Write in ASCII format instead of binary
|
||||||
|
|
||||||
|
- \par -export
|
||||||
|
re-export mesh in CCM format for post-processing
|
||||||
|
|
||||||
|
- \par -list
|
||||||
|
List some information about the geometry
|
||||||
|
|
||||||
|
- \par -name \<name\>
|
||||||
|
Provide alternative base name for export. Default is <tt>meshExport</tt>.
|
||||||
|
|
||||||
|
- \par -combine
|
||||||
|
Combine identically named patches
|
||||||
|
|
||||||
|
- \par -noBaffles
|
||||||
|
Remove any baffles by merging the faces.
|
||||||
|
|
||||||
|
- \par -merge
|
||||||
|
Merge in-place interfaces
|
||||||
|
|
||||||
|
- \par -numbered
|
||||||
|
Use numbered patch/zone (not names) directly from ccm ids.
|
||||||
|
|
||||||
|
- \par -remap \<name\>
|
||||||
|
use specified remapping dictionary instead of <tt>constant/remapping</tt>
|
||||||
|
|
||||||
|
- \par -scale \<factor\>
|
||||||
|
Specify an alternative geometry scaling factor.
|
||||||
|
The default is \b 1 (no scaling).
|
||||||
|
|
||||||
|
- \par -solids
|
||||||
|
Treat any solid cells present just like fluid cells.
|
||||||
|
The default is to remove them.
|
||||||
|
|
||||||
|
Note
|
||||||
|
- sub-domains (fluid | solid | porosity) are stored as separate domains
|
||||||
|
within the CCM file. These are merged together to form a single mesh.
|
||||||
|
- baffles are written as interfaces for later use
|
||||||
|
|
||||||
|
See also
|
||||||
|
Foam::ccm::reader for more information about the File Locations
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "ccm.H"
|
||||||
|
#include "regionSplit.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
argList::addNote
|
||||||
|
(
|
||||||
|
"Reads CCM files as written by PROSTAR/STARCCM and writes an"
|
||||||
|
" OPENFOAM polyMesh."
|
||||||
|
);
|
||||||
|
|
||||||
|
argList::noParallel();
|
||||||
|
argList::validArgs.append("ccmMesh");
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"ascii",
|
||||||
|
"write in ASCII format instead of binary"
|
||||||
|
);
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"export",
|
||||||
|
"re-export mesh in CCM format for post-processing"
|
||||||
|
);
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"list",
|
||||||
|
"list some information about the geometry"
|
||||||
|
);
|
||||||
|
argList::addOption
|
||||||
|
(
|
||||||
|
"remap",
|
||||||
|
"name",
|
||||||
|
"use specified remapping dictionary instead of <constant/remapping>"
|
||||||
|
);
|
||||||
|
argList::addOption
|
||||||
|
(
|
||||||
|
"name",
|
||||||
|
"name",
|
||||||
|
"provide alternative base name when re-exporting (implies -export). "
|
||||||
|
"Default is <meshExport>."
|
||||||
|
);
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"combine",
|
||||||
|
"combine identically named patches"
|
||||||
|
);
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"noBaffles",
|
||||||
|
"remove any baffles by merging the faces"
|
||||||
|
);
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"merge",
|
||||||
|
"merge in-place interfaces"
|
||||||
|
);
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"numbered",
|
||||||
|
"use numbered names (eg, patch_0, zone_0) only"
|
||||||
|
);
|
||||||
|
argList::addOption
|
||||||
|
(
|
||||||
|
"scale",
|
||||||
|
"scale",
|
||||||
|
"geometry scaling factor - default is 1 (ie, no scaling)"
|
||||||
|
);
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"withSolid",
|
||||||
|
"treat any solid cells present just like fluid cells. "
|
||||||
|
"the default is to remove them."
|
||||||
|
);
|
||||||
|
|
||||||
|
argList args(argc, argv);
|
||||||
|
Time runTime(args.rootPath(), args.caseName());
|
||||||
|
runTime.functionObjects().off();
|
||||||
|
|
||||||
|
const bool optList = args.optionFound("list");
|
||||||
|
|
||||||
|
// exportName only has a size when export is in effect
|
||||||
|
fileName exportName;
|
||||||
|
if (args.optionReadIfPresent("name", exportName))
|
||||||
|
{
|
||||||
|
const word ext = exportName.ext();
|
||||||
|
// strip erroneous extension (.ccm, .ccmg, .ccmp)
|
||||||
|
if (ext == "ccm" || ext == "ccmg" || ext == "ccmp")
|
||||||
|
{
|
||||||
|
exportName = exportName.lessExt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (args.optionFound("export"))
|
||||||
|
{
|
||||||
|
exportName = ccm::writer::defaultMeshName;
|
||||||
|
if (args.optionFound("case"))
|
||||||
|
{
|
||||||
|
exportName += '-' + args.globalCaseName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// By default, no scaling
|
||||||
|
const scalar scaleFactor = args.optionLookupOrDefault("scale", 1.0);
|
||||||
|
|
||||||
|
// Default to binary output, unless otherwise specified
|
||||||
|
const IOstream::streamFormat format =
|
||||||
|
(
|
||||||
|
args.optionFound("ascii")
|
||||||
|
? IOstream::ASCII
|
||||||
|
: IOstream::BINARY
|
||||||
|
);
|
||||||
|
|
||||||
|
// Increase the precision of the points data
|
||||||
|
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
|
||||||
|
|
||||||
|
|
||||||
|
// Read control options
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
ccm::reader::options rOpts;
|
||||||
|
rOpts.removeBaffles(args.optionFound("noBaffles"));
|
||||||
|
rOpts.mergeInterfaces(args.optionFound("merge"));
|
||||||
|
|
||||||
|
if (args.optionFound("numbered"))
|
||||||
|
{
|
||||||
|
rOpts.useNumberedNames(true);
|
||||||
|
}
|
||||||
|
else if (args.optionFound("combine"))
|
||||||
|
{
|
||||||
|
rOpts.combineBoundaries(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.optionFound("solids"))
|
||||||
|
{
|
||||||
|
Info<< "treating solids like fluids" << endl;
|
||||||
|
rOpts.keepSolid(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rOpts.keepSolid(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// CCM reader for reading geometry/solution
|
||||||
|
ccm::reader reader(args[1], rOpts);
|
||||||
|
|
||||||
|
// list the geometry information
|
||||||
|
if (optList)
|
||||||
|
{
|
||||||
|
Info<< "mesh geometry information:" << endl;
|
||||||
|
if (reader.hasGeometry())
|
||||||
|
{
|
||||||
|
Info<< nl << "cellTable:" << reader.cellTableInfo()
|
||||||
|
<< nl << "boundaryRegion:" << reader.boundaryTableInfo()
|
||||||
|
<< nl << "interfaces:" << reader.interfaceDefinitionsInfo()
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
args.optionFound("remap")
|
||||||
|
? reader.remapMeshInfo(runTime, args["remap"])
|
||||||
|
: reader.remapMeshInfo(runTime)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Info<< nl
|
||||||
|
<< "Remapped cellTable:" << reader.cellTableInfo() << nl
|
||||||
|
<< "Remapped boundaryRegion:" << reader.boundaryTableInfo()
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "NONE" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else if (reader.readGeometry(scaleFactor))
|
||||||
|
{
|
||||||
|
autoPtr<polyMesh> mesh =
|
||||||
|
(
|
||||||
|
args.optionFound("remap")
|
||||||
|
? reader.mesh(runTime, args["remap"])
|
||||||
|
: reader.mesh(runTime)
|
||||||
|
);
|
||||||
|
|
||||||
|
// report mesh bounding box information
|
||||||
|
Info<< nl << "Bounding box size: " << mesh().bounds().span() << nl;
|
||||||
|
|
||||||
|
// check number of regions
|
||||||
|
regionSplit rs(mesh);
|
||||||
|
|
||||||
|
Info<< "Number of regions: " << rs.nRegions();
|
||||||
|
if (rs.nRegions() == 1)
|
||||||
|
{
|
||||||
|
Info<< " (OK)." << nl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< nl << nl
|
||||||
|
<< "**************************************************" << nl
|
||||||
|
<< "** WARNING: the mesh has disconnected regions **" << nl
|
||||||
|
<< "**************************************************" << nl;
|
||||||
|
}
|
||||||
|
Info<< endl;
|
||||||
|
reader.writeMesh(mesh, format);
|
||||||
|
|
||||||
|
// exportName only has a size when export is in effect
|
||||||
|
if (exportName.size())
|
||||||
|
{
|
||||||
|
const fileName geomName = exportName + ".ccmg";
|
||||||
|
Info<< nl << "Re-exporting geometry as " << geomName << nl;
|
||||||
|
ccm::writer(geomName, mesh).writeGeometry();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorIn("ccmToFoam")
|
||||||
|
<< "could not read geometry"
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "\nEnd\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
foamToCcm.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/foamToCcm
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/conversion/lnInclude \
|
||||||
|
-I$(LIB_SRC)/conversion/ccm/lnInclude \
|
||||||
|
-I$(LIB_SRC)/fileFormats/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-lgenericPatchFields \
|
||||||
|
-lconversion -lccm
|
||||||
272
applications/utilities/mesh/conversion/ccm/foamToCcm/foamToCcm.C
Normal file
272
applications/utilities/mesh/conversion/ccm/foamToCcm/foamToCcm.C
Normal file
@ -0,0 +1,272 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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
|
||||||
|
foamToCcm
|
||||||
|
|
||||||
|
Group
|
||||||
|
grpMeshConversionUtilities
|
||||||
|
|
||||||
|
Description
|
||||||
|
Translates OPENFOAM mesh and/or results to CCM format
|
||||||
|
|
||||||
|
Usage
|
||||||
|
\b foamToCcm [OPTION]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
- \par -mesh
|
||||||
|
convert mesh only to CCM format
|
||||||
|
|
||||||
|
- \par -name \<name\>
|
||||||
|
Provide alternative base name. Default is <tt>meshExport</tt>.
|
||||||
|
|
||||||
|
- \par -overwrite
|
||||||
|
No backup of existing output files.
|
||||||
|
|
||||||
|
- \par -remap \<name\>
|
||||||
|
use specified remapping dictionary instead of <tt>constant/remapping</tt>
|
||||||
|
|
||||||
|
- \par -results
|
||||||
|
convert results only to CCM format
|
||||||
|
|
||||||
|
Note
|
||||||
|
- No parallel data
|
||||||
|
- No Lagrangian elements
|
||||||
|
- the -noZero time option can be useful to avoid the often incomplete
|
||||||
|
initial conditions (missing useful calculated values)
|
||||||
|
|
||||||
|
See also
|
||||||
|
Foam::ccm::writer for information about the
|
||||||
|
<tt>constant/remapping</tt> file.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "timeSelector.H"
|
||||||
|
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "OFstream.H"
|
||||||
|
#include "IOobjectList.H"
|
||||||
|
#include "scalarIOField.H"
|
||||||
|
#include "tensorIOField.H"
|
||||||
|
|
||||||
|
#include "ccm.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Main program:
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
argList::addNote
|
||||||
|
(
|
||||||
|
"Translate OPENFOAM data to CCM format"
|
||||||
|
);
|
||||||
|
|
||||||
|
Foam::timeSelector::addOptions();
|
||||||
|
argList::noParallel();
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"mesh",
|
||||||
|
"convert mesh only"
|
||||||
|
);
|
||||||
|
argList::addOption
|
||||||
|
(
|
||||||
|
"name",
|
||||||
|
"name",
|
||||||
|
"provide alternative base name. Default is <meshExport>."
|
||||||
|
);
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"overwrite",
|
||||||
|
"no backup of existing output files"
|
||||||
|
);
|
||||||
|
argList::addOption
|
||||||
|
(
|
||||||
|
"remap",
|
||||||
|
"name",
|
||||||
|
"use specified remapping dictionary instead of <constant/remapping>"
|
||||||
|
);
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"results",
|
||||||
|
"convert results only"
|
||||||
|
);
|
||||||
|
|
||||||
|
#include "setRootCase.H"
|
||||||
|
#include "createTime.H"
|
||||||
|
runTime.functionObjects().off();
|
||||||
|
|
||||||
|
// get times list
|
||||||
|
instantList timeDirs = Foam::timeSelector::select0(runTime, args);
|
||||||
|
|
||||||
|
const bool optMesh = args.optionFound("mesh");
|
||||||
|
const bool optResults = args.optionFound("results");
|
||||||
|
const bool optOverwrite = args.optionFound("overwrite");
|
||||||
|
|
||||||
|
fileName exportName = ccm::writer::defaultMeshName;
|
||||||
|
if (args.optionReadIfPresent("name", exportName))
|
||||||
|
{
|
||||||
|
const word ext = exportName.ext();
|
||||||
|
// strip erroneous extension (.ccm, .ccmg, .ccmp)
|
||||||
|
if (ext == "ccm" || ext == "ccmg" || ext == "ccmp")
|
||||||
|
{
|
||||||
|
exportName = exportName.lessExt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (args.optionFound("case"))
|
||||||
|
{
|
||||||
|
exportName += '-' + args.globalCaseName();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (optMesh && optResults)
|
||||||
|
{
|
||||||
|
Warning
|
||||||
|
<< "\n-mesh and -results options are mutually exclusive\n"
|
||||||
|
<< endl;
|
||||||
|
args.printUsage();
|
||||||
|
FatalError.exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// // skip over time=0, unless some other time option has been specified
|
||||||
|
// if
|
||||||
|
// (
|
||||||
|
// !args.optionFound("zeroTime")
|
||||||
|
// && !args.optionFound("time")
|
||||||
|
// && !args.optionFound("latestTime")
|
||||||
|
// && Times.size() > 2
|
||||||
|
// )
|
||||||
|
// {
|
||||||
|
// startTime = 2;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// runTime.setTime(Times[startTime], startTime);
|
||||||
|
|
||||||
|
runTime.setTime(timeDirs[0], 0);
|
||||||
|
if (optMesh)
|
||||||
|
{
|
||||||
|
// convert mesh only
|
||||||
|
#include "createPolyMesh.H"
|
||||||
|
|
||||||
|
forAll(timeDirs, timeI)
|
||||||
|
{
|
||||||
|
runTime.setTime(timeDirs[timeI], timeI);
|
||||||
|
|
||||||
|
#include "getTimeIndex.H"
|
||||||
|
|
||||||
|
if (timeI == 0)
|
||||||
|
{
|
||||||
|
ccm::writer writer
|
||||||
|
(
|
||||||
|
exportName + ".ccmg",
|
||||||
|
mesh,
|
||||||
|
!optOverwrite
|
||||||
|
);
|
||||||
|
writer.writeGeometry();
|
||||||
|
}
|
||||||
|
else if (mesh.moving())
|
||||||
|
{
|
||||||
|
ccm::writer writer
|
||||||
|
(
|
||||||
|
exportName + ".ccmg_" + timeName,
|
||||||
|
mesh,
|
||||||
|
!optOverwrite
|
||||||
|
);
|
||||||
|
writer.writeGeometry();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// convert fields with or without converting mesh
|
||||||
|
#include "createMesh.H"
|
||||||
|
|
||||||
|
// #include "checkHasMovingMesh.H"
|
||||||
|
// #include "checkHasLagrangian.H"
|
||||||
|
|
||||||
|
IOobjectList objects(mesh, timeDirs[timeDirs.size()-1].name());
|
||||||
|
// IOobjectList sprayObjects(mesh, Times[Times.size()-1].name(), "lagrangian");
|
||||||
|
|
||||||
|
forAll(timeDirs, timeI)
|
||||||
|
{
|
||||||
|
runTime.setTime(timeDirs[timeI], timeI);
|
||||||
|
|
||||||
|
#include "getTimeIndex.H"
|
||||||
|
|
||||||
|
Info<< "has "
|
||||||
|
<< mesh.nCells() << " cells, "
|
||||||
|
<< mesh.nPoints() << " points, "
|
||||||
|
<< mesh.boundaryMesh().size() << " patches"
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
if (!optResults)
|
||||||
|
{
|
||||||
|
if (timeI == 0)
|
||||||
|
{
|
||||||
|
ccm::writer writer
|
||||||
|
(
|
||||||
|
exportName + ".ccmg",
|
||||||
|
mesh,
|
||||||
|
!optOverwrite
|
||||||
|
);
|
||||||
|
writer.writeGeometry();
|
||||||
|
}
|
||||||
|
else if (mesh.moving())
|
||||||
|
{
|
||||||
|
ccm::writer writer
|
||||||
|
(
|
||||||
|
exportName + ".ccmg_" + timeName,
|
||||||
|
mesh,
|
||||||
|
!optOverwrite
|
||||||
|
);
|
||||||
|
writer.writeGeometry();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ccm::writer writer
|
||||||
|
(
|
||||||
|
exportName + ".ccmp_" + timeName,
|
||||||
|
mesh,
|
||||||
|
!optOverwrite
|
||||||
|
);
|
||||||
|
// writer.setTopologyFile(exportName + ".ccmg");
|
||||||
|
Info<< "writing solution:";
|
||||||
|
if (args.optionFound("remap"))
|
||||||
|
{
|
||||||
|
writer.writeSolution(objects, args["remap"]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
writer.writeSolution(objects);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "\nEnd\n" << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
// Read time index from */uniform/time, but treat 0 and constant specially
|
||||||
|
|
||||||
|
word timeName = "0";
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
runTime.timeName() != runTime.constant()
|
||||||
|
&& runTime.timeName() != "0"
|
||||||
|
)
|
||||||
|
{
|
||||||
|
IOobject io
|
||||||
|
(
|
||||||
|
"time",
|
||||||
|
runTime.timeName(),
|
||||||
|
"uniform",
|
||||||
|
runTime,
|
||||||
|
IOobject::READ_IF_PRESENT,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
if (io.typeHeaderOk<IOdictionary>(true))
|
||||||
|
{
|
||||||
|
IOdictionary timeObject
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"time",
|
||||||
|
runTime.timeName(),
|
||||||
|
"uniform",
|
||||||
|
runTime,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
label index;
|
||||||
|
timeObject.lookup("index") >> index;
|
||||||
|
timeName = Foam::name(index);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
timeName = runTime.timeName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "\nTime [" << timeName << "] = " << runTime.timeName() << nl;
|
||||||
|
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
fireToFoam.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/fireToFoam
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/conversion/lnInclude \
|
||||||
|
-I$(LIB_SRC)/fileFormats/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lconversion
|
||||||
123
applications/utilities/mesh/conversion/fireToFoam/fireToFoam.C
Normal file
123
applications/utilities/mesh/conversion/fireToFoam/fireToFoam.C
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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
|
||||||
|
fireToFoam
|
||||||
|
|
||||||
|
Group
|
||||||
|
grpMeshConversionUtilities
|
||||||
|
|
||||||
|
Description
|
||||||
|
Converts an AVL/FIRE polyhedral mesh to OPENFOAM
|
||||||
|
|
||||||
|
Usage
|
||||||
|
\b fireToFoam [OPTION] firePolyMesh
|
||||||
|
|
||||||
|
Options:
|
||||||
|
|
||||||
|
- \param -ascii
|
||||||
|
Write in ASCII format instead of binary
|
||||||
|
|
||||||
|
- \par -check
|
||||||
|
Perform edge checking
|
||||||
|
|
||||||
|
- \par -scale \<factor\>
|
||||||
|
Specify an alternative geometry scaling factor.
|
||||||
|
The default is \b 1 (no scaling).
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "FIREMeshReader.H"
|
||||||
|
#include "checkFireEdges.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
argList::addNote
|
||||||
|
(
|
||||||
|
"Convert AVL/FIRE polyhedral mesh to OPENFOAM format"
|
||||||
|
);
|
||||||
|
|
||||||
|
argList::noParallel();
|
||||||
|
argList::validArgs.append("firePolyMesh");
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"ascii",
|
||||||
|
"write in ASCII format instead of binary"
|
||||||
|
);
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"check",
|
||||||
|
"perform edge checking as well"
|
||||||
|
);
|
||||||
|
argList::addOption
|
||||||
|
(
|
||||||
|
"scale",
|
||||||
|
"scale",
|
||||||
|
"geometry scaling factor - default is 1 (no scaling)"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
argList args(argc, argv);
|
||||||
|
Time runTime(args.rootPath(), args.caseName());
|
||||||
|
|
||||||
|
|
||||||
|
// Binary output, unless otherwise specified
|
||||||
|
const IOstream::streamFormat format =
|
||||||
|
(
|
||||||
|
args.optionFound("ascii")
|
||||||
|
? IOstream::ASCII
|
||||||
|
: IOstream::BINARY
|
||||||
|
);
|
||||||
|
|
||||||
|
// increase the precision of the points data
|
||||||
|
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
|
||||||
|
|
||||||
|
|
||||||
|
fileFormats::FIREMeshReader reader
|
||||||
|
(
|
||||||
|
args[1],
|
||||||
|
// Default no scaling
|
||||||
|
args.optionLookupOrDefault("scale", 1.0)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
autoPtr<polyMesh> mesh = reader.mesh(runTime);
|
||||||
|
reader.writeMesh(mesh(), format);
|
||||||
|
|
||||||
|
|
||||||
|
if (args.optionFound("check"))
|
||||||
|
{
|
||||||
|
checkFireEdges(mesh());
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "\nEnd\n" << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
foamToFireMesh.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/foamToFireMesh
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/conversion/lnInclude \
|
||||||
|
-I$(LIB_SRC)/fileFormats/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lconversion
|
||||||
@ -0,0 +1,136 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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
|
||||||
|
foamToFireMesh
|
||||||
|
|
||||||
|
Description
|
||||||
|
Reads an OpenFOAM mesh and writes an AVL/FIRE fpma format
|
||||||
|
|
||||||
|
Usage
|
||||||
|
\b foamToFireMesh [OPTION]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
- \par -ascii
|
||||||
|
Write in ASCII format instead of binary
|
||||||
|
|
||||||
|
- \par -scale \<factor\>
|
||||||
|
Specify an alternative geometry scaling factor.
|
||||||
|
The default is \b 1 (ie, no scaling).
|
||||||
|
|
||||||
|
See also
|
||||||
|
Foam::cellTable, Foam::meshWriter and Foam::fileFormats::FIREMeshWriter
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "timeSelector.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "polyMesh.H"
|
||||||
|
#include "FIREMeshWriter.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Main program:
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
argList::addNote
|
||||||
|
(
|
||||||
|
"read OpenFOAM mesh and write an AVL/FIRE fpma format"
|
||||||
|
);
|
||||||
|
argList::noParallel();
|
||||||
|
timeSelector::addOptions();
|
||||||
|
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"ascii",
|
||||||
|
"write in ASCII format instead of binary"
|
||||||
|
);
|
||||||
|
argList::addOption
|
||||||
|
(
|
||||||
|
"scale",
|
||||||
|
"factor",
|
||||||
|
"geometry scaling factor - default is 1 (none)"
|
||||||
|
);
|
||||||
|
|
||||||
|
#include "setRootCase.H"
|
||||||
|
#include "createTime.H"
|
||||||
|
|
||||||
|
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||||
|
|
||||||
|
fileName exportName = meshWriter::defaultMeshName;
|
||||||
|
if (args.optionFound("case"))
|
||||||
|
{
|
||||||
|
exportName += '-' + args.globalCaseName();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// write control options
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
fileFormats::FIREMeshWriter::binary = !args.optionFound("ascii");
|
||||||
|
|
||||||
|
// default: rescale from [m] to [mm]
|
||||||
|
scalar scaleFactor = 1;
|
||||||
|
if (args.optionReadIfPresent("scale", scaleFactor))
|
||||||
|
{
|
||||||
|
if (scaleFactor <= 0)
|
||||||
|
{
|
||||||
|
scaleFactor = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "createPolyMesh.H"
|
||||||
|
|
||||||
|
forAll(timeDirs, timeI)
|
||||||
|
{
|
||||||
|
runTime.setTime(timeDirs[timeI], timeI);
|
||||||
|
|
||||||
|
#include "getTimeIndex.H"
|
||||||
|
|
||||||
|
polyMesh::readUpdateState state = mesh.readUpdate();
|
||||||
|
|
||||||
|
if (!timeI || state != polyMesh::UNCHANGED)
|
||||||
|
{
|
||||||
|
fileFormats::FIREMeshWriter writer(mesh, scaleFactor);
|
||||||
|
|
||||||
|
fileName meshName(exportName);
|
||||||
|
if (state != polyMesh::UNCHANGED)
|
||||||
|
{
|
||||||
|
meshName += '_' + runTime.timeName();
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.write(meshName);
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< nl << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
// Read time index from */uniform/time, but treat 0 and constant specially
|
||||||
|
|
||||||
|
word timeName = "0";
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
runTime.timeName() != runTime.constant()
|
||||||
|
&& runTime.timeName() != "0"
|
||||||
|
)
|
||||||
|
{
|
||||||
|
IOobject io
|
||||||
|
(
|
||||||
|
"time",
|
||||||
|
runTime.timeName(),
|
||||||
|
"uniform",
|
||||||
|
runTime,
|
||||||
|
IOobject::READ_IF_PRESENT,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
if (io.typeHeaderOk<IOdictionary>(true))
|
||||||
|
{
|
||||||
|
IOdictionary timeObject
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"time",
|
||||||
|
runTime.timeName(),
|
||||||
|
"uniform",
|
||||||
|
runTime,
|
||||||
|
IOobject::MUST_READ_IF_MODIFIED,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
label index;
|
||||||
|
timeObject.lookup("index") >> index;
|
||||||
|
timeName = Foam::name(index);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
timeName = runTime.timeName();
|
||||||
|
// Info<< "skip ... missing entry " << io.objectPath() << endl;
|
||||||
|
// continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "\nTime [" << timeName << "] = " << runTime.timeName() << nl;
|
||||||
|
|
||||||
@ -94,15 +94,9 @@ int main(int argc, char *argv[])
|
|||||||
exportName += '-' + args.globalCaseName();
|
exportName += '-' + args.globalCaseName();
|
||||||
}
|
}
|
||||||
|
|
||||||
// default: rescale from [m] to [mm]
|
// Default rescale from [m] to [mm]
|
||||||
scalar scaleFactor = 1000;
|
const scalar scaleFactor = args.optionLookupOrDefault("scale", 1000.0);
|
||||||
if (args.optionReadIfPresent("scale", scaleFactor))
|
const bool writeBndFile = !args.optionFound("noBnd");
|
||||||
{
|
|
||||||
if (scaleFactor <= 0)
|
|
||||||
{
|
|
||||||
scaleFactor = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "createPolyMesh.H"
|
#include "createPolyMesh.H"
|
||||||
|
|
||||||
@ -116,12 +110,12 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (!timeI || state != polyMesh::UNCHANGED)
|
if (!timeI || state != polyMesh::UNCHANGED)
|
||||||
{
|
{
|
||||||
fileFormats::STARCDMeshWriter writer(mesh, scaleFactor);
|
fileFormats::STARCDMeshWriter writer
|
||||||
|
(
|
||||||
if (args.optionFound("noBnd"))
|
mesh,
|
||||||
{
|
scaleFactor,
|
||||||
writer.noBoundary();
|
writeBndFile
|
||||||
}
|
);
|
||||||
|
|
||||||
fileName meshName(exportName);
|
fileName meshName(exportName);
|
||||||
if (state != polyMesh::UNCHANGED)
|
if (state != polyMesh::UNCHANGED)
|
||||||
|
|||||||
@ -48,7 +48,7 @@ Usage
|
|||||||
Note
|
Note
|
||||||
Baffles are written as interfaces for later use
|
Baffles are written as interfaces for later use
|
||||||
|
|
||||||
See Also
|
See also
|
||||||
Foam::cellTable, Foam::meshReader and Foam::fileFormats::STARCDMeshReader
|
Foam::cellTable, Foam::meshReader and Foam::fileFormats::STARCDMeshReader
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -88,32 +88,35 @@ int main(int argc, char *argv[])
|
|||||||
"retain solid cells and treat them like fluid cells"
|
"retain solid cells and treat them like fluid cells"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
argList args(argc, argv);
|
argList args(argc, argv);
|
||||||
Time runTime(args.rootPath(), args.caseName());
|
Time runTime(args.rootPath(), args.caseName());
|
||||||
|
|
||||||
// default rescale from [mm] to [m]
|
// Binary output, unless otherwise specified
|
||||||
scalar scaleFactor = args.optionLookupOrDefault("scale", 0.001);
|
const IOstream::streamFormat format =
|
||||||
if (scaleFactor <= 0)
|
(
|
||||||
{
|
args.optionFound("ascii")
|
||||||
scaleFactor = 1;
|
? IOstream::ASCII
|
||||||
}
|
: IOstream::BINARY
|
||||||
|
);
|
||||||
|
|
||||||
fileFormats::STARCDMeshReader::keepSolids = args.optionFound("solids");
|
// Increase the precision of the points data
|
||||||
|
|
||||||
// default to binary output, unless otherwise specified
|
|
||||||
IOstream::streamFormat format = IOstream::BINARY;
|
|
||||||
if (args.optionFound("ascii"))
|
|
||||||
{
|
|
||||||
format = IOstream::ASCII;
|
|
||||||
}
|
|
||||||
|
|
||||||
// increase the precision of the points data
|
|
||||||
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
|
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
|
||||||
|
|
||||||
// remove extensions and/or trailing '.'
|
|
||||||
|
// Remove extensions and/or trailing '.'
|
||||||
const fileName prefix = fileName(args[1]).lessExt();
|
const fileName prefix = fileName(args[1]).lessExt();
|
||||||
|
|
||||||
fileFormats::STARCDMeshReader reader(prefix, runTime, scaleFactor);
|
|
||||||
|
fileFormats::STARCDMeshReader reader
|
||||||
|
(
|
||||||
|
prefix,
|
||||||
|
runTime,
|
||||||
|
// Default rescale from [mm] to [m]
|
||||||
|
args.optionLookupOrDefault("scale", 0.001),
|
||||||
|
args.optionFound("solids")
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
autoPtr<polyMesh> mesh = reader.mesh(runTime);
|
autoPtr<polyMesh> mesh = reader.mesh(runTime);
|
||||||
reader.writeMesh(mesh, format);
|
reader.writeMesh(mesh, format);
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -785,7 +785,7 @@ int main(int argc, char *argv[])
|
|||||||
if (flipNormals)
|
if (flipNormals)
|
||||||
{
|
{
|
||||||
Info<< "Flipping faces." << nl << endl;
|
Info<< "Flipping faces." << nl << endl;
|
||||||
faceList& faces = const_cast<faceList&>(fMesh.faces());
|
faceList& faces = const_cast<faceList&>(fMesh.surfFaces());
|
||||||
forAll(faces, i)
|
forAll(faces, i)
|
||||||
{
|
{
|
||||||
faces[i] = fMesh[i].reverseFace();
|
faces[i] = fMesh[i].reverseFace();
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -172,7 +172,7 @@ void Foam::patchToPoly2DMesh::addPatchFacesToFaces()
|
|||||||
void Foam::patchToPoly2DMesh::addPatchFacesToOwner()
|
void Foam::patchToPoly2DMesh::addPatchFacesToOwner()
|
||||||
{
|
{
|
||||||
const label nInternalEdges = patch_.nInternalEdges();
|
const label nInternalEdges = patch_.nInternalEdges();
|
||||||
const faceList& faces = patch_.faces();
|
const faceList& faces = patch_.surfFaces();
|
||||||
const label nExternalEdges = patch_.edges().size() - nInternalEdges;
|
const label nExternalEdges = patch_.edges().size() - nInternalEdges;
|
||||||
const labelList& meshPoints = patch_.meshPoints();
|
const labelList& meshPoints = patch_.meshPoints();
|
||||||
|
|
||||||
|
|||||||
@ -4,8 +4,8 @@ cd ${0%/*} || exit 1 # Run from this directory
|
|||||||
# Parse arguments for library compilation
|
# Parse arguments for library compilation
|
||||||
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
||||||
|
|
||||||
if [ -d "$CGAL_ARCH_PATH/include/CGAL" ] || \
|
if [ -f "$CGAL_ARCH_PATH/include/CGAL/version.h" ] || \
|
||||||
[ "${CGAL_ARCH_PATH##*-}" = system -a -d /usr/include/CGAL ]
|
[ "${CGAL_ARCH_PATH##*-}" = system -a -f /usr/include/CGAL/version.h ]
|
||||||
then
|
then
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -289,8 +289,11 @@ Foam::tmp<Foam::triSurfacePointScalarField> Foam::automatic::load()
|
|||||||
(
|
(
|
||||||
surface_.searchableSurface::time().constant()/"triSurface",
|
surface_.searchableSurface::time().constant()/"triSurface",
|
||||||
surfaceName_.lessExt().name(),
|
surfaceName_.lessExt().name(),
|
||||||
surface_.points(),
|
meshedSurfRef
|
||||||
faces,
|
(
|
||||||
|
surface_.points(),
|
||||||
|
faces
|
||||||
|
),
|
||||||
"cellSize",
|
"cellSize",
|
||||||
pointCellSize,
|
pointCellSize,
|
||||||
true,
|
true,
|
||||||
|
|||||||
@ -232,7 +232,7 @@ Foam::shortEdgeFilter2D::filter()
|
|||||||
// These are global indices.
|
// These are global indices.
|
||||||
const pointField& points = ms_.points();
|
const pointField& points = ms_.points();
|
||||||
const edgeList& edges = ms_.edges();
|
const edgeList& edges = ms_.edges();
|
||||||
const faceList& faces = ms_.faces();
|
const faceList& faces = ms_.surfFaces();
|
||||||
const labelList& meshPoints = ms_.meshPoints();
|
const labelList& meshPoints = ms_.meshPoints();
|
||||||
const labelList& boundaryPoints = ms_.boundaryPoints();
|
const labelList& boundaryPoints = ms_.boundaryPoints();
|
||||||
|
|
||||||
|
|||||||
@ -20,23 +20,18 @@ snap true;
|
|||||||
addLayers false;
|
addLayers false;
|
||||||
|
|
||||||
|
|
||||||
//Optional: single region surfaces get patch names according to
|
// Optional: single region surfaces get patch names according to
|
||||||
// surface only. Multi-region surfaces get patch name
|
// surface only. Multi-region surfaces get patch name
|
||||||
// surface "_ "region. Default is true
|
// surface "_ "region. Default is true
|
||||||
//singleRegionName false;
|
// singleRegionName false;
|
||||||
|
|
||||||
// Optional: avoid patch-face merging. Allows mesh to be used for
|
// Optional: avoid patch-face merging. Allows mesh to be used for
|
||||||
// refinement/unrefinement
|
// refinement/unrefinement
|
||||||
//mergePatchFaces false; // default true
|
// mergePatchFaces false; // default true
|
||||||
|
|
||||||
// Optional: keep zero-sized patches. By default snappyHexMesh filters
|
// Optional: preserve all generated patches. Default is to remove
|
||||||
// these out.
|
|
||||||
//keepPatches true; // default false
|
|
||||||
|
|
||||||
|
|
||||||
//Optional: preserve all generated patches. Default is to remove
|
|
||||||
// zero-sized patches.
|
// zero-sized patches.
|
||||||
//keepPatches true;
|
// keepPatches true;
|
||||||
|
|
||||||
|
|
||||||
// Geometry. Definition of all surfaces. All surfaces are of class
|
// Geometry. Definition of all surfaces. All surfaces are of class
|
||||||
@ -138,8 +133,10 @@ castellatedMeshControls
|
|||||||
(
|
(
|
||||||
//{
|
//{
|
||||||
// file "someLine.eMesh";
|
// file "someLine.eMesh";
|
||||||
// //level 2;
|
// //level 2; // Have level 2 for all cells intersected
|
||||||
// levels ((0.0 2) (1.0 3));
|
// // by feature.
|
||||||
|
// levels ((0.1 2)); // Have level 2 for all cells within
|
||||||
|
// // 0.1 of feature.
|
||||||
//}
|
//}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -260,8 +257,11 @@ castellatedMeshControls
|
|||||||
// // that in small gaps we're getting more cells.
|
// // that in small gaps we're getting more cells.
|
||||||
// // The specification is
|
// // The specification is
|
||||||
// // - numGapCells : minimum number of cells in the gap
|
// // - numGapCells : minimum number of cells in the gap
|
||||||
|
// // (usually >3; lower than this might not
|
||||||
|
// // resolve correctly)
|
||||||
// // - minLevel : min refinement level at which to kick in
|
// // - minLevel : min refinement level at which to kick in
|
||||||
// // - maxLevel : upper refinement level
|
// // - maxLevel : upper refinement level (to avoid refinement
|
||||||
|
// // continuing on a single extraneous feature)
|
||||||
// // All three settings can be overridden on a surface by
|
// // All three settings can be overridden on a surface by
|
||||||
// // surface basis in the refinementSurfaces section.
|
// // surface basis in the refinementSurfaces section.
|
||||||
// gapLevel (<numGapCells> <minLevel> <maxlevel>);
|
// gapLevel (<numGapCells> <minLevel> <maxlevel>);
|
||||||
|
|||||||
@ -9,5 +9,4 @@ EXE_INC = \
|
|||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-lsampling \
|
-lsampling \
|
||||||
-lsurfMesh \
|
|
||||||
-ldynamicMesh
|
-ldynamicMesh
|
||||||
|
|||||||
@ -1019,8 +1019,11 @@ Foam::label Foam::checkGeometry
|
|||||||
(
|
(
|
||||||
"postProcessing",
|
"postProcessing",
|
||||||
"src_" + tmName,
|
"src_" + tmName,
|
||||||
mergedPoints,
|
meshedSurfRef
|
||||||
mergedFaces,
|
(
|
||||||
|
mergedPoints,
|
||||||
|
mergedFaces
|
||||||
|
),
|
||||||
"weightsSum",
|
"weightsSum",
|
||||||
mergedWeights,
|
mergedWeights,
|
||||||
false
|
false
|
||||||
@ -1066,8 +1069,11 @@ Foam::label Foam::checkGeometry
|
|||||||
(
|
(
|
||||||
"postProcessing",
|
"postProcessing",
|
||||||
"tgt_" + tmName,
|
"tgt_" + tmName,
|
||||||
mergedPoints,
|
meshedSurfRef
|
||||||
mergedFaces,
|
(
|
||||||
|
mergedPoints,
|
||||||
|
mergedFaces
|
||||||
|
),
|
||||||
"weightsSum",
|
"weightsSum",
|
||||||
mergedWeights,
|
mergedWeights,
|
||||||
false
|
false
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -42,6 +42,7 @@ License
|
|||||||
#include "globalIndex.H"
|
#include "globalIndex.H"
|
||||||
#include "PatchTools.H"
|
#include "PatchTools.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology)
|
void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology)
|
||||||
{
|
{
|
||||||
@ -238,7 +239,16 @@ void Foam::mergeAndWrite
|
|||||||
// Write
|
// Write
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
writer.write(outputDir, name, mergedPoints, mergedFaces);
|
writer.write
|
||||||
|
(
|
||||||
|
outputDir,
|
||||||
|
name,
|
||||||
|
meshedSurfRef
|
||||||
|
(
|
||||||
|
mergedPoints,
|
||||||
|
mergedFaces
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -247,8 +257,11 @@ void Foam::mergeAndWrite
|
|||||||
(
|
(
|
||||||
outputDir,
|
outputDir,
|
||||||
name,
|
name,
|
||||||
setPatch.localPoints(),
|
meshedSurfRef
|
||||||
setPatch.localFaces()
|
(
|
||||||
|
setPatch.localPoints(),
|
||||||
|
setPatch.localFaces()
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -30,6 +30,7 @@ License
|
|||||||
#include "polyAddPoint.H"
|
#include "polyAddPoint.H"
|
||||||
#include "polyAddCell.H"
|
#include "polyAddCell.H"
|
||||||
#include "polyAddFace.H"
|
#include "polyAddFace.H"
|
||||||
|
#include "processorPolyPatch.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -104,11 +105,11 @@ Foam::label Foam::mergePolyMesh::zoneIndex
|
|||||||
const word& curName
|
const word& curName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
forAll(names, zoneI)
|
forAll(names, zonei)
|
||||||
{
|
{
|
||||||
if (names[zoneI] == curName)
|
if (names[zonei] == curName)
|
||||||
{
|
{
|
||||||
return zoneI;
|
return zonei;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,6 +120,84 @@ Foam::label Foam::mergePolyMesh::zoneIndex
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::mergePolyMesh::sortProcessorPatches()
|
||||||
|
{
|
||||||
|
Info<< "Reordering processor patches last" << endl;
|
||||||
|
|
||||||
|
// Updates boundaryMesh() and meshMod_ to guarantee processor patches
|
||||||
|
// are last. This could be done inside the merge() but it is far easier
|
||||||
|
// to do separately.
|
||||||
|
|
||||||
|
|
||||||
|
// 1. Shuffle the patches in the boundaryMesh
|
||||||
|
|
||||||
|
const polyBoundaryMesh& oldPatches = boundaryMesh();
|
||||||
|
|
||||||
|
DynamicList<polyPatch*> newPatches(oldPatches.size());
|
||||||
|
|
||||||
|
labelList oldToSorted(oldPatches.size());
|
||||||
|
|
||||||
|
forAll(oldPatches, patchi)
|
||||||
|
{
|
||||||
|
const polyPatch& pp = oldPatches[patchi];
|
||||||
|
|
||||||
|
if (!isA<processorPolyPatch>(pp))
|
||||||
|
{
|
||||||
|
oldToSorted[patchi] = newPatches.size();
|
||||||
|
newPatches.append
|
||||||
|
(
|
||||||
|
pp.clone
|
||||||
|
(
|
||||||
|
oldPatches,
|
||||||
|
oldToSorted[patchi],
|
||||||
|
0,
|
||||||
|
nInternalFaces()
|
||||||
|
).ptr()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
forAll(oldPatches, patchi)
|
||||||
|
{
|
||||||
|
const polyPatch& pp = oldPatches[patchi];
|
||||||
|
|
||||||
|
if (isA<processorPolyPatch>(pp))
|
||||||
|
{
|
||||||
|
oldToSorted[patchi] = newPatches.size();
|
||||||
|
newPatches.append
|
||||||
|
(
|
||||||
|
pp.clone
|
||||||
|
(
|
||||||
|
oldPatches,
|
||||||
|
oldToSorted[patchi],
|
||||||
|
0,
|
||||||
|
nInternalFaces()
|
||||||
|
).ptr()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
removeBoundary();
|
||||||
|
addPatches(newPatches);
|
||||||
|
|
||||||
|
|
||||||
|
// Update the polyTopoChange
|
||||||
|
DynamicList<label>& patchID = const_cast<DynamicList<label>&>
|
||||||
|
(
|
||||||
|
meshMod_.region()
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(patchID, facei)
|
||||||
|
{
|
||||||
|
label patchi = patchID[facei];
|
||||||
|
if (patchi != -1)
|
||||||
|
{
|
||||||
|
patchID[facei] = oldToSorted[patchID[facei]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::mergePolyMesh::mergePolyMesh(const IOobject& io)
|
Foam::mergePolyMesh::mergePolyMesh(const IOobject& io)
|
||||||
@ -183,9 +262,6 @@ Foam::mergePolyMesh::mergePolyMesh(const IOobject& io)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::mergePolyMesh::addMesh(const polyMesh& m)
|
void Foam::mergePolyMesh::addMesh(const polyMesh& m)
|
||||||
@ -506,6 +582,10 @@ void Foam::mergePolyMesh::merge()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Shuffle the processor patches to be last
|
||||||
|
sortProcessorPatches();
|
||||||
|
|
||||||
// Change mesh. No inflation
|
// Change mesh. No inflation
|
||||||
meshMod_.changeMesh(*this, false);
|
meshMod_.changeMesh(*this, false);
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -89,6 +89,9 @@ class mergePolyMesh
|
|||||||
//- Return zone index given a list of active zones and a name
|
//- Return zone index given a list of active zones and a name
|
||||||
label zoneIndex(DynamicList<word>&, const word&);
|
label zoneIndex(DynamicList<word>&, const word&);
|
||||||
|
|
||||||
|
//- Shuffle processor patches to be last
|
||||||
|
void sortProcessorPatches();
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
|
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/sampling/lnInclude \
|
-I$(LIB_SRC)/sampling/lnInclude \
|
||||||
|
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -95,8 +95,11 @@ void writeWeights
|
|||||||
(
|
(
|
||||||
directory,
|
directory,
|
||||||
prefix + "_" + timeName,
|
prefix + "_" + timeName,
|
||||||
mergedPoints,
|
meshedSurfRef
|
||||||
mergedFaces,
|
(
|
||||||
|
mergedPoints,
|
||||||
|
mergedFaces
|
||||||
|
),
|
||||||
"weightsSum",
|
"weightsSum",
|
||||||
mergedWeights,
|
mergedWeights,
|
||||||
false
|
false
|
||||||
|
|||||||
@ -3,7 +3,6 @@ cd ${0%/*} || exit 1 # Run from this directory
|
|||||||
|
|
||||||
# Parse arguments for compilation (at least for error catching)
|
# Parse arguments for compilation (at least for error catching)
|
||||||
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
||||||
set -x
|
|
||||||
|
|
||||||
export COMPILE_FLAGS=''
|
export COMPILE_FLAGS=''
|
||||||
export LINK_FLAGS=''
|
export LINK_FLAGS=''
|
||||||
@ -21,6 +20,7 @@ then
|
|||||||
export LINK_FLAGS="${LINK_FLAGS} -lzoltanRenumber -L${ZOLTAN_ARCH_PATH}/lib -lzoltan"
|
export LINK_FLAGS="${LINK_FLAGS} -lzoltanRenumber -L${ZOLTAN_ARCH_PATH}/lib -lzoltan"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
set -x
|
||||||
wmake $targetType
|
wmake $targetType
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
ensightMesh.C
|
ensightOutputCloud.C
|
||||||
ensightCloud.C
|
|
||||||
foamToEnsight.C
|
foamToEnsight.C
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/foamToEnsight
|
EXE = $(FOAM_APPBIN)/foamToEnsight
|
||||||
|
|||||||
@ -3,14 +3,12 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||||
-I$(LIB_SRC)/sampling/lnInclude \
|
|
||||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/conversion/lnInclude
|
-I$(LIB_SRC)/conversion/lnInclude
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-ldynamicMesh \
|
-ldynamicMesh \
|
||||||
-lfileFormats \
|
-lfileFormats \
|
||||||
-lsampling \
|
|
||||||
-lgenericPatchFields \
|
-lgenericPatchFields \
|
||||||
-llagrangian \
|
-llagrangian \
|
||||||
-lconversion
|
-lconversion
|
||||||
|
|||||||
@ -38,8 +38,7 @@ if (timeDirs.size() > 1 && Pstream::master())
|
|||||||
|
|
||||||
if (meshMoving)
|
if (meshMoving)
|
||||||
{
|
{
|
||||||
Info<< "found." << nl
|
Info<< "found. Writing meshes for every timestep." << endl;
|
||||||
<< " Writing meshes for every timestep." << endl;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,153 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation | Copyright (C) 2016 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::ensightAsciiStream
|
|
||||||
|
|
||||||
Description
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
ensightAsciiStream.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef ensightAsciiStream_H
|
|
||||||
#define ensightAsciiStream_H
|
|
||||||
|
|
||||||
#include "ensightStream.H"
|
|
||||||
#include "OFstream.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class ensightAsciiStream Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
class ensightAsciiStream
|
|
||||||
:
|
|
||||||
public ensightStream
|
|
||||||
{
|
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- Output file stream
|
|
||||||
OFstream str_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
|
||||||
ensightAsciiStream(const ensightAsciiStream&) = delete;
|
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
|
||||||
void operator=(const ensightAsciiStream&) = delete;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct from components
|
|
||||||
ensightAsciiStream(const fileName& f)
|
|
||||||
:
|
|
||||||
ensightStream(f),
|
|
||||||
str_
|
|
||||||
(
|
|
||||||
f,
|
|
||||||
IOstream::ASCII,
|
|
||||||
IOstream::currentVersion,
|
|
||||||
IOstream::UNCOMPRESSED
|
|
||||||
)
|
|
||||||
{
|
|
||||||
|
|
||||||
str_.setf(ios_base::scientific, ios_base::floatfield);
|
|
||||||
str_.precision(5);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
|
||||||
virtual ~ensightAsciiStream()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
|
||||||
|
|
||||||
virtual bool ascii() const
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void write(const char* c)
|
|
||||||
{
|
|
||||||
str_ << c << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void write(const int v)
|
|
||||||
{
|
|
||||||
str_ << setw(10) << v << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void write(const scalarField& sf)
|
|
||||||
{
|
|
||||||
forAll(sf, i)
|
|
||||||
{
|
|
||||||
if (mag(sf[i]) >= scalar(floatScalarVSMALL))
|
|
||||||
{
|
|
||||||
str_ << setw(12) << sf[i] << nl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
str_ << setw(12) << scalar(0) << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void write(const List<int>& sf)
|
|
||||||
{
|
|
||||||
forAll(sf, i)
|
|
||||||
{
|
|
||||||
str_ << setw(10) << sf[i];
|
|
||||||
}
|
|
||||||
str_<< nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void writePartHeader(const label partI)
|
|
||||||
{
|
|
||||||
str_<< "part" << nl
|
|
||||||
<< setw(10) << partI << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,150 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation | Copyright (C) 2016 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::ensightBinaryStream
|
|
||||||
|
|
||||||
Description
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
ensightBinaryStream.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef ensightBinaryStream_H
|
|
||||||
#define ensightBinaryStream_H
|
|
||||||
|
|
||||||
#include "ensightStream.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class ensightBinaryStream Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
class ensightBinaryStream
|
|
||||||
:
|
|
||||||
public ensightStream
|
|
||||||
{
|
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- Output file stream
|
|
||||||
autoPtr<std::ofstream> str_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
|
||||||
ensightBinaryStream(const ensightBinaryStream&) = delete;
|
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
|
||||||
void operator=(const ensightBinaryStream&) = delete;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct from components
|
|
||||||
ensightBinaryStream(const fileName& f)
|
|
||||||
:
|
|
||||||
ensightStream(f),
|
|
||||||
str_
|
|
||||||
(
|
|
||||||
new std::ofstream
|
|
||||||
(
|
|
||||||
f.c_str(),
|
|
||||||
ios_base::out | ios_base::binary | ios_base::trunc
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
|
||||||
virtual ~ensightBinaryStream()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
|
||||||
|
|
||||||
virtual void write(const char* val)
|
|
||||||
{
|
|
||||||
char buffer[80];
|
|
||||||
strncpy(buffer, val, 80);
|
|
||||||
str_().write(buffer, 80*sizeof(char));
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void write(const int val)
|
|
||||||
{
|
|
||||||
str_().write(reinterpret_cast<const char*>(&val), sizeof(int));
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void write(const scalarField& sf)
|
|
||||||
{
|
|
||||||
if (sf.size())
|
|
||||||
{
|
|
||||||
List<float> temp(sf.size());
|
|
||||||
|
|
||||||
forAll(sf, i)
|
|
||||||
{
|
|
||||||
temp[i] = float(sf[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
str_().write
|
|
||||||
(
|
|
||||||
reinterpret_cast<const char*>(temp.begin()),
|
|
||||||
sf.size()*sizeof(float)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void write(const List<int>& sf)
|
|
||||||
{
|
|
||||||
str_().write
|
|
||||||
(
|
|
||||||
reinterpret_cast<const char*>(sf.begin()),
|
|
||||||
sf.size()*sizeof(int)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void writePartHeader(const label partI)
|
|
||||||
{
|
|
||||||
write("part");
|
|
||||||
write(partI);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,33 +0,0 @@
|
|||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
ensightCaseFile.setf(ios_base::scientific, ios_base::floatfield);
|
|
||||||
ensightCaseFile.precision(5);
|
|
||||||
|
|
||||||
ensightCaseFile << nl << "TIME" << nl
|
|
||||||
<< "time set: " << 1 << nl
|
|
||||||
<< "number of steps: " << nTimeSteps << nl
|
|
||||||
<< "filename start number: " << 0 << nl
|
|
||||||
<< "filename increment: " << 1 << nl;
|
|
||||||
|
|
||||||
ensightCaseFile << "time values:" << nl;
|
|
||||||
|
|
||||||
label count = 0;
|
|
||||||
scalar Tcorr = 0.0;
|
|
||||||
if (timeDirs[0].value() < 0)
|
|
||||||
{
|
|
||||||
Tcorr = -timeDirs[0].value();
|
|
||||||
Info<< "Correcting time values. Adding " << Tcorr << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
forAll(timeDirs, n)
|
|
||||||
{
|
|
||||||
ensightCaseFile << setw(12) << timeDirs[n].value() + Tcorr << " ";
|
|
||||||
|
|
||||||
if (++count % 6 == 0)
|
|
||||||
{
|
|
||||||
ensightCaseFile << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ensightCaseFile << nl;
|
|
||||||
}
|
|
||||||
@ -1,816 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation | Copyright (C) 2016 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 "ensightFile.H"
|
|
||||||
#include "ensightField.H"
|
|
||||||
#include "fvMesh.H"
|
|
||||||
#include "volFields.H"
|
|
||||||
#include "OFstream.H"
|
|
||||||
#include "IOmanip.H"
|
|
||||||
#include "volPointInterpolation.H"
|
|
||||||
#include "ensightBinaryStream.H"
|
|
||||||
#include "ensightAsciiStream.H"
|
|
||||||
#include "globalIndex.H"
|
|
||||||
#include "ensightPTraits.H"
|
|
||||||
#include "zeroGradientFvPatchField.H"
|
|
||||||
|
|
||||||
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.ref().checkOut();
|
|
||||||
tfld.ref().rename(vf.name());
|
|
||||||
return tfld;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return vf;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
tmp<GeometricField<Type, fvPatchField, volMesh>>
|
|
||||||
volField
|
|
||||||
(
|
|
||||||
const fvMeshSubset& meshSubsetter,
|
|
||||||
const typename GeometricField<Type, fvPatchField, volMesh>::Internal& df
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// Construct volField (with zeroGradient) from dimensioned field
|
|
||||||
|
|
||||||
IOobject io(df);
|
|
||||||
io.readOpt() = IOobject::NO_READ;
|
|
||||||
io.writeOpt() = IOobject::NO_WRITE;
|
|
||||||
io.registerObject() = false;
|
|
||||||
|
|
||||||
tmp<GeometricField<Type, fvPatchField, volMesh>> tvf
|
|
||||||
(
|
|
||||||
new GeometricField<Type, fvPatchField, volMesh>
|
|
||||||
(
|
|
||||||
io,
|
|
||||||
df.mesh(),
|
|
||||||
dimensioned<Type>("0", df.dimensions(), Zero),
|
|
||||||
zeroGradientFvPatchField<Type>::typeName
|
|
||||||
)
|
|
||||||
);
|
|
||||||
tvf.ref().primitiveFieldRef() = df;
|
|
||||||
tvf.ref().correctBoundaryConditions();
|
|
||||||
|
|
||||||
if (meshSubsetter.hasSubMesh())
|
|
||||||
{
|
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& vf = tvf();
|
|
||||||
|
|
||||||
tmp<GeometricField<Type, fvPatchField, volMesh>> tfld
|
|
||||||
(
|
|
||||||
meshSubsetter.interpolate(vf)
|
|
||||||
);
|
|
||||||
tfld.ref().checkOut();
|
|
||||||
tfld.ref().rename(vf.name());
|
|
||||||
return tfld;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return tvf;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//template<class Container>
|
|
||||||
//void readAndConvertField
|
|
||||||
//(
|
|
||||||
// const fvMeshSubset& meshSubsetter,
|
|
||||||
// const IOobject& io,
|
|
||||||
// const fvMesh& mesh,
|
|
||||||
// const ensightMesh& eMesh,
|
|
||||||
// const fileName& dataDir,
|
|
||||||
// const label timeIndex,
|
|
||||||
// const bool nodeValues,
|
|
||||||
// Ostream& ensightCaseFile
|
|
||||||
//)
|
|
||||||
//{
|
|
||||||
// Container fld(io, mesh);
|
|
||||||
// ensightField<typename Container::value_type>
|
|
||||||
// (
|
|
||||||
// volField<typename Container::value_type>(meshSubsetter, fld),
|
|
||||||
// eMesh,
|
|
||||||
// dataDir,
|
|
||||||
// timeIndex,
|
|
||||||
// nodeValues,
|
|
||||||
// ensightCaseFile
|
|
||||||
// );
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Field<Type> map
|
|
||||||
(
|
|
||||||
const Field<Type>& vf,
|
|
||||||
const labelList& map1,
|
|
||||||
const labelList& map2
|
|
||||||
)
|
|
||||||
{
|
|
||||||
Field<Type> mf(map1.size() + map2.size());
|
|
||||||
|
|
||||||
forAll(map1, i)
|
|
||||||
{
|
|
||||||
mf[i] = vf[map1[i]];
|
|
||||||
}
|
|
||||||
|
|
||||||
label offset = map1.size();
|
|
||||||
|
|
||||||
forAll(map2, i)
|
|
||||||
{
|
|
||||||
mf[i + offset] = vf[map2[i]];
|
|
||||||
}
|
|
||||||
|
|
||||||
return mf;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void writeField
|
|
||||||
(
|
|
||||||
const char* key,
|
|
||||||
const Field<Type>& vf,
|
|
||||||
ensightStream& os
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (returnReduce(vf.size(), sumOp<label>()) > 0)
|
|
||||||
{
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
os.write(key);
|
|
||||||
|
|
||||||
for (direction i=0; i < pTraits<Type>::nComponents; ++i)
|
|
||||||
{
|
|
||||||
label cmpt = ensightPTraits<Type>::componentOrder[i];
|
|
||||||
|
|
||||||
os.write(vf.component(cmpt));
|
|
||||||
|
|
||||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
|
||||||
{
|
|
||||||
IPstream fromSlave(Pstream::scheduled, slave);
|
|
||||||
scalarField slaveData(fromSlave);
|
|
||||||
os.write(slaveData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (direction i=0; i < pTraits<Type>::nComponents; ++i)
|
|
||||||
{
|
|
||||||
label cmpt = ensightPTraits<Type>::componentOrder[i];
|
|
||||||
|
|
||||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
|
||||||
toMaster<< vf.component(cmpt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
bool writePatchField
|
|
||||||
(
|
|
||||||
const Field<Type>& pf,
|
|
||||||
const label patchi,
|
|
||||||
const label ensightPatchi,
|
|
||||||
const faceSets& boundaryFaceSet,
|
|
||||||
const ensightMesh::nFacePrimitives& nfp,
|
|
||||||
ensightStream& os
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (nfp.nTris || nfp.nQuads || nfp.nPolys)
|
|
||||||
{
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
os.writePartHeader(ensightPatchi);
|
|
||||||
}
|
|
||||||
|
|
||||||
writeField
|
|
||||||
(
|
|
||||||
"tria3",
|
|
||||||
Field<Type>(pf, boundaryFaceSet.tris),
|
|
||||||
os
|
|
||||||
);
|
|
||||||
|
|
||||||
writeField
|
|
||||||
(
|
|
||||||
"quad4",
|
|
||||||
Field<Type>(pf, boundaryFaceSet.quads),
|
|
||||||
os
|
|
||||||
);
|
|
||||||
|
|
||||||
writeField
|
|
||||||
(
|
|
||||||
"nsided",
|
|
||||||
Field<Type>(pf, boundaryFaceSet.polys),
|
|
||||||
os
|
|
||||||
);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void writePatchField
|
|
||||||
(
|
|
||||||
const word& fieldName,
|
|
||||||
const Field<Type>& pf,
|
|
||||||
const word& patchName,
|
|
||||||
const ensightMesh& eMesh,
|
|
||||||
const fileName& dataDir,
|
|
||||||
const label timeIndex,
|
|
||||||
Ostream& ensightCaseFile
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
|
|
||||||
const wordList& allPatchNames = eMesh.allPatchNames();
|
|
||||||
const HashTable<ensightMesh::nFacePrimitives>&
|
|
||||||
nPatchPrims = eMesh.nPatchPrims();
|
|
||||||
|
|
||||||
label ensightPatchi = eMesh.patchPartOffset();
|
|
||||||
|
|
||||||
label patchi = -1;
|
|
||||||
|
|
||||||
forAll(allPatchNames, i)
|
|
||||||
{
|
|
||||||
if (allPatchNames[i] == patchName)
|
|
||||||
{
|
|
||||||
patchi = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ensightPatchi++;
|
|
||||||
}
|
|
||||||
|
|
||||||
ensightStream* filePtr(nullptr);
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
// TODO: verify that these are indeed valid ensight variable names
|
|
||||||
const word varName = patchName + '.' + fieldName;
|
|
||||||
const fileName postFileName = ensightFile::subDir(timeIndex)/varName;
|
|
||||||
|
|
||||||
// the data/ITER subdirectory must exist
|
|
||||||
mkDir(dataDir/postFileName.path());
|
|
||||||
|
|
||||||
if (timeIndex == 0)
|
|
||||||
{
|
|
||||||
const fileName dirName = dataDir.name()/ensightFile::mask();
|
|
||||||
|
|
||||||
ensightCaseFile.setf(ios_base::left);
|
|
||||||
ensightCaseFile
|
|
||||||
<< ensightPTraits<Type>::typeName << " per "
|
|
||||||
<< setw(20)
|
|
||||||
<< "element:"
|
|
||||||
<< " 1 "
|
|
||||||
<< setw(15)
|
|
||||||
<< varName.c_str() << ' '
|
|
||||||
<< (dirName/varName).c_str()
|
|
||||||
<< nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eMesh.format() == IOstream::BINARY)
|
|
||||||
{
|
|
||||||
filePtr = new ensightBinaryStream
|
|
||||||
(
|
|
||||||
dataDir/postFileName
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
filePtr = new ensightAsciiStream
|
|
||||||
(
|
|
||||||
dataDir/postFileName
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
filePtr->write(ensightPTraits<Type>::typeName);
|
|
||||||
}
|
|
||||||
|
|
||||||
ensightStream& os = *filePtr;
|
|
||||||
|
|
||||||
if (patchi >= 0)
|
|
||||||
{
|
|
||||||
writePatchField
|
|
||||||
(
|
|
||||||
pf,
|
|
||||||
patchi,
|
|
||||||
ensightPatchi,
|
|
||||||
boundaryFaceSets[patchi],
|
|
||||||
nPatchPrims.find(patchName)(),
|
|
||||||
os
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
faceSets nullFaceSets;
|
|
||||||
|
|
||||||
writePatchField
|
|
||||||
(
|
|
||||||
Field<Type>(),
|
|
||||||
-1,
|
|
||||||
ensightPatchi,
|
|
||||||
nullFaceSets,
|
|
||||||
nPatchPrims.find(patchName)(),
|
|
||||||
os
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (filePtr) // on master only
|
|
||||||
{
|
|
||||||
delete filePtr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void ensightField
|
|
||||||
(
|
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& vf,
|
|
||||||
const ensightMesh& eMesh,
|
|
||||||
const fileName& dataDir,
|
|
||||||
const label timeIndex,
|
|
||||||
Ostream& ensightCaseFile
|
|
||||||
)
|
|
||||||
{
|
|
||||||
Info<< ' ' << vf.name();
|
|
||||||
|
|
||||||
const fvMesh& mesh = eMesh.mesh();
|
|
||||||
|
|
||||||
const cellSets& meshCellSets = eMesh.meshCellSets();
|
|
||||||
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
|
|
||||||
const wordList& allPatchNames = eMesh.allPatchNames();
|
|
||||||
const wordHashSet& patchNames = eMesh.patchNames();
|
|
||||||
const HashTable<ensightMesh::nFacePrimitives>&
|
|
||||||
nPatchPrims = eMesh.nPatchPrims();
|
|
||||||
const List<faceSets>& faceZoneFaceSets = eMesh.faceZoneFaceSets();
|
|
||||||
const wordHashSet& faceZoneNames = eMesh.faceZoneNames();
|
|
||||||
const HashTable<ensightMesh::nFacePrimitives>&
|
|
||||||
nFaceZonePrims = eMesh.nFaceZonePrims();
|
|
||||||
|
|
||||||
const labelList& tets = meshCellSets.tets;
|
|
||||||
const labelList& pyrs = meshCellSets.pyrs;
|
|
||||||
const labelList& prisms = meshCellSets.prisms;
|
|
||||||
const labelList& wedges = meshCellSets.wedges;
|
|
||||||
const labelList& hexes = meshCellSets.hexes;
|
|
||||||
const labelList& polys = meshCellSets.polys;
|
|
||||||
|
|
||||||
ensightStream* filePtr(nullptr);
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
const ensight::VarName varName(vf.name());
|
|
||||||
const fileName postFileName = ensightFile::subDir(timeIndex)/varName;
|
|
||||||
|
|
||||||
// the data/ITER subdirectory must exist
|
|
||||||
mkDir(dataDir/postFileName.path());
|
|
||||||
|
|
||||||
if (timeIndex == 0)
|
|
||||||
{
|
|
||||||
const fileName dirName = dataDir.name()/ensightFile::mask();
|
|
||||||
|
|
||||||
ensightCaseFile.setf(ios_base::left);
|
|
||||||
ensightCaseFile
|
|
||||||
<< ensightPTraits<Type>::typeName
|
|
||||||
<< " per element: 1 "
|
|
||||||
<< setw(15)
|
|
||||||
<< varName.c_str() << ' '
|
|
||||||
<< (dirName/varName).c_str()
|
|
||||||
<< nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eMesh.format() == IOstream::BINARY)
|
|
||||||
{
|
|
||||||
filePtr = new ensightBinaryStream
|
|
||||||
(
|
|
||||||
dataDir/postFileName
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
filePtr = new ensightAsciiStream
|
|
||||||
(
|
|
||||||
dataDir/postFileName
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
filePtr->write(ensightPTraits<Type>::typeName);
|
|
||||||
}
|
|
||||||
|
|
||||||
ensightStream& os = *filePtr;
|
|
||||||
|
|
||||||
if (patchNames.empty())
|
|
||||||
{
|
|
||||||
eMesh.barrier();
|
|
||||||
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
os.writePartHeader(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
writeField
|
|
||||||
(
|
|
||||||
"hexa8",
|
|
||||||
map(vf, hexes, wedges),
|
|
||||||
os
|
|
||||||
);
|
|
||||||
|
|
||||||
writeField
|
|
||||||
(
|
|
||||||
"penta6",
|
|
||||||
Field<Type>(vf, prisms),
|
|
||||||
os
|
|
||||||
);
|
|
||||||
|
|
||||||
writeField
|
|
||||||
(
|
|
||||||
"pyramid5",
|
|
||||||
Field<Type>(vf, pyrs),
|
|
||||||
os
|
|
||||||
);
|
|
||||||
|
|
||||||
writeField
|
|
||||||
(
|
|
||||||
"tetra4",
|
|
||||||
Field<Type>(vf, tets),
|
|
||||||
os
|
|
||||||
);
|
|
||||||
|
|
||||||
writeField
|
|
||||||
(
|
|
||||||
"nfaced",
|
|
||||||
Field<Type>(vf, polys),
|
|
||||||
os
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
label ensightPatchi = eMesh.patchPartOffset();
|
|
||||||
|
|
||||||
forAll(allPatchNames, patchi)
|
|
||||||
{
|
|
||||||
const word& patchName = allPatchNames[patchi];
|
|
||||||
|
|
||||||
eMesh.barrier();
|
|
||||||
|
|
||||||
if (patchNames.empty() || patchNames.found(patchName))
|
|
||||||
{
|
|
||||||
if
|
|
||||||
(
|
|
||||||
writePatchField
|
|
||||||
(
|
|
||||||
vf.boundaryField()[patchi],
|
|
||||||
patchi,
|
|
||||||
ensightPatchi,
|
|
||||||
boundaryFaceSets[patchi],
|
|
||||||
nPatchPrims.find(patchName)(),
|
|
||||||
os
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
ensightPatchi++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// write faceZones, if requested
|
|
||||||
if (faceZoneNames.size())
|
|
||||||
{
|
|
||||||
// Interpolates cell values to faces - needed only when exporting
|
|
||||||
// faceZones...
|
|
||||||
GeometricField<Type, fvsPatchField, surfaceMesh> sf
|
|
||||||
(
|
|
||||||
linearInterpolate(vf)
|
|
||||||
);
|
|
||||||
|
|
||||||
forAllConstIter(wordHashSet, faceZoneNames, iter)
|
|
||||||
{
|
|
||||||
const word& faceZoneName = iter.key();
|
|
||||||
|
|
||||||
eMesh.barrier();
|
|
||||||
|
|
||||||
const label zoneID = mesh.faceZones().findZoneID(faceZoneName);
|
|
||||||
const faceZone& fz = mesh.faceZones()[zoneID];
|
|
||||||
|
|
||||||
// Prepare data to write
|
|
||||||
label nIncluded = 0;
|
|
||||||
forAll(fz, i)
|
|
||||||
{
|
|
||||||
if (eMesh.faceToBeIncluded(fz[i]))
|
|
||||||
{
|
|
||||||
++nIncluded;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Field<Type> values(nIncluded);
|
|
||||||
|
|
||||||
// Loop on the faceZone and store the needed field values
|
|
||||||
label j = 0;
|
|
||||||
forAll(fz, i)
|
|
||||||
{
|
|
||||||
label facei = fz[i];
|
|
||||||
if (mesh.isInternalFace(facei))
|
|
||||||
{
|
|
||||||
values[j] = sf[facei];
|
|
||||||
++j;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (eMesh.faceToBeIncluded(facei))
|
|
||||||
{
|
|
||||||
label patchi = mesh.boundaryMesh().whichPatch(facei);
|
|
||||||
const polyPatch& pp = mesh.boundaryMesh()[patchi];
|
|
||||||
label patchFacei = pp.whichFace(facei);
|
|
||||||
Type value = sf.boundaryField()[patchi][patchFacei];
|
|
||||||
values[j] = value;
|
|
||||||
++j;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
writePatchField
|
|
||||||
(
|
|
||||||
values,
|
|
||||||
zoneID,
|
|
||||||
ensightPatchi,
|
|
||||||
faceZoneFaceSets[zoneID],
|
|
||||||
nFaceZonePrims.find(faceZoneName)(),
|
|
||||||
os
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
ensightPatchi++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (filePtr) // on master only
|
|
||||||
{
|
|
||||||
delete filePtr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void ensightPointField
|
|
||||||
(
|
|
||||||
const GeometricField<Type, pointPatchField, pointMesh>& pf,
|
|
||||||
const ensightMesh& eMesh,
|
|
||||||
const fileName& dataDir,
|
|
||||||
const label timeIndex,
|
|
||||||
Ostream& ensightCaseFile
|
|
||||||
)
|
|
||||||
{
|
|
||||||
Info<< ' ' << pf.name();
|
|
||||||
|
|
||||||
const fvMesh& mesh = eMesh.mesh();
|
|
||||||
const wordList& allPatchNames = eMesh.allPatchNames();
|
|
||||||
const wordHashSet& patchNames = eMesh.patchNames();
|
|
||||||
const wordHashSet& faceZoneNames = eMesh.faceZoneNames();
|
|
||||||
|
|
||||||
ensightStream* filePtr(nullptr);
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
const ensight::VarName varName(pf.name());
|
|
||||||
const fileName postFileName = ensightFile::subDir(timeIndex)/varName;
|
|
||||||
|
|
||||||
// the data/ITER subdirectory must exist
|
|
||||||
mkDir(dataDir/postFileName.path());
|
|
||||||
|
|
||||||
if (timeIndex == 0)
|
|
||||||
{
|
|
||||||
const fileName dirName = dataDir.name()/ensightFile::mask();
|
|
||||||
|
|
||||||
ensightCaseFile.setf(ios_base::left);
|
|
||||||
ensightCaseFile
|
|
||||||
<< ensightPTraits<Type>::typeName
|
|
||||||
<< " per "
|
|
||||||
<< setw(20)
|
|
||||||
<< " node:"
|
|
||||||
<< " 1 "
|
|
||||||
<< setw(15)
|
|
||||||
<< varName.c_str() << ' '
|
|
||||||
<< (dirName/varName).c_str()
|
|
||||||
<< nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eMesh.format() == IOstream::BINARY)
|
|
||||||
{
|
|
||||||
filePtr = new ensightBinaryStream
|
|
||||||
(
|
|
||||||
dataDir/postFileName
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
filePtr = new ensightAsciiStream
|
|
||||||
(
|
|
||||||
dataDir/postFileName
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
filePtr->write(ensightPTraits<Type>::typeName);
|
|
||||||
}
|
|
||||||
|
|
||||||
ensightStream& os = *filePtr;
|
|
||||||
|
|
||||||
if (eMesh.patchNames().empty())
|
|
||||||
{
|
|
||||||
eMesh.barrier();
|
|
||||||
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
os.writePartHeader(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
writeField
|
|
||||||
(
|
|
||||||
"coordinates",
|
|
||||||
Field<Type>(pf.primitiveField(), eMesh.uniquePointMap()),
|
|
||||||
os
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
label ensightPatchi = eMesh.patchPartOffset();
|
|
||||||
|
|
||||||
forAll(allPatchNames, patchi)
|
|
||||||
{
|
|
||||||
const word& patchName = allPatchNames[patchi];
|
|
||||||
|
|
||||||
eMesh.barrier();
|
|
||||||
|
|
||||||
if (patchNames.empty() || patchNames.found(patchName))
|
|
||||||
{
|
|
||||||
const fvPatch& p = mesh.boundary()[patchi];
|
|
||||||
|
|
||||||
if (returnReduce(p.size(), sumOp<label>()) > 0)
|
|
||||||
{
|
|
||||||
// Renumber the patch points/faces into unique points
|
|
||||||
labelList pointToGlobal;
|
|
||||||
labelList uniqueMeshPointLabels;
|
|
||||||
autoPtr<globalIndex> globalPointsPtr =
|
|
||||||
mesh.globalData().mergePoints
|
|
||||||
(
|
|
||||||
p.patch().meshPoints(),
|
|
||||||
p.patch().meshPointMap(),
|
|
||||||
pointToGlobal,
|
|
||||||
uniqueMeshPointLabels
|
|
||||||
);
|
|
||||||
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
os.writePartHeader(ensightPatchi);
|
|
||||||
}
|
|
||||||
|
|
||||||
writeField
|
|
||||||
(
|
|
||||||
"coordinates",
|
|
||||||
Field<Type>(pf.primitiveField(), uniqueMeshPointLabels),
|
|
||||||
os
|
|
||||||
);
|
|
||||||
|
|
||||||
ensightPatchi++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// write faceZones, if requested
|
|
||||||
if (faceZoneNames.size())
|
|
||||||
{
|
|
||||||
forAllConstIter(wordHashSet, faceZoneNames, iter)
|
|
||||||
{
|
|
||||||
const word& faceZoneName = iter.key();
|
|
||||||
|
|
||||||
eMesh.barrier();
|
|
||||||
|
|
||||||
const label zoneID = mesh.faceZones().findZoneID(faceZoneName);
|
|
||||||
const faceZone& fz = mesh.faceZones()[zoneID];
|
|
||||||
|
|
||||||
if (returnReduce(fz().nPoints(), sumOp<label>()) > 0)
|
|
||||||
{
|
|
||||||
// Renumber the faceZone points/faces into unique points
|
|
||||||
labelList pointToGlobal;
|
|
||||||
labelList uniqueMeshPointLabels;
|
|
||||||
autoPtr<globalIndex> globalPointsPtr =
|
|
||||||
mesh.globalData().mergePoints
|
|
||||||
(
|
|
||||||
fz().meshPoints(),
|
|
||||||
fz().meshPointMap(),
|
|
||||||
pointToGlobal,
|
|
||||||
uniqueMeshPointLabels
|
|
||||||
);
|
|
||||||
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
os.writePartHeader(ensightPatchi);
|
|
||||||
}
|
|
||||||
|
|
||||||
writeField
|
|
||||||
(
|
|
||||||
"coordinates",
|
|
||||||
Field<Type>
|
|
||||||
(
|
|
||||||
pf.primitiveField(),
|
|
||||||
uniqueMeshPointLabels
|
|
||||||
),
|
|
||||||
os
|
|
||||||
);
|
|
||||||
|
|
||||||
ensightPatchi++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (filePtr) // on master only
|
|
||||||
{
|
|
||||||
delete filePtr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void ensightField
|
|
||||||
(
|
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& vf,
|
|
||||||
const ensightMesh& eMesh,
|
|
||||||
const fileName& dataDir,
|
|
||||||
const label timeIndex,
|
|
||||||
const bool nodeValues,
|
|
||||||
Ostream& ensightCaseFile
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (nodeValues)
|
|
||||||
{
|
|
||||||
tmp<GeometricField<Type, pointPatchField, pointMesh>> pfld
|
|
||||||
(
|
|
||||||
volPointInterpolation::New(vf.mesh()).interpolate(vf)
|
|
||||||
);
|
|
||||||
pfld.ref().rename(vf.name());
|
|
||||||
|
|
||||||
ensightPointField<Type>
|
|
||||||
(
|
|
||||||
pfld,
|
|
||||||
eMesh,
|
|
||||||
dataDir,
|
|
||||||
timeIndex,
|
|
||||||
ensightCaseFile
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ensightField<Type>
|
|
||||||
(
|
|
||||||
vf,
|
|
||||||
eMesh,
|
|
||||||
dataDir,
|
|
||||||
timeIndex,
|
|
||||||
ensightCaseFile
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,102 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation | Copyright (C) 2016 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/>.
|
|
||||||
|
|
||||||
InApplication
|
|
||||||
foamToEnsight
|
|
||||||
|
|
||||||
Description
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
ensightField.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef ensightField_H
|
|
||||||
#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
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//- Wrapper to convert dimensionedInternalField to volField
|
|
||||||
template<class Type>
|
|
||||||
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
|
|
||||||
volField
|
|
||||||
(
|
|
||||||
const Foam::fvMeshSubset&,
|
|
||||||
const typename Foam::GeometricField
|
|
||||||
<
|
|
||||||
Type,
|
|
||||||
Foam::fvPatchField,
|
|
||||||
Foam::volMesh
|
|
||||||
>::Internal& df
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void ensightField
|
|
||||||
(
|
|
||||||
const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>& vf,
|
|
||||||
const Foam::ensightMesh& eMesh,
|
|
||||||
const Foam::fileName& dataDir,
|
|
||||||
const Foam::label timeIndex,
|
|
||||||
const bool nodeValues,
|
|
||||||
Foam::Ostream& ensightCaseFile
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void writePatchField
|
|
||||||
(
|
|
||||||
const Foam::word& fieldName,
|
|
||||||
const Foam::Field<Type>& pf,
|
|
||||||
const Foam::word& patchName,
|
|
||||||
const Foam::ensightMesh& eMesh,
|
|
||||||
const Foam::fileName& dataDir,
|
|
||||||
const Foam::label timeIndex,
|
|
||||||
Foam::Ostream& ensightCaseFile
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#ifdef NoRepository
|
|
||||||
#include "ensightField.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -1,398 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation | Copyright (C) 2016 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::ensightMesh
|
|
||||||
|
|
||||||
Description
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
ensightMesh.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef ensightMesh_H
|
|
||||||
#define ensightMesh_H
|
|
||||||
|
|
||||||
#include "cellSets.H"
|
|
||||||
#include "faceSets.H"
|
|
||||||
#include "HashTable.H"
|
|
||||||
#include "HashSet.H"
|
|
||||||
#include "PackedBoolList.H"
|
|
||||||
#include "wordReList.H"
|
|
||||||
#include "scalarField.H"
|
|
||||||
#include "cellShapeList.H"
|
|
||||||
#include "cellList.H"
|
|
||||||
|
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
class fvMesh;
|
|
||||||
class argList;
|
|
||||||
class globalIndex;
|
|
||||||
class ensightStream;
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class ensightMesh Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
class ensightMesh
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
//- The name for geometry files
|
|
||||||
static const char* geometryName;
|
|
||||||
|
|
||||||
//- Helper class for managing face primitives
|
|
||||||
class nFacePrimitives
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
label nTris;
|
|
||||||
label nQuads;
|
|
||||||
label nPolys;
|
|
||||||
|
|
||||||
nFacePrimitives()
|
|
||||||
:
|
|
||||||
nTris(0),
|
|
||||||
nQuads(0),
|
|
||||||
nPolys(0)
|
|
||||||
{}
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- Reference to the OpenFOAM mesh
|
|
||||||
const fvMesh& mesh_;
|
|
||||||
|
|
||||||
//- Suppress patches
|
|
||||||
const bool noPatches_;
|
|
||||||
|
|
||||||
//- Output selected patches only
|
|
||||||
const bool patches_;
|
|
||||||
const wordReList patchPatterns_;
|
|
||||||
|
|
||||||
//- Output selected faceZones
|
|
||||||
const bool faceZones_;
|
|
||||||
const wordReList faceZonePatterns_;
|
|
||||||
|
|
||||||
//- Ascii/Binary file output
|
|
||||||
const IOstream::streamFormat format_;
|
|
||||||
|
|
||||||
//- The ensight part id for the first patch
|
|
||||||
label patchPartOffset_;
|
|
||||||
|
|
||||||
cellSets meshCellSets_;
|
|
||||||
|
|
||||||
List<faceSets> boundaryFaceSets_;
|
|
||||||
|
|
||||||
wordList allPatchNames_;
|
|
||||||
|
|
||||||
wordHashSet patchNames_;
|
|
||||||
|
|
||||||
HashTable<nFacePrimitives> nPatchPrims_;
|
|
||||||
|
|
||||||
// faceZone - related variables
|
|
||||||
List<faceSets> faceZoneFaceSets_;
|
|
||||||
|
|
||||||
wordHashSet faceZoneNames_;
|
|
||||||
|
|
||||||
HashTable<nFacePrimitives> nFaceZonePrims_;
|
|
||||||
|
|
||||||
//- Per boundary face whether to include or not
|
|
||||||
PackedBoolList boundaryFaceToBeIncluded_;
|
|
||||||
|
|
||||||
|
|
||||||
// Parallel merged points
|
|
||||||
|
|
||||||
//- Global numbering for merged points
|
|
||||||
autoPtr<globalIndex> globalPointsPtr_;
|
|
||||||
|
|
||||||
//- From mesh point to global merged point
|
|
||||||
labelList pointToGlobal_;
|
|
||||||
|
|
||||||
//- Local points that are unique
|
|
||||||
labelList uniquePointMap_;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
|
||||||
ensightMesh(const ensightMesh&) = delete;
|
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
|
||||||
void operator=(const ensightMesh&) = delete;
|
|
||||||
|
|
||||||
void writePoints
|
|
||||||
(
|
|
||||||
const scalarField& pointsComponent,
|
|
||||||
ensightStream& ensightGeometryFile
|
|
||||||
) const;
|
|
||||||
|
|
||||||
cellShapeList map
|
|
||||||
(
|
|
||||||
const cellShapeList& cellShapes,
|
|
||||||
const labelList& prims,
|
|
||||||
const labelList& pointToGlobal
|
|
||||||
) const;
|
|
||||||
|
|
||||||
cellShapeList map
|
|
||||||
(
|
|
||||||
const cellShapeList& cellShapes,
|
|
||||||
const labelList& hexes,
|
|
||||||
const labelList& wedges,
|
|
||||||
const labelList& pointToGlobal
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writePrims
|
|
||||||
(
|
|
||||||
const cellShapeList& cellShapes,
|
|
||||||
ensightStream& ensightGeometryFile
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writePolysNFaces
|
|
||||||
(
|
|
||||||
const labelList& polys,
|
|
||||||
const cellList& cellFaces,
|
|
||||||
ensightStream& ensightGeometryFile
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writePolysNPointsPerFace
|
|
||||||
(
|
|
||||||
const labelList& polys,
|
|
||||||
const cellList& cellFaces,
|
|
||||||
const faceList& faces,
|
|
||||||
ensightStream& ensightGeometryFile
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writePolysPoints
|
|
||||||
(
|
|
||||||
const labelList& polys,
|
|
||||||
const cellList& cellFaces,
|
|
||||||
const faceList& faces,
|
|
||||||
const labelList& faceOwner,
|
|
||||||
ensightStream& ensightGeometryFile
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writeAllPolys
|
|
||||||
(
|
|
||||||
const labelList& pointToGlobal,
|
|
||||||
ensightStream& ensightGeometryFile
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writeAllPrims
|
|
||||||
(
|
|
||||||
const char* key,
|
|
||||||
const label nPrims,
|
|
||||||
const cellShapeList& cellShapes,
|
|
||||||
ensightStream& ensightGeometryFile
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writeFacePrims
|
|
||||||
(
|
|
||||||
const faceList& patchFaces,
|
|
||||||
ensightStream& ensightGeometryFile
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writeAllFacePrims
|
|
||||||
(
|
|
||||||
const char* key,
|
|
||||||
const labelList& prims,
|
|
||||||
const label nPrims,
|
|
||||||
const faceList& patchFaces,
|
|
||||||
ensightStream& ensightGeometryFile
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writeNSidedNPointsPerFace
|
|
||||||
(
|
|
||||||
const faceList& patchFaces,
|
|
||||||
ensightStream& ensightGeometryFile
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writeNSidedPoints
|
|
||||||
(
|
|
||||||
const faceList& patchFaces,
|
|
||||||
ensightStream& ensightGeometryFile
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writeAllNSided
|
|
||||||
(
|
|
||||||
const labelList& prims,
|
|
||||||
const label nPrims,
|
|
||||||
const faceList& patchFaces,
|
|
||||||
ensightStream& ensightGeometryFile
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writeAllPoints
|
|
||||||
(
|
|
||||||
const label ensightPartI,
|
|
||||||
const word& ensightPartName,
|
|
||||||
const pointField& uniquePoints,
|
|
||||||
const label nPoints,
|
|
||||||
ensightStream& ensightGeometryFile
|
|
||||||
) const;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct from fvMesh
|
|
||||||
ensightMesh
|
|
||||||
(
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const bool noPatches,
|
|
||||||
const bool patches,
|
|
||||||
const wordReList& patchPatterns,
|
|
||||||
const bool faceZones,
|
|
||||||
const wordReList& faceZonePatterns,
|
|
||||||
const IOstream::streamFormat format = IOstream::BINARY
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
|
||||||
~ensightMesh();
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
|
||||||
|
|
||||||
// Access
|
|
||||||
|
|
||||||
const fvMesh& mesh() const
|
|
||||||
{
|
|
||||||
return mesh_;
|
|
||||||
}
|
|
||||||
|
|
||||||
IOstream::streamFormat format() const
|
|
||||||
{
|
|
||||||
return format_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const cellSets& meshCellSets() const
|
|
||||||
{
|
|
||||||
return meshCellSets_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const List<faceSets>& boundaryFaceSets() const
|
|
||||||
{
|
|
||||||
return boundaryFaceSets_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const wordList& allPatchNames() const
|
|
||||||
{
|
|
||||||
return allPatchNames_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const wordHashSet& patchNames() const
|
|
||||||
{
|
|
||||||
return patchNames_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const HashTable<nFacePrimitives>& nPatchPrims() const
|
|
||||||
{
|
|
||||||
return nPatchPrims_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const List<faceSets>& faceZoneFaceSets() const
|
|
||||||
{
|
|
||||||
return faceZoneFaceSets_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const wordHashSet& faceZoneNames() const
|
|
||||||
{
|
|
||||||
return faceZoneNames_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const HashTable<nFacePrimitives>& nFaceZonePrims() const
|
|
||||||
{
|
|
||||||
return nFaceZonePrims_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- The ensight part id for the first patch
|
|
||||||
label patchPartOffset() const
|
|
||||||
{
|
|
||||||
return patchPartOffset_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Parallel point merging
|
|
||||||
|
|
||||||
//- Global numbering for merged points
|
|
||||||
const globalIndex& globalPoints() const
|
|
||||||
{
|
|
||||||
return globalPointsPtr_();
|
|
||||||
}
|
|
||||||
|
|
||||||
//- From mesh point to global merged point
|
|
||||||
const labelList& pointToGlobal() const
|
|
||||||
{
|
|
||||||
return pointToGlobal_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Local points that are unique
|
|
||||||
const labelList& uniquePointMap() const
|
|
||||||
{
|
|
||||||
return uniquePointMap_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Other
|
|
||||||
|
|
||||||
//- Update for new mesh
|
|
||||||
void correct();
|
|
||||||
|
|
||||||
//- When exporting faceZones, check if a given face has to be included
|
|
||||||
// or not (i.e. faces on processor boundaries)
|
|
||||||
bool faceToBeIncluded(const label facei) const;
|
|
||||||
|
|
||||||
//- Helper to cause barrier. Necessary on Quadrics.
|
|
||||||
static void barrier();
|
|
||||||
|
|
||||||
|
|
||||||
// I-O
|
|
||||||
|
|
||||||
void write
|
|
||||||
(
|
|
||||||
const fileName& ensightDir,
|
|
||||||
const label timeIndex,
|
|
||||||
const bool meshMoving,
|
|
||||||
Ostream& ensightCaseFile
|
|
||||||
) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -23,8 +23,8 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "ensightCloud.H"
|
#include "ensightOutputCloud.H"
|
||||||
#include "ensightFile.H"
|
|
||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "passiveParticle.H"
|
#include "passiveParticle.H"
|
||||||
#include "Cloud.H"
|
#include "Cloud.H"
|
||||||
@ -32,30 +32,19 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::ensightParticlePositions
|
void Foam::ensightCloud::writePositions
|
||||||
(
|
(
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
const fileName& dataDir,
|
|
||||||
const label timeIndex,
|
|
||||||
const word& cloudName,
|
const word& cloudName,
|
||||||
const bool dataExists,
|
const bool exists,
|
||||||
IOstream::streamFormat format
|
autoPtr<ensightFile>& output
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (dataExists)
|
|
||||||
{
|
|
||||||
Info<< " positions";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Info<< " positions{0}";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Total number of parcels on all processes
|
// Total number of parcels on all processes
|
||||||
label nTotParcels = 0;
|
label nTotParcels = 0;
|
||||||
autoPtr<Cloud<passiveParticle>> cloudPtr;
|
autoPtr<Cloud<passiveParticle>> cloudPtr;
|
||||||
|
|
||||||
if (dataExists)
|
if (exists)
|
||||||
{
|
{
|
||||||
cloudPtr.reset(new Cloud<passiveParticle>(mesh, cloudName, false));
|
cloudPtr.reset(new Cloud<passiveParticle>(mesh, cloudName, false));
|
||||||
nTotParcels = cloudPtr().size();
|
nTotParcels = cloudPtr().size();
|
||||||
@ -64,29 +53,15 @@ void Foam::ensightParticlePositions
|
|||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
const fileName postFileName =
|
ensightFile& os = output();
|
||||||
ensightFile::subDir(timeIndex)/cloud::prefix/cloudName/"positions";
|
|
||||||
|
|
||||||
// the ITER/lagrangian subdirectory must exist
|
|
||||||
mkDir(dataDir/postFileName.path());
|
|
||||||
|
|
||||||
ensightFile os(dataDir, postFileName, format);
|
|
||||||
|
|
||||||
// tag binary format (just like geometry files)
|
|
||||||
os.writeBinaryHeader();
|
|
||||||
os.write(postFileName); // description
|
|
||||||
os.newline();
|
|
||||||
os.write("particle coordinates");
|
|
||||||
os.newline();
|
|
||||||
os.write(nTotParcels, 8); // unusual width
|
|
||||||
os.newline();
|
|
||||||
|
|
||||||
|
os.beginParticleCoordinates(nTotParcels);
|
||||||
if (!nTotParcels)
|
if (!nTotParcels)
|
||||||
{
|
{
|
||||||
return; // DONE
|
return; // DONE
|
||||||
}
|
}
|
||||||
|
|
||||||
if (format == IOstream::BINARY)
|
if (os.format() == IOstream::BINARY)
|
||||||
{
|
{
|
||||||
// binary write is Ensight6 - first ids, then positions
|
// binary write is Ensight6 - first ids, then positions
|
||||||
|
|
||||||
@ -131,7 +106,7 @@ void Foam::ensightParticlePositions
|
|||||||
{
|
{
|
||||||
const point& p = elmnt().position();
|
const point& p = elmnt().position();
|
||||||
|
|
||||||
os.write(++parcelId, 8); // unusual width
|
os.write(++parcelId, 8); // unusual width
|
||||||
os.write(p.x());
|
os.write(p.x());
|
||||||
os.write(p.y());
|
os.write(p.y());
|
||||||
os.write(p.z());
|
os.write(p.z());
|
||||||
@ -148,7 +123,7 @@ void Foam::ensightParticlePositions
|
|||||||
{
|
{
|
||||||
const point& p = points[pti];
|
const point& p = points[pti];
|
||||||
|
|
||||||
os.write(++parcelId, 8); // unusual width
|
os.write(++parcelId, 8); // unusual width
|
||||||
os.write(p.x());
|
os.write(p.x());
|
||||||
os.write(p.y());
|
os.write(p.y());
|
||||||
os.write(p.z());
|
os.write(p.z());
|
||||||
@ -171,10 +146,11 @@ void Foam::ensightParticlePositions
|
|||||||
|
|
||||||
{
|
{
|
||||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||||
toMaster<< points;
|
toMaster
|
||||||
|
<< points;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
@ -2,8 +2,8 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -21,78 +21,73 @@ License
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Namespace
|
||||||
|
ensightOutput
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Miscellaneous collection of functions and template related to Ensight data
|
A collection of global functions for writing ensight file content.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
ensightOutputFunctions.C
|
ensightOutputCloud.C
|
||||||
|
ensightOutputCloudTemplates.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef ensightOutputFunctions_H
|
#ifndef ensightOutputCloud_H
|
||||||
#define ensightOutputFunctions_H
|
#define ensightOutputCloud_H
|
||||||
|
|
||||||
#include "ensightFile.H"
|
#include "ensightFile.H"
|
||||||
#include "Cloud.H"
|
#include "ensightMesh.H"
|
||||||
#include "polyMesh.H"
|
|
||||||
#include "IOobject.H"
|
#include "autoPtr.H"
|
||||||
|
#include "IOField.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
namespace ensightCloud
|
||||||
|
{
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
//- Write cloud positions
|
||||||
|
void writePositions
|
||||||
void ensightCaseEntry
|
|
||||||
(
|
(
|
||||||
OFstream& caseFile,
|
|
||||||
const string& ensightType,
|
|
||||||
const word& fieldName,
|
|
||||||
const fileName& dataMask,
|
|
||||||
const fileName& local=fileName::null,
|
|
||||||
const label cloudNo=-1,
|
|
||||||
const label timeSet=1
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
void ensightParticlePositions
|
|
||||||
(
|
|
||||||
const polyMesh& mesh,
|
|
||||||
const fileName& dataDir,
|
|
||||||
const fileName& subDir,
|
|
||||||
const word& cloudName,
|
|
||||||
IOstream::streamFormat format
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//- Write lagrangian parcels
|
|
||||||
template<class Type>
|
|
||||||
void ensightLagrangianField
|
|
||||||
(
|
|
||||||
const IOobject& fieldObject,
|
|
||||||
const fileName& dataDir,
|
|
||||||
const fileName& subDir,
|
|
||||||
const word& cloudName,
|
|
||||||
IOstream::streamFormat format
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Write generalized field components
|
|
||||||
template<class Type>
|
|
||||||
void ensightVolField
|
|
||||||
(
|
|
||||||
const ensightParts& partsList,
|
|
||||||
const IOobject& fieldObject,
|
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
const fileName& dataDir,
|
const word& cloudName,
|
||||||
const fileName& subDir,
|
const bool exists,
|
||||||
IOstream::streamFormat format
|
autoPtr<ensightFile>& output
|
||||||
);
|
);
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
|
//- Write cloud field, returning true if the field is non-empty.
|
||||||
|
template<class Type>
|
||||||
|
bool writeCloudField
|
||||||
|
(
|
||||||
|
const IOField<Type>& field,
|
||||||
|
ensightFile& os
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Write cloud field from IOobject, always returning true.
|
||||||
|
template<class Type>
|
||||||
|
bool writeCloudField
|
||||||
|
(
|
||||||
|
const IOobject& fieldObject,
|
||||||
|
const bool exists,
|
||||||
|
autoPtr<ensightFile>& output
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace ensightCloud
|
||||||
} // namespace Foam
|
} // namespace Foam
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
#ifdef NoRepository
|
||||||
#include "ensightOutputFunctions.C"
|
#include "ensightOutputCloudTemplates.C"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -23,24 +23,26 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "ensightCloud.H"
|
#include "ensightOutputCloud.H"
|
||||||
#include "ensightFile.H"
|
|
||||||
#include "Time.H"
|
|
||||||
#include "IOField.H"
|
|
||||||
#include "OFstream.H"
|
|
||||||
#include "IOmanip.H"
|
|
||||||
#include "ensightPTraits.H"
|
#include "ensightPTraits.H"
|
||||||
|
|
||||||
|
#include "IOField.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "globalIndex.H"
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::writeCloudField
|
bool Foam::ensightCloud::writeCloudField
|
||||||
(
|
(
|
||||||
const Foam::IOField<Type>& field,
|
const Foam::IOField<Type>& field,
|
||||||
Foam::ensightFile& os
|
Foam::ensightFile& os
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (returnReduce(field.size(), sumOp<label>()) > 0)
|
const bool exists = (returnReduce(field.size(), sumOp<label>()) > 0);
|
||||||
|
|
||||||
|
if (exists)
|
||||||
{
|
{
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
@ -106,86 +108,30 @@ void Foam::writeCloudField
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||||
toMaster<< field;
|
toMaster
|
||||||
|
<< field;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return exists;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::ensightCloudField
|
bool Foam::ensightCloud::writeCloudField
|
||||||
(
|
(
|
||||||
const Foam::IOobject& fieldObject,
|
const Foam::IOobject& fieldObject,
|
||||||
const Foam::fileName& dataDir,
|
const bool exists,
|
||||||
const Foam::label timeIndex,
|
Foam::autoPtr<Foam::ensightFile>& output
|
||||||
const Foam::word& cloudName,
|
|
||||||
const Foam::label cloudNo,
|
|
||||||
Foam::Ostream& ensightCaseFile,
|
|
||||||
const bool dataExists,
|
|
||||||
Foam::IOstream::streamFormat format
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const ensight::VarName varName(fieldObject.name());
|
if (exists)
|
||||||
|
|
||||||
if (dataExists)
|
|
||||||
{
|
|
||||||
Info<< ' ' << fieldObject.name();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Info<< ' ' << fieldObject.name() << "{0}"; // ie, empty field
|
|
||||||
}
|
|
||||||
|
|
||||||
ensightFile* filePtr(nullptr);
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
const fileName postFileName =
|
|
||||||
ensightFile::subDir(timeIndex)/cloud::prefix/cloudName/varName;
|
|
||||||
|
|
||||||
// the ITER/lagrangian subdirectory must exist
|
|
||||||
// the ITER/lagrangian subdirectory was already created
|
|
||||||
// when writing positions
|
|
||||||
|
|
||||||
mkDir(dataDir/postFileName.path());
|
|
||||||
|
|
||||||
if (timeIndex == 0)
|
|
||||||
{
|
|
||||||
const fileName dirName =
|
|
||||||
dataDir.name()/ensightFile::mask()/cloud::prefix/cloudName;
|
|
||||||
|
|
||||||
ensightCaseFile.setf(ios_base::left);
|
|
||||||
|
|
||||||
// prefix variables with 'c' (cloud)
|
|
||||||
ensightCaseFile
|
|
||||||
<< ensightPTraits<Type>::typeName << " per "
|
|
||||||
<< setw(20)
|
|
||||||
<< "measured node:"
|
|
||||||
<< " 1 "
|
|
||||||
<< setw(15)
|
|
||||||
<< ("c" + Foam::name(cloudNo) + varName).c_str() << ' '
|
|
||||||
<< (dirName/varName).c_str()
|
|
||||||
<< nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
filePtr = new ensightFile(dataDir, postFileName, format);
|
|
||||||
// description
|
|
||||||
filePtr->write
|
|
||||||
(
|
|
||||||
string(postFileName + " <" + pTraits<Type>::typeName + ">")
|
|
||||||
);
|
|
||||||
filePtr->newline();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dataExists)
|
|
||||||
{
|
{
|
||||||
IOField<Type> field(fieldObject);
|
IOField<Type> field(fieldObject);
|
||||||
writeCloudField(field, *filePtr);
|
writeCloudField(field, output.rawRef());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filePtr) // on master only
|
return true;
|
||||||
{
|
|
||||||
delete filePtr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ if (timeDirs.size() && !noLagrangian)
|
|||||||
|
|
||||||
forAllConstIter(IOobjectList, cloudObjs, fieldIter)
|
forAllConstIter(IOobjectList, cloudObjs, fieldIter)
|
||||||
{
|
{
|
||||||
const IOobject obj = *fieldIter();
|
const IOobject& obj = *fieldIter();
|
||||||
|
|
||||||
// Add field and field type
|
// Add field and field type
|
||||||
cloudIter().insert
|
cloudIter().insert
|
||||||
|
|||||||
@ -61,6 +61,9 @@ Usage
|
|||||||
- \par -width \<n\>
|
- \par -width \<n\>
|
||||||
Width of EnSight data subdir (default: 8)
|
Width of EnSight data subdir (default: 8)
|
||||||
|
|
||||||
|
- \par -deprecatedOrder
|
||||||
|
Use older ordering for volume cells (hex prism pyr tet poly)
|
||||||
|
|
||||||
Note
|
Note
|
||||||
Writes to \a EnSight directory to avoid collisions with
|
Writes to \a EnSight directory to avoid collisions with
|
||||||
foamToEnsightParts
|
foamToEnsightParts
|
||||||
@ -73,20 +76,22 @@ Note
|
|||||||
#include "IOmanip.H"
|
#include "IOmanip.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
|
|
||||||
|
#include "fvc.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
|
|
||||||
#include "labelIOField.H"
|
#include "labelIOField.H"
|
||||||
#include "scalarIOField.H"
|
#include "scalarIOField.H"
|
||||||
#include "tensorIOField.H"
|
#include "tensorIOField.H"
|
||||||
|
|
||||||
#include "ensightFile.H"
|
// file-format/conversion
|
||||||
|
#include "ensightCase.H"
|
||||||
|
#include "ensightGeoFile.H"
|
||||||
#include "ensightMesh.H"
|
#include "ensightMesh.H"
|
||||||
#include "ensightField.H"
|
#include "ensightOutput.H"
|
||||||
#include "ensightCloud.H"
|
|
||||||
|
|
||||||
#include "fvc.H"
|
// local files
|
||||||
#include "cellSet.H"
|
#include "meshSubsetHelper.H"
|
||||||
#include "fvMeshSubset.H"
|
#include "ensightOutputCloud.H"
|
||||||
|
|
||||||
#include "memInfo.H"
|
#include "memInfo.H"
|
||||||
|
|
||||||
@ -94,7 +99,12 @@ using namespace Foam;
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool inFileNameList(const fileNameList& nameList, const word& name)
|
// file-scope helper
|
||||||
|
static bool inFileNameList
|
||||||
|
(
|
||||||
|
const fileNameList& nameList,
|
||||||
|
const word& name
|
||||||
|
)
|
||||||
{
|
{
|
||||||
forAll(nameList, i)
|
forAll(nameList, i)
|
||||||
{
|
{
|
||||||
@ -171,10 +181,16 @@ int main(int argc, char *argv[])
|
|||||||
"n",
|
"n",
|
||||||
"width of ensight data subdir"
|
"width of ensight data subdir"
|
||||||
);
|
);
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"deprecatedOrder",
|
||||||
|
"Use old ordering (hex prism pyr tet poly) "
|
||||||
|
"instead of the ascending number of points "
|
||||||
|
"(tet pyr prism hex poly)."
|
||||||
|
);
|
||||||
|
|
||||||
// the volume field types that we handle
|
// The volume field types that we handle
|
||||||
const label nVolFieldTypes = 10;
|
const wordList volFieldTypes
|
||||||
const word volFieldTypes[] =
|
|
||||||
{
|
{
|
||||||
volScalarField::typeName,
|
volScalarField::typeName,
|
||||||
volVectorField::typeName,
|
volVectorField::typeName,
|
||||||
@ -203,137 +219,102 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
cpuTime timer;
|
cpuTime timer;
|
||||||
memInfo mem;
|
memInfo mem;
|
||||||
Info<< "Initial memory "
|
Info<< "Initial memory " << mem.update().size() << " kB" << endl;
|
||||||
<< mem.update().size() << " kB" << endl;
|
|
||||||
|
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
|
|
||||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||||
|
|
||||||
// adjust output width
|
|
||||||
if (args.optionFound("width"))
|
|
||||||
{
|
|
||||||
ensightFile::subDirWidth(args.optionRead<label>("width"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// define sub-directory name to use for EnSight data
|
|
||||||
fileName ensightDir = "EnSight";
|
|
||||||
args.optionReadIfPresent("name", ensightDir);
|
|
||||||
|
|
||||||
// Path to EnSight directory at case level only
|
|
||||||
// - For parallel cases, data only written from master
|
|
||||||
if (!ensightDir.isAbsolute())
|
|
||||||
{
|
|
||||||
ensightDir = args.rootPath()/args.globalCaseName()/ensightDir;
|
|
||||||
}
|
|
||||||
|
|
||||||
const fileName dataDir = ensightDir/"data";
|
|
||||||
const fileName dataMask = dataDir.name()/ensightFile::mask();
|
|
||||||
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
// EnSight and EnSight/data directories must exist
|
|
||||||
// - remove old data for a clean conversion of everything
|
|
||||||
if (isDir(ensightDir))
|
|
||||||
{
|
|
||||||
rmDir(ensightDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
mkDir(dataDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "createNamedMesh.H"
|
#include "createNamedMesh.H"
|
||||||
|
|
||||||
// Mesh instance (region0 gets filtered out)
|
fileName regionPrefix; // Mesh instance (region0 gets filtered out)
|
||||||
fileName regionPrefix;
|
|
||||||
if (regionName != polyMesh::defaultRegion)
|
if (regionName != polyMesh::defaultRegion)
|
||||||
{
|
{
|
||||||
regionPrefix = regionName;
|
regionPrefix = regionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start of case file header output
|
//
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// general (case) output options
|
||||||
|
//
|
||||||
|
ensightCase::options caseOpts(format);
|
||||||
|
|
||||||
OFstream *ensightCaseFilePtr(nullptr);
|
caseOpts.nodeValues(args.optionFound("nodeValues"));
|
||||||
if (Pstream::master())
|
caseOpts.width(args.optionLookupOrDefault<label>("width", 8));
|
||||||
|
caseOpts.overwrite(true); // remove existing output directory
|
||||||
|
|
||||||
|
// Can also have separate directory for lagrangian
|
||||||
|
// caseOpts.separateCloud(true);
|
||||||
|
|
||||||
|
|
||||||
|
// Define sub-directory name to use for EnSight data.
|
||||||
|
// The path to the ensight directory is at case level only
|
||||||
|
// - For parallel cases, data only written from master
|
||||||
|
fileName ensightDir = args.optionLookupOrDefault<word>("name", "EnSight");
|
||||||
|
if (!ensightDir.isAbsolute())
|
||||||
{
|
{
|
||||||
fileName caseFileName = args.globalCaseName() + ".case";
|
ensightDir = args.rootPath()/args.globalCaseName()/ensightDir;
|
||||||
|
|
||||||
Info<< "Converting " << timeDirs.size() << " time steps" << nl
|
|
||||||
<< "Ensight case: " << caseFileName.c_str() << endl;
|
|
||||||
|
|
||||||
// The case file is always ASCII
|
|
||||||
ensightCaseFilePtr = new OFstream
|
|
||||||
(
|
|
||||||
ensightDir/caseFileName,
|
|
||||||
IOstream::ASCII
|
|
||||||
);
|
|
||||||
|
|
||||||
ensightCaseFilePtr->setf(ios_base::left);
|
|
||||||
ensightCaseFilePtr->setf(ios_base::scientific, ios_base::floatfield);
|
|
||||||
ensightCaseFilePtr->precision(5);
|
|
||||||
|
|
||||||
*ensightCaseFilePtr
|
|
||||||
<< "FORMAT" << nl
|
|
||||||
<< "type: ensight gold" << nl << nl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OFstream& ensightCaseFile = *ensightCaseFilePtr;
|
|
||||||
|
|
||||||
// Construct the EnSight mesh
|
//
|
||||||
const bool selectedPatches = args.optionFound("patches");
|
// output configuration (geometry related)
|
||||||
wordReList patchPatterns;
|
//
|
||||||
if (selectedPatches)
|
ensightMesh::options writeOpts(format);
|
||||||
|
writeOpts.noPatches(args.optionFound("noPatches"));
|
||||||
|
writeOpts.deprecatedOrder(args.optionFound("deprecatedOrder"));
|
||||||
|
|
||||||
|
if (args.optionFound("patches"))
|
||||||
{
|
{
|
||||||
patchPatterns = wordReList(args.optionLookup("patches")());
|
writeOpts.patchSelection(args.optionReadList<wordRe>("patches"));
|
||||||
}
|
}
|
||||||
const bool selectedZones = args.optionFound("faceZones");
|
if (args.optionFound("faceZones"))
|
||||||
wordReList zonePatterns;
|
|
||||||
if (selectedZones)
|
|
||||||
{
|
{
|
||||||
zonePatterns = wordReList(args.optionLookup("faceZones")());
|
writeOpts.faceZoneSelection(args.optionReadList<wordRe>("faceZones"));
|
||||||
}
|
|
||||||
|
|
||||||
const bool selectedFields = args.optionFound("fields");
|
|
||||||
wordReList fieldPatterns;
|
|
||||||
if (selectedFields)
|
|
||||||
{
|
|
||||||
fieldPatterns = wordReList(args.optionLookup("fields")());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// output configuration (field related)
|
||||||
|
//
|
||||||
const bool noLagrangian = args.optionFound("noLagrangian");
|
const bool noLagrangian = args.optionFound("noLagrangian");
|
||||||
|
|
||||||
word cellZoneName;
|
wordReList fieldPatterns;
|
||||||
const bool doCellZone = args.optionReadIfPresent("cellZone", cellZoneName);
|
if (args.optionFound("fields"))
|
||||||
|
{
|
||||||
|
fieldPatterns = args.optionReadList<wordRe>("fields");
|
||||||
|
}
|
||||||
|
|
||||||
fvMeshSubset meshSubsetter(mesh);
|
word cellZoneName;
|
||||||
if (doCellZone)
|
if (args.optionReadIfPresent("cellZone", cellZoneName))
|
||||||
{
|
{
|
||||||
Info<< "Converting cellZone " << cellZoneName
|
Info<< "Converting cellZone " << cellZoneName
|
||||||
<< " only (puts outside faces into patch "
|
<< " only (puts outside faces into patch "
|
||||||
<< mesh.boundaryMesh()[0].name()
|
<< mesh.boundaryMesh()[0].name() << ")"
|
||||||
<< ")" << endl;
|
<< endl;
|
||||||
const cellZone& cz = mesh.cellZones()[cellZoneName];
|
|
||||||
cellSet c0(mesh, "c0", labelHashSet(cz));
|
|
||||||
meshSubsetter.setLargeCellSubset(c0, 0);
|
|
||||||
}
|
}
|
||||||
|
meshSubsetHelper myMesh(mesh, meshSubsetHelper::ZONE, cellZoneName);
|
||||||
|
|
||||||
ensightMesh eMesh
|
//
|
||||||
|
// Open new ensight case file, initialize header etc.
|
||||||
|
//
|
||||||
|
ensightCase ensCase
|
||||||
(
|
(
|
||||||
(
|
ensightDir,
|
||||||
meshSubsetter.hasSubMesh()
|
args.globalCaseName(),
|
||||||
? meshSubsetter.subMesh()
|
caseOpts
|
||||||
: meshSubsetter.baseMesh()
|
|
||||||
),
|
|
||||||
args.optionFound("noPatches"),
|
|
||||||
selectedPatches,
|
|
||||||
patchPatterns,
|
|
||||||
selectedZones,
|
|
||||||
zonePatterns,
|
|
||||||
format
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set Time to the last time before looking for the lagrangian objects
|
|
||||||
|
// Construct the Ensight mesh
|
||||||
|
ensightMesh ensMesh(myMesh.mesh(), writeOpts);
|
||||||
|
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
Info<< "Converting " << timeDirs.size() << " time steps" << nl;
|
||||||
|
ensCase.printInfo(Info) << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Set Time to the last time before looking for lagrangian objects
|
||||||
runTime.setTime(timeDirs.last(), timeDirs.size()-1);
|
runTime.setTime(timeDirs.last(), timeDirs.size()-1);
|
||||||
|
|
||||||
IOobjectList objects(mesh, runTime.timeName());
|
IOobjectList objects(mesh, runTime.timeName());
|
||||||
@ -341,42 +322,10 @@ int main(int argc, char *argv[])
|
|||||||
#include "checkMeshMoving.H"
|
#include "checkMeshMoving.H"
|
||||||
#include "findCloudFields.H"
|
#include "findCloudFields.H"
|
||||||
|
|
||||||
if (Pstream::master())
|
// test the pre-check variable if there is a moving mesh
|
||||||
{
|
// time-set for geometries
|
||||||
// test the pre-check variable if there is a moving mesh
|
// TODO: split off into separate time-set,
|
||||||
// time-set for geometries
|
// but need to verify ensight spec
|
||||||
// TODO: split off into separate time-set,
|
|
||||||
// but need to verify ensight spec
|
|
||||||
|
|
||||||
if (meshMoving)
|
|
||||||
{
|
|
||||||
ensightCaseFile
|
|
||||||
<< "GEOMETRY" << nl
|
|
||||||
<< setw(16) << "model: 1"
|
|
||||||
<< (dataMask/ensightMesh::geometryName).c_str() << nl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ensightCaseFile
|
|
||||||
<< "GEOMETRY" << nl
|
|
||||||
<< setw(16) << "model:"
|
|
||||||
<< ensightMesh::geometryName << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Add the name of the cloud(s) to the case file header
|
|
||||||
forAll(cloudNames, cloudNo)
|
|
||||||
{
|
|
||||||
const word& cloudName = cloudNames[cloudNo];
|
|
||||||
|
|
||||||
ensightCaseFile
|
|
||||||
<< setw(16) << "measured: 1"
|
|
||||||
<< fileName
|
|
||||||
(
|
|
||||||
dataMask/cloud::prefix/cloudName/"positions"
|
|
||||||
).c_str() << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Info<< "Startup in "
|
Info<< "Startup in "
|
||||||
<< timer.cpuTimeIncrement() << " s, "
|
<< timer.cpuTimeIncrement() << " s, "
|
||||||
@ -387,63 +336,25 @@ int main(int argc, char *argv[])
|
|||||||
// ignore fields that are not available for all time-steps
|
// ignore fields that are not available for all time-steps
|
||||||
HashTable<bool> fieldsToUse;
|
HashTable<bool> fieldsToUse;
|
||||||
|
|
||||||
label nTimeSteps = 0;
|
|
||||||
forAll(timeDirs, timeIndex)
|
forAll(timeDirs, timeIndex)
|
||||||
{
|
{
|
||||||
++nTimeSteps;
|
|
||||||
runTime.setTime(timeDirs[timeIndex], timeIndex);
|
runTime.setTime(timeDirs[timeIndex], timeIndex);
|
||||||
|
ensCase.nextTime(timeDirs[timeIndex]);
|
||||||
|
|
||||||
Info<< "Time [" << timeIndex << "] = " << runTime.timeName() << nl;
|
Info<< "Time [" << timeIndex << "] = " << runTime.timeName() << nl;
|
||||||
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
// the data/ITER subdirectory must exist
|
|
||||||
// Note that data/ITER is indeed a valid ensight::FileName
|
|
||||||
const fileName subDir = ensightFile::subDir(timeIndex);
|
|
||||||
mkDir(dataDir/subDir);
|
|
||||||
|
|
||||||
// place a timestamp in the directory for future reference
|
|
||||||
OFstream timeStamp(dataDir/subDir/"time");
|
|
||||||
timeStamp
|
|
||||||
<< "# timestep time" << nl
|
|
||||||
<< subDir.c_str() << " " << runTime.timeName() << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
polyMesh::readUpdateState meshState = mesh.readUpdate();
|
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)
|
if (meshState != polyMesh::UNCHANGED)
|
||||||
{
|
{
|
||||||
eMesh.correct();
|
myMesh.correct();
|
||||||
|
ensMesh.expire();
|
||||||
|
ensMesh.correct();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timeIndex == 0 || meshMoving)
|
if (timeIndex == 0 || meshMoving)
|
||||||
{
|
{
|
||||||
eMesh.write
|
autoPtr<ensightGeoFile> os = ensCase.newGeometry(meshMoving);
|
||||||
(
|
ensMesh.write(os);
|
||||||
dataDir,
|
|
||||||
timeIndex,
|
|
||||||
meshMoving,
|
|
||||||
ensightCaseFile
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Start of field data output
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
if (timeIndex == 0 && Pstream::master())
|
|
||||||
{
|
|
||||||
ensightCaseFile<< nl << "VARIABLE" << nl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -451,22 +362,20 @@ int main(int argc, char *argv[])
|
|||||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||||
Info<< "Write volume field (";
|
Info<< "Write volume field (";
|
||||||
|
|
||||||
for (label i=0; i<nVolFieldTypes; ++i)
|
forAll(volFieldTypes, typei)
|
||||||
{
|
{
|
||||||
wordList fieldNames = objects.names(volFieldTypes[i]);
|
const word& fieldType = volFieldTypes[typei];
|
||||||
|
wordList fieldNames = objects.names(fieldType);
|
||||||
|
|
||||||
forAll(fieldNames, j)
|
// Filter on name as required
|
||||||
|
if (!fieldPatterns.empty())
|
||||||
{
|
{
|
||||||
const word& fieldName = fieldNames[j];
|
inplaceSubsetStrings(fieldPatterns, fieldNames);
|
||||||
|
}
|
||||||
|
|
||||||
// Check if the field has to be exported
|
forAll(fieldNames, fieldi)
|
||||||
if (selectedFields)
|
{
|
||||||
{
|
const word& fieldName = fieldNames[fieldi];
|
||||||
if (!findStrings(fieldPatterns, fieldName))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "checkData.H"
|
#include "checkData.H"
|
||||||
|
|
||||||
@ -484,151 +393,206 @@ int main(int argc, char *argv[])
|
|||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
if (volFieldTypes[i] == volScalarField::typeName)
|
bool wrote = false;
|
||||||
|
if (fieldType == volScalarField::typeName)
|
||||||
{
|
{
|
||||||
|
autoPtr<ensightFile> os = ensCase.newData<scalar>
|
||||||
|
(
|
||||||
|
fieldName
|
||||||
|
);
|
||||||
|
|
||||||
volScalarField vf(fieldObject, mesh);
|
volScalarField vf(fieldObject, mesh);
|
||||||
ensightField<scalar>
|
wrote = ensightOutput::writeField<scalar>
|
||||||
(
|
(
|
||||||
volField(meshSubsetter, vf),
|
myMesh.interpolate(vf),
|
||||||
eMesh,
|
ensMesh,
|
||||||
dataDir,
|
os,
|
||||||
timeIndex,
|
nodeValues
|
||||||
nodeValues,
|
|
||||||
ensightCaseFile
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (volFieldTypes[i] == volVectorField::typeName)
|
else if (fieldType == volVectorField::typeName)
|
||||||
{
|
{
|
||||||
|
autoPtr<ensightFile> os = ensCase.newData<vector>
|
||||||
|
(
|
||||||
|
fieldName
|
||||||
|
);
|
||||||
|
|
||||||
volVectorField vf(fieldObject, mesh);
|
volVectorField vf(fieldObject, mesh);
|
||||||
ensightField<vector>
|
wrote = ensightOutput::writeField<vector>
|
||||||
(
|
(
|
||||||
volField(meshSubsetter, vf),
|
myMesh.interpolate(vf),
|
||||||
eMesh,
|
ensMesh,
|
||||||
dataDir,
|
os,
|
||||||
timeIndex,
|
nodeValues
|
||||||
nodeValues,
|
|
||||||
ensightCaseFile
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (volFieldTypes[i] == volSphericalTensorField::typeName)
|
else if (fieldType == volSphericalTensorField::typeName)
|
||||||
{
|
{
|
||||||
|
autoPtr<ensightFile> os = ensCase.newData<sphericalTensor>
|
||||||
|
(
|
||||||
|
fieldObject.name()
|
||||||
|
);
|
||||||
|
|
||||||
volSphericalTensorField vf(fieldObject, mesh);
|
volSphericalTensorField vf(fieldObject, mesh);
|
||||||
ensightField<sphericalTensor>
|
wrote = ensightOutput::writeField<sphericalTensor>
|
||||||
(
|
(
|
||||||
volField(meshSubsetter, vf),
|
myMesh.interpolate(vf),
|
||||||
eMesh,
|
ensMesh,
|
||||||
dataDir,
|
os,
|
||||||
timeIndex,
|
nodeValues
|
||||||
nodeValues,
|
|
||||||
ensightCaseFile
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (volFieldTypes[i] == volSymmTensorField::typeName)
|
else if (fieldType == volSymmTensorField::typeName)
|
||||||
{
|
{
|
||||||
|
autoPtr<ensightFile> os = ensCase.newData<symmTensor>
|
||||||
|
(
|
||||||
|
fieldName
|
||||||
|
);
|
||||||
|
|
||||||
volSymmTensorField vf(fieldObject, mesh);
|
volSymmTensorField vf(fieldObject, mesh);
|
||||||
ensightField<symmTensor>
|
wrote = ensightOutput::writeField<symmTensor>
|
||||||
(
|
(
|
||||||
volField(meshSubsetter, vf),
|
myMesh.interpolate(vf),
|
||||||
eMesh,
|
ensMesh,
|
||||||
dataDir,
|
os,
|
||||||
timeIndex,
|
nodeValues
|
||||||
nodeValues,
|
|
||||||
ensightCaseFile
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (volFieldTypes[i] == volTensorField::typeName)
|
else if (fieldType == volTensorField::typeName)
|
||||||
{
|
{
|
||||||
volTensorField vf(fieldObject, mesh);
|
autoPtr<ensightFile> os = ensCase.newData<tensor>
|
||||||
ensightField<tensor>
|
|
||||||
(
|
(
|
||||||
volField(meshSubsetter, vf),
|
fieldName
|
||||||
eMesh,
|
);
|
||||||
dataDir,
|
|
||||||
timeIndex,
|
volTensorField vf(fieldObject, mesh);
|
||||||
nodeValues,
|
wrote = ensightOutput::writeField<tensor>
|
||||||
ensightCaseFile
|
(
|
||||||
|
myMesh.interpolate(vf),
|
||||||
|
ensMesh,
|
||||||
|
os,
|
||||||
|
nodeValues
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// DimensionedFields
|
// DimensionedFields
|
||||||
else if
|
else if
|
||||||
(
|
(
|
||||||
volFieldTypes[i] == volScalarField::Internal::typeName
|
fieldType
|
||||||
|
== volScalarField::Internal::typeName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
volScalarField::Internal df(fieldObject, mesh);
|
autoPtr<ensightFile> os = ensCase.newData<scalar>
|
||||||
ensightField<scalar>
|
|
||||||
(
|
(
|
||||||
volField<scalar>(meshSubsetter, df),
|
fieldName
|
||||||
eMesh,
|
);
|
||||||
dataDir,
|
|
||||||
timeIndex,
|
volScalarField::Internal df
|
||||||
nodeValues,
|
(
|
||||||
ensightCaseFile
|
fieldObject,
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
wrote = ensightOutput::writeField<scalar>
|
||||||
|
(
|
||||||
|
myMesh.interpolate<scalar>(df),
|
||||||
|
ensMesh,
|
||||||
|
os,
|
||||||
|
nodeValues
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if
|
else if
|
||||||
(
|
(
|
||||||
volFieldTypes[i] == volVectorField::Internal::typeName
|
fieldType
|
||||||
|
== volVectorField::Internal::typeName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
volVectorField::Internal df(fieldObject, mesh);
|
autoPtr<ensightFile> os = ensCase.newData<vector>
|
||||||
ensightField<vector>
|
|
||||||
(
|
(
|
||||||
volField<vector>(meshSubsetter, df),
|
fieldName
|
||||||
eMesh,
|
);
|
||||||
dataDir,
|
|
||||||
timeIndex,
|
volVectorField::Internal df
|
||||||
nodeValues,
|
(
|
||||||
ensightCaseFile
|
fieldObject,
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
wrote = ensightOutput::writeField<vector>
|
||||||
|
(
|
||||||
|
myMesh.interpolate<vector>(df),
|
||||||
|
ensMesh,
|
||||||
|
os,
|
||||||
|
nodeValues
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if
|
else if
|
||||||
(
|
(
|
||||||
volFieldTypes[i]
|
fieldType
|
||||||
== volSphericalTensorField::Internal::typeName
|
== volSphericalTensorField::Internal::typeName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
volSphericalTensorField::Internal df(fieldObject, mesh);
|
autoPtr<ensightFile> os = ensCase.newData<sphericalTensor>
|
||||||
ensightField<sphericalTensor>
|
|
||||||
(
|
(
|
||||||
volField<sphericalTensor>(meshSubsetter, df),
|
fieldName
|
||||||
eMesh,
|
);
|
||||||
dataDir,
|
|
||||||
timeIndex,
|
volSphericalTensorField::Internal df
|
||||||
nodeValues,
|
(
|
||||||
ensightCaseFile
|
fieldObject,
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
wrote = ensightOutput::writeField<sphericalTensor>
|
||||||
|
(
|
||||||
|
myMesh.interpolate<sphericalTensor>(df),
|
||||||
|
ensMesh,
|
||||||
|
os,
|
||||||
|
nodeValues
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if
|
else if
|
||||||
(
|
(
|
||||||
volFieldTypes[i] == volSymmTensorField::Internal::typeName
|
fieldType
|
||||||
|
== volSymmTensorField::Internal::typeName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
volSymmTensorField::Internal df(fieldObject, mesh);
|
autoPtr<ensightFile> os = ensCase.newData<symmTensor>
|
||||||
ensightField<symmTensor>
|
|
||||||
(
|
(
|
||||||
volField<symmTensor>(meshSubsetter, df),
|
fieldName
|
||||||
eMesh,
|
);
|
||||||
dataDir,
|
|
||||||
timeIndex,
|
volSymmTensorField::Internal df
|
||||||
nodeValues,
|
(
|
||||||
ensightCaseFile
|
fieldObject,
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
wrote = ensightOutput::writeField<symmTensor>
|
||||||
|
(
|
||||||
|
myMesh.interpolate<symmTensor>(df),
|
||||||
|
ensMesh,
|
||||||
|
os,
|
||||||
|
nodeValues
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if
|
else if
|
||||||
(
|
(
|
||||||
volFieldTypes[i] == volTensorField::Internal::typeName
|
fieldType
|
||||||
|
== volTensorField::Internal::typeName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
volTensorField::Internal df(fieldObject, mesh);
|
autoPtr<ensightFile> os = ensCase.newData<tensor>
|
||||||
ensightField<tensor>
|
|
||||||
(
|
(
|
||||||
volField<tensor>(meshSubsetter, df),
|
fieldName
|
||||||
eMesh,
|
);
|
||||||
dataDir,
|
|
||||||
timeIndex,
|
volTensorField::Internal df
|
||||||
nodeValues,
|
(
|
||||||
ensightCaseFile
|
fieldObject,
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
wrote = ensightOutput::writeField<tensor>
|
||||||
|
(
|
||||||
|
myMesh.interpolate<tensor>(df),
|
||||||
|
ensMesh,
|
||||||
|
os,
|
||||||
|
nodeValues
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -636,6 +600,11 @@ int main(int argc, char *argv[])
|
|||||||
// Do not currently handle this type - blacklist for the future.
|
// Do not currently handle this type - blacklist for the future.
|
||||||
fieldsToUse.set(fieldName, false);
|
fieldsToUse.set(fieldName, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (wrote)
|
||||||
|
{
|
||||||
|
Info<< ' ' << fieldName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Info<< " )" << nl;
|
Info<< " )" << nl;
|
||||||
@ -660,15 +629,23 @@ int main(int argc, char *argv[])
|
|||||||
bool cloudExists = inFileNameList(currentCloudDirs, cloudName);
|
bool cloudExists = inFileNameList(currentCloudDirs, cloudName);
|
||||||
reduce(cloudExists, orOp<bool>());
|
reduce(cloudExists, orOp<bool>());
|
||||||
|
|
||||||
ensightParticlePositions
|
{
|
||||||
(
|
autoPtr<ensightFile> os = ensCase.newCloud(cloudName);
|
||||||
mesh,
|
|
||||||
dataDir,
|
ensightCloud::writePositions
|
||||||
timeIndex,
|
(
|
||||||
cloudName,
|
mesh,
|
||||||
cloudExists,
|
cloudName,
|
||||||
format
|
cloudExists,
|
||||||
);
|
os
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< " positions";
|
||||||
|
if (!cloudExists)
|
||||||
|
{
|
||||||
|
Info<< "{0}"; // report empty field
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
forAllConstIter(HashTable<word>, theseCloudFields, fieldIter)
|
forAllConstIter(HashTable<word>, theseCloudFields, fieldIter)
|
||||||
{
|
{
|
||||||
@ -684,40 +661,46 @@ int main(int argc, char *argv[])
|
|||||||
IOobject::MUST_READ
|
IOobject::MUST_READ
|
||||||
);
|
);
|
||||||
|
|
||||||
bool fieldExists = fieldObject.typeHeaderOk<IOField<scalar>>
|
// cannot have field without cloud positions
|
||||||
(
|
bool fieldExists = cloudExists;
|
||||||
false
|
if (cloudExists)
|
||||||
);
|
{
|
||||||
reduce(fieldExists, orOp<bool>());
|
fieldExists =
|
||||||
|
fieldObject.typeHeaderOk<IOField<scalar>>(false);
|
||||||
|
|
||||||
|
reduce(fieldExists, orOp<bool>());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wrote = false;
|
||||||
if (fieldType == scalarIOField::typeName)
|
if (fieldType == scalarIOField::typeName)
|
||||||
{
|
{
|
||||||
ensightCloudField<scalar>
|
autoPtr<ensightFile> os =
|
||||||
|
ensCase.newCloudData<scalar>(cloudName, fieldName);
|
||||||
|
|
||||||
|
wrote = ensightCloud::writeCloudField<scalar>
|
||||||
(
|
(
|
||||||
fieldObject,
|
fieldObject, fieldExists, os
|
||||||
dataDir,
|
|
||||||
timeIndex,
|
|
||||||
cloudName,
|
|
||||||
cloudNo,
|
|
||||||
ensightCaseFile,
|
|
||||||
fieldExists,
|
|
||||||
format
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (fieldType == vectorIOField::typeName)
|
else if (fieldType == vectorIOField::typeName)
|
||||||
{
|
{
|
||||||
ensightCloudField<vector>
|
autoPtr<ensightFile> os =
|
||||||
|
ensCase.newCloudData<vector>(cloudName, fieldName);
|
||||||
|
|
||||||
|
wrote = ensightCloud::writeCloudField<vector>
|
||||||
(
|
(
|
||||||
fieldObject,
|
fieldObject, fieldExists, os
|
||||||
dataDir,
|
|
||||||
timeIndex,
|
|
||||||
cloudName,
|
|
||||||
cloudNo,
|
|
||||||
ensightCaseFile,
|
|
||||||
fieldExists,
|
|
||||||
format
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (wrote)
|
||||||
|
{
|
||||||
|
Info<< ' ' << fieldName;
|
||||||
|
if (!fieldExists)
|
||||||
|
{
|
||||||
|
Info<< "{0}"; // report empty field
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Info<< " )" << nl;
|
Info<< " )" << nl;
|
||||||
}
|
}
|
||||||
@ -727,12 +710,7 @@ int main(int argc, char *argv[])
|
|||||||
<< mem.update().size() << " kB" << nl << nl;
|
<< mem.update().size() << " kB" << nl << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "ensightCaseTail.H"
|
ensCase.write();
|
||||||
|
|
||||||
if (ensightCaseFilePtr) // on master only
|
|
||||||
{
|
|
||||||
delete ensightCaseFilePtr;
|
|
||||||
}
|
|
||||||
|
|
||||||
Info<< "End: "
|
Info<< "End: "
|
||||||
<< timer.elapsedCpuTime() << " s, "
|
<< timer.elapsedCpuTime() << " s, "
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
ensightOutputSerialCloud.C
|
||||||
foamToEnsightParts.C
|
foamToEnsightParts.C
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/foamToEnsightParts
|
EXE = $(FOAM_APPBIN)/foamToEnsightParts
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// check for "points" in all of the result directories
|
// check for "points" in all of the result directories
|
||||||
// - could restrict to the selected times
|
// - could restrict to the selected times
|
||||||
|
|
||||||
bool hasMovingMesh = false;
|
bool meshMoving = false;
|
||||||
|
|
||||||
if (timeDirs.size() > 1 && Pstream::master())
|
if (timeDirs.size() > 1 && Pstream::master())
|
||||||
{
|
{
|
||||||
@ -13,7 +13,7 @@ if (timeDirs.size() > 1 && Pstream::master())
|
|||||||
Info<< "Search for moving mesh ... " << flush;
|
Info<< "Search for moving mesh ... " << flush;
|
||||||
forAll(timeDirs, timeI)
|
forAll(timeDirs, timeI)
|
||||||
{
|
{
|
||||||
hasMovingMesh =
|
meshMoving =
|
||||||
(
|
(
|
||||||
isDir(baseDir/timeDirs[timeI].name()/polyMesh::meshSubDir)
|
isDir(baseDir/timeDirs[timeI].name()/polyMesh::meshSubDir)
|
||||||
&& IOobject
|
&& IOobject
|
||||||
@ -28,13 +28,13 @@ if (timeDirs.size() > 1 && Pstream::master())
|
|||||||
).typeHeaderOk<pointIOField>(true)
|
).typeHeaderOk<pointIOField>(true)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (hasMovingMesh)
|
if (meshMoving)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasMovingMesh)
|
if (meshMoving)
|
||||||
{
|
{
|
||||||
Info<< "found." << nl
|
Info<< "found." << nl
|
||||||
<< " Writing meshes for every timestep." << endl;
|
<< " Writing meshes for every timestep." << endl;
|
||||||
@ -45,4 +45,4 @@ if (timeDirs.size() > 1 && Pstream::master())
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reduce(hasMovingMesh, orOp<bool>());
|
reduce(meshMoving, orOp<bool>());
|
||||||
@ -1,270 +0,0 @@
|
|||||||
// write time values to case file
|
|
||||||
|
|
||||||
scalar timeCorrection = 0;
|
|
||||||
if (timeDirs[0].value() < 0)
|
|
||||||
{
|
|
||||||
timeCorrection = - timeDirs[0].value();
|
|
||||||
Info<< "Correcting time values. Adding " << timeCorrection << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// the case file is always ASCII
|
|
||||||
Info<< "write case: " << caseFileName.c_str() << endl;
|
|
||||||
|
|
||||||
OFstream caseFile(ensightDir/caseFileName, IOstream::ASCII);
|
|
||||||
caseFile.setf(ios_base::left);
|
|
||||||
|
|
||||||
caseFile.setf(ios_base::scientific, ios_base::floatfield);
|
|
||||||
caseFile.precision(5);
|
|
||||||
|
|
||||||
caseFile
|
|
||||||
<< "FORMAT" << nl
|
|
||||||
<< setw(16) << "type:" << "ensight gold" << nl << nl;
|
|
||||||
|
|
||||||
// time-set for geometries
|
|
||||||
// TODO: split off into separate time-set, but need to verify ensight spec
|
|
||||||
if (geometryTimesUsed.size())
|
|
||||||
{
|
|
||||||
caseFile
|
|
||||||
<< "GEOMETRY" << nl
|
|
||||||
<< setw(16) << "model: 1" << (dataMask/geometryName).c_str() << nl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
caseFile
|
|
||||||
<< "GEOMETRY" << nl
|
|
||||||
<< setw(16) << "model:" << geometryName << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// add information for clouds
|
|
||||||
// multiple clouds currently require the same time index
|
|
||||||
forAllConstIter(HashTable<HashTable<word>>, cloudFields, cloudIter)
|
|
||||||
{
|
|
||||||
const word& cloudName = cloudIter.key();
|
|
||||||
|
|
||||||
caseFile
|
|
||||||
<< setw(16) << "measured: 2"
|
|
||||||
<< fileName(dataMask/cloud::prefix/cloudName/"positions").c_str()
|
|
||||||
<< nl;
|
|
||||||
}
|
|
||||||
caseFile
|
|
||||||
<< nl << "VARIABLE" << nl;
|
|
||||||
|
|
||||||
forAllConstIter(HashTable<word>, volumeFields, fieldIter)
|
|
||||||
{
|
|
||||||
const word& fieldName = fieldIter.key();
|
|
||||||
const word& fieldType = fieldIter();
|
|
||||||
string ensightType;
|
|
||||||
|
|
||||||
if (fieldType == volScalarField::typeName)
|
|
||||||
{
|
|
||||||
ensightType = ensightPTraits<scalar>::typeName;
|
|
||||||
}
|
|
||||||
else if (fieldType == volVectorField::typeName)
|
|
||||||
{
|
|
||||||
ensightType = ensightPTraits<vector>::typeName;
|
|
||||||
}
|
|
||||||
else if (fieldType == volSphericalTensorField::typeName)
|
|
||||||
{
|
|
||||||
ensightType = ensightPTraits<sphericalTensor>::typeName;
|
|
||||||
}
|
|
||||||
else if (fieldType == volSymmTensorField::typeName)
|
|
||||||
{
|
|
||||||
ensightType = ensightPTraits<symmTensor>::typeName;
|
|
||||||
}
|
|
||||||
else if (fieldType == volTensorField::typeName)
|
|
||||||
{
|
|
||||||
ensightType = ensightPTraits<tensor>::typeName;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ensightCaseEntry
|
|
||||||
(
|
|
||||||
caseFile,
|
|
||||||
ensightType,
|
|
||||||
fieldName,
|
|
||||||
dataMask
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: allow similar/different time-steps for each cloud
|
|
||||||
label cloudNo = 0;
|
|
||||||
forAllConstIter(HashTable<HashTable<word>>, cloudFields, cloudIter)
|
|
||||||
{
|
|
||||||
const word& cloudName = cloudIter.key();
|
|
||||||
|
|
||||||
forAllConstIter(HashTable<word>, cloudIter(), fieldIter)
|
|
||||||
{
|
|
||||||
const word& fieldName = fieldIter.key();
|
|
||||||
const word& fieldType = fieldIter();
|
|
||||||
string ensightType;
|
|
||||||
|
|
||||||
if (fieldType == scalarIOField::typeName)
|
|
||||||
{
|
|
||||||
ensightType = ensightPTraits<scalar>::typeName;
|
|
||||||
}
|
|
||||||
else if (fieldType == vectorIOField::typeName)
|
|
||||||
{
|
|
||||||
ensightType = ensightPTraits<vector>::typeName;
|
|
||||||
}
|
|
||||||
else if (fieldType == tensorIOField::typeName)
|
|
||||||
{
|
|
||||||
ensightType = ensightPTraits<tensor>::typeName;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ensightCaseEntry
|
|
||||||
(
|
|
||||||
caseFile,
|
|
||||||
ensightType,
|
|
||||||
fieldName,
|
|
||||||
dataMask,
|
|
||||||
cloud::prefix/cloudName,
|
|
||||||
cloudNo,
|
|
||||||
2
|
|
||||||
);
|
|
||||||
}
|
|
||||||
cloudNo++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// add time values
|
|
||||||
caseFile << nl << "TIME" << nl;
|
|
||||||
|
|
||||||
// time set 1 - volume fields
|
|
||||||
if (fieldTimesUsed.size())
|
|
||||||
{
|
|
||||||
caseFile
|
|
||||||
<< "time set: " << 1 << nl
|
|
||||||
<< "number of steps: " << fieldTimesUsed.size() << nl
|
|
||||||
<< "filename numbers:" << nl;
|
|
||||||
|
|
||||||
label count = 0;
|
|
||||||
forAll(fieldTimesUsed, i)
|
|
||||||
{
|
|
||||||
caseFile
|
|
||||||
<< " " << setw(12) << fieldTimesUsed[i];
|
|
||||||
|
|
||||||
if (++count % 6 == 0)
|
|
||||||
{
|
|
||||||
caseFile << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
caseFile
|
|
||||||
<< nl << "time values:" << nl;
|
|
||||||
|
|
||||||
count = 0;
|
|
||||||
forAll(fieldTimesUsed, i)
|
|
||||||
{
|
|
||||||
const label index = fieldTimesUsed[i];
|
|
||||||
caseFile
|
|
||||||
<< " " << setw(12) << timeIndices[index] + timeCorrection;
|
|
||||||
|
|
||||||
if (++count % 6 == 0)
|
|
||||||
{
|
|
||||||
caseFile << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
caseFile << nl << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// time set 2 - geometry
|
|
||||||
// THIS NEEDS MORE CHECKING
|
|
||||||
#if 0
|
|
||||||
if (geometryTimesUsed.size())
|
|
||||||
{
|
|
||||||
caseFile
|
|
||||||
<< "time set: " << 2 << nl
|
|
||||||
<< "number of steps: " << geometryTimesUsed.size() << nl
|
|
||||||
<< "filename numbers:" << nl;
|
|
||||||
|
|
||||||
label count = 0;
|
|
||||||
forAll(geometryTimesUsed, i)
|
|
||||||
{
|
|
||||||
caseFile
|
|
||||||
<< " " << setw(12) << geometryTimesUsed[i];
|
|
||||||
|
|
||||||
if (++count % 6 == 0)
|
|
||||||
{
|
|
||||||
caseFile << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
caseFile
|
|
||||||
<< nl << "time values:" << nl;
|
|
||||||
|
|
||||||
count = 0;
|
|
||||||
forAll(geometryTimesUsed, i)
|
|
||||||
{
|
|
||||||
const label index = geometryTimesUsed[i];
|
|
||||||
caseFile
|
|
||||||
<< " " << setw(12) << timeIndices[index] + timeCorrection;
|
|
||||||
|
|
||||||
if (++count % 6 == 0)
|
|
||||||
{
|
|
||||||
caseFile << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
caseFile << nl << nl;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// time set - clouds
|
|
||||||
// TODO: allow similar/different time-steps for each cloud
|
|
||||||
cloudNo = 0;
|
|
||||||
forAllConstIter(HashTable<DynamicList<label>>, cloudTimesUsed, cloudIter)
|
|
||||||
{
|
|
||||||
// const word& cloudName = cloudIter.key();
|
|
||||||
const DynamicList<label>& timesUsed = cloudIter();
|
|
||||||
|
|
||||||
if (timesUsed.size() && cloudNo == 0)
|
|
||||||
{
|
|
||||||
caseFile
|
|
||||||
<< "time set: " << 2 << nl
|
|
||||||
<< "number of steps: " << timesUsed.size() << nl
|
|
||||||
<< "filename numbers:" << nl;
|
|
||||||
|
|
||||||
label count = 0;
|
|
||||||
forAll(timesUsed, i)
|
|
||||||
{
|
|
||||||
caseFile
|
|
||||||
<< " " << setw(12) << timesUsed[i];
|
|
||||||
|
|
||||||
if (++count % 6 == 0)
|
|
||||||
{
|
|
||||||
caseFile << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
caseFile
|
|
||||||
<< nl << "time values:" << nl;
|
|
||||||
|
|
||||||
count = 0;
|
|
||||||
forAll(timesUsed, i)
|
|
||||||
{
|
|
||||||
const label index = timesUsed[i];
|
|
||||||
caseFile
|
|
||||||
<< " " << setw(12) << timeIndices[index] + timeCorrection;
|
|
||||||
|
|
||||||
if (++count % 6 == 0)
|
|
||||||
{
|
|
||||||
caseFile << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
caseFile << nl << nl;
|
|
||||||
|
|
||||||
cloudNo++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
caseFile << "# end" << nl;
|
|
||||||
|
|
||||||
@ -1,245 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation | Copyright (C) 2016 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 "ensightOutputFunctions.H"
|
|
||||||
#include "ensightPTraits.H"
|
|
||||||
|
|
||||||
#include "passiveParticle.H"
|
|
||||||
#include "IOField.H"
|
|
||||||
#include "volFields.H"
|
|
||||||
#include "surfaceFields.H"
|
|
||||||
|
|
||||||
#include "OFstream.H"
|
|
||||||
#include "IOmanip.H"
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void Foam::ensightCaseEntry
|
|
||||||
(
|
|
||||||
OFstream& caseFile,
|
|
||||||
const string& ensightType,
|
|
||||||
const word& fieldName,
|
|
||||||
const fileName& dataMask,
|
|
||||||
const fileName& local,
|
|
||||||
const label cloudNo,
|
|
||||||
const label timeSet
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const ensight::VarName varName(fieldName);
|
|
||||||
|
|
||||||
caseFile.setf(ios_base::left);
|
|
||||||
|
|
||||||
fileName dirName(dataMask);
|
|
||||||
if (local.size())
|
|
||||||
{
|
|
||||||
dirName = dirName/local;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cloudNo >= 0)
|
|
||||||
{
|
|
||||||
label ts = 1;
|
|
||||||
if (timeSet > ts)
|
|
||||||
{
|
|
||||||
ts = timeSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
// prefix variables with 'c' (cloud)
|
|
||||||
caseFile
|
|
||||||
<< ensightType.c_str()
|
|
||||||
<< " per measured node: " << ts << " "
|
|
||||||
<< setw(15)
|
|
||||||
<< ("c" + Foam::name(cloudNo) + varName).c_str()
|
|
||||||
<< " "
|
|
||||||
<< (dirName/varName).c_str()
|
|
||||||
<< nl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
caseFile
|
|
||||||
<< ensightType.c_str()
|
|
||||||
<< " per element: "
|
|
||||||
<< setw(15) << varName
|
|
||||||
<< " "
|
|
||||||
<< (dirName/varName).c_str()
|
|
||||||
<< nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::ensightParticlePositions
|
|
||||||
(
|
|
||||||
const polyMesh& mesh,
|
|
||||||
const fileName& dataDir,
|
|
||||||
const fileName& subDir,
|
|
||||||
const word& cloudName,
|
|
||||||
IOstream::streamFormat format
|
|
||||||
)
|
|
||||||
{
|
|
||||||
Cloud<passiveParticle> parcels(mesh, cloudName, false);
|
|
||||||
|
|
||||||
const fileName postFileName =
|
|
||||||
subDir/cloud::prefix/cloudName/"positions";
|
|
||||||
|
|
||||||
// the ITER/lagrangian subdirectory must exist
|
|
||||||
mkDir(dataDir/postFileName.path());
|
|
||||||
ensightFile os(dataDir, postFileName, format);
|
|
||||||
|
|
||||||
// tag binary format (just like geometry files)
|
|
||||||
os.writeBinaryHeader();
|
|
||||||
os.write(postFileName); // description
|
|
||||||
os.newline();
|
|
||||||
os.write("particle coordinates");
|
|
||||||
os.newline();
|
|
||||||
os.write(parcels.size(), 8); // unusual width
|
|
||||||
os.newline();
|
|
||||||
|
|
||||||
// binary write is Ensight6 - first ids, then positions
|
|
||||||
if (format == IOstream::BINARY)
|
|
||||||
{
|
|
||||||
forAll(parcels, i)
|
|
||||||
{
|
|
||||||
os.write(i+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
forAllConstIter(Cloud<passiveParticle>, parcels, elmnt)
|
|
||||||
{
|
|
||||||
const vector& p = elmnt().position();
|
|
||||||
|
|
||||||
os.write(p.x());
|
|
||||||
os.write(p.y());
|
|
||||||
os.write(p.z());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
label nParcels = 0;
|
|
||||||
|
|
||||||
forAllConstIter(Cloud<passiveParticle>, parcels, elmnt)
|
|
||||||
{
|
|
||||||
const vector& p = elmnt().position();
|
|
||||||
|
|
||||||
os.write(++nParcels, 8); // unusual width
|
|
||||||
os.write(p.x());
|
|
||||||
os.write(p.y());
|
|
||||||
os.write(p.z());
|
|
||||||
os.newline();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::ensightLagrangianField
|
|
||||||
(
|
|
||||||
const IOobject& fieldObject,
|
|
||||||
const fileName& dataDir,
|
|
||||||
const fileName& subDir,
|
|
||||||
const word& cloudName,
|
|
||||||
IOstream::streamFormat format
|
|
||||||
)
|
|
||||||
{
|
|
||||||
Info<< " " << fieldObject.name() << flush;
|
|
||||||
|
|
||||||
const fileName postFileName =
|
|
||||||
subDir/cloud::prefix/cloudName
|
|
||||||
/ensight::VarName(fieldObject.name());
|
|
||||||
|
|
||||||
// the ITER/lagrangian subdirectory was already created
|
|
||||||
// when writing positions
|
|
||||||
|
|
||||||
ensightFile os(dataDir, postFileName, format);
|
|
||||||
// description
|
|
||||||
os.write(string(postFileName + " <" + pTraits<Type>::typeName + ">"));
|
|
||||||
os.newline();
|
|
||||||
|
|
||||||
IOField<Type> field(fieldObject);
|
|
||||||
|
|
||||||
// 6 values per line
|
|
||||||
label count = 0;
|
|
||||||
|
|
||||||
forAll(field, i)
|
|
||||||
{
|
|
||||||
Type val = field[i];
|
|
||||||
|
|
||||||
if (mag(val) < 1e-90)
|
|
||||||
{
|
|
||||||
val = Zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (direction d=0; d < pTraits<Type>::nComponents; ++d)
|
|
||||||
{
|
|
||||||
label cmpt = ensightPTraits<Type>::componentOrder[d];
|
|
||||||
os.write(component(val, cmpt));
|
|
||||||
|
|
||||||
if (++count % 6 == 0)
|
|
||||||
{
|
|
||||||
os.newline();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// add final newline if required
|
|
||||||
if (count % 6)
|
|
||||||
{
|
|
||||||
os.newline();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::ensightVolField
|
|
||||||
(
|
|
||||||
const ensightParts& partsList,
|
|
||||||
const IOobject& fieldObject,
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const fileName& dataDir,
|
|
||||||
const fileName& subDir,
|
|
||||||
IOstream::streamFormat format
|
|
||||||
)
|
|
||||||
{
|
|
||||||
Info<< " " << fieldObject.name() << flush;
|
|
||||||
|
|
||||||
const fileName postFileName = subDir/ensight::VarName(fieldObject.name());
|
|
||||||
|
|
||||||
ensightFile os(dataDir, postFileName, format);
|
|
||||||
os.write(postFileName); // description
|
|
||||||
os.newline();
|
|
||||||
|
|
||||||
// ie, volField<Type>
|
|
||||||
partsList.writeField
|
|
||||||
(
|
|
||||||
os,
|
|
||||||
GeometricField<Type, fvPatchField, volMesh>
|
|
||||||
(
|
|
||||||
fieldObject,
|
|
||||||
mesh
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -0,0 +1,95 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation | Copyright (C) 2016 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 "ensightOutputSerialCloud.H"
|
||||||
|
#include "ensightPTraits.H"
|
||||||
|
|
||||||
|
#include "passiveParticle.H"
|
||||||
|
#include "IOField.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::ensightSerialCloud::writePositions
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const word& cloudName,
|
||||||
|
autoPtr<ensightFile> output
|
||||||
|
)
|
||||||
|
{
|
||||||
|
label nTotParcels = 0;
|
||||||
|
autoPtr<Cloud<passiveParticle>> cloudPtr;
|
||||||
|
|
||||||
|
cloudPtr.reset(new Cloud<passiveParticle>(mesh, cloudName, false));
|
||||||
|
nTotParcels = cloudPtr().size();
|
||||||
|
|
||||||
|
Cloud<passiveParticle> parcels(mesh, cloudName, false);
|
||||||
|
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
ensightFile& os = output();
|
||||||
|
os.beginParticleCoordinates(nTotParcels);
|
||||||
|
|
||||||
|
// binary write is Ensight6 - first ids, then positions
|
||||||
|
if (os.format() == IOstream::BINARY)
|
||||||
|
{
|
||||||
|
// 1-index
|
||||||
|
for (label parcelId = 0; parcelId < nTotParcels; ++parcelId)
|
||||||
|
{
|
||||||
|
os.write(parcelId+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
forAllConstIter(Cloud<passiveParticle>, cloudPtr(), elmnt)
|
||||||
|
{
|
||||||
|
const vector& p = elmnt().position();
|
||||||
|
|
||||||
|
os.write(p.x());
|
||||||
|
os.write(p.y());
|
||||||
|
os.write(p.z());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// ASCII id + position together
|
||||||
|
|
||||||
|
label parcelId = 0;
|
||||||
|
forAllConstIter(Cloud<passiveParticle>, cloudPtr(), elmnt)
|
||||||
|
{
|
||||||
|
const vector& p = elmnt().position();
|
||||||
|
|
||||||
|
os.write(++parcelId, 8); // unusual width
|
||||||
|
os.write(p.x());
|
||||||
|
os.write(p.y());
|
||||||
|
os.write(p.z());
|
||||||
|
os.newline();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -21,68 +21,65 @@ License
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
InApplication
|
|
||||||
foamToEnsight
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
Miscellaneous collection of functions and template related to Ensight data
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
ensightCloud.C
|
ensightOutputFunctions.C
|
||||||
ensightCloudTemplates.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef ensightCloud_H
|
#ifndef ensightOutputSerialCloud_H
|
||||||
#define ensightCloud_H
|
#define ensightOutputSerialCloud_H
|
||||||
|
|
||||||
#include "ensightFile.H"
|
#include "ensightFile.H"
|
||||||
#include "fvMesh.H"
|
|
||||||
#include "Cloud.H"
|
#include "Cloud.H"
|
||||||
|
#include "polyMesh.H"
|
||||||
#include "IOobject.H"
|
#include "IOobject.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
namespace ensightSerialCloud
|
||||||
|
{
|
||||||
|
|
||||||
void ensightParticlePositions
|
//- Write cloud positions
|
||||||
|
void writePositions
|
||||||
(
|
(
|
||||||
const fvMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const fileName& dataDir,
|
|
||||||
const label timeIndex,
|
|
||||||
const word& cloudName,
|
const word& cloudName,
|
||||||
const bool dataExists,
|
autoPtr<ensightFile> output
|
||||||
const IOstream::streamFormat format
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Write cloud field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void ensightCloudField
|
bool writeCloudField
|
||||||
(
|
|
||||||
const IOobject& fieldObject,
|
|
||||||
const fileName& dataDir,
|
|
||||||
const label timeIndex,
|
|
||||||
const word& cloudName,
|
|
||||||
const label cloudNo,
|
|
||||||
Ostream& ensightCaseFile,
|
|
||||||
const bool dataExists,
|
|
||||||
const IOstream::streamFormat format
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void writeCloudField
|
|
||||||
(
|
(
|
||||||
const IOField<Type>& field,
|
const IOField<Type>& field,
|
||||||
ensightFile& os
|
ensightFile& os
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
|
||||||
|
//- Write cloud field
|
||||||
|
template<class Type>
|
||||||
|
bool writeCloudField
|
||||||
|
(
|
||||||
|
const IOobject& fieldObject,
|
||||||
|
autoPtr<ensightFile> output
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace ensightSerialCloud
|
||||||
|
} // namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
#ifdef NoRepository
|
#ifdef NoRepository
|
||||||
#include "ensightCloudTemplates.C"
|
#include "ensightOutputSerialCloudTemplates.C"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -21,56 +21,69 @@ License
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Description
|
|
||||||
Template to write generalized field components
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "ensightPart.H"
|
#include "ensightOutputSerialCloud.H"
|
||||||
|
#include "ensightSerialOutput.H"
|
||||||
#include "ensightPTraits.H"
|
#include "ensightPTraits.H"
|
||||||
|
|
||||||
|
#include "passiveParticle.H"
|
||||||
|
#include "IOField.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::ensightPart::writeField
|
bool Foam::ensightSerialCloud::writeCloudField
|
||||||
(
|
(
|
||||||
ensightFile& os,
|
const IOField<Type>& field,
|
||||||
const Field<Type>& field,
|
ensightFile& os
|
||||||
const bool perNode
|
)
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
if (this->size() && field.size())
|
// 6 values per line
|
||||||
|
label count = 0;
|
||||||
|
|
||||||
|
forAll(field, i)
|
||||||
{
|
{
|
||||||
writeHeader(os);
|
Type val = field[i];
|
||||||
|
|
||||||
if (perNode)
|
if (mag(val) < 1e-90)
|
||||||
{
|
{
|
||||||
os.writeKeyword("coordinates");
|
val = Zero;
|
||||||
for (direction d=0; d < pTraits<Type>::nComponents; ++d)
|
|
||||||
{
|
|
||||||
label cmpt = ensightPTraits<Type>::componentOrder[d];
|
|
||||||
writeFieldList(os, field.component(cmpt), labelUList::null());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
for (direction d=0; d < pTraits<Type>::nComponents; ++d)
|
||||||
{
|
{
|
||||||
forAll(elementTypes(), elemI)
|
label cmpt = ensightPTraits<Type>::componentOrder[d];
|
||||||
|
os.write(component(val, cmpt));
|
||||||
|
|
||||||
|
if (++count % 6 == 0)
|
||||||
{
|
{
|
||||||
const labelUList& idList = elemLists_[elemI];
|
os.newline();
|
||||||
|
|
||||||
if (idList.size())
|
|
||||||
{
|
|
||||||
os.writeKeyword(elementTypes()[elemI]);
|
|
||||||
|
|
||||||
for (direction d=0; d < pTraits<Type>::nComponents; ++d)
|
|
||||||
{
|
|
||||||
label cmpt = ensightPTraits<Type>::componentOrder[d];
|
|
||||||
writeFieldList(os, field.component(cmpt), idList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add final newline if required
|
||||||
|
if (count % 6)
|
||||||
|
{
|
||||||
|
os.newline();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
bool Foam::ensightSerialCloud::writeCloudField
|
||||||
|
(
|
||||||
|
const IOobject& fieldObject,
|
||||||
|
autoPtr<ensightFile> output
|
||||||
|
)
|
||||||
|
{
|
||||||
|
IOField<Type> field(fieldObject);
|
||||||
|
return writeCloudField(field, output.rawRef());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -78,8 +78,14 @@ Note
|
|||||||
#include "scalarIOField.H"
|
#include "scalarIOField.H"
|
||||||
#include "tensorIOField.H"
|
#include "tensorIOField.H"
|
||||||
|
|
||||||
|
// file-format/conversion
|
||||||
|
#include "ensightCase.H"
|
||||||
|
#include "ensightGeoFile.H"
|
||||||
#include "ensightParts.H"
|
#include "ensightParts.H"
|
||||||
#include "ensightOutputFunctions.H"
|
#include "ensightSerialOutput.H"
|
||||||
|
|
||||||
|
// local files
|
||||||
|
#include "ensightOutputSerialCloud.H"
|
||||||
|
|
||||||
#include "memInfo.H"
|
#include "memInfo.H"
|
||||||
|
|
||||||
@ -133,33 +139,25 @@ int main(int argc, char *argv[])
|
|||||||
);
|
);
|
||||||
|
|
||||||
// The volume field types that we handle
|
// The volume field types that we handle
|
||||||
wordHashSet volFieldTypes;
|
const wordHashSet volFieldTypes
|
||||||
volFieldTypes.insert(volScalarField::typeName);
|
{
|
||||||
volFieldTypes.insert(volVectorField::typeName);
|
volScalarField::typeName,
|
||||||
volFieldTypes.insert(volSphericalTensorField::typeName);
|
volVectorField::typeName,
|
||||||
volFieldTypes.insert(volSymmTensorField::typeName);
|
volSphericalTensorField::typeName,
|
||||||
volFieldTypes.insert(volTensorField::typeName);
|
volSymmTensorField::typeName,
|
||||||
|
volTensorField::typeName
|
||||||
|
};
|
||||||
|
|
||||||
// The lagrangian field types that we handle
|
// The lagrangian field types that we handle
|
||||||
wordHashSet cloudFieldTypes;
|
const wordHashSet cloudFieldTypes
|
||||||
cloudFieldTypes.insert(scalarIOField::typeName);
|
{
|
||||||
cloudFieldTypes.insert(vectorIOField::typeName);
|
scalarIOField::typeName,
|
||||||
cloudFieldTypes.insert(tensorIOField::typeName);
|
vectorIOField::typeName,
|
||||||
|
tensorIOField::typeName
|
||||||
const char* geometryName = "geometry";
|
};
|
||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
|
|
||||||
cpuTime timer;
|
|
||||||
memInfo mem;
|
|
||||||
Info<< "Initial memory "
|
|
||||||
<< mem.update().size() << " kB" << endl;
|
|
||||||
|
|
||||||
#include "createTime.H"
|
|
||||||
|
|
||||||
// Get times list
|
|
||||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
|
||||||
|
|
||||||
// Default to binary output, unless otherwise specified
|
// Default to binary output, unless otherwise specified
|
||||||
const IOstream::streamFormat format =
|
const IOstream::streamFormat format =
|
||||||
(
|
(
|
||||||
@ -168,6 +166,57 @@ int main(int argc, char *argv[])
|
|||||||
: IOstream::BINARY
|
: IOstream::BINARY
|
||||||
);
|
);
|
||||||
|
|
||||||
|
cpuTime timer;
|
||||||
|
memInfo mem;
|
||||||
|
Info<< "Initial memory " << mem.update().size() << " kB" << endl;
|
||||||
|
|
||||||
|
#include "createTime.H"
|
||||||
|
|
||||||
|
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||||
|
|
||||||
|
#include "createNamedMesh.H"
|
||||||
|
|
||||||
|
fileName regionPrefix; // Mesh instance (region0 gets filtered out)
|
||||||
|
if (regionName != polyMesh::defaultRegion)
|
||||||
|
{
|
||||||
|
regionPrefix = regionName;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// general (case) output options
|
||||||
|
//
|
||||||
|
ensightCase::options caseOpts(format);
|
||||||
|
|
||||||
|
caseOpts.width(args.optionLookupOrDefault<label>("width", 8));
|
||||||
|
caseOpts.overwrite(false); // leave existing output directory
|
||||||
|
|
||||||
|
// Can also have separate directory for lagrangian
|
||||||
|
// caseOpts.separateCloud(true);
|
||||||
|
|
||||||
|
// Define sub-directory name to use for EnSight data.
|
||||||
|
// The path to the ensight directory is at case level only
|
||||||
|
// - For parallel cases, data only written from master
|
||||||
|
fileName ensightDir = args.optionLookupOrDefault<word>("name", "Ensight");
|
||||||
|
if (!ensightDir.isAbsolute())
|
||||||
|
{
|
||||||
|
ensightDir = args.rootPath()/args.globalCaseName()/ensightDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Open new ensight case file, initialize header etc.
|
||||||
|
//
|
||||||
|
ensightCase ensCase
|
||||||
|
(
|
||||||
|
ensightDir,
|
||||||
|
"Ensight", // args.globalCaseName(),
|
||||||
|
caseOpts
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Miscellaneous output configuration
|
||||||
|
//
|
||||||
|
|
||||||
// Control for renumbering iterations
|
// Control for renumbering iterations
|
||||||
label indexingNumber = 0;
|
label indexingNumber = 0;
|
||||||
const bool optIndex = args.optionReadIfPresent("index", indexingNumber);
|
const bool optIndex = args.optionReadIfPresent("index", indexingNumber);
|
||||||
@ -176,93 +225,32 @@ int main(int argc, char *argv[])
|
|||||||
// Always write the geometry, unless the -noMesh option is specified
|
// Always write the geometry, unless the -noMesh option is specified
|
||||||
bool optNoMesh = args.optionFound("noMesh");
|
bool optNoMesh = args.optionFound("noMesh");
|
||||||
|
|
||||||
// Adjust output width
|
|
||||||
if (args.optionFound("width"))
|
|
||||||
{
|
|
||||||
ensightFile::subDirWidth(args.optionRead<label>("width"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Define sub-directory name to use for Ensight data
|
|
||||||
fileName ensightDir = "Ensight";
|
|
||||||
args.optionReadIfPresent("name", ensightDir);
|
|
||||||
|
|
||||||
if (!ensightDir.isAbsolute())
|
|
||||||
{
|
|
||||||
ensightDir = args.rootPath()/args.globalCaseName()/ensightDir;
|
|
||||||
}
|
|
||||||
|
|
||||||
const fileName caseFileName = "Ensight.case";
|
|
||||||
const fileName dataDir = ensightDir/"data";
|
|
||||||
const fileName dataMask = dataDir.name()/ensightFile::mask();
|
|
||||||
|
|
||||||
// Ensight and Ensight/data directories must exist
|
|
||||||
// do not remove old data - we might wish to convert new results
|
|
||||||
// or a particular time interval
|
|
||||||
if (isDir(ensightDir))
|
|
||||||
{
|
|
||||||
Info<<"Warning: re-using existing directory" << nl
|
|
||||||
<< " " << ensightDir << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// As per mkdir -p "Ensight/data"
|
|
||||||
mkDir(ensightDir);
|
|
||||||
mkDir(dataDir);
|
|
||||||
|
|
||||||
#include "createNamedMesh.H"
|
|
||||||
|
|
||||||
// Mesh instance (region0 gets filtered out)
|
|
||||||
fileName regionPrefix;
|
|
||||||
|
|
||||||
if (regionName != polyMesh::defaultRegion)
|
|
||||||
{
|
|
||||||
regionPrefix = regionName;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
Info<< "Converting " << timeDirs.size() << " time steps" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Construct the list of ensight parts for the entire mesh
|
// Construct the list of ensight parts for the entire mesh
|
||||||
ensightParts partsList(mesh);
|
ensightParts partsList(mesh);
|
||||||
|
|
||||||
// Write summary information
|
// Write summary information
|
||||||
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
OFstream partsInfoFile(ensightDir/"partsInfo");
|
Info<< "Converting " << timeDirs.size() << " time steps" << endl;
|
||||||
|
|
||||||
partsInfoFile
|
OFstream info(ensCase.path()/"partsInfo");
|
||||||
|
|
||||||
|
info
|
||||||
<< "// summary of ensight parts" << nl << nl;
|
<< "// summary of ensight parts" << nl << nl;
|
||||||
partsList.writeSummary(partsInfoFile);
|
partsList.writeSummary(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "checkHasMovingMesh.H"
|
#include "checkMeshMoving.H"
|
||||||
#include "findFields.H"
|
#include "findFields.H"
|
||||||
|
|
||||||
if (hasMovingMesh && optNoMesh)
|
if (meshMoving && optNoMesh)
|
||||||
{
|
{
|
||||||
Info<< "mesh is moving: ignoring '-noMesh' option" << endl;
|
Info<< "mesh is moving: ignoring '-noMesh' option" << endl;
|
||||||
optNoMesh = false;
|
optNoMesh = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Map times used
|
|
||||||
Map<scalar> timeIndices;
|
|
||||||
|
|
||||||
// TODO: Track the time indices used by the geometry
|
|
||||||
DynamicList<label> geometryTimesUsed;
|
|
||||||
|
|
||||||
// Track the time indices used by the volume fields
|
|
||||||
DynamicList<label> fieldTimesUsed;
|
|
||||||
|
|
||||||
// Track the time indices used by each cloud
|
|
||||||
HashTable<DynamicList<label>> cloudTimesUsed;
|
|
||||||
|
|
||||||
// Create a new DynamicList for each cloud
|
|
||||||
forAllConstIter(HashTable<HashTable<word>>, cloudFields, cloudIter)
|
|
||||||
{
|
|
||||||
cloudTimesUsed.insert(cloudIter.key(), DynamicList<label>());
|
|
||||||
}
|
|
||||||
|
|
||||||
Info<< "Startup in "
|
Info<< "Startup in "
|
||||||
<< timer.cpuTimeIncrement() << " s, "
|
<< timer.cpuTimeIncrement() << " s, "
|
||||||
<< mem.update().size() << " kB" << nl << endl;
|
<< mem.update().size() << " kB" << nl << endl;
|
||||||
@ -272,25 +260,10 @@ int main(int argc, char *argv[])
|
|||||||
runTime.setTime(timeDirs[timeI], timeI);
|
runTime.setTime(timeDirs[timeI], timeI);
|
||||||
|
|
||||||
#include "getTimeIndex.H"
|
#include "getTimeIndex.H"
|
||||||
|
|
||||||
// Remember the time index for the volume fields
|
|
||||||
fieldTimesUsed.append(timeIndex);
|
|
||||||
|
|
||||||
// The data/ITER subdirectory must exist
|
|
||||||
// Note that data/ITER is indeed a valid ensight::FileName
|
|
||||||
const fileName subDir = ensightFile::subDir(timeIndex);
|
|
||||||
mkDir(dataDir/subDir);
|
|
||||||
|
|
||||||
// Place a timestamp in the directory for future reference
|
|
||||||
{
|
|
||||||
OFstream timeStamp(dataDir/subDir/"time");
|
|
||||||
timeStamp
|
|
||||||
<< "# timestep time" << nl
|
|
||||||
<< subDir.c_str() << " " << runTime.timeName() << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "moveMesh.H"
|
#include "moveMesh.H"
|
||||||
|
|
||||||
|
ensCase.setTime(timeDirs[timeI], timeIndex);
|
||||||
|
|
||||||
if (timeI == 0 || mesh.moving())
|
if (timeI == 0 || mesh.moving())
|
||||||
{
|
{
|
||||||
if (mesh.moving())
|
if (mesh.moving())
|
||||||
@ -300,19 +273,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (!optNoMesh)
|
if (!optNoMesh)
|
||||||
{
|
{
|
||||||
if (hasMovingMesh)
|
autoPtr<ensightGeoFile> os = ensCase.newGeometry(meshMoving);
|
||||||
{
|
partsList.write(os.rawRef());
|
||||||
// Remember the time index for the geometry
|
|
||||||
geometryTimesUsed.append(timeIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
ensightGeoFile geoFile
|
|
||||||
(
|
|
||||||
(hasMovingMesh ? dataDir/subDir : ensightDir),
|
|
||||||
geometryName,
|
|
||||||
format
|
|
||||||
);
|
|
||||||
partsList.writeGeometry(geoFile);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,68 +294,76 @@ int main(int argc, char *argv[])
|
|||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
bool wrote = false;
|
||||||
if (fieldType == volScalarField::typeName)
|
if (fieldType == volScalarField::typeName)
|
||||||
{
|
{
|
||||||
ensightVolField<scalar>
|
autoPtr<ensightFile> os = ensCase.newData<scalar>
|
||||||
(
|
(
|
||||||
partsList,
|
fieldName
|
||||||
fieldObject,
|
|
||||||
mesh,
|
|
||||||
dataDir,
|
|
||||||
subDir,
|
|
||||||
format
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
volScalarField vf(fieldObject, mesh);
|
||||||
|
wrote = ensightSerialOutput::writeField<scalar>
|
||||||
|
(
|
||||||
|
vf, partsList, os
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else if (fieldType == volVectorField::typeName)
|
else if (fieldType == volVectorField::typeName)
|
||||||
{
|
{
|
||||||
ensightVolField<vector>
|
autoPtr<ensightFile> os = ensCase.newData<vector>
|
||||||
(
|
(
|
||||||
partsList,
|
fieldName
|
||||||
fieldObject,
|
|
||||||
mesh,
|
|
||||||
dataDir,
|
|
||||||
subDir,
|
|
||||||
format
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
volVectorField vf(fieldObject, mesh);
|
||||||
|
wrote = ensightSerialOutput::writeField<vector>
|
||||||
|
(
|
||||||
|
vf, partsList, os
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else if (fieldType == volSphericalTensorField::typeName)
|
else if (fieldType == volSphericalTensorField::typeName)
|
||||||
{
|
{
|
||||||
ensightVolField<sphericalTensor>
|
autoPtr<ensightFile> os = ensCase.newData<sphericalTensor>
|
||||||
(
|
(
|
||||||
partsList,
|
fieldName
|
||||||
fieldObject,
|
|
||||||
mesh,
|
|
||||||
dataDir,
|
|
||||||
subDir,
|
|
||||||
format
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
volSphericalTensorField vf(fieldObject, mesh);
|
||||||
|
wrote = ensightSerialOutput::writeField<sphericalTensor>
|
||||||
|
(
|
||||||
|
vf, partsList, os
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else if (fieldType == volSymmTensorField::typeName)
|
else if (fieldType == volSymmTensorField::typeName)
|
||||||
{
|
{
|
||||||
ensightVolField<symmTensor>
|
autoPtr<ensightFile> os = ensCase.newData<symmTensor>
|
||||||
(
|
(
|
||||||
partsList,
|
fieldName
|
||||||
fieldObject,
|
);
|
||||||
mesh,
|
|
||||||
dataDir,
|
volSymmTensorField vf(fieldObject, mesh);
|
||||||
subDir,
|
wrote = ensightSerialOutput::writeField<symmTensor>
|
||||||
format
|
(
|
||||||
|
vf, partsList, os
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (fieldType == volTensorField::typeName)
|
else if (fieldType == volTensorField::typeName)
|
||||||
{
|
{
|
||||||
ensightVolField<tensor>
|
autoPtr<ensightFile> os = ensCase.newData<tensor>
|
||||||
(
|
(
|
||||||
partsList,
|
fieldName
|
||||||
fieldObject,
|
|
||||||
mesh,
|
|
||||||
dataDir,
|
|
||||||
subDir,
|
|
||||||
format
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
volTensorField vf(fieldObject, mesh);
|
||||||
|
wrote = ensightSerialOutput::writeField<tensor>
|
||||||
|
(
|
||||||
|
vf, partsList, os
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wrote)
|
||||||
|
{
|
||||||
|
Info<< " " << fieldObject.name() << flush;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Info<< " )" << endl;
|
Info<< " )" << endl;
|
||||||
@ -422,16 +392,16 @@ int main(int argc, char *argv[])
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "Write " << cloudName << " ( positions" << flush;
|
Info<< "Write " << cloudName << " (" << flush;
|
||||||
|
|
||||||
ensightParticlePositions
|
ensightSerialCloud::writePositions
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
dataDir,
|
|
||||||
subDir,
|
|
||||||
cloudName,
|
cloudName,
|
||||||
format
|
ensCase.newCloud(cloudName)
|
||||||
);
|
);
|
||||||
|
Info<< " positions";
|
||||||
|
|
||||||
|
|
||||||
forAllConstIter(HashTable<word>, cloudIter(), fieldIter)
|
forAllConstIter(HashTable<word>, cloudIter(), fieldIter)
|
||||||
{
|
{
|
||||||
@ -449,48 +419,39 @@ int main(int argc, char *argv[])
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wrote = false;
|
||||||
if (fieldType == scalarIOField::typeName)
|
if (fieldType == scalarIOField::typeName)
|
||||||
{
|
{
|
||||||
ensightLagrangianField<scalar>
|
wrote = ensightSerialCloud::writeCloudField<scalar>
|
||||||
(
|
(
|
||||||
*fieldObject,
|
*fieldObject,
|
||||||
dataDir,
|
ensCase.newCloudData<scalar>(cloudName, fieldName)
|
||||||
subDir,
|
|
||||||
cloudName,
|
|
||||||
format
|
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (fieldType == vectorIOField::typeName)
|
else if (fieldType == vectorIOField::typeName)
|
||||||
{
|
{
|
||||||
ensightLagrangianField<vector>
|
wrote = ensightSerialCloud::writeCloudField<vector>
|
||||||
(
|
(
|
||||||
*fieldObject,
|
*fieldObject,
|
||||||
dataDir,
|
ensCase.newCloudData<vector>(cloudName, fieldName)
|
||||||
subDir,
|
|
||||||
cloudName,
|
|
||||||
format
|
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (fieldType == tensorIOField::typeName)
|
else if (fieldType == tensorIOField::typeName)
|
||||||
{
|
{
|
||||||
ensightLagrangianField<tensor>
|
wrote = ensightSerialCloud::writeCloudField<tensor>
|
||||||
(
|
(
|
||||||
*fieldObject,
|
*fieldObject,
|
||||||
dataDir,
|
ensCase.newCloudData<tensor>(cloudName, fieldName)
|
||||||
subDir,
|
|
||||||
cloudName,
|
|
||||||
format
|
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wrote)
|
||||||
|
{
|
||||||
|
Info<< " " << fieldObject->name();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< " )" << endl;
|
Info<< " )" << endl;
|
||||||
|
|
||||||
// Remember the time index
|
|
||||||
cloudTimesUsed[cloudName].append(timeIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "Wrote in "
|
Info<< "Wrote in "
|
||||||
@ -498,7 +459,7 @@ int main(int argc, char *argv[])
|
|||||||
<< mem.update().size() << " kB" << endl;
|
<< mem.update().size() << " kB" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "ensightOutputCase.H"
|
ensCase.write();
|
||||||
|
|
||||||
Info<< "\nEnd: "
|
Info<< "\nEnd: "
|
||||||
<< timer.elapsedCpuTime() << " s, "
|
<< timer.elapsedCpuTime() << " s, "
|
||||||
|
|||||||
@ -38,6 +38,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
timeIndices.insert(timeIndex, timeDirs[timeI].value());
|
|
||||||
Info<< nl << "Time [" << timeIndex << "] = " << runTime.timeName() << nl;
|
Info<< nl << "Time [" << timeIndex << "] = " << runTime.timeName() << nl;
|
||||||
|
|
||||||
|
// end-of-file
|
||||||
|
|||||||
@ -4,11 +4,13 @@ cd ${0%/*} || exit 1 # Run from this directory
|
|||||||
# Parse arguments for application compilation (at least for error control)
|
# Parse arguments for application compilation (at least for error control)
|
||||||
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
||||||
|
|
||||||
if [ ! -d ${WM_THIRD_PARTY_DIR}/tecio ]
|
export TECIO_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/tecio
|
||||||
|
if [ -f $TECIO_ARCH_PATH/TECIO.h -a -r $TECIO_ARCH_PATH/libtecio.a ]
|
||||||
then
|
then
|
||||||
echo "Did not find tecio in ${WM_THIRD_PARTY_DIR}. Not building foamToTecplot360."
|
echo "Building optional tecplot conversion component."
|
||||||
else
|
|
||||||
wmake $targetType
|
wmake $targetType
|
||||||
|
else
|
||||||
|
echo "Skipping optional tecplot conversion components (no tecio detected)."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
tecplotWriter.C
|
tecplotWriter.C
|
||||||
vtkMesh.C
|
|
||||||
foamToTecplot360.C
|
foamToTecplot360.C
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/foamToTecplot360
|
EXE = $(FOAM_APPBIN)/foamToTecplot360
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
|
/* Tecio doesn't have many files, so they are just in a single directory */
|
||||||
|
|
||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(WM_THIRD_PARTY_DIR)/tecio/tecsrc/lnInclude \
|
-I$(TECIO_ARCH_PATH) \
|
||||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude
|
-I$(LIB_SRC)/meshTools/lnInclude
|
||||||
|
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
|
-L$(TECIO_ARCH_PATH) -ltecio \
|
||||||
-llagrangian \
|
-llagrangian \
|
||||||
-ldynamicMesh \
|
-ldynamicMesh \
|
||||||
-ldynamicMesh \
|
-lgenericPatchFields
|
||||||
-lgenericPatchFields \
|
|
||||||
-L$(FOAM_EXT_LIBBIN) -ltecio
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -2,8 +2,8 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -36,37 +36,32 @@ namespace Foam
|
|||||||
template<class GeoField>
|
template<class GeoField>
|
||||||
void readFields
|
void readFields
|
||||||
(
|
(
|
||||||
const vtkMesh& vMesh,
|
const meshSubsetHelper& helper,
|
||||||
const typename GeoField::Mesh& mesh,
|
const typename GeoField::Mesh& mesh,
|
||||||
const IOobjectList& objects,
|
const IOobjectList& objects,
|
||||||
const HashSet<word>& selectedFields,
|
const HashSet<word>& selectedFields,
|
||||||
PtrList<GeoField>& fields
|
PtrList<const GeoField>& fields
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Search list of objects for volScalarFields
|
// Search list of objects for fields of type GeomField
|
||||||
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));
|
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));
|
||||||
|
|
||||||
// Construct the vol scalar fields
|
// Construct the fields
|
||||||
label nFields = fields.size();
|
fields.setSize(fieldObjects.size());
|
||||||
fields.setSize(nFields + fieldObjects.size());
|
label nFields = 0;
|
||||||
|
|
||||||
forAllIter(IOobjectList, fieldObjects, iter)
|
forAllConstIter(IOobjectList, fieldObjects, iter)
|
||||||
{
|
{
|
||||||
if (selectedFields.empty() || selectedFields.found(iter()->name()))
|
if (selectedFields.empty() || selectedFields.found(iter()->name()))
|
||||||
{
|
{
|
||||||
fields.set
|
fields.set
|
||||||
(
|
(
|
||||||
nFields,
|
nFields++,
|
||||||
vMesh.interpolate
|
helper.interpolate
|
||||||
(
|
(
|
||||||
GeoField
|
GeoField(*iter(), mesh)
|
||||||
(
|
).ptr()
|
||||||
*iter(),
|
|
||||||
mesh
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
nFields++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -34,7 +34,7 @@ SourceFiles
|
|||||||
#ifndef readFields_H
|
#ifndef readFields_H
|
||||||
#define readFields_H
|
#define readFields_H
|
||||||
|
|
||||||
#include "fvMesh.H"
|
#include "meshSubsetHelper.H"
|
||||||
#include "PtrList.H"
|
#include "PtrList.H"
|
||||||
#include "IOobjectList.H"
|
#include "IOobjectList.H"
|
||||||
#include "HashSet.H"
|
#include "HashSet.H"
|
||||||
@ -48,11 +48,11 @@ namespace Foam
|
|||||||
template<class GeoField>
|
template<class GeoField>
|
||||||
void readFields
|
void readFields
|
||||||
(
|
(
|
||||||
const vtkMesh& vMesh,
|
const meshSubsetHelper&,
|
||||||
const typename GeoField::Mesh& mesh,
|
const typename GeoField::Mesh& mesh,
|
||||||
const IOobjectList& objects,
|
const IOobjectList& objects,
|
||||||
const HashSet<word>& selectedFields,
|
const HashSet<word>& selectedFields,
|
||||||
PtrList<GeoField>& fields
|
PtrList<const GeoField>& fields
|
||||||
);
|
);
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,13 +25,23 @@ License
|
|||||||
|
|
||||||
#include "tecplotWriter.H"
|
#include "tecplotWriter.H"
|
||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
|
#include "TECIO.h"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const int32_t Foam::tecplotWriter::tecConst_0 = 0;
|
||||||
|
const int32_t Foam::tecplotWriter::tecConst_1 = 1;
|
||||||
|
const int32_t Foam::tecplotWriter::tecConst_False = 0;
|
||||||
|
const int32_t Foam::tecplotWriter::tecConst_True = 1;
|
||||||
|
|
||||||
|
const Foam::string Foam::tecplotWriter::XYZ = "X Y Z";
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Construct from components
|
|
||||||
Foam::tecplotWriter::tecplotWriter(const Time& runTime)
|
Foam::tecplotWriter::tecplotWriter(const Time& runTime)
|
||||||
:
|
:
|
||||||
runTime_(runTime)
|
time_(runTime)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -42,35 +52,37 @@ void Foam::tecplotWriter::writeInit
|
|||||||
const word& name,
|
const word& name,
|
||||||
const string& varNames,
|
const string& varNames,
|
||||||
const fileName& fName,
|
const fileName& fName,
|
||||||
INTEGER4 tecplotFileType
|
const dataFileType fileType
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
Pout<< endl
|
const int32_t FileType = fileType;
|
||||||
<< endl
|
const int32_t FileFormat = 0; // 0 = binary (plt), 1 = subzone (.szplt)
|
||||||
<< "Name:" << name
|
|
||||||
<< " varNames:" << varNames
|
Pout<< nl << nl
|
||||||
<< " to file:" << fName
|
<< "Name:" << name
|
||||||
<< " of type:" << tecplotFileType
|
<< " varNames:" << varNames
|
||||||
<< endl;
|
<< " to file:" << fName
|
||||||
|
<< " of type:" << int(fileType)
|
||||||
|
<< endl;
|
||||||
|
|
||||||
INTEGER4 IsDouble = 0; //float
|
|
||||||
INTEGER4 Debug = 0; //nodebug
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
!TECINI112
|
tecini142
|
||||||
(
|
(
|
||||||
const_cast<char*>(name.c_str()), /* Data Set Title */
|
name.c_str(), //< DataSet Title
|
||||||
const_cast<char*>(varNames.c_str()), /* Variable List */
|
varNames.c_str(), //< Variables List
|
||||||
const_cast<char*>(fName.c_str()), /* File Name */
|
fName.c_str(), //< FileName
|
||||||
const_cast<char*>(runTime_.path().c_str()), /* Scratch Directory */
|
time_.path().c_str(), //< ScratchDir
|
||||||
&tecplotFileType,
|
&FileFormat, //< FileFormat
|
||||||
&Debug,
|
&FileType, //< FileType
|
||||||
&IsDouble
|
&tecConst_False, //< Debug (0: no debug, 1: debug)
|
||||||
|
&tecConst_False //< VIsDouble (0: single, 1: double)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
// << "Error in TECINI112." << exit(FatalError);
|
<< "Error in tecini142."
|
||||||
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,78 +90,60 @@ Pout<< endl
|
|||||||
void Foam::tecplotWriter::writePolyhedralZone
|
void Foam::tecplotWriter::writePolyhedralZone
|
||||||
(
|
(
|
||||||
const word& zoneName,
|
const word& zoneName,
|
||||||
INTEGER4 strandID,
|
const int32_t strandID,
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
const List<INTEGER4>& varLocArray,
|
const UList<int32_t>& varLocArray,
|
||||||
INTEGER4 nFaceNodes
|
const int32_t NumFaceNodes
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
/* Call TECZNE112 */
|
const int32_t NumNodes = mesh.nPoints(); // Number of unique nodes
|
||||||
INTEGER4 NumNodes = mesh.nPoints(); /* number of unique nodes */
|
const int32_t NumElems = mesh.nCells(); // Number of elements
|
||||||
INTEGER4 NumElems = mesh.nCells(); /* number of elements */
|
const int32_t NumFaces = mesh.nFaces(); // Number of unique faces
|
||||||
INTEGER4 NumFaces = mesh.nFaces(); /* number of unique faces */
|
const double SolTime = time_.value(); // Solution time
|
||||||
|
|
||||||
INTEGER4 ICellMax = 0; /* Not Used, set to zero */
|
const int32_t ParentZone = 0; // Bool: 0 = no parent zone
|
||||||
INTEGER4 JCellMax = 0; /* Not Used, set to zero */
|
const int32_t ShrConn = 0;
|
||||||
INTEGER4 KCellMax = 0; /* Not Used, set to zero */
|
const int32_t NumBConns = 0; // No Boundary Connections
|
||||||
|
const int32_t NumBItems = 0; // No Boundary Items
|
||||||
|
|
||||||
double SolTime = runTime_.value(); /* solution time */
|
Pout<< "zoneName:" << zoneName
|
||||||
INTEGER4 ParentZone = 0; /* no parent zone */
|
//<< " varLocArray:" << varLocArray
|
||||||
|
<< " solTime:" << SolTime
|
||||||
INTEGER4 IsBlock = 1; /* block format */
|
<< " strand:" << strandID
|
||||||
|
<< endl;
|
||||||
INTEGER4 NFConns = 0; /* not used for FEPolyhedron
|
|
||||||
* zones
|
|
||||||
*/
|
|
||||||
INTEGER4 FNMode = 0; /* not used for FEPolyhedron
|
|
||||||
* zones
|
|
||||||
*/
|
|
||||||
Pout<< "zoneName:" << zoneName
|
|
||||||
//<< " varLocArray:" << varLocArray
|
|
||||||
<< " solTime:" << SolTime
|
|
||||||
<< endl;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
INTEGER4 *PassiveVarArray = nullptr;
|
|
||||||
INTEGER4 *VarShareArray = nullptr;
|
|
||||||
INTEGER4 ShrConn = 0;
|
|
||||||
|
|
||||||
INTEGER4 NumBConns = 0; /* No Boundary Connections */
|
|
||||||
INTEGER4 NumBItems = 0; /* No Boundary Items */
|
|
||||||
|
|
||||||
INTEGER4 ZoneType = ZoneType_FEPolyhedron;
|
|
||||||
|
|
||||||
|
const int32_t ZoneType = ZONE_FEPOLYHEDRON;
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
!TECZNE112
|
teczne142
|
||||||
(
|
(
|
||||||
const_cast<char*>(zoneName.c_str()),
|
zoneName.c_str(), //< ZoneTitle
|
||||||
&ZoneType,
|
&ZoneType, //< ZoneType
|
||||||
&NumNodes,
|
&NumNodes, //< IMxOrNumPts
|
||||||
&NumElems,
|
&NumElems, //< JMxOrNumElements
|
||||||
&NumFaces,
|
&NumFaces, //< KMxOrNumFaces
|
||||||
&ICellMax,
|
&tecConst_0, //< (unused set to zero) ICellMax
|
||||||
&JCellMax,
|
&tecConst_0, //< (unused set to zero) JCellMax
|
||||||
&KCellMax,
|
&tecConst_0, //< (unused set to zero) KCellMax
|
||||||
&SolTime,
|
&SolTime, //< SolutionTime
|
||||||
&strandID,
|
&strandID, //< StrandID
|
||||||
&ParentZone,
|
&ParentZone, //< ParentZone
|
||||||
&IsBlock,
|
&tecConst_True, //< IsBlock
|
||||||
&NFConns,
|
&tecConst_0, //< (unused) NumFaceConnections
|
||||||
&FNMode,
|
&tecConst_0, //< (unused) FaceNeighborMode
|
||||||
&nFaceNodes,
|
&NumFaceNodes, //< TotalNumFaceNodes
|
||||||
&NumBConns,
|
&NumBConns, //< NumConnectedBoundaryFaces
|
||||||
&NumBItems,
|
&NumBItems, //< TotalNumBoundaryConnections
|
||||||
PassiveVarArray,
|
nullptr, //< PassiveVarList
|
||||||
const_cast<INTEGER4*>(varLocArray.begin()),
|
varLocArray.cdata(), //< ValueLocation
|
||||||
VarShareArray,
|
nullptr, //< ShareVarFromZone
|
||||||
&ShrConn
|
&ShrConn //< ShareConnectivityFromZone
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
// << "Error in TECZNE112." << exit(FatalError);
|
<< "Error in teczne142 - writing polyhedron zones."
|
||||||
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,79 +151,61 @@ Pout<< "zoneName:" << zoneName
|
|||||||
void Foam::tecplotWriter::writePolygonalZone
|
void Foam::tecplotWriter::writePolygonalZone
|
||||||
(
|
(
|
||||||
const word& zoneName,
|
const word& zoneName,
|
||||||
INTEGER4 strandID,
|
const int32_t strandID,
|
||||||
const indirectPrimitivePatch& pp,
|
const indirectPrimitivePatch& pp,
|
||||||
const List<INTEGER4>& varLocArray
|
const UList<int32_t>& varLocArray
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
/* Call TECZNE112 */
|
const int32_t NumNodes = pp.nPoints(); // Number of unique nodes
|
||||||
INTEGER4 NumNodes = pp.nPoints(); /* number of unique nodes */
|
const int32_t NumElems = pp.size(); // Number of elements
|
||||||
INTEGER4 NumElems = pp.size(); /* number of elements */
|
const int32_t NumFaces = pp.nEdges(); // Number of unique faces
|
||||||
INTEGER4 NumFaces = pp.nEdges(); /* number of unique faces */
|
const double SolTime = time_.value(); // Solution time
|
||||||
|
|
||||||
INTEGER4 ICellMax = 0; /* Not Used, set to zero */
|
const int32_t ParentZone = 0; // Int: 0 = no parent zone
|
||||||
INTEGER4 JCellMax = 0; /* Not Used, set to zero */
|
const int32_t NumFaceNodes = 2*pp.nEdges();
|
||||||
INTEGER4 KCellMax = 0; /* Not Used, set to zero */
|
|
||||||
|
|
||||||
double SolTime = runTime_.value(); /* solution time */
|
const int32_t ShrConn = 0;
|
||||||
INTEGER4 ParentZone = 0; /* no parent zone */
|
const int32_t NumBConns = 0; // No Boundary Connections
|
||||||
|
const int32_t NumBItems = 0; // No Boundary Items
|
||||||
|
|
||||||
INTEGER4 IsBlock = 1; /* block format */
|
Pout<< "zoneName:" << zoneName
|
||||||
|
<< " strandID:" << strandID
|
||||||
INTEGER4 NFConns = 0; /* not used for FEPolyhedron
|
//<< " varLocArray:" << varLocArray
|
||||||
* zones
|
<< " solTime:" << SolTime
|
||||||
*/
|
<< endl;
|
||||||
INTEGER4 FNMode = 0; /* not used for FEPolyhedron
|
|
||||||
* zones
|
|
||||||
*/
|
|
||||||
INTEGER4 NumFaceNodes = 2*pp.nEdges();
|
|
||||||
|
|
||||||
Pout<< "zoneName:" << zoneName
|
|
||||||
<< " strandID:" << strandID
|
|
||||||
//<< " varLocArray:" << varLocArray
|
|
||||||
<< " solTime:" << SolTime
|
|
||||||
<< endl;
|
|
||||||
|
|
||||||
|
|
||||||
INTEGER4 *PassiveVarArray = nullptr;
|
|
||||||
INTEGER4 *VarShareArray = nullptr;
|
|
||||||
INTEGER4 ShrConn = 0;
|
|
||||||
|
|
||||||
INTEGER4 NumBConns = 0; /* No Boundary Connections */
|
|
||||||
INTEGER4 NumBItems = 0; /* No Boundary Items */
|
|
||||||
|
|
||||||
INTEGER4 ZoneType = ZoneType_FEPolygon;
|
|
||||||
|
|
||||||
|
const int32_t ZoneType = ZONE_FEPOLYGON;
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
!TECZNE112
|
teczne142
|
||||||
(
|
(
|
||||||
const_cast<char*>(zoneName.c_str()),
|
zoneName.c_str(), //< ZoneTitle
|
||||||
&ZoneType,
|
&ZoneType, //< ZoneType
|
||||||
&NumNodes,
|
&NumNodes, //< IMax or NumPts
|
||||||
&NumElems,
|
&NumElems, //< JMax or NumElements
|
||||||
&NumFaces,
|
&NumFaces, //< KMax or NumFaces
|
||||||
&ICellMax,
|
&tecConst_0, //< (Unused set to zero) ICellMax
|
||||||
&JCellMax,
|
&tecConst_0, //< (Unused set to zero) JCellMax
|
||||||
&KCellMax,
|
&tecConst_0, //< (Unused set to zero) KCellMax
|
||||||
&SolTime,
|
&SolTime, //< SolutionTime
|
||||||
&strandID,
|
&strandID, //< StrandID
|
||||||
&ParentZone,
|
&ParentZone, //< ParentZone
|
||||||
&IsBlock,
|
&tecConst_True, //< IsBlock
|
||||||
&NFConns,
|
&tecConst_0, //< (Unused for polygon zone) NumFaceConnections
|
||||||
&FNMode,
|
&tecConst_0, //< (Unused for polygon zone) FaceNeighborMode
|
||||||
&NumFaceNodes,
|
&NumFaceNodes, //< TotalNumFaceNodes
|
||||||
&NumBConns,
|
&NumBConns, //< NumConnectedBoundaryFaces
|
||||||
&NumBItems,
|
&NumBItems, //< TotalNumBoundaryConnections
|
||||||
PassiveVarArray,
|
nullptr, //< PassiveVarList
|
||||||
const_cast<INTEGER4*>(varLocArray.begin()),
|
varLocArray.cdata(), //< ValueLocation
|
||||||
VarShareArray,
|
nullptr, //< ShareVarFromZone
|
||||||
&ShrConn
|
&ShrConn //< ShareConnectivityFromZone
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
// << "Error in TECZNE112." << exit(FatalError);
|
<< "Error in teczne142 - writing polygon zones."
|
||||||
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,120 +213,99 @@ Pout<< "zoneName:" << zoneName
|
|||||||
void Foam::tecplotWriter::writeOrderedZone
|
void Foam::tecplotWriter::writeOrderedZone
|
||||||
(
|
(
|
||||||
const word& zoneName,
|
const word& zoneName,
|
||||||
INTEGER4 strandID,
|
const int32_t strandID,
|
||||||
const label n,
|
const label n,
|
||||||
const List<INTEGER4>& varLocArray
|
const UList<int32_t>& varLocArray
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
/* Call TECZNE112 */
|
const int32_t IMax = n; // Number in I direction
|
||||||
INTEGER4 IMax = n; /* number of unique nodes */
|
const int32_t JMax = 1; // Number in J direction
|
||||||
INTEGER4 JMax = 1; /* number of elements */
|
const int32_t KMax = 1; // Number in K direction
|
||||||
INTEGER4 KMax = 1; /* number of unique faces */
|
const double SolTime = time_.value(); // Solution time
|
||||||
|
|
||||||
INTEGER4 ICellMax = 0; /* Not Used, set to zero */
|
const int32_t ParentZone = 0; // Bool: no parent zone
|
||||||
INTEGER4 JCellMax = 0; /* Not Used, set to zero */
|
const int32_t NFConns = 0; // Unused for ordered zones
|
||||||
INTEGER4 KCellMax = 0; /* Not Used, set to zero */
|
const int32_t FNMode = 0; // Unused for ordered zones
|
||||||
|
|
||||||
double SolTime = runTime_.value(); /* solution time */
|
const int32_t ShrConn = 0;
|
||||||
INTEGER4 ParentZone = 0; /* no parent zone */
|
const int32_t NumFaceNodes = 1;
|
||||||
|
const int32_t NumBConns = 0; // No Boundary Connections
|
||||||
|
const int32_t NumBItems = 0; // No Boundary Items
|
||||||
|
|
||||||
INTEGER4 IsBlock = 1; /* block format */
|
Pout<< "zoneName:" << zoneName
|
||||||
|
<< " strandID:" << strandID
|
||||||
INTEGER4 NFConns = 0; /* not used for FEPolyhedron
|
//<< " varLocArray:" << varLocArray
|
||||||
* zones
|
<< " solTime:" << SolTime
|
||||||
*/
|
<< endl;
|
||||||
INTEGER4 FNMode = 0; /* not used for FEPolyhedron
|
|
||||||
* zones
|
|
||||||
*/
|
|
||||||
INTEGER4 NumFaceNodes = 1;
|
|
||||||
INTEGER4 NumBConns = 1; /* No Boundary Connections */
|
|
||||||
INTEGER4 NumBItems = 1; /* No Boundary Items */
|
|
||||||
|
|
||||||
Pout<< "zoneName:" << zoneName
|
|
||||||
<< " strandID:" << strandID
|
|
||||||
//<< " varLocArray:" << varLocArray
|
|
||||||
<< " solTime:" << SolTime
|
|
||||||
<< endl;
|
|
||||||
|
|
||||||
|
|
||||||
INTEGER4 *PassiveVarArray = nullptr;
|
|
||||||
INTEGER4 *VarShareArray = nullptr;
|
|
||||||
INTEGER4 ShrConn = 0;
|
|
||||||
|
|
||||||
|
|
||||||
INTEGER4 ZoneType = ZoneType_Ordered;
|
|
||||||
|
|
||||||
|
const int32_t ZoneType = ZONE_ORDERED;
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
!TECZNE112
|
teczne142
|
||||||
(
|
(
|
||||||
const_cast<char*>(zoneName.c_str()),
|
zoneName.c_str(), //< ZoneTitle
|
||||||
&ZoneType,
|
&ZoneType, //< ZoneType
|
||||||
&IMax,
|
&IMax, //< IMax or NumPts
|
||||||
&JMax,
|
&JMax, //< JMax or NumElements
|
||||||
&KMax,
|
&KMax, //< KMax or NumFaces
|
||||||
&ICellMax,
|
&tecConst_0, //< (Unused set to zero) ICellMax
|
||||||
&JCellMax,
|
&tecConst_0, //< (Unused set to zero) JCellMax
|
||||||
&KCellMax,
|
&tecConst_0, //< (Unused set to zero) KCellMax
|
||||||
&SolTime,
|
&SolTime, //< SolutionTime
|
||||||
&strandID,
|
&strandID, //< StrandID
|
||||||
&ParentZone,
|
&ParentZone, //< ParentZone
|
||||||
&IsBlock,
|
&tecConst_True, //< IsBlock
|
||||||
&NFConns,
|
&NFConns, //< NumFaceConnections
|
||||||
&FNMode,
|
&FNMode, //< FaceNeighborMode
|
||||||
&NumFaceNodes,
|
&NumFaceNodes, //< TotalNumFaceNodes
|
||||||
&NumBConns,
|
&NumBConns, //< NumConnectedBoundaryFaces
|
||||||
&NumBItems,
|
&NumBItems, //< TotalNumBoundaryConnections
|
||||||
PassiveVarArray,
|
nullptr, //< PassiveVarList
|
||||||
const_cast<INTEGER4*>(varLocArray.begin()),
|
varLocArray.cdata(), //< ValueLocation
|
||||||
VarShareArray,
|
nullptr, //< ShareVarFromZone
|
||||||
&ShrConn
|
&ShrConn //< ShareConnectivityFromZone
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
// << "Error in TECZNE112." << exit(FatalError);
|
<< "Error in teczne142 - writing ordered zones."
|
||||||
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::tecplotWriter::writeConnectivity(const fvMesh& mesh) const
|
void Foam::tecplotWriter::writeConnectivity(const fvMesh& mesh) const
|
||||||
{
|
{
|
||||||
List<INTEGER4> FaceNodeCounts(mesh.nFaces());
|
// first pass: get the sizes
|
||||||
|
List<int32_t> FaceNodeCounts(mesh.nFaces());
|
||||||
|
label nFaceNodes = 0;
|
||||||
forAll(mesh.faces(), facei)
|
forAll(mesh.faces(), facei)
|
||||||
{
|
{
|
||||||
const face& f = mesh.faces()[facei];
|
const face& f = mesh.faces()[facei];
|
||||||
FaceNodeCounts[facei] = INTEGER4(f.size());
|
nFaceNodes += f.size();
|
||||||
|
FaceNodeCounts[facei] = int32_t(f.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// second pass: get the nodes as a flat list
|
||||||
INTEGER4 nFaceNodes = 0;
|
List<int32_t> FaceNodes(nFaceNodes);
|
||||||
forAll(mesh.faces(), facei)
|
|
||||||
{
|
|
||||||
nFaceNodes += mesh.faces()[facei].size();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
List<INTEGER4> FaceNodes(nFaceNodes);
|
|
||||||
label nodeI = 0;
|
label nodeI = 0;
|
||||||
forAll(mesh.faces(), facei)
|
forAll(mesh.faces(), facei)
|
||||||
{
|
{
|
||||||
const face& f = mesh.faces()[facei];
|
const face& f = mesh.faces()[facei];
|
||||||
forAll(f, fp)
|
forAll(f, fp)
|
||||||
{
|
{
|
||||||
FaceNodes[nodeI++] = INTEGER4(f[fp]+1);
|
FaceNodes[nodeI++] = int32_t(f[fp]+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
List<INTEGER4> FaceLeftElems(mesh.nFaces());
|
List<int32_t> FaceLeftElems(mesh.nFaces());
|
||||||
forAll(mesh.faceOwner(), facei)
|
forAll(mesh.faceOwner(), facei)
|
||||||
{
|
{
|
||||||
FaceLeftElems[facei] = mesh.faceOwner()[facei]+1;
|
FaceLeftElems[facei] = mesh.faceOwner()[facei]+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<INTEGER4> FaceRightElems(mesh.nFaces());
|
List<int32_t> FaceRightElems(mesh.nFaces());
|
||||||
forAll(mesh.faceNeighbour(), facei)
|
forAll(mesh.faceNeighbour(), facei)
|
||||||
{
|
{
|
||||||
FaceRightElems[facei] = mesh.faceNeighbour()[facei]+1;
|
FaceRightElems[facei] = mesh.faceNeighbour()[facei]+1;
|
||||||
@ -367,20 +322,21 @@ void Foam::tecplotWriter::writeConnectivity(const fvMesh& mesh) const
|
|||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
!TECPOLY112
|
tecpoly142
|
||||||
(
|
(
|
||||||
FaceNodeCounts.begin(), /* The face node counts array */
|
FaceNodeCounts.cdata(), // The face node counts array
|
||||||
FaceNodes.begin(), /* The face nodes array */
|
FaceNodes.cdata(), // The face nodes array
|
||||||
FaceLeftElems.begin(), /* The left elements array */
|
FaceLeftElems.cdata(), // The left elements array
|
||||||
FaceRightElems.begin(), /* The right elements array */
|
FaceRightElems.cdata(), // The right elements array
|
||||||
nullptr, /* No boundary connection counts */
|
nullptr, // No face boundary connection counts
|
||||||
nullptr, /* No boundary connection elements */
|
nullptr, // No face boundary connection elements
|
||||||
nullptr /* No boundary connection zones */
|
nullptr // No face boundary connection zones
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
// << "Error in TECPOLY112." << exit(FatalError);
|
<< "Error in tecpoly142."
|
||||||
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,25 +345,25 @@ void Foam::tecplotWriter::writeConnectivity
|
|||||||
const indirectPrimitivePatch& pp
|
const indirectPrimitivePatch& pp
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
INTEGER4 NumFaces = pp.nEdges(); /* number of unique faces */
|
const int32_t NumFaces = pp.nEdges(); // Number of unique faces
|
||||||
INTEGER4 NumFaceNodes = 2*pp.nEdges();
|
const int32_t NumFaceNodes = 2*NumFaces; // 2 nodes per edge
|
||||||
|
|
||||||
// All faces (=edges) have 2 nodes
|
// All faces (=edges) have 2 nodes
|
||||||
List<INTEGER4> FaceNodeCounts(NumFaces);
|
List<int32_t> FaceNodeCounts(NumFaces);
|
||||||
FaceNodeCounts = 2;
|
FaceNodeCounts = 2;
|
||||||
|
|
||||||
List<INTEGER4> FaceNodes(NumFaceNodes);
|
List<int32_t> FaceNodes(NumFaceNodes);
|
||||||
label nodeI = 0;
|
label nodeI = 0;
|
||||||
forAll(pp.edges(), edgeI)
|
forAll(pp.edges(), edgei)
|
||||||
{
|
{
|
||||||
edge e = pp.edges()[edgeI];
|
edge e = pp.edges()[edgei];
|
||||||
if (e[0] > e[1])
|
if (e[0] > e[1])
|
||||||
{
|
{
|
||||||
e.flip();
|
e.flip();
|
||||||
}
|
}
|
||||||
|
|
||||||
FaceNodes[nodeI++] = INTEGER4(e[0]+1);
|
FaceNodes[nodeI++] = int32_t(e[0]+1);
|
||||||
FaceNodes[nodeI++] = INTEGER4(e[1]+1);
|
FaceNodes[nodeI++] = int32_t(e[1]+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Define the right and left elements of each face.
|
/* Define the right and left elements of each face.
|
||||||
@ -430,22 +386,22 @@ void Foam::tecplotWriter::writeConnectivity
|
|||||||
* (element 0).
|
* (element 0).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
List<INTEGER4> FaceLeftElems(NumFaces);
|
List<int32_t> FaceLeftElems(NumFaces);
|
||||||
List<INTEGER4> FaceRightElems(NumFaces);
|
List<int32_t> FaceRightElems(NumFaces);
|
||||||
|
|
||||||
const labelListList& edgeFaces = pp.edgeFaces();
|
const labelListList& edgeFaces = pp.edgeFaces();
|
||||||
forAll(edgeFaces, edgeI)
|
forAll(edgeFaces, edgei)
|
||||||
{
|
{
|
||||||
const labelList& eFaces = edgeFaces[edgeI];
|
const labelList& eFaces = edgeFaces[edgei];
|
||||||
|
|
||||||
if (eFaces.size() == 1)
|
if (eFaces.size() == 1)
|
||||||
{
|
{
|
||||||
FaceLeftElems[edgeI] = 0;
|
FaceLeftElems[edgei] = 0;
|
||||||
FaceRightElems[edgeI] = eFaces[0]+1;
|
FaceRightElems[edgei] = eFaces[0]+1;
|
||||||
}
|
}
|
||||||
else if (eFaces.size() == 2)
|
else if (eFaces.size() == 2)
|
||||||
{
|
{
|
||||||
edge e = pp.edges()[edgeI];
|
edge e = pp.edges()[edgei];
|
||||||
if (e[0] > e[1])
|
if (e[0] > e[1])
|
||||||
{
|
{
|
||||||
e.flip();
|
e.flip();
|
||||||
@ -456,59 +412,60 @@ void Foam::tecplotWriter::writeConnectivity
|
|||||||
// The face that uses the vertices of e in increasing order
|
// The face that uses the vertices of e in increasing order
|
||||||
// is the left face.
|
// is the left face.
|
||||||
|
|
||||||
label fp = findIndex(f0, e[0]);
|
const label fp = findIndex(f0, e[0]);
|
||||||
bool f0IsLeft = (f0.nextLabel(fp) == e[1]);
|
const bool f0IsLeft = (f0.nextLabel(fp) == e[1]);
|
||||||
|
|
||||||
if (f0IsLeft)
|
if (f0IsLeft)
|
||||||
{
|
{
|
||||||
FaceLeftElems[edgeI] = eFaces[0]+1;
|
FaceLeftElems[edgei] = eFaces[0]+1;
|
||||||
FaceRightElems[edgeI] = eFaces[1]+1;
|
FaceRightElems[edgei] = eFaces[1]+1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FaceLeftElems[edgeI] = eFaces[1]+1;
|
FaceLeftElems[edgei] = eFaces[1]+1;
|
||||||
FaceRightElems[edgeI] = eFaces[0]+1;
|
FaceRightElems[edgei] = eFaces[0]+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// non-manifold. Treat as if open.
|
// non-manifold. Treat as if open.
|
||||||
FaceLeftElems[edgeI] = 0;
|
FaceLeftElems[edgei] = 0;
|
||||||
FaceRightElems[edgeI] = eFaces[0]+1;
|
FaceRightElems[edgei] = eFaces[0]+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the face map (created above) using TECPOLY112. */
|
// Write the face map (created above)
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
!TECPOLY112
|
tecpoly142
|
||||||
(
|
(
|
||||||
FaceNodeCounts.begin(), /* The face node counts array */
|
FaceNodeCounts.cdata(), // Face node counts array
|
||||||
FaceNodes.begin(), /* The face nodes array */
|
FaceNodes.cdata(), // Face nodes array
|
||||||
FaceLeftElems.begin(), /* The left elements array */
|
FaceLeftElems.cdata(), // Left elements array
|
||||||
FaceRightElems.begin(), /* The right elements array */
|
FaceRightElems.cdata(), // Right elements array
|
||||||
nullptr, /* No boundary connection counts */
|
nullptr, // No boundary connection counts
|
||||||
nullptr, /* No boundary connection elements */
|
nullptr, // No boundary connection elements
|
||||||
nullptr /* No boundary connection zones */
|
nullptr // No boundary connection zones
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
// << "Error in TECPOLY112." << exit(FatalError);
|
<< "Error in tecpoly142."
|
||||||
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::tecplotWriter::writeEnd() const
|
void Foam::tecplotWriter::writeEnd() const
|
||||||
{
|
{
|
||||||
Pout<< "writeEnd" << endl;
|
Pout<< "writeEnd" << endl;
|
||||||
|
|
||||||
if (!TECEND112())
|
if (tecend142())
|
||||||
{
|
{
|
||||||
// FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
// << "Error in TECEND112." << exit(FatalError);
|
<< "Error in tecend142."
|
||||||
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -27,6 +27,11 @@ Class
|
|||||||
Description
|
Description
|
||||||
Write binary tecplot files using tecio.
|
Write binary tecplot files using tecio.
|
||||||
|
|
||||||
|
Note
|
||||||
|
The tecplot API uses pass by reference for all routines.
|
||||||
|
Its standard integer is defined as INTEGER4 (ie, int32_t),
|
||||||
|
which is also used when passing boolean values.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
tecplotWriter.C
|
tecplotWriter.C
|
||||||
tecplotWriterTemplates.C
|
tecplotWriterTemplates.C
|
||||||
@ -36,14 +41,11 @@ SourceFiles
|
|||||||
#ifndef tecplotWriter_H
|
#ifndef tecplotWriter_H
|
||||||
#define tecplotWriter_H
|
#define tecplotWriter_H
|
||||||
|
|
||||||
#include "TECIO.h"
|
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "indirectPrimitivePatch.H"
|
#include "indirectPrimitivePatch.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "surfaceFields.H"
|
#include "surfaceFields.H"
|
||||||
|
|
||||||
using namespace Foam;
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -52,15 +54,76 @@ namespace Foam
|
|||||||
class fvMesh;
|
class fvMesh;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class tecplotWriter Declaration
|
Class tecplotWriter Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class tecplotWriter
|
class tecplotWriter
|
||||||
{
|
{
|
||||||
const Time& runTime_;
|
//- Tecplot ZoneTypes
|
||||||
|
enum tecplotZoneType
|
||||||
|
{
|
||||||
|
ZONE_ORDERED = 0,
|
||||||
|
ZONE_FELINESEG = 1,
|
||||||
|
ZONE_FETRIANGLE = 2,
|
||||||
|
ZONE_FEQUADRILATERAL = 3,
|
||||||
|
ZONE_FETETRAHEDRON = 4,
|
||||||
|
ZONE_FEBRICK = 5,
|
||||||
|
ZONE_FEPOLYGON = 6,
|
||||||
|
ZONE_FEPOLYHEDRON = 7
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Static data members
|
||||||
|
|
||||||
|
// Values commonly used internally
|
||||||
|
static const int32_t tecConst_0;
|
||||||
|
static const int32_t tecConst_1;
|
||||||
|
static const int32_t tecConst_False;
|
||||||
|
static const int32_t tecConst_True;
|
||||||
|
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Time reference. Used for paths and the solution time.
|
||||||
|
const Time& time_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
template<class GeoField>
|
||||||
|
static wordList getNames(const PtrList<const GeoField>&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
tecplotWriter(const tecplotWriter&) = delete;
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const tecplotWriter&) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
//- Data location types
|
||||||
|
enum dataLocation
|
||||||
|
{
|
||||||
|
CELL_CENTERED = 0,
|
||||||
|
NODE_CENTERED = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//- Data file type
|
||||||
|
enum dataFileType
|
||||||
|
{
|
||||||
|
FILETYPE_FULL = 0,
|
||||||
|
FILETYPE_GRID = 1,
|
||||||
|
FILETYPE_SOLUTION = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Static data members
|
||||||
|
|
||||||
|
//- Commonly used "X Y Z" string
|
||||||
|
static const string XYZ;
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
@ -69,92 +132,103 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Initialize writing
|
||||||
void writeInit
|
void writeInit
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const string& varNames,
|
const string& varNames,
|
||||||
const fileName&,
|
const fileName&,
|
||||||
INTEGER4 tecplotFileType
|
const dataFileType fileType
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Write mesh as polyhedral zone
|
//- Write mesh as polyhedral zone
|
||||||
void writePolyhedralZone
|
void writePolyhedralZone
|
||||||
(
|
(
|
||||||
const word& zoneName,
|
const word& zoneName,
|
||||||
const INTEGER4 strandID,
|
const int32_t strandID,
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
const List<INTEGER4>& varLocArray,
|
const UList<int32_t>& varLocArray,
|
||||||
INTEGER4 nFaceNodes
|
const int32_t NumFaceNodes
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Write surface as polygonal zone
|
//- Write surface as polygonal zone
|
||||||
void writePolygonalZone
|
void writePolygonalZone
|
||||||
(
|
(
|
||||||
const word& zoneName,
|
const word& zoneName,
|
||||||
const INTEGER4 strandID,
|
const int32_t strandID,
|
||||||
const indirectPrimitivePatch& pp,
|
const indirectPrimitivePatch& pp,
|
||||||
const List<INTEGER4>& varLocArray
|
const UList<int32_t>& varLocArray
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Write unordered data (or rather 1D ordered)
|
//- Write unordered data (or rather 1D ordered)
|
||||||
void writeOrderedZone
|
void writeOrderedZone
|
||||||
(
|
(
|
||||||
const word& zoneName,
|
const word& zoneName,
|
||||||
INTEGER4 strandID,
|
const int32_t strandID,
|
||||||
const label n,
|
const label n,
|
||||||
const List<INTEGER4>& varLocArray
|
const UList<int32_t>& varLocArray
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Write mesh
|
//- Write mesh
|
||||||
void writeConnectivity(const fvMesh& mesh) const;
|
void writeConnectivity(const fvMesh&) const;
|
||||||
|
|
||||||
//- Write surface
|
//- Write surface
|
||||||
void writeConnectivity(const indirectPrimitivePatch& pp) const;
|
void writeConnectivity(const indirectPrimitivePatch& pp) const;
|
||||||
|
|
||||||
|
//- Finalize writing
|
||||||
void writeEnd() const;
|
void writeEnd() const;
|
||||||
|
|
||||||
//- Write generic Field
|
|
||||||
|
//- Write generic Field, component-wise
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void writeField(const Field<Type>& fld) const;
|
void writeField(const Field<Type>&) const;
|
||||||
|
|
||||||
|
//- Write generic Field, component-wise
|
||||||
|
template<class Type>
|
||||||
|
void writeField(const tmp<Field<Type>>&) const;
|
||||||
|
|
||||||
|
//- Write all fields listed
|
||||||
|
template<class GeoField>
|
||||||
|
void writeFields(const PtrList<const GeoField>&) const;
|
||||||
|
|
||||||
|
|
||||||
//- Get either fvPatchField or patchInternalField
|
//- Get either fvPatchField or patchInternalField
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<Field<Type>> getPatchField
|
static tmp<Field<Type>> getPatchField
|
||||||
(
|
(
|
||||||
const bool nearCellValue,
|
const bool nearCellValue,
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& vfld,
|
const GeometricField<Type, fvPatchField, volMesh>&,
|
||||||
const label patchi
|
const label patchi
|
||||||
) const;
|
);
|
||||||
|
|
||||||
//- Get mixed field: fvsPatchField for boundary faces and
|
//- Get mixed field: fvsPatchField for boundary faces and
|
||||||
// internalField for internal faces.
|
// internalField for internal faces.
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<Field<Type>> getFaceField
|
static tmp<Field<Type>> getFaceField
|
||||||
(
|
(
|
||||||
const GeometricField<Type, fvsPatchField, surfaceMesh>&,
|
const GeometricField<Type, fvsPatchField, surfaceMesh>&,
|
||||||
const labelList& faceLabels
|
const labelUList& faceLabels
|
||||||
) const;
|
);
|
||||||
|
|
||||||
template<class GeoField>
|
|
||||||
static wordList getNames(const PtrList<GeoField>&);
|
|
||||||
|
|
||||||
|
//- Fill in tecplot names/locations for the given input names
|
||||||
template<class Type>
|
template<class Type>
|
||||||
static void getTecplotNames
|
static void getTecplotNames
|
||||||
(
|
(
|
||||||
const wordList& names,
|
const wordList& names,
|
||||||
const INTEGER4 loc,
|
const int32_t loc,
|
||||||
string& varNames,
|
string& varNames,
|
||||||
DynamicList<INTEGER4>& varLocation
|
DynamicList<int32_t>& varLocation
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Fill in tecplot names/locations for the given input fields
|
||||||
template<class GeoField>
|
template<class GeoField>
|
||||||
static void getTecplotNames
|
static void getTecplotNames
|
||||||
(
|
(
|
||||||
const PtrList<GeoField>& flds,
|
const PtrList<GeoField>& flds,
|
||||||
const INTEGER4 loc,
|
const int32_t loc,
|
||||||
string& varNames,
|
string& varNames,
|
||||||
DynamicList<INTEGER4>& varLocation
|
DynamicList<int32_t>& varLocation
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -23,14 +23,8 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
//extern "C"
|
|
||||||
//{
|
|
||||||
#include "MASTER.h"
|
|
||||||
#include "GLOBAL.h"
|
|
||||||
//}
|
|
||||||
|
|
||||||
#include "tecplotWriter.H"
|
#include "tecplotWriter.H"
|
||||||
|
#include "TECIO.h"
|
||||||
#include "fvc.H"
|
#include "fvc.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -38,39 +32,71 @@ License
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::tecplotWriter::writeField(const Field<Type>& fld) const
|
void Foam::tecplotWriter::writeField(const Field<Type>& fld) const
|
||||||
{
|
{
|
||||||
for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
|
typedef typename pTraits<Type>::cmptType cmptType;
|
||||||
|
|
||||||
|
for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; ++cmpt)
|
||||||
{
|
{
|
||||||
scalarField cmptFld(fld.component(cmpt));
|
tmp<Field<cmptType>> tcmptFld = fld.component(cmpt);
|
||||||
|
const Field<cmptType>& cmptFld = tcmptFld();
|
||||||
|
|
||||||
|
const int32_t size = int32_t(cmptFld.size());
|
||||||
|
|
||||||
// Convert to float
|
// Convert to float
|
||||||
Field<float> floats(cmptFld.size());
|
Field<float> floats(size);
|
||||||
forAll(cmptFld, i)
|
forAll(cmptFld, i)
|
||||||
{
|
{
|
||||||
floats[i] = float(cmptFld[i]);
|
floats[i] = float(cmptFld[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
INTEGER4 size = INTEGER4(floats.size());
|
|
||||||
INTEGER4 IsDouble = 0; //float
|
|
||||||
|
|
||||||
//Pout<< "Writing component:" << cmpt << " of size:" << size
|
//Pout<< "Writing component:" << cmpt << " of size:" << size
|
||||||
// << " floats." << endl;
|
// << " floats." << endl;
|
||||||
|
|
||||||
if (!TECDAT112(&size, floats.begin(), &IsDouble))
|
if
|
||||||
|
(
|
||||||
|
tecdat142
|
||||||
|
(
|
||||||
|
&size,
|
||||||
|
floats.cdata(),
|
||||||
|
&tecConst_False //< VIsDouble (0: single, 1: double)
|
||||||
|
)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
// << "Error in TECDAT112." << exit(FatalError);
|
<< "Error in tecdat142."
|
||||||
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Field<Type>> Foam::tecplotWriter::getPatchField
|
void Foam::tecplotWriter::writeField(const tmp<Field<Type>>& tfld) const
|
||||||
|
{
|
||||||
|
writeField(tfld());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class GeoField>
|
||||||
|
void Foam::tecplotWriter::writeFields
|
||||||
|
(
|
||||||
|
const PtrList<const GeoField>& flds
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
forAll(flds, i)
|
||||||
|
{
|
||||||
|
writeField(flds[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::Field<Type>>
|
||||||
|
Foam::tecplotWriter::getPatchField
|
||||||
(
|
(
|
||||||
const bool nearCellValue,
|
const bool nearCellValue,
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& vfld,
|
const GeometricField<Type, fvPatchField, volMesh>& vfld,
|
||||||
const label patchi
|
const label patchi
|
||||||
) const
|
)
|
||||||
{
|
{
|
||||||
if (nearCellValue)
|
if (nearCellValue)
|
||||||
{
|
{
|
||||||
@ -84,11 +110,12 @@ Foam::tmp<Field<Type>> Foam::tecplotWriter::getPatchField
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Field<Type>> Foam::tecplotWriter::getFaceField
|
Foam::tmp<Foam::Field<Type>>
|
||||||
|
Foam::tecplotWriter::getFaceField
|
||||||
(
|
(
|
||||||
const GeometricField<Type, fvsPatchField, surfaceMesh>& sfld,
|
const GeometricField<Type, fvsPatchField, surfaceMesh>& sfld,
|
||||||
const labelList& faceLabels
|
const labelUList& faceLabels
|
||||||
) const
|
)
|
||||||
{
|
{
|
||||||
const polyBoundaryMesh& patches = sfld.mesh().boundaryMesh();
|
const polyBoundaryMesh& patches = sfld.mesh().boundaryMesh();
|
||||||
|
|
||||||
@ -97,9 +124,8 @@ Foam::tmp<Field<Type>> Foam::tecplotWriter::getFaceField
|
|||||||
|
|
||||||
forAll(faceLabels, i)
|
forAll(faceLabels, i)
|
||||||
{
|
{
|
||||||
label facei = faceLabels[i];
|
const label facei = faceLabels[i];
|
||||||
|
const label patchi = patches.whichPatch(facei);
|
||||||
label patchi = patches.whichPatch(facei);
|
|
||||||
|
|
||||||
if (patchi == -1)
|
if (patchi == -1)
|
||||||
{
|
{
|
||||||
@ -117,9 +143,10 @@ Foam::tmp<Field<Type>> Foam::tecplotWriter::getFaceField
|
|||||||
|
|
||||||
|
|
||||||
template<class GeoField>
|
template<class GeoField>
|
||||||
Foam::wordList Foam::tecplotWriter::getNames
|
Foam::wordList
|
||||||
|
Foam::tecplotWriter::getNames
|
||||||
(
|
(
|
||||||
const PtrList<GeoField>& flds
|
const PtrList<const GeoField>& flds
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
wordList names(flds.size());
|
wordList names(flds.size());
|
||||||
@ -135,11 +162,13 @@ template<class Type>
|
|||||||
void Foam::tecplotWriter::getTecplotNames
|
void Foam::tecplotWriter::getTecplotNames
|
||||||
(
|
(
|
||||||
const wordList& names,
|
const wordList& names,
|
||||||
const INTEGER4 loc,
|
const int32_t loc,
|
||||||
string& varNames,
|
string& varNames,
|
||||||
DynamicList<INTEGER4>& varLocation
|
DynamicList<int32_t>& varLocation
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
const direction nCmpts = pTraits<Type>::nComponents;
|
||||||
|
|
||||||
forAll(names, i)
|
forAll(names, i)
|
||||||
{
|
{
|
||||||
if (!varNames.empty())
|
if (!varNames.empty())
|
||||||
@ -147,8 +176,6 @@ void Foam::tecplotWriter::getTecplotNames
|
|||||||
varNames += " ";
|
varNames += " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
label nCmpts = pTraits<Type>::nComponents;
|
|
||||||
|
|
||||||
if (nCmpts == 1)
|
if (nCmpts == 1)
|
||||||
{
|
{
|
||||||
varNames += names[i];
|
varNames += names[i];
|
||||||
@ -156,19 +183,13 @@ void Foam::tecplotWriter::getTecplotNames
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for
|
for (direction cmpt = 0; cmpt < nCmpts; ++cmpt)
|
||||||
(
|
|
||||||
direction cmpt = 0;
|
|
||||||
cmpt < nCmpts;
|
|
||||||
cmpt++
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
string fldName =
|
varNames +=
|
||||||
(cmpt != 0 ? " " : string::null)
|
(
|
||||||
+ names[i]
|
(cmpt ? " " : string::null)
|
||||||
+ "_"
|
+ names[i] + "_" + pTraits<Type>::componentNames[cmpt]
|
||||||
+ pTraits<Type>::componentNames[cmpt];
|
);
|
||||||
varNames += fldName;
|
|
||||||
varLocation.append(loc);
|
varLocation.append(loc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -180,9 +201,9 @@ template<class GeoField>
|
|||||||
void Foam::tecplotWriter::getTecplotNames
|
void Foam::tecplotWriter::getTecplotNames
|
||||||
(
|
(
|
||||||
const PtrList<GeoField>& flds,
|
const PtrList<GeoField>& flds,
|
||||||
const INTEGER4 loc,
|
const int32_t loc,
|
||||||
string& varNames,
|
string& varNames,
|
||||||
DynamicList<INTEGER4>& varLocation
|
DynamicList<int32_t>& varLocation
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
getTecplotNames<typename GeoField::value_type>
|
getTecplotNames<typename GeoField::value_type>
|
||||||
|
|||||||
@ -1,83 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
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 "vtkMesh.H"
|
|
||||||
#include "fvMeshSubset.H"
|
|
||||||
#include "Time.H"
|
|
||||||
#include "cellSet.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
// Construct from components
|
|
||||||
Foam::vtkMesh::vtkMesh
|
|
||||||
(
|
|
||||||
fvMesh& baseMesh,
|
|
||||||
const word& setName
|
|
||||||
)
|
|
||||||
:
|
|
||||||
baseMesh_(baseMesh),
|
|
||||||
subsetter_(baseMesh),
|
|
||||||
setName_(setName)
|
|
||||||
{
|
|
||||||
if (setName.size())
|
|
||||||
{
|
|
||||||
// Read cellSet using whole mesh
|
|
||||||
cellSet currentSet(baseMesh_, setName_);
|
|
||||||
|
|
||||||
// Set current subset
|
|
||||||
subsetter_.setLargeCellSubset(currentSet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::polyMesh::readUpdateState Foam::vtkMesh::readUpdate()
|
|
||||||
{
|
|
||||||
polyMesh::readUpdateState meshState = baseMesh_.readUpdate();
|
|
||||||
|
|
||||||
if (meshState != polyMesh::UNCHANGED)
|
|
||||||
{
|
|
||||||
// Note: since fvMeshSubset has no movePoints() functionality
|
|
||||||
// reconstruct the subset even if only movement.
|
|
||||||
|
|
||||||
// topoPtr_.clear();
|
|
||||||
|
|
||||||
if (setName_.size())
|
|
||||||
{
|
|
||||||
Info<< "Subsetting mesh based on cellSet " << setName_ << endl;
|
|
||||||
|
|
||||||
// Read cellSet using whole mesh
|
|
||||||
cellSet currentSet(baseMesh_, setName_);
|
|
||||||
|
|
||||||
subsetter_.setLargeCellSubset(currentSet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return meshState;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,178 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
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::vtkMesh
|
|
||||||
|
|
||||||
Description
|
|
||||||
Encapsulation of VTK mesh data. Holds mesh or meshsubset and
|
|
||||||
polyhedral-cell decomposition on it.
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
vtkMesh.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef vtkMesh_H
|
|
||||||
#define vtkMesh_H
|
|
||||||
|
|
||||||
#include "fvMeshSubset.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// Forward declaration of classes
|
|
||||||
class Time;
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class vtkMesh Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
class vtkMesh
|
|
||||||
{
|
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- Reference to mesh
|
|
||||||
fvMesh& baseMesh_;
|
|
||||||
|
|
||||||
//- Subsetting engine + sub-fvMesh
|
|
||||||
fvMeshSubset subsetter_;
|
|
||||||
|
|
||||||
//- Current cellSet (or empty)
|
|
||||||
const word setName_;
|
|
||||||
|
|
||||||
// //- Current decomposition of topology
|
|
||||||
// mutable autoPtr<vtkTopo> topoPtr_;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
|
||||||
vtkMesh(const vtkMesh&);
|
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
|
||||||
void operator=(const vtkMesh&);
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct from components
|
|
||||||
vtkMesh(fvMesh& baseMesh, const word& setName = "");
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
|
||||||
|
|
||||||
// Access
|
|
||||||
|
|
||||||
//- Whole mesh
|
|
||||||
const fvMesh& baseMesh() const
|
|
||||||
{
|
|
||||||
return baseMesh_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const fvMeshSubset& subsetter() const
|
|
||||||
{
|
|
||||||
return subsetter_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Check if running subMesh
|
|
||||||
bool useSubMesh() const
|
|
||||||
{
|
|
||||||
return setName_.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
// //- topology
|
|
||||||
// const vtkTopo& topo() const
|
|
||||||
// {
|
|
||||||
// if (topoPtr_.empty())
|
|
||||||
// {
|
|
||||||
// topoPtr_.reset(new vtkTopo(mesh()));
|
|
||||||
// }
|
|
||||||
// return topoPtr_();
|
|
||||||
// }
|
|
||||||
|
|
||||||
//- Access either mesh or submesh
|
|
||||||
const fvMesh& mesh() const
|
|
||||||
{
|
|
||||||
if (useSubMesh())
|
|
||||||
{
|
|
||||||
return subsetter_.subMesh();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return baseMesh_;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// //- Number of field cells
|
|
||||||
// label nFieldCells() const
|
|
||||||
// {
|
|
||||||
// return topo().vertLabels().size();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// //- Number of field points
|
|
||||||
// label nFieldPoints() const
|
|
||||||
// {
|
|
||||||
// return mesh().nPoints() + topo().addPointCellLabels().size();
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// Edit
|
|
||||||
|
|
||||||
//- Read mesh
|
|
||||||
polyMesh::readUpdateState readUpdate();
|
|
||||||
|
|
||||||
|
|
||||||
//- Map volume field (does in fact do very little interpolation;
|
|
||||||
// just copied from fvMeshSubset)
|
|
||||||
template<class GeoField>
|
|
||||||
tmp<GeoField> interpolate(const GeoField& fld) const
|
|
||||||
{
|
|
||||||
if (useSubMesh())
|
|
||||||
{
|
|
||||||
tmp<GeoField> subFld = subsetter_.interpolate(fld);
|
|
||||||
subFld.ref().rename(fld.name());
|
|
||||||
return subFld;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return fld;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -410,7 +410,6 @@ int main(int argc, char *argv[])
|
|||||||
args.optionReadIfPresent("pointSet", pointSetName);
|
args.optionReadIfPresent("pointSet", pointSetName);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||||
|
|
||||||
#include "createNamedMesh.H"
|
#include "createNamedMesh.H"
|
||||||
@ -450,7 +449,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
mkDir(fvPath);
|
mkDir(fvPath);
|
||||||
|
|
||||||
// Mesh wrapper; does subsetting and decomposition
|
// Mesh wrapper: does subsetting and decomposition
|
||||||
vtkMesh vMesh(mesh, cellSetName);
|
vtkMesh vMesh(mesh, cellSetName);
|
||||||
|
|
||||||
Info<< "VTK mesh topology: "
|
Info<< "VTK mesh topology: "
|
||||||
@ -503,7 +502,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< " FaceSet : " << patchFileName << endl;
|
Info<< " FaceSet : " << patchFileName << endl;
|
||||||
|
|
||||||
writeFaceSet(binary, vMesh, set, patchFileName);
|
writeFaceSet(binary, vMesh.mesh(), set, patchFileName);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -526,7 +525,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< " pointSet : " << patchFileName << endl;
|
Info<< " pointSet : " << patchFileName << endl;
|
||||||
|
|
||||||
writePointSet(binary, vMesh, set, patchFileName);
|
writePointSet(binary, vMesh.mesh(), set, patchFileName);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -849,7 +848,7 @@ int main(int argc, char *argv[])
|
|||||||
writeSurfFields
|
writeSurfFields
|
||||||
(
|
(
|
||||||
binary,
|
binary,
|
||||||
vMesh,
|
vMesh.mesh(),
|
||||||
surfFileName,
|
surfFileName,
|
||||||
svf
|
svf
|
||||||
);
|
);
|
||||||
@ -892,7 +891,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
patchWriter writer
|
patchWriter writer
|
||||||
(
|
(
|
||||||
vMesh,
|
vMesh.mesh(),
|
||||||
binary,
|
binary,
|
||||||
nearCellValue,
|
nearCellValue,
|
||||||
patchFileName,
|
patchFileName,
|
||||||
@ -970,7 +969,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
patchWriter writer
|
patchWriter writer
|
||||||
(
|
(
|
||||||
vMesh,
|
vMesh.mesh(),
|
||||||
binary,
|
binary,
|
||||||
nearCellValue,
|
nearCellValue,
|
||||||
patchFileName,
|
patchFileName,
|
||||||
@ -1188,7 +1187,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
lagrangianWriter writer
|
lagrangianWriter writer
|
||||||
(
|
(
|
||||||
vMesh,
|
vMesh.mesh(),
|
||||||
binary,
|
binary,
|
||||||
lagrFileName,
|
lagrFileName,
|
||||||
cloudName,
|
cloudName,
|
||||||
@ -1218,7 +1217,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
lagrangianWriter writer
|
lagrangianWriter writer
|
||||||
(
|
(
|
||||||
vMesh,
|
vMesh.mesh(),
|
||||||
binary,
|
binary,
|
||||||
lagrFileName,
|
lagrFileName,
|
||||||
cloudName,
|
cloudName,
|
||||||
|
|||||||
@ -6,7 +6,6 @@ writeFuns.C
|
|||||||
writeFaceSet.C
|
writeFaceSet.C
|
||||||
writePointSet.C
|
writePointSet.C
|
||||||
writeSurfFields.C
|
writeSurfFields.C
|
||||||
vtkMesh.C
|
|
||||||
vtkTopo.C
|
vtkTopo.C
|
||||||
|
|
||||||
writeVTK/writeVTK.C
|
writeVTK/writeVTK.C
|
||||||
|
|||||||
@ -41,8 +41,6 @@ SourceFiles
|
|||||||
#include "pointFields.H"
|
#include "pointFields.H"
|
||||||
#include "vtkMesh.H"
|
#include "vtkMesh.H"
|
||||||
|
|
||||||
using namespace Foam;
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -32,23 +32,21 @@ License
|
|||||||
|
|
||||||
Foam::lagrangianWriter::lagrangianWriter
|
Foam::lagrangianWriter::lagrangianWriter
|
||||||
(
|
(
|
||||||
const vtkMesh& vMesh,
|
const fvMesh& mesh,
|
||||||
const bool binary,
|
const bool binary,
|
||||||
const fileName& fName,
|
const fileName& fName,
|
||||||
const word& cloudName,
|
const word& cloudName,
|
||||||
const bool dummyCloud
|
const bool dummyCloud
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
vMesh_(vMesh),
|
mesh_(mesh),
|
||||||
binary_(binary),
|
binary_(binary),
|
||||||
fName_(fName),
|
fName_(fName),
|
||||||
cloudName_(cloudName),
|
cloudName_(cloudName),
|
||||||
os_(fName.c_str())
|
os_(fName.c_str())
|
||||||
{
|
{
|
||||||
const fvMesh& mesh = vMesh_.mesh();
|
|
||||||
|
|
||||||
// Write header
|
// Write header
|
||||||
writeFuns::writeHeader(os_, binary_, mesh.time().caseName());
|
writeFuns::writeHeader(os_, binary_, mesh_.time().caseName());
|
||||||
os_ << "DATASET POLYDATA" << std::endl;
|
os_ << "DATASET POLYDATA" << std::endl;
|
||||||
|
|
||||||
if (dummyCloud)
|
if (dummyCloud)
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -40,9 +40,6 @@ SourceFiles
|
|||||||
#include "Cloud.H"
|
#include "Cloud.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "pointFields.H"
|
#include "pointFields.H"
|
||||||
#include "vtkMesh.H"
|
|
||||||
|
|
||||||
using namespace Foam;
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -57,7 +54,7 @@ class volPointInterpolation;
|
|||||||
|
|
||||||
class lagrangianWriter
|
class lagrangianWriter
|
||||||
{
|
{
|
||||||
const vtkMesh& vMesh_;
|
const fvMesh& mesh_;
|
||||||
|
|
||||||
const bool binary_;
|
const bool binary_;
|
||||||
|
|
||||||
@ -77,7 +74,7 @@ public:
|
|||||||
//- Construct from components
|
//- Construct from components
|
||||||
lagrangianWriter
|
lagrangianWriter
|
||||||
(
|
(
|
||||||
const vtkMesh&,
|
const fvMesh&,
|
||||||
const bool binary,
|
const bool binary,
|
||||||
const fileName&,
|
const fileName&,
|
||||||
const word&,
|
const word&,
|
||||||
|
|||||||
@ -39,9 +39,9 @@ void Foam::lagrangianWriter::writeIOField(const wordList& objects)
|
|||||||
IOobject header
|
IOobject header
|
||||||
(
|
(
|
||||||
object,
|
object,
|
||||||
vMesh_.mesh().time().timeName(),
|
mesh_.time().timeName(),
|
||||||
cloud::prefix/cloudName_,
|
cloud::prefix/cloudName_,
|
||||||
vMesh_.mesh(),
|
mesh_,
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
IOobject::NO_WRITE,
|
IOobject::NO_WRITE,
|
||||||
false
|
false
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -30,21 +30,20 @@ License
|
|||||||
|
|
||||||
Foam::patchWriter::patchWriter
|
Foam::patchWriter::patchWriter
|
||||||
(
|
(
|
||||||
const vtkMesh& vMesh,
|
const fvMesh& mesh,
|
||||||
const bool binary,
|
const bool binary,
|
||||||
const bool nearCellValue,
|
const bool nearCellValue,
|
||||||
const fileName& fName,
|
const fileName& fName,
|
||||||
const labelList& patchIDs
|
const labelList& patchIDs
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
vMesh_(vMesh),
|
mesh_(mesh),
|
||||||
binary_(binary),
|
binary_(binary),
|
||||||
nearCellValue_(nearCellValue),
|
nearCellValue_(nearCellValue),
|
||||||
fName_(fName),
|
fName_(fName),
|
||||||
patchIDs_(patchIDs),
|
patchIDs_(patchIDs),
|
||||||
os_(fName.c_str())
|
os_(fName.c_str())
|
||||||
{
|
{
|
||||||
const fvMesh& mesh = vMesh_.mesh();
|
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
|
|
||||||
// Write header
|
// Write header
|
||||||
@ -115,8 +114,6 @@ Foam::patchWriter::patchWriter
|
|||||||
|
|
||||||
void Foam::patchWriter::writePatchIDs()
|
void Foam::patchWriter::writePatchIDs()
|
||||||
{
|
{
|
||||||
const fvMesh& mesh = vMesh_.mesh();
|
|
||||||
|
|
||||||
DynamicList<floatScalar> fField(nFaces_);
|
DynamicList<floatScalar> fField(nFaces_);
|
||||||
|
|
||||||
os_ << "patchID 1 " << nFaces_ << " float" << std::endl;
|
os_ << "patchID 1 " << nFaces_ << " float" << std::endl;
|
||||||
@ -125,7 +122,7 @@ void Foam::patchWriter::writePatchIDs()
|
|||||||
{
|
{
|
||||||
label patchi = patchIDs_[i];
|
label patchi = patchIDs_[i];
|
||||||
|
|
||||||
const polyPatch& pp = mesh.boundaryMesh()[patchi];
|
const polyPatch& pp = mesh_.boundaryMesh()[patchi];
|
||||||
|
|
||||||
if (!isA<emptyPolyPatch>(pp))
|
if (!isA<emptyPolyPatch>(pp))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -40,12 +40,9 @@ SourceFiles
|
|||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "pointFields.H"
|
#include "pointFields.H"
|
||||||
#include "vtkMesh.H"
|
|
||||||
#include "indirectPrimitivePatch.H"
|
#include "indirectPrimitivePatch.H"
|
||||||
#include "PrimitivePatchInterpolation.H"
|
#include "PrimitivePatchInterpolation.H"
|
||||||
|
|
||||||
using namespace Foam;
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -59,7 +56,8 @@ class volPointInterpolation;
|
|||||||
|
|
||||||
class patchWriter
|
class patchWriter
|
||||||
{
|
{
|
||||||
const vtkMesh& vMesh_;
|
//- Reference to the OpenFOAM mesh (or subset)
|
||||||
|
const fvMesh& mesh_;
|
||||||
|
|
||||||
const bool binary_;
|
const bool binary_;
|
||||||
|
|
||||||
@ -82,7 +80,7 @@ public:
|
|||||||
//- Construct from components
|
//- Construct from components
|
||||||
patchWriter
|
patchWriter
|
||||||
(
|
(
|
||||||
const vtkMesh&,
|
const fvMesh&,
|
||||||
const bool binary,
|
const bool binary,
|
||||||
const bool nearCellValue,
|
const bool nearCellValue,
|
||||||
const fileName&,
|
const fileName&,
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -36,37 +36,32 @@ namespace Foam
|
|||||||
template<class GeoField>
|
template<class GeoField>
|
||||||
void readFields
|
void readFields
|
||||||
(
|
(
|
||||||
const vtkMesh& vMesh,
|
const meshSubsetHelper& helper,
|
||||||
const typename GeoField::Mesh& mesh,
|
const typename GeoField::Mesh& mesh,
|
||||||
const IOobjectList& objects,
|
const IOobjectList& objects,
|
||||||
const HashSet<word>& selectedFields,
|
const HashSet<word>& selectedFields,
|
||||||
PtrList<const GeoField>& fields
|
PtrList<const GeoField>& fields
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Search list of objects for volScalarFields
|
// Search list of objects for fields of type GeomField
|
||||||
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));
|
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));
|
||||||
|
|
||||||
// Construct the vol scalar fields
|
// Construct the fields
|
||||||
fields.setSize(fieldObjects.size());
|
fields.setSize(fieldObjects.size());
|
||||||
label nFields = 0;
|
label nFields = 0;
|
||||||
|
|
||||||
forAllIter(IOobjectList, fieldObjects, iter)
|
forAllConstIter(IOobjectList, fieldObjects, iter)
|
||||||
{
|
{
|
||||||
if (selectedFields.empty() || selectedFields.found(iter()->name()))
|
if (selectedFields.empty() || selectedFields.found(iter()->name()))
|
||||||
{
|
{
|
||||||
fields.set
|
fields.set
|
||||||
(
|
(
|
||||||
nFields,
|
nFields++,
|
||||||
vMesh.interpolate
|
helper.interpolate
|
||||||
(
|
(
|
||||||
GeoField
|
GeoField(*iter(), mesh)
|
||||||
(
|
|
||||||
*iter(),
|
|
||||||
mesh
|
|
||||||
)
|
|
||||||
).ptr()
|
).ptr()
|
||||||
);
|
);
|
||||||
nFields++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -34,7 +34,7 @@ SourceFiles
|
|||||||
#ifndef readFields_H
|
#ifndef readFields_H
|
||||||
#define readFields_H
|
#define readFields_H
|
||||||
|
|
||||||
#include "fvMesh.H"
|
#include "meshSubsetHelper.H"
|
||||||
#include "PtrList.H"
|
#include "PtrList.H"
|
||||||
#include "IOobjectList.H"
|
#include "IOobjectList.H"
|
||||||
#include "HashSet.H"
|
#include "HashSet.H"
|
||||||
@ -48,7 +48,7 @@ namespace Foam
|
|||||||
template<class GeoField>
|
template<class GeoField>
|
||||||
void readFields
|
void readFields
|
||||||
(
|
(
|
||||||
const vtkMesh& vMesh,
|
const meshSubsetHelper&,
|
||||||
const typename GeoField::Mesh& mesh,
|
const typename GeoField::Mesh& mesh,
|
||||||
const IOobjectList& objects,
|
const IOobjectList& objects,
|
||||||
const HashSet<word>& selectedFields,
|
const HashSet<word>& selectedFields,
|
||||||
|
|||||||
@ -40,11 +40,8 @@ SourceFiles
|
|||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "surfaceFields.H"
|
#include "surfaceFields.H"
|
||||||
#include "vtkMesh.H"
|
|
||||||
#include "indirectPrimitivePatch.H"
|
#include "indirectPrimitivePatch.H"
|
||||||
|
|
||||||
using namespace Foam;
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
|
|||||||
@ -29,7 +29,8 @@ License
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Field<Type>> Foam::surfaceMeshWriter::getFaceField
|
Foam::tmp<Foam::Field<Type>>
|
||||||
|
Foam::surfaceMeshWriter::getFaceField
|
||||||
(
|
(
|
||||||
const GeometricField<Type, fvsPatchField, surfaceMesh>& sfld
|
const GeometricField<Type, fvsPatchField, surfaceMesh>& sfld
|
||||||
) const
|
) const
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -36,46 +36,35 @@ SourceFiles
|
|||||||
#ifndef vtkMesh_H
|
#ifndef vtkMesh_H
|
||||||
#define vtkMesh_H
|
#define vtkMesh_H
|
||||||
|
|
||||||
|
#include "meshSubsetHelper.H"
|
||||||
#include "vtkTopo.H"
|
#include "vtkTopo.H"
|
||||||
#include "fvMeshSubset.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
|
||||||
class Time;
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class vtkMesh Declaration
|
Class vtkMesh Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class vtkMesh
|
class vtkMesh
|
||||||
|
:
|
||||||
|
public meshSubsetHelper
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Reference to mesh
|
|
||||||
fvMesh& baseMesh_;
|
|
||||||
|
|
||||||
//- Subsetting engine + sub-fvMesh
|
|
||||||
fvMeshSubset subsetter_;
|
|
||||||
|
|
||||||
//- Current cellSet (or empty)
|
|
||||||
const word setName_;
|
|
||||||
|
|
||||||
//- Current decomposition of topology
|
//- Current decomposition of topology
|
||||||
mutable autoPtr<vtkTopo> topoPtr_;
|
mutable autoPtr<vtkTopo> topoPtr_;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
vtkMesh(const vtkMesh&);
|
vtkMesh(const vtkMesh&) = delete;
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const vtkMesh&);
|
void operator=(const vtkMesh&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -83,31 +72,17 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
vtkMesh(fvMesh& baseMesh, const word& setName = "");
|
vtkMesh(fvMesh& baseMesh, const word& setName = word::null)
|
||||||
|
:
|
||||||
|
meshSubsetHelper(baseMesh, meshSubsetHelper::SET, setName)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Whole mesh
|
//- Topology
|
||||||
const fvMesh& baseMesh() const
|
|
||||||
{
|
|
||||||
return baseMesh_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const fvMeshSubset& subsetter() const
|
|
||||||
{
|
|
||||||
return subsetter_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Check if running subMesh
|
|
||||||
bool useSubMesh() const
|
|
||||||
{
|
|
||||||
return setName_.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
//- topology
|
|
||||||
const vtkTopo& topo() const
|
const vtkTopo& topo() const
|
||||||
{
|
{
|
||||||
if (topoPtr_.empty())
|
if (topoPtr_.empty())
|
||||||
@ -117,18 +92,6 @@ public:
|
|||||||
return topoPtr_();
|
return topoPtr_();
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Access either mesh or submesh
|
|
||||||
const fvMesh& mesh() const
|
|
||||||
{
|
|
||||||
if (useSubMesh())
|
|
||||||
{
|
|
||||||
return subsetter_.subMesh();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return baseMesh_;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Number of field cells
|
//- Number of field cells
|
||||||
label nFieldCells() const
|
label nFieldCells() const
|
||||||
@ -136,6 +99,7 @@ public:
|
|||||||
return topo().cellTypes().size();
|
return topo().cellTypes().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Number of field points
|
//- Number of field points
|
||||||
label nFieldPoints() const
|
label nFieldPoints() const
|
||||||
{
|
{
|
||||||
@ -145,26 +109,20 @@ public:
|
|||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
|
|
||||||
//- Read mesh
|
//- Read mesh, forcing topo update if necessary
|
||||||
polyMesh::readUpdateState readUpdate();
|
polyMesh::readUpdateState readUpdate()
|
||||||
|
|
||||||
|
|
||||||
//- Map volume field (does in fact do very little interpolation;
|
|
||||||
// just copied from fvMeshSubset)
|
|
||||||
template<class GeoField>
|
|
||||||
tmp<GeoField> interpolate(const GeoField& fld) const
|
|
||||||
{
|
{
|
||||||
if (useSubMesh())
|
polyMesh::readUpdateState meshState
|
||||||
|
= meshSubsetHelper::readUpdate();
|
||||||
|
|
||||||
|
if (meshState != polyMesh::UNCHANGED)
|
||||||
{
|
{
|
||||||
tmp<GeoField> subFld = subsetter_.interpolate(fld);
|
topoPtr_.clear();
|
||||||
subFld.ref().rename(fld.name());
|
|
||||||
return subFld;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return fld;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return meshState;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -32,12 +32,12 @@ License
|
|||||||
void Foam::writeFaceSet
|
void Foam::writeFaceSet
|
||||||
(
|
(
|
||||||
const bool binary,
|
const bool binary,
|
||||||
const vtkMesh& vMesh,
|
const fvMesh& mesh,
|
||||||
const faceSet& set,
|
const faceSet& set,
|
||||||
const fileName& fileName
|
const fileName& fileName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const faceList& faces = vMesh.mesh().faces();
|
const faceList& faces = mesh.faces();
|
||||||
|
|
||||||
std::ofstream ostr(fileName.c_str());
|
std::ofstream ostr(fileName.c_str());
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ void Foam::writeFaceSet
|
|||||||
setFaces[setFacei] = faces[iter.key()];
|
setFaces[setFacei] = faces[iter.key()];
|
||||||
setFacei++;
|
setFacei++;
|
||||||
}
|
}
|
||||||
primitiveFacePatch fp(setFaces, vMesh.mesh().points());
|
primitiveFacePatch fp(setFaces, mesh.points());
|
||||||
|
|
||||||
|
|
||||||
// Write points and faces as polygons
|
// Write points and faces as polygons
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -36,7 +36,7 @@ SourceFiles
|
|||||||
#ifndef writeFaceSet_H
|
#ifndef writeFaceSet_H
|
||||||
#define writeFaceSet_H
|
#define writeFaceSet_H
|
||||||
|
|
||||||
#include "vtkMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "faceSet.H"
|
#include "faceSet.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -48,7 +48,7 @@ namespace Foam
|
|||||||
void writeFaceSet
|
void writeFaceSet
|
||||||
(
|
(
|
||||||
const bool binary,
|
const bool binary,
|
||||||
const vtkMesh& vMesh,
|
const fvMesh&,
|
||||||
const faceSet& set,
|
const faceSet& set,
|
||||||
const fileName& fileName
|
const fileName& fileName
|
||||||
);
|
);
|
||||||
|
|||||||
@ -37,7 +37,7 @@ namespace Foam
|
|||||||
void writePointSet
|
void writePointSet
|
||||||
(
|
(
|
||||||
const bool binary,
|
const bool binary,
|
||||||
const vtkMesh& vMesh,
|
const fvMesh& mesh,
|
||||||
const pointSet& set,
|
const pointSet& set,
|
||||||
const fileName& fileName
|
const fileName& fileName
|
||||||
)
|
)
|
||||||
@ -68,7 +68,7 @@ void writePointSet
|
|||||||
|
|
||||||
writeFuns::insert
|
writeFuns::insert
|
||||||
(
|
(
|
||||||
UIndirectList<point>(vMesh.mesh().points(), set.toc())(),
|
UIndirectList<point>(mesh.points(), set.toc())(),
|
||||||
ptField
|
ptField
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -36,7 +36,7 @@ SourceFiles
|
|||||||
#ifndef writePointSet_H
|
#ifndef writePointSet_H
|
||||||
#define writePointSet_H
|
#define writePointSet_H
|
||||||
|
|
||||||
#include "vtkMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "pointSet.H"
|
#include "pointSet.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -48,7 +48,7 @@ namespace Foam
|
|||||||
void writePointSet
|
void writePointSet
|
||||||
(
|
(
|
||||||
const bool binary,
|
const bool binary,
|
||||||
const vtkMesh& vMesh,
|
const fvMesh& mesh,
|
||||||
const pointSet& set,
|
const pointSet& set,
|
||||||
const fileName& fileName
|
const fileName& fileName
|
||||||
);
|
);
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -35,13 +35,11 @@ License
|
|||||||
void Foam::writeSurfFields
|
void Foam::writeSurfFields
|
||||||
(
|
(
|
||||||
const bool binary,
|
const bool binary,
|
||||||
const vtkMesh& vMesh,
|
const fvMesh& mesh,
|
||||||
const fileName& fileName,
|
const fileName& fileName,
|
||||||
const UPtrList<const surfaceVectorField>& surfVectorFields
|
const UPtrList<const surfaceVectorField>& surfVectorFields
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const fvMesh& mesh = vMesh.mesh();
|
|
||||||
|
|
||||||
std::ofstream str(fileName.c_str());
|
std::ofstream str(fileName.c_str());
|
||||||
|
|
||||||
writeFuns::writeHeader
|
writeFuns::writeHeader
|
||||||
|
|||||||
@ -35,7 +35,7 @@ SourceFiles
|
|||||||
#ifndef writeSurfFields_H
|
#ifndef writeSurfFields_H
|
||||||
#define writeSurfFields_H
|
#define writeSurfFields_H
|
||||||
|
|
||||||
#include "vtkMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "surfaceMesh.H"
|
#include "surfaceMesh.H"
|
||||||
#include "surfaceFieldsFwd.H"
|
#include "surfaceFieldsFwd.H"
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ namespace Foam
|
|||||||
void writeSurfFields
|
void writeSurfFields
|
||||||
(
|
(
|
||||||
const bool binary,
|
const bool binary,
|
||||||
const vtkMesh& vMesh,
|
const fvMesh&,
|
||||||
const fileName& fileName,
|
const fileName& fileName,
|
||||||
const UPtrList<const surfaceVectorField>& surfVectorFields
|
const UPtrList<const surfaceVectorField>& surfVectorFields
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
cd ${0%/*} || exit 1 # Run from this directory
|
|
||||||
set -x
|
|
||||||
|
|
||||||
wclean libso vtkPV3Readers
|
|
||||||
PV3blockMeshReader/Allwclean
|
|
||||||
PV3FoamReader/Allwclean
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
cd ${0%/*} || exit 1 # Run from this directory
|
|
||||||
|
|
||||||
# Optional unit: continue-on-error
|
|
||||||
export WM_CONTINUE_ON_ERROR=true
|
|
||||||
|
|
||||||
# Parse arguments for library compilation
|
|
||||||
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
|
||||||
|
|
||||||
#
|
|
||||||
# There are several prerequisites for building a plugin
|
|
||||||
#
|
|
||||||
#set -x
|
|
||||||
canBuildPlugin()
|
|
||||||
{
|
|
||||||
[ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ] || {
|
|
||||||
echo
|
|
||||||
echo "WARNING: cannot build ParaView plugin(s) without paraview directory"
|
|
||||||
echo " ParaView_DIR=$ParaView_DIR"
|
|
||||||
echo
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
[ -n "$PV_PLUGIN_PATH" ] || {
|
|
||||||
echo
|
|
||||||
echo "${PWD##*/} : invalid PV_PLUGIN_PATH for building ParaView plugin(s)"
|
|
||||||
echo " PV_PLUGIN_PATH=${PV_PLUGIN_PATH:-unset}"
|
|
||||||
echo
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
type cmake > /dev/null 2>&1 || {
|
|
||||||
echo
|
|
||||||
echo "WARNING: cannot build ParaView plugin(s) without cmake"
|
|
||||||
echo
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0 # success
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
# major version as per paraview include directory:
|
|
||||||
# Eg, "PREFIX/include/paraview-3.4" -> "3.4"
|
|
||||||
major="${ParaView_INCLUDE_DIR##*-}"
|
|
||||||
|
|
||||||
case "$major" in
|
|
||||||
3.[0-9]*)
|
|
||||||
if canBuildPlugin
|
|
||||||
then
|
|
||||||
(
|
|
||||||
wmake $targetType vtkPV3Readers
|
|
||||||
PV3blockMeshReader/Allwmake $targetType $*
|
|
||||||
PV3FoamReader/Allwmake $targetType $*
|
|
||||||
)
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo
|
|
||||||
echo "NOTE: skipping build of ParaView V3 plugin(s)"
|
|
||||||
echo " include directory was for paraview major version '${major:-none}'"
|
|
||||||
echo
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
cd ${0%/*} || exit 1 # Run from this directory
|
|
||||||
set -x
|
|
||||||
|
|
||||||
# deal with client/server vs combined plugins
|
|
||||||
rm -f $FOAM_LIBBIN/libPV3FoamReader* 2>/dev/null
|
|
||||||
|
|
||||||
rm -rf PV3FoamReader/Make
|
|
||||||
wclean libso vtkPV3Foam
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
cd ${0%/*} || exit 1 # Run from this directory
|
|
||||||
|
|
||||||
# Parse arguments for library compilation
|
|
||||||
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
|
||||||
set -x
|
|
||||||
|
|
||||||
if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ]
|
|
||||||
then
|
|
||||||
wmake $targetType vtkPV3Foam
|
|
||||||
|
|
||||||
if [ "$targetType" != "objects" ]
|
|
||||||
then
|
|
||||||
(
|
|
||||||
cd PV3FoamReader
|
|
||||||
mkdir -p Make/$WM_OPTIONS > /dev/null 2>&1
|
|
||||||
cd Make/$WM_OPTIONS
|
|
||||||
cmake ../..
|
|
||||||
make
|
|
||||||
)
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
@ -1,86 +0,0 @@
|
|||||||
# create a plugin that adds a reader to the ParaView GUI
|
|
||||||
# it is added in the file dialog when doing opens/saves.
|
|
||||||
|
|
||||||
# The qrc file is processed by Qt's resource compiler (rcc)
|
|
||||||
# the qrc file must have a resource prefix of "/ParaViewResources"
|
|
||||||
# and ParaView will read anything contained under that prefix
|
|
||||||
# the pqReader.xml file contains xml defining readers with their
|
|
||||||
# file extensions and descriptions.
|
|
||||||
|
|
||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
|
||||||
|
|
||||||
FIND_PACKAGE(ParaView REQUIRED)
|
|
||||||
INCLUDE(${PARAVIEW_USE_FILE})
|
|
||||||
|
|
||||||
LINK_DIRECTORIES(
|
|
||||||
$ENV{FOAM_LIBBIN}
|
|
||||||
$ENV{FOAM_EXT_LIBBIN}
|
|
||||||
)
|
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(
|
|
||||||
$ENV{WM_PROJECT_DIR}/src/OpenFOAM/lnInclude
|
|
||||||
$ENV{WM_PROJECT_DIR}/src/OSspecific/$ENV{WM_OSTYPE}/lnInclude
|
|
||||||
$ENV{WM_PROJECT_DIR}/src/finiteVolume/lnInclude
|
|
||||||
${PROJECT_SOURCE_DIR}/../vtkPV3Foam
|
|
||||||
)
|
|
||||||
|
|
||||||
ADD_DEFINITIONS(
|
|
||||||
-DWM_$ENV{WM_PRECISION_OPTION}
|
|
||||||
-DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE}
|
|
||||||
)
|
|
||||||
|
|
||||||
# Set output library destination to plugin directory
|
|
||||||
SET(
|
|
||||||
LIBRARY_OUTPUT_PATH $ENV{PV_PLUGIN_PATH}
|
|
||||||
CACHE INTERNAL
|
|
||||||
"Single output directory for building all libraries."
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Defined combined plugin
|
|
||||||
#
|
|
||||||
|
|
||||||
# Extend the auto-generated panel
|
|
||||||
QT4_WRAP_CPP(MOC_SRCS pqPV3FoamReaderPanel.h)
|
|
||||||
|
|
||||||
ADD_PARAVIEW_OBJECT_PANEL(IFACES IFACE_SRCS
|
|
||||||
CLASS_NAME pqPV3FoamReaderPanel
|
|
||||||
XML_NAME PV3FoamReader # name of SourceProxy in *SM.xml
|
|
||||||
XML_GROUP sources
|
|
||||||
)
|
|
||||||
|
|
||||||
ADD_PARAVIEW_PLUGIN(
|
|
||||||
PV3FoamReader_SM "1.0"
|
|
||||||
SERVER_MANAGER_XML PV3FoamReader_SM.xml
|
|
||||||
SERVER_MANAGER_SOURCES vtkPV3FoamReader.cxx
|
|
||||||
GUI_INTERFACES ${IFACES}
|
|
||||||
GUI_SOURCES pqPV3FoamReaderPanel.cxx
|
|
||||||
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
|
|
||||||
GUI_RESOURCE_FILES PV3FoamReader.xml
|
|
||||||
)
|
|
||||||
|
|
||||||
# #
|
|
||||||
# # Define the server-side portion of the reader plugin
|
|
||||||
# #
|
|
||||||
# ADD_PARAVIEW_PLUGIN(
|
|
||||||
# PV3FoamReader_SM "1.0"
|
|
||||||
# SERVER_MANAGER_XML PV3FoamReader_SM.xml
|
|
||||||
# SERVER_MANAGER_SOURCES vtkPV3FoamReader.cxx
|
|
||||||
# )
|
|
||||||
# #
|
|
||||||
# # Define the client-side portion of the reader plugin
|
|
||||||
# #
|
|
||||||
# ADD_PARAVIEW_PLUGIN(
|
|
||||||
# PV3FoamReader "1.0"
|
|
||||||
# GUI_RESOURCES PV3FoamReader.qrc
|
|
||||||
# )
|
|
||||||
#
|
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(
|
|
||||||
PV3FoamReader_SM
|
|
||||||
OpenFOAM
|
|
||||||
finiteVolume
|
|
||||||
vtkPV3Foam
|
|
||||||
)
|
|
||||||
#-----------------------------------------------------------------------------
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
<RCC>
|
|
||||||
<qresource prefix="/ParaViewResources" >
|
|
||||||
<file>PV3FoamReader.xml</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
<ParaViewReaders>
|
|
||||||
<Reader name="PV3FoamReader"
|
|
||||||
extensions="OpenFOAM"
|
|
||||||
file_description="OpenFOAM Reader">
|
|
||||||
</Reader>
|
|
||||||
</ParaViewReaders>
|
|
||||||
@ -1,306 +0,0 @@
|
|||||||
<ServerManagerConfiguration>
|
|
||||||
<ProxyGroup name="sources">
|
|
||||||
<SourceProxy
|
|
||||||
name="PV3FoamReader"
|
|
||||||
class="vtkPV3FoamReader">
|
|
||||||
|
|
||||||
<!-- File name - compulsory -->
|
|
||||||
<StringVectorProperty
|
|
||||||
name="FileName"
|
|
||||||
command="SetFileName"
|
|
||||||
number_of_elements="1"
|
|
||||||
animateable="0">
|
|
||||||
<FileListDomain name="files"/>
|
|
||||||
<Documentation>
|
|
||||||
Specifies the filename for the OpenFOAM Reader.
|
|
||||||
</Documentation>
|
|
||||||
</StringVectorProperty>
|
|
||||||
|
|
||||||
<!-- Send discrete time info to the animation panel -->
|
|
||||||
<DoubleVectorProperty
|
|
||||||
name="TimestepValues"
|
|
||||||
repeatable="1"
|
|
||||||
information_only="1">
|
|
||||||
<TimeStepsInformationHelper/>
|
|
||||||
<Documentation>
|
|
||||||
Available timestep values.
|
|
||||||
</Documentation>
|
|
||||||
</DoubleVectorProperty>
|
|
||||||
|
|
||||||
<!-- Cache Mesh check-box -->
|
|
||||||
<IntVectorProperty
|
|
||||||
name="UiCacheMesh"
|
|
||||||
command="SetCacheMesh"
|
|
||||||
number_of_elements="1"
|
|
||||||
is_internal="1"
|
|
||||||
default_values="1"
|
|
||||||
animateable="0">
|
|
||||||
<BooleanDomain name="bool"/>
|
|
||||||
<Documentation>
|
|
||||||
Cache the fvMesh in memory.
|
|
||||||
</Documentation>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<!-- Refresh button -->
|
|
||||||
<IntVectorProperty
|
|
||||||
name="UiRefresh"
|
|
||||||
command="SetRefresh"
|
|
||||||
number_of_elements="1"
|
|
||||||
is_internal="0"
|
|
||||||
default_values="0"
|
|
||||||
animateable="0">
|
|
||||||
<BooleanDomain name="bool"/>
|
|
||||||
<Documentation>
|
|
||||||
Rescan for updated timesteps/fields.
|
|
||||||
</Documentation>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<!-- Skip Zero Time check-box -->
|
|
||||||
<IntVectorProperty
|
|
||||||
name="UiZeroTime"
|
|
||||||
command="SetSkipZeroTime"
|
|
||||||
number_of_elements="1"
|
|
||||||
is_internal="1"
|
|
||||||
default_values="0"
|
|
||||||
animateable="0">
|
|
||||||
<BooleanDomain name="bool"/>
|
|
||||||
<Documentation>
|
|
||||||
Skip including the 0/ time directory
|
|
||||||
</Documentation>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<!-- Interpolate Fields check-box -->
|
|
||||||
<IntVectorProperty
|
|
||||||
name="UiInterpolateVolFields"
|
|
||||||
command="SetInterpolateVolFields"
|
|
||||||
number_of_elements="1"
|
|
||||||
is_internal="1"
|
|
||||||
default_values="1"
|
|
||||||
animateable="0">
|
|
||||||
<BooleanDomain name="bool"/>
|
|
||||||
<Documentation>
|
|
||||||
Interpolate volume fields into point fields
|
|
||||||
</Documentation>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<!-- Extrapolate Patches check-box -->
|
|
||||||
<IntVectorProperty
|
|
||||||
name="UiExtrapolatePatches"
|
|
||||||
command="SetExtrapolatePatches"
|
|
||||||
number_of_elements="1"
|
|
||||||
is_internal="1"
|
|
||||||
default_values="0"
|
|
||||||
animateable="0">
|
|
||||||
<BooleanDomain name="bool"/>
|
|
||||||
<Documentation>
|
|
||||||
Extrapolate internalField to non-constraint patches
|
|
||||||
</Documentation>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<!-- Use VTK Polyhedron check-box -->
|
|
||||||
<IntVectorProperty
|
|
||||||
name="UseVTKPolyhedron"
|
|
||||||
command="SetUseVTKPolyhedron"
|
|
||||||
number_of_elements="1"
|
|
||||||
default_values="0"
|
|
||||||
animateable="0">
|
|
||||||
<BooleanDomain name="bool"/>
|
|
||||||
<Documentation>
|
|
||||||
Use vtkPolyhedron instead of decomposing polyhedra.
|
|
||||||
</Documentation>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<!-- Include Sets check-box -->
|
|
||||||
<IntVectorProperty
|
|
||||||
name="UiIncludeSets"
|
|
||||||
command="SetIncludeSets"
|
|
||||||
number_of_elements="1"
|
|
||||||
is_internal="1"
|
|
||||||
default_values="0"
|
|
||||||
animateable="0">
|
|
||||||
<Documentation>
|
|
||||||
Search the polyMesh/sets/ directory
|
|
||||||
</Documentation>
|
|
||||||
<BooleanDomain name="bool"/>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<!-- Include Zones check-box -->
|
|
||||||
<IntVectorProperty
|
|
||||||
name="UiIncludeZones"
|
|
||||||
command="SetIncludeZones"
|
|
||||||
number_of_elements="1"
|
|
||||||
is_internal="1"
|
|
||||||
default_values="0"
|
|
||||||
animateable="0">
|
|
||||||
<Documentation>
|
|
||||||
ZoneMesh information is used to find {cell,face,point}Zones.
|
|
||||||
The polyMesh/ directory is only checked on startup.
|
|
||||||
</Documentation>
|
|
||||||
<BooleanDomain name="bool"/>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<!-- Show Patch Names check-box -->
|
|
||||||
<IntVectorProperty
|
|
||||||
name="UiShowPatchNames"
|
|
||||||
command="SetShowPatchNames"
|
|
||||||
number_of_elements="1"
|
|
||||||
default_values="0"
|
|
||||||
is_internal="1"
|
|
||||||
animateable="0">
|
|
||||||
<BooleanDomain name="bool"/>
|
|
||||||
<Documentation>
|
|
||||||
Show patch names in render window
|
|
||||||
</Documentation>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<!-- Show Groups Only check-box -->
|
|
||||||
<IntVectorProperty
|
|
||||||
name="UiShowGroupsOnly"
|
|
||||||
command="SetShowGroupsOnly"
|
|
||||||
number_of_elements="1"
|
|
||||||
default_values="0"
|
|
||||||
is_internal="1"
|
|
||||||
animateable="0">
|
|
||||||
<BooleanDomain name="bool"/>
|
|
||||||
<Documentation>
|
|
||||||
Show groups only
|
|
||||||
</Documentation>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<!-- Force GUI update check box -->
|
|
||||||
<IntVectorProperty
|
|
||||||
name="UpdateGUI"
|
|
||||||
command="SetUpdateGUI"
|
|
||||||
number_of_elements="1"
|
|
||||||
default_values="0"
|
|
||||||
animateable="0">
|
|
||||||
<BooleanDomain name="bool"/>
|
|
||||||
<Documentation>
|
|
||||||
A simple way to cause a reader GUI modification.
|
|
||||||
</Documentation>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
| Selections
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!-- Available Parts (volume, patches, lagrangian) array -->
|
|
||||||
<StringVectorProperty
|
|
||||||
name="PartArrayStatus"
|
|
||||||
information_only="1">
|
|
||||||
<ArraySelectionInformationHelper attribute_name="Part"/>
|
|
||||||
</StringVectorProperty>
|
|
||||||
<StringVectorProperty
|
|
||||||
name="PartStatus"
|
|
||||||
label="Mesh Parts"
|
|
||||||
command="SetPartArrayStatus"
|
|
||||||
number_of_elements="0"
|
|
||||||
repeat_command="1"
|
|
||||||
number_of_elements_per_command="2"
|
|
||||||
element_types="2 0"
|
|
||||||
information_property="PartArrayStatus"
|
|
||||||
animateable="0">
|
|
||||||
<ArraySelectionDomain name="array_list">
|
|
||||||
<RequiredProperties>
|
|
||||||
<Property name="PartArrayStatus" function="ArrayList"/>
|
|
||||||
</RequiredProperties>
|
|
||||||
</ArraySelectionDomain>
|
|
||||||
<Documentation>
|
|
||||||
This property contains a list of the mesh parts
|
|
||||||
(patches, groups, sets, zones).
|
|
||||||
</Documentation>
|
|
||||||
</StringVectorProperty>
|
|
||||||
|
|
||||||
<!-- Available volFields array -->
|
|
||||||
<StringVectorProperty
|
|
||||||
name="VolFieldArrayStatus"
|
|
||||||
information_only="1">
|
|
||||||
<ArraySelectionInformationHelper attribute_name="VolField"/>
|
|
||||||
</StringVectorProperty>
|
|
||||||
<StringVectorProperty
|
|
||||||
name="VolFieldStatus"
|
|
||||||
label="Volume Fields"
|
|
||||||
command="SetVolFieldArrayStatus"
|
|
||||||
number_of_elements="0"
|
|
||||||
repeat_command="1"
|
|
||||||
number_of_elements_per_command="2"
|
|
||||||
element_types="2 0"
|
|
||||||
information_property="VolFieldArrayStatus"
|
|
||||||
animateable="0">
|
|
||||||
<ArraySelectionDomain name="array_list">
|
|
||||||
<RequiredProperties>
|
|
||||||
<Property name="VolFieldArrayStatus" function="ArrayList"/>
|
|
||||||
</RequiredProperties>
|
|
||||||
</ArraySelectionDomain>
|
|
||||||
<Documentation>
|
|
||||||
This property contains a list of the volume fields
|
|
||||||
</Documentation>
|
|
||||||
</StringVectorProperty>
|
|
||||||
|
|
||||||
<!-- Available Lagrangian fields array -->
|
|
||||||
<StringVectorProperty
|
|
||||||
name="LagrangianFieldArrayStatus"
|
|
||||||
information_only="1">
|
|
||||||
<ArraySelectionInformationHelper attribute_name="LagrangianField"/>
|
|
||||||
</StringVectorProperty>
|
|
||||||
<StringVectorProperty
|
|
||||||
name="LagrangianFieldStatus"
|
|
||||||
label="Lagrangian Fields"
|
|
||||||
command="SetLagrangianFieldArrayStatus"
|
|
||||||
number_of_elements="0"
|
|
||||||
repeat_command="1"
|
|
||||||
number_of_elements_per_command="2"
|
|
||||||
element_types="2 0"
|
|
||||||
information_property="LagrangianFieldArrayStatus"
|
|
||||||
animateable="0">
|
|
||||||
<ArraySelectionDomain name="array_list">
|
|
||||||
<RequiredProperties>
|
|
||||||
<Property name="LagrangianFieldArrayStatus" function="ArrayList"/>
|
|
||||||
</RequiredProperties>
|
|
||||||
</ArraySelectionDomain>
|
|
||||||
<Documentation>
|
|
||||||
This property contains a list of the lagrangian fields
|
|
||||||
</Documentation>
|
|
||||||
</StringVectorProperty>
|
|
||||||
|
|
||||||
<!-- Available pointFields array -->
|
|
||||||
<StringVectorProperty
|
|
||||||
name="PointFieldArrayStatus"
|
|
||||||
information_only="1">
|
|
||||||
<ArraySelectionInformationHelper attribute_name="PointField"/>
|
|
||||||
</StringVectorProperty>
|
|
||||||
<StringVectorProperty
|
|
||||||
name="PointFieldStatus"
|
|
||||||
label="Point Fields"
|
|
||||||
command="SetPointFieldArrayStatus"
|
|
||||||
number_of_elements="0"
|
|
||||||
repeat_command="1"
|
|
||||||
number_of_elements_per_command="2"
|
|
||||||
element_types="2 0"
|
|
||||||
information_property="PointFieldArrayStatus"
|
|
||||||
animateable="0">
|
|
||||||
<ArraySelectionDomain name="array_list">
|
|
||||||
<RequiredProperties>
|
|
||||||
<Property name="PointFieldArrayStatus" function="ArrayList"/>
|
|
||||||
</RequiredProperties>
|
|
||||||
</ArraySelectionDomain>
|
|
||||||
<Documentation>
|
|
||||||
This property contains a list of the point fields
|
|
||||||
</Documentation>
|
|
||||||
</StringVectorProperty>
|
|
||||||
|
|
||||||
<Hints>
|
|
||||||
<Property name="FileName" show="0"/>
|
|
||||||
<Property name="UiCacheMesh" show="0"/>
|
|
||||||
<Property name="UiZeroTime" show="0"/>
|
|
||||||
<Property name="UiRefresh" show="0"/>
|
|
||||||
<Property name="UiShowPatchNames" show="0"/>
|
|
||||||
<Property name="UiShowGroupsOnly" show="0"/>
|
|
||||||
<Property name="UiIncludeSets" show="0"/>
|
|
||||||
<Property name="UiIncludeZones" show="0"/>
|
|
||||||
</Hints>
|
|
||||||
|
|
||||||
|
|
||||||
</SourceProxy>
|
|
||||||
</ProxyGroup>
|
|
||||||
</ServerManagerConfiguration>
|
|
||||||
@ -1,464 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
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 "pqPV3FoamReaderPanel.h"
|
|
||||||
|
|
||||||
// QT
|
|
||||||
#include <QGridLayout>
|
|
||||||
#include <QCheckBox>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QLayout>
|
|
||||||
#include <QString>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QtDebug>
|
|
||||||
|
|
||||||
// Paraview <-> QT UI
|
|
||||||
#include "pqAnimationScene.h"
|
|
||||||
#include "pqApplicationCore.h"
|
|
||||||
#include "pqPipelineRepresentation.h"
|
|
||||||
#include "pqServerManagerModel.h"
|
|
||||||
#include "pqView.h"
|
|
||||||
|
|
||||||
// Paraview Server Manager
|
|
||||||
#include "vtkSMDoubleVectorProperty.h"
|
|
||||||
#include "vtkSMIntVectorProperty.h"
|
|
||||||
#include "vtkSMProperty.h"
|
|
||||||
#include "vtkSMSourceProxy.h"
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
pqPV3FoamReaderPanel::pqPV3FoamReaderPanel
|
|
||||||
(
|
|
||||||
pqProxy *proxy,
|
|
||||||
QWidget *p
|
|
||||||
)
|
|
||||||
:
|
|
||||||
pqAutoGeneratedObjectPanel(proxy, p)
|
|
||||||
{
|
|
||||||
// create first sublayout (at top of the panel)
|
|
||||||
QGridLayout* form = new QGridLayout();
|
|
||||||
this->PanelLayout->addLayout(form, 0, 0, 1, -1);
|
|
||||||
|
|
||||||
// ROW 0
|
|
||||||
// ~~~~~
|
|
||||||
|
|
||||||
vtkSMProperty* prop = 0;
|
|
||||||
|
|
||||||
// refresh button for updating times/fields
|
|
||||||
if ((prop = this->proxy()->GetProperty("UiRefresh")) != 0)
|
|
||||||
{
|
|
||||||
prop->SetImmediateUpdate(1);
|
|
||||||
QPushButton *refresh = new QPushButton("Refresh Times");
|
|
||||||
refresh->setToolTip("Rescan for updated times/fields.");
|
|
||||||
|
|
||||||
form->addWidget(refresh, 0, 0, Qt::AlignLeft);
|
|
||||||
QObject::connect
|
|
||||||
(
|
|
||||||
refresh,
|
|
||||||
SIGNAL(clicked()),
|
|
||||||
this,
|
|
||||||
SLOT(RefreshPressed())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// checkbox for skip zeroTime
|
|
||||||
if ((prop = this->proxy()->GetProperty("UiZeroTime")) != 0)
|
|
||||||
{
|
|
||||||
// immediate update on the Server Manager side
|
|
||||||
prop->SetImmediateUpdate(true);
|
|
||||||
|
|
||||||
ZeroTime_ = new QCheckBox("Skip Zero Time");
|
|
||||||
ZeroTime_->setChecked
|
|
||||||
(
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
|
|
||||||
);
|
|
||||||
ZeroTime_->setToolTip
|
|
||||||
(
|
|
||||||
"Skip including the 0/ time directory."
|
|
||||||
);
|
|
||||||
|
|
||||||
form->addWidget(ZeroTime_, 0, 1, Qt::AlignLeft);
|
|
||||||
connect
|
|
||||||
(
|
|
||||||
ZeroTime_,
|
|
||||||
SIGNAL(stateChanged(int)),
|
|
||||||
this,
|
|
||||||
SLOT(ZeroTimeToggled())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ROW 1
|
|
||||||
// ~~~~~
|
|
||||||
|
|
||||||
QFrame* hline1 = new QFrame(this);
|
|
||||||
hline1->setFrameStyle(QFrame::HLine | QFrame::Sunken);
|
|
||||||
form->addWidget(hline1, 1, 0, 1, 3);
|
|
||||||
|
|
||||||
// ROW 2
|
|
||||||
// ~~~~~
|
|
||||||
|
|
||||||
// checkbox for caching mesh
|
|
||||||
if ((prop = this->proxy()->GetProperty("UiCacheMesh")) != 0)
|
|
||||||
{
|
|
||||||
// immediate update on the Server Manager side
|
|
||||||
prop->SetImmediateUpdate(true);
|
|
||||||
|
|
||||||
CacheMesh_ = new QCheckBox("Cache Mesh");
|
|
||||||
CacheMesh_->setChecked
|
|
||||||
(
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
|
|
||||||
);
|
|
||||||
CacheMesh_->setToolTip
|
|
||||||
(
|
|
||||||
"Cache the fvMesh in memory."
|
|
||||||
);
|
|
||||||
|
|
||||||
form->addWidget(CacheMesh_, 2, 0, Qt::AlignLeft);
|
|
||||||
connect
|
|
||||||
(
|
|
||||||
CacheMesh_,
|
|
||||||
SIGNAL(stateChanged(int)),
|
|
||||||
this,
|
|
||||||
SLOT(CacheMeshToggled())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// cell 2,1 empty
|
|
||||||
|
|
||||||
// ROW 3
|
|
||||||
// ~~~~~
|
|
||||||
|
|
||||||
// checkbox for include sets
|
|
||||||
if ((prop = this->proxy()->GetProperty("UiIncludeSets")) != 0)
|
|
||||||
{
|
|
||||||
// immediate update on the Server Manager side
|
|
||||||
prop->SetImmediateUpdate(true);
|
|
||||||
|
|
||||||
IncludeSets_ = new QCheckBox("Include Sets");
|
|
||||||
IncludeSets_->setChecked
|
|
||||||
(
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
|
|
||||||
);
|
|
||||||
IncludeSets_->setToolTip
|
|
||||||
(
|
|
||||||
"Search the polyMesh/sets/ directory."
|
|
||||||
);
|
|
||||||
|
|
||||||
// row/col 1,0
|
|
||||||
form->addWidget(IncludeSets_, 3, 0, Qt::AlignLeft);
|
|
||||||
connect
|
|
||||||
(
|
|
||||||
IncludeSets_,
|
|
||||||
SIGNAL(stateChanged(int)),
|
|
||||||
this,
|
|
||||||
SLOT(IncludeSetsToggled())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// checkbox for Groups Only
|
|
||||||
if ((prop = this->proxy()->GetProperty("UiShowGroupsOnly")) != 0)
|
|
||||||
{
|
|
||||||
// immediate update on the Server Manager side
|
|
||||||
prop->SetImmediateUpdate(true);
|
|
||||||
|
|
||||||
ShowGroupsOnly_ = new QCheckBox("Groups Only");
|
|
||||||
ShowGroupsOnly_->setChecked
|
|
||||||
(
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
|
|
||||||
);
|
|
||||||
ShowGroupsOnly_->setToolTip
|
|
||||||
(
|
|
||||||
"Show patchGroups only."
|
|
||||||
);
|
|
||||||
|
|
||||||
// row/col 2, 2
|
|
||||||
form->addWidget(ShowGroupsOnly_, 3, 1, Qt::AlignLeft);
|
|
||||||
connect
|
|
||||||
(
|
|
||||||
ShowGroupsOnly_,
|
|
||||||
SIGNAL(stateChanged(int)),
|
|
||||||
this,
|
|
||||||
SLOT(ShowGroupsOnlyToggled())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ROW 4
|
|
||||||
// ~~~~~
|
|
||||||
|
|
||||||
// checkbox for include zones
|
|
||||||
if ((prop = this->proxy()->GetProperty("UiIncludeZones")) != 0)
|
|
||||||
{
|
|
||||||
// immediate update on the Server Manager side
|
|
||||||
prop->SetImmediateUpdate(true);
|
|
||||||
|
|
||||||
IncludeZones_ = new QCheckBox("Include Zones");
|
|
||||||
IncludeZones_->setChecked
|
|
||||||
(
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
|
|
||||||
);
|
|
||||||
IncludeZones_->setToolTip
|
|
||||||
(
|
|
||||||
"ZoneMesh information is used to find {cell,face,point}Zones. "
|
|
||||||
"The polyMesh/ directory is only checked on startup."
|
|
||||||
);
|
|
||||||
|
|
||||||
// row/col 1,1
|
|
||||||
form->addWidget(IncludeZones_, 4, 0, Qt::AlignLeft);
|
|
||||||
connect
|
|
||||||
(
|
|
||||||
IncludeZones_,
|
|
||||||
SIGNAL(stateChanged(int)),
|
|
||||||
this,
|
|
||||||
SLOT(IncludeZonesToggled())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// checkbox for patch names
|
|
||||||
if ((prop = this->proxy()->GetProperty("UiShowPatchNames")) != 0)
|
|
||||||
{
|
|
||||||
// immediate update on the Server Manager side
|
|
||||||
prop->SetImmediateUpdate(true);
|
|
||||||
|
|
||||||
ShowPatchNames_ = new QCheckBox("Patch Names");
|
|
||||||
ShowPatchNames_->setChecked
|
|
||||||
(
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
|
|
||||||
);
|
|
||||||
ShowPatchNames_->setToolTip
|
|
||||||
(
|
|
||||||
"Show patch names in render window."
|
|
||||||
);
|
|
||||||
|
|
||||||
// row/col 0,1
|
|
||||||
form->addWidget(ShowPatchNames_, 4, 1, Qt::AlignLeft);
|
|
||||||
connect
|
|
||||||
(
|
|
||||||
ShowPatchNames_,
|
|
||||||
SIGNAL(stateChanged(int)),
|
|
||||||
this,
|
|
||||||
SLOT(ShowPatchNamesToggled())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ROW 5
|
|
||||||
// ~~~~~
|
|
||||||
|
|
||||||
QFrame* hline2 = new QFrame(this);
|
|
||||||
hline2->setFrameStyle(QFrame::HLine | QFrame::Sunken);
|
|
||||||
form->addWidget(hline2, 5, 0, 1, 3);
|
|
||||||
|
|
||||||
// ROW 6
|
|
||||||
// ~~~~~
|
|
||||||
|
|
||||||
// checkbox for vol field interpolation
|
|
||||||
if ((prop = this->proxy()->GetProperty("UiInterpolateVolFields")) != 0)
|
|
||||||
{
|
|
||||||
// immediate update on the Server Manager side
|
|
||||||
prop->SetImmediateUpdate(true);
|
|
||||||
|
|
||||||
InterpolateVolFields_ = new QCheckBox("Interpolate volFields");
|
|
||||||
InterpolateVolFields_->setChecked
|
|
||||||
(
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
|
|
||||||
);
|
|
||||||
InterpolateVolFields_->setToolTip
|
|
||||||
(
|
|
||||||
"Interpolate volFields into pointFields"
|
|
||||||
);
|
|
||||||
|
|
||||||
// row/col 1,1
|
|
||||||
form->addWidget(InterpolateVolFields_, 6, 0, Qt::AlignLeft);
|
|
||||||
connect
|
|
||||||
(
|
|
||||||
InterpolateVolFields_,
|
|
||||||
SIGNAL(stateChanged(int)),
|
|
||||||
this,
|
|
||||||
SLOT(InterpolateVolFieldsToggled())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// checkbox for extrapolate patches
|
|
||||||
if ((prop = this->proxy()->GetProperty("UiExtrapolatePatches")) != 0)
|
|
||||||
{
|
|
||||||
// immediate update on the Server Manager side
|
|
||||||
prop->SetImmediateUpdate(true);
|
|
||||||
|
|
||||||
ExtrapolatePatches_ = new QCheckBox("Extrapolate Patches");
|
|
||||||
ExtrapolatePatches_->setChecked
|
|
||||||
(
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
|
|
||||||
);
|
|
||||||
ExtrapolatePatches_->setToolTip
|
|
||||||
(
|
|
||||||
"Extrapolate internalField to non-constraint patches"
|
|
||||||
);
|
|
||||||
|
|
||||||
// row/col 1,1
|
|
||||||
form->addWidget(ExtrapolatePatches_, 6, 1, Qt::AlignLeft);
|
|
||||||
connect
|
|
||||||
(
|
|
||||||
ExtrapolatePatches_,
|
|
||||||
SIGNAL(stateChanged(int)),
|
|
||||||
this,
|
|
||||||
SLOT(ExtrapolatePatchesToggled())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ROW 7
|
|
||||||
// ~~~~~
|
|
||||||
|
|
||||||
QFrame* hline3 = new QFrame(this);
|
|
||||||
hline3->setFrameStyle(QFrame::HLine | QFrame::Sunken);
|
|
||||||
form->addWidget(hline3, 7, 0, 1, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void pqPV3FoamReaderPanel::CacheMeshToggled()
|
|
||||||
{
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast
|
|
||||||
(
|
|
||||||
this->proxy()->GetProperty("UiCacheMesh")
|
|
||||||
)->SetElement(0, CacheMesh_->isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void pqPV3FoamReaderPanel::RefreshPressed()
|
|
||||||
{
|
|
||||||
// update everything
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast
|
|
||||||
(
|
|
||||||
this->proxy()->GetProperty("UiRefresh")
|
|
||||||
)->Modified();
|
|
||||||
|
|
||||||
vtkSMSourceProxy::SafeDownCast(this->proxy())->UpdatePipeline();
|
|
||||||
|
|
||||||
// render all views
|
|
||||||
pqApplicationCore::instance()->render();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void pqPV3FoamReaderPanel::ZeroTimeToggled()
|
|
||||||
{
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast
|
|
||||||
(
|
|
||||||
this->proxy()->GetProperty("UiZeroTime")
|
|
||||||
)->SetElement(0, ZeroTime_->isChecked());
|
|
||||||
|
|
||||||
this->setModified();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void pqPV3FoamReaderPanel::ShowPatchNamesToggled()
|
|
||||||
{
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast
|
|
||||||
(
|
|
||||||
this->proxy()->GetProperty("UiShowPatchNames")
|
|
||||||
)->SetElement(0, ShowPatchNames_->isChecked());
|
|
||||||
|
|
||||||
// update the active view
|
|
||||||
if (this->view())
|
|
||||||
{
|
|
||||||
this->view()->render();
|
|
||||||
}
|
|
||||||
// OR: update all views
|
|
||||||
// pqApplicationCore::instance()->render();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void pqPV3FoamReaderPanel::ShowGroupsOnlyToggled()
|
|
||||||
{
|
|
||||||
vtkSMProperty* prop;
|
|
||||||
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast
|
|
||||||
(
|
|
||||||
this->proxy()->GetProperty("UiShowGroupsOnly")
|
|
||||||
)->SetElement(0, ShowGroupsOnly_->isChecked());
|
|
||||||
|
|
||||||
if ((prop = this->proxy()->GetProperty("PartArrayStatus")) != 0)
|
|
||||||
{
|
|
||||||
this->proxy()->UpdatePropertyInformation(prop);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void pqPV3FoamReaderPanel::IncludeSetsToggled()
|
|
||||||
{
|
|
||||||
vtkSMProperty* prop;
|
|
||||||
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast
|
|
||||||
(
|
|
||||||
this->proxy()->GetProperty("UiIncludeSets")
|
|
||||||
)->SetElement(0, IncludeSets_->isChecked());
|
|
||||||
|
|
||||||
if ((prop = this->proxy()->GetProperty("PartArrayStatus")) != 0)
|
|
||||||
{
|
|
||||||
this->proxy()->UpdatePropertyInformation(prop);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void pqPV3FoamReaderPanel::IncludeZonesToggled()
|
|
||||||
{
|
|
||||||
vtkSMProperty* prop;
|
|
||||||
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast
|
|
||||||
(
|
|
||||||
this->proxy()->GetProperty("UiIncludeZones")
|
|
||||||
)->SetElement(0, IncludeZones_->isChecked());
|
|
||||||
|
|
||||||
if ((prop = this->proxy()->GetProperty("PartArrayStatus")) != 0)
|
|
||||||
{
|
|
||||||
this->proxy()->UpdatePropertyInformation(prop);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void pqPV3FoamReaderPanel::ExtrapolatePatchesToggled()
|
|
||||||
{
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast
|
|
||||||
(
|
|
||||||
this->proxy()->GetProperty("UiExtrapolatePatches")
|
|
||||||
)->SetElement(0, ExtrapolatePatches_->isChecked());
|
|
||||||
|
|
||||||
this->setModified();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void pqPV3FoamReaderPanel::InterpolateVolFieldsToggled()
|
|
||||||
{
|
|
||||||
vtkSMIntVectorProperty::SafeDownCast
|
|
||||||
(
|
|
||||||
this->proxy()->GetProperty("UiInterpolateVolFields")
|
|
||||||
)->SetElement(0, InterpolateVolFields_->isChecked());
|
|
||||||
|
|
||||||
this->setModified();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,120 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
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
|
|
||||||
pqPV3FoamReaderPanel
|
|
||||||
|
|
||||||
Description
|
|
||||||
GUI modifications for the ParaView reader panel
|
|
||||||
|
|
||||||
A custom panel for the PV3FoamReader.
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
pqPV3FoamReaderPanel.cxx
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
#ifndef pqPV3FoamReaderPanel_h
|
|
||||||
#define pqPV3FoamReaderPanel_h
|
|
||||||
|
|
||||||
|
|
||||||
#include "pqAutoGeneratedObjectPanel.h"
|
|
||||||
|
|
||||||
// Forward declaration of QT classes
|
|
||||||
|
|
||||||
class QCheckBox;
|
|
||||||
class QLineEdit;
|
|
||||||
class QTimer;
|
|
||||||
class QToolButton;
|
|
||||||
|
|
||||||
// Forward declaration of ParaView classes
|
|
||||||
class vtkSMSourceProxy;
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class pqPV3FoamReaderPanel Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
class pqPV3FoamReaderPanel
|
|
||||||
:
|
|
||||||
public pqAutoGeneratedObjectPanel
|
|
||||||
{
|
|
||||||
// Private data
|
|
||||||
Q_OBJECT;
|
|
||||||
typedef pqAutoGeneratedObjectPanel Superclass;
|
|
||||||
|
|
||||||
//- ZeroTime checkbox
|
|
||||||
QCheckBox* ZeroTime_;
|
|
||||||
|
|
||||||
//- CacheMesh checkbox
|
|
||||||
QCheckBox* CacheMesh_;
|
|
||||||
|
|
||||||
//- Show Patch Names checkbox
|
|
||||||
QCheckBox* ShowPatchNames_;
|
|
||||||
|
|
||||||
//- Show Groups Only checkbox
|
|
||||||
QCheckBox* ShowGroupsOnly_;
|
|
||||||
|
|
||||||
//- IncludeSets checkbox
|
|
||||||
QCheckBox* IncludeSets_;
|
|
||||||
|
|
||||||
//- IncludeZones checkbox
|
|
||||||
QCheckBox* IncludeZones_;
|
|
||||||
|
|
||||||
//- InterpolateVolFields checkbox
|
|
||||||
QCheckBox* InterpolateVolFields_;
|
|
||||||
|
|
||||||
//- ExtrapolatePatches checkbox
|
|
||||||
QCheckBox* ExtrapolatePatches_;
|
|
||||||
|
|
||||||
|
|
||||||
protected slots:
|
|
||||||
|
|
||||||
void CacheMeshToggled();
|
|
||||||
void ZeroTimeToggled();
|
|
||||||
void RefreshPressed();
|
|
||||||
void ShowPatchNamesToggled();
|
|
||||||
void ShowGroupsOnlyToggled();
|
|
||||||
void IncludeSetsToggled();
|
|
||||||
void IncludeZonesToggled();
|
|
||||||
void InterpolateVolFieldsToggled();
|
|
||||||
void ExtrapolatePatchesToggled();
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct from components
|
|
||||||
pqPV3FoamReaderPanel(pqProxy*, QWidget*);
|
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
|
||||||
// virtual ~pqPV3FoamReaderPanel();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user