Commit b5c7e43c authored by Mark Olesen's avatar Mark Olesen
Browse files

DEFEATURE: remove foamToTecplot360

- the API-versioned calls (eg, tecini142, teczne142, tecpoly142, tecend142),
  the limited availability of the SDK and lack of adequate testing make
  proper maintenance very difficult.
parent 6b8f0373
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for application compilation (at least for error control)
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
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
echo "Building optional tecplot conversion component."
wmake $targetType
else
echo "Skipping optional tecplot conversion components (no tecio detected)."
fi
#------------------------------------------------------------------------------
tecplotWriter.C
foamToTecplot360.C
EXE = $(FOAM_APPBIN)/foamToTecplot360
/* Tecio doesn't have many files, so they are just in a single directory */
EXE_INC = \
-I$(TECIO_ARCH_PATH) \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-L$(TECIO_ARCH_PATH) -ltecio \
-llagrangian \
-ldynamicMesh \
-lgenericPatchFields
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "readFields.H"
#include "IOobjectList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
template<class GeoField>
void readFields
(
const meshSubsetHelper& helper,
const typename GeoField::Mesh& mesh,
const IOobjectList& objects,
const wordHashSet& selectedFields,
PtrList<const GeoField>& fields
)
{
// Search list of objects for fields of type GeomField
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));
// Construct the fields
fields.setSize(fieldObjects.size());
label nFields = 0;
forAllConstIter(IOobjectList, fieldObjects, iter)
{
if (selectedFields.empty() || selectedFields.found(iter()->name()))
{
fields.set
(
nFields++,
helper.interpolate
(
GeoField(*iter(), mesh)
).ptr()
);
}
}
fields.setSize(nFields);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / 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/>.
InClass
Foam::readFields
Description
SourceFiles
readFields.C
\*---------------------------------------------------------------------------*/
#ifndef readFields_H
#define readFields_H
#include "meshSubsetHelper.H"
#include "PtrList.H"
#include "IOobjectList.H"
#include "HashSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Read the fields and optionally subset and put on the pointer list
template<class GeoField>
void readFields
(
const meshSubsetHelper&,
const typename GeoField::Mesh& mesh,
const IOobjectList& objects,
const wordHashSet& selectedFields,
PtrList<const GeoField>& fields
);
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "readFields.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "tecplotWriter.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 * * * * * * * * * * * * * * //
Foam::tecplotWriter::tecplotWriter(const Time& runTime)
:
time_(runTime)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::tecplotWriter::writeInit
(
const word& name,
const string& varNames,
const fileName& fName,
const dataFileType fileType
) const
{
const int32_t FileType = fileType;
const int32_t FileFormat = 0; // 0 = binary (plt), 1 = subzone (.szplt)
Pout<< nl << nl
<< "Name:" << name
<< " varNames:" << varNames
<< " to file:" << fName
<< " of type:" << int(fileType)
<< endl;
if
(
tecini142
(
name.c_str(), //< DataSet Title
varNames.c_str(), //< Variables List
fName.c_str(), //< FileName
time_.path().c_str(), //< ScratchDir
&FileFormat, //< FileFormat
&FileType, //< FileType
&tecConst_False, //< Debug (0: no debug, 1: debug)
&tecConst_False //< VIsDouble (0: single, 1: double)
)
)
{
FatalErrorInFunction
<< "Error in tecini142."
<< exit(FatalError);
}
}
void Foam::tecplotWriter::writePolyhedralZone
(
const word& zoneName,
const int32_t strandID,
const fvMesh& mesh,
const UList<int32_t>& varLocArray,
const int32_t NumFaceNodes
) const
{
const int32_t NumNodes = mesh.nPoints(); // Number of unique nodes
const int32_t NumElems = mesh.nCells(); // Number of elements
const int32_t NumFaces = mesh.nFaces(); // Number of unique faces
const double SolTime = time_.value(); // Solution time
const int32_t ParentZone = 0; // Bool: 0 = no parent zone
const int32_t ShrConn = 0;
const int32_t NumBConns = 0; // No Boundary Connections
const int32_t NumBItems = 0; // No Boundary Items
Pout<< "zoneName:" << zoneName
//<< " varLocArray:" << varLocArray
<< " solTime:" << SolTime
<< " strand:" << strandID
<< endl;
const int32_t ZoneType = ZONE_FEPOLYHEDRON;
if
(
teczne142
(
zoneName.c_str(), //< ZoneTitle
&ZoneType, //< ZoneType
&NumNodes, //< IMxOrNumPts
&NumElems, //< JMxOrNumElements
&NumFaces, //< KMxOrNumFaces
&tecConst_0, //< (unused set to zero) ICellMax
&tecConst_0, //< (unused set to zero) JCellMax
&tecConst_0, //< (unused set to zero) KCellMax
&SolTime, //< SolutionTime
&strandID, //< StrandID
&ParentZone, //< ParentZone
&tecConst_True, //< IsBlock
&tecConst_0, //< (unused) NumFaceConnections
&tecConst_0, //< (unused) FaceNeighborMode
&NumFaceNodes, //< TotalNumFaceNodes
&NumBConns, //< NumConnectedBoundaryFaces
&NumBItems, //< TotalNumBoundaryConnections
nullptr, //< PassiveVarList
varLocArray.cdata(), //< ValueLocation
nullptr, //< ShareVarFromZone
&ShrConn //< ShareConnectivityFromZone
)
)
{
FatalErrorInFunction
<< "Error in teczne142 - writing polyhedron zones."
<< exit(FatalError);
}
}
void Foam::tecplotWriter::writePolygonalZone
(
const word& zoneName,
const int32_t strandID,
const indirectPrimitivePatch& pp,
const UList<int32_t>& varLocArray
) const
{
const int32_t NumNodes = pp.nPoints(); // Number of unique nodes
const int32_t NumElems = pp.size(); // Number of elements
const int32_t NumFaces = pp.nEdges(); // Number of unique faces
const double SolTime = time_.value(); // Solution time
const int32_t ParentZone = 0; // Int: 0 = no parent zone
const int32_t NumFaceNodes = 2*pp.nEdges();
const int32_t ShrConn = 0;
const int32_t NumBConns = 0; // No Boundary Connections
const int32_t NumBItems = 0; // No Boundary Items
Pout<< "zoneName:" << zoneName
<< " strandID:" << strandID
//<< " varLocArray:" << varLocArray
<< " solTime:" << SolTime
<< endl;
const int32_t ZoneType = ZONE_FEPOLYGON;
if
(
teczne142
(
zoneName.c_str(), //< ZoneTitle
&ZoneType, //< ZoneType
&NumNodes, //< IMax or NumPts
&NumElems, //< JMax or NumElements
&NumFaces, //< KMax or NumFaces
&tecConst_0, //< (Unused set to zero) ICellMax
&tecConst_0, //< (Unused set to zero) JCellMax
&tecConst_0, //< (Unused set to zero) KCellMax
&SolTime, //< SolutionTime
&strandID, //< StrandID
&ParentZone, //< ParentZone
&tecConst_True, //< IsBlock
&tecConst_0, //< (Unused for polygon zone) NumFaceConnections
&tecConst_0, //< (Unused for polygon zone) FaceNeighborMode
&NumFaceNodes, //< TotalNumFaceNodes
&NumBConns, //< NumConnectedBoundaryFaces
&NumBItems, //< TotalNumBoundaryConnections
nullptr, //< PassiveVarList
varLocArray.cdata(), //< ValueLocation
nullptr, //< ShareVarFromZone
&ShrConn //< ShareConnectivityFromZone
)
)
{
FatalErrorInFunction
<< "Error in teczne142 - writing polygon zones."
<< exit(FatalError);
}
}
void Foam::tecplotWriter::writeOrderedZone
(
const word& zoneName,
const int32_t strandID,
const label n,
const UList<int32_t>& varLocArray
) const
{
const int32_t IMax = n; // Number in I direction
const int32_t JMax = 1; // Number in J direction
const int32_t KMax = 1; // Number in K direction
const double SolTime = time_.value(); // Solution time
const int32_t ParentZone = 0; // Bool: no parent zone
const int32_t NFConns = 0; // Unused for ordered zones
const int32_t FNMode = 0; // Unused for ordered zones
const int32_t ShrConn = 0;
const int32_t NumFaceNodes = 1;
const int32_t NumBConns = 0; // No Boundary Connections
const int32_t NumBItems = 0; // No Boundary Items
Pout<< "zoneName:" << zoneName
<< " strandID:" << strandID
//<< " varLocArray:" << varLocArray
<< " solTime:" << SolTime
<< endl;
const int32_t ZoneType = ZONE_ORDERED;
if
(
teczne142
(
zoneName.c_str(), //< ZoneTitle
&ZoneType, //< ZoneType
&IMax, //< IMax or NumPts
&JMax, //< JMax or NumElements
&KMax, //< KMax or NumFaces
&tecConst_0, //< (Unused set to zero) ICellMax
&tecConst_0, //< (Unused set to zero) JCellMax
&tecConst_0, //< (Unused set to zero) KCellMax
&SolTime, //< SolutionTime
&strandID, //< StrandID
&ParentZone, //< ParentZone
&tecConst_True, //< IsBlock
&NFConns, //< NumFaceConnections
&FNMode, //< FaceNeighborMode
&NumFaceNodes, //< TotalNumFaceNodes
&NumBConns, //< NumConnectedBoundaryFaces
&NumBItems, //< TotalNumBoundaryConnections
nullptr, //< PassiveVarList
varLocArray.cdata(), //< ValueLocation
nullptr, //< ShareVarFromZone
&ShrConn //< ShareConnectivityFromZone
)
)
{
FatalErrorInFunction
<< "Error in teczne142 - writing ordered zones."
<< exit(FatalError);
}
}
void Foam::tecplotWriter::writeConnectivity(const fvMesh& mesh) const
{
// first pass: get the sizes
List<int32_t> FaceNodeCounts(mesh.nFaces());
label nFaceNodes = 0;
forAll(mesh.faces(), facei)
{
const face& f = mesh.faces()[facei];
nFaceNodes += f.size();
FaceNodeCounts[facei] = int32_t(f.size());
}
// second pass: get the nodes as a flat list
List<int32_t> FaceNodes(nFaceNodes);
label nodeI = 0;
forAll(mesh.faces(), facei)
{
const face& f = mesh.faces()[facei];
forAll(f, fp)
{
FaceNodes[nodeI++] = int32_t(f[fp]+1);
}
}
List<int32_t> FaceLeftElems(mesh.nFaces());
forAll(mesh.faceOwner(), facei)
{
FaceLeftElems[facei] = mesh.faceOwner()[facei]+1;
}
List<int32_t> FaceRightElems(mesh.nFaces());
forAll(mesh.faceNeighbour(), facei)
{
FaceRightElems[facei] = mesh.faceNeighbour()[facei]+1;
}
for
(
label facei = mesh.nInternalFaces();
facei < mesh.nFaces();
facei++
)
{
FaceRightElems[facei] = 0;
}
if
(
tecpoly142
(
FaceNodeCounts.cdata(), // The face node counts array
FaceNodes.cdata(), // The face nodes array
FaceLeftElems.cdata(), // The left elements array
FaceRightElems.cdata(), // The right elements array
nullptr, // No face boundary connection counts
nullptr, // No face boundary connection elements
nullptr // No face boundary connection zones
)
)
{
FatalErrorInFunction
<< "Error in tecpoly142."
<< exit(FatalError);
}
}
void Foam::tecplotWriter::writeConnectivity
(
const indirectPrimitivePatch& pp
) const
{
const int32_t NumFaces = pp.nEdges(); // Number of unique faces
const int32_t NumFaceNodes = 2*NumFaces; // 2 nodes per edge
// All faces (=edges) have 2 nodes
List<int32_t> FaceNodeCounts(NumFaces);
FaceNodeCounts = 2;
List<int32_t> FaceNodes(NumFaceNodes);
label nodeI = 0;
forAll(pp.edges(), edgei)
{
edge e = pp.edges()[edgei];
if (e[0] > e[1])
{
e.flip();
}
FaceNodes[nodeI++] = int32_t(e[0]+1);
FaceNodes[nodeI++] = int32_t(e[1]+1);
}
/* Define the right and left elements of each face.
*
* The last step for writing out the polyhedral data is to
* define the right and left neighboring elements for each
* face. The neighboring elements can be determined using the
* right-hand rule. For each face, place your right-hand along
* the face which your fingers pointing the direction of
* incrementing node numbers (i.e. from node 1 to node 2).
* Your right thumb will point towards the right element; the
* element on the other side of your hand is the left element.
*
* The number zero is used to indicate that there isn't an
* element on that side of the face.
*
* Because of the way we numbered the nodes and faces, the
* right element for every face is the element itself
* (element 1) and the left element is "no-neighboring element"
* (element 0).
*/
List<int32_t> FaceLeftElems(NumFaces);
List<int32_t> FaceRightElems(NumFaces);
const labelListList& edgeFaces = pp.edgeFaces();
forAll(edgeFaces, edgei)
{
const labelList& eFaces = edgeFaces[edgei];