mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: foamToEnsight : cleanup and -nodeValues for outputting interpolate
This commit is contained in:
@ -2,6 +2,5 @@ itoa.C
|
|||||||
ensightMesh.C
|
ensightMesh.C
|
||||||
ensightParticlePositions.C
|
ensightParticlePositions.C
|
||||||
foamToEnsight.C
|
foamToEnsight.C
|
||||||
ensightWriteBinary.C
|
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/foamToEnsight
|
EXE = $(FOAM_APPBIN)/foamToEnsight
|
||||||
|
|||||||
@ -44,15 +44,6 @@ namespace Foam
|
|||||||
|
|
||||||
class cellSets
|
class cellSets
|
||||||
{
|
{
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
|
||||||
cellSets(const cellSets&);
|
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
|
||||||
void operator=(const cellSets&);
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
label nHexesWedges;
|
label nHexesWedges;
|
||||||
|
|||||||
@ -0,0 +1,156 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2010-2010 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/>.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
//- Description of data_
|
||||||
|
OFstream str_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
ensightAsciiStream(const ensightAsciiStream&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const ensightAsciiStream&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
ensightAsciiStream(const fileName& f, const Time& runTime)
|
||||||
|
:
|
||||||
|
ensightStream(f),
|
||||||
|
str_
|
||||||
|
(
|
||||||
|
f,
|
||||||
|
runTime.writeFormat(),
|
||||||
|
runTime.writeVersion(),
|
||||||
|
IOstream::UNCOMPRESSED
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
str_.setf(ios_base::scientific, ios_base::floatfield);
|
||||||
|
str_.precision(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~ensightAsciiStream()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Member Operators
|
||||||
|
|
||||||
|
// Friend Functions
|
||||||
|
|
||||||
|
// Friend Operators
|
||||||
|
|
||||||
|
// IOstream Operators
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,158 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2010-2010 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/>.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
//- Description of data_
|
||||||
|
autoPtr<std::ofstream> str_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
ensightBinaryStream(const ensightBinaryStream&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const ensightBinaryStream&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
ensightBinaryStream(const fileName& f, const Time&)
|
||||||
|
:
|
||||||
|
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] = {0};
|
||||||
|
strcpy(buffer, val);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Member Operators
|
||||||
|
|
||||||
|
// Friend Functions
|
||||||
|
|
||||||
|
// Friend Operators
|
||||||
|
|
||||||
|
// IOstream Operators
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -29,28 +29,14 @@ License
|
|||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "IOmanip.H"
|
#include "IOmanip.H"
|
||||||
#include "itoa.H"
|
#include "itoa.H"
|
||||||
#include "ensightWriteBinary.H"
|
#include "volPointInterpolation.H"
|
||||||
|
#include "ensightBinaryStream.H"
|
||||||
|
#include "ensightAsciiStream.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void writeData(const scalarField& sf, OFstream& ensightFile)
|
|
||||||
{
|
|
||||||
forAll(sf, i)
|
|
||||||
{
|
|
||||||
if (mag( sf[i] ) >= scalar(floatScalarVSMALL))
|
|
||||||
{
|
|
||||||
ensightFile << setw(12) << sf[i] << nl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ensightFile << setw(12) << scalar(0) << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
scalarField map
|
scalarField map
|
||||||
(
|
(
|
||||||
@ -104,64 +90,25 @@ void writeAllData
|
|||||||
const Field<Type>& vf,
|
const Field<Type>& vf,
|
||||||
const labelList& prims,
|
const labelList& prims,
|
||||||
const label nPrims,
|
const label nPrims,
|
||||||
OFstream& ensightFile
|
ensightStream& ensightFile
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (nPrims)
|
if (nPrims)
|
||||||
{
|
{
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
ensightFile << key << nl;
|
ensightFile.write(key);
|
||||||
|
|
||||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||||
{
|
{
|
||||||
writeData(map(vf, prims, cmpt), ensightFile);
|
scalarField masterData(map(vf, prims, cmpt));
|
||||||
|
ensightFile.write(masterData);
|
||||||
|
|
||||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||||
{
|
{
|
||||||
IPstream fromSlave(Pstream::scheduled, slave);
|
IPstream fromSlave(Pstream::scheduled, slave);
|
||||||
scalarField data(fromSlave);
|
scalarField slaveData(fromSlave);
|
||||||
writeData(data, ensightFile);
|
ensightFile.write(slaveData);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
|
||||||
{
|
|
||||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
|
||||||
toMaster<< map(vf, prims, cmpt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void writeAllDataBinary
|
|
||||||
(
|
|
||||||
const char* key,
|
|
||||||
const Field<Type>& vf,
|
|
||||||
const labelList& prims,
|
|
||||||
const label nPrims,
|
|
||||||
std::ofstream& ensightFile
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (nPrims)
|
|
||||||
{
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
writeEnsDataBinary(key,ensightFile);
|
|
||||||
|
|
||||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
|
||||||
{
|
|
||||||
writeEnsDataBinary(map(vf, prims, cmpt), ensightFile);
|
|
||||||
|
|
||||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
|
||||||
{
|
|
||||||
IPstream fromSlave(Pstream::scheduled, slave);
|
|
||||||
scalarField data(fromSlave);
|
|
||||||
writeEnsDataBinary(data, ensightFile);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -184,66 +131,25 @@ void writeAllFaceData
|
|||||||
const labelList& prims,
|
const labelList& prims,
|
||||||
const label nPrims,
|
const label nPrims,
|
||||||
const Field<Type>& pf,
|
const Field<Type>& pf,
|
||||||
OFstream& ensightFile
|
ensightStream& ensightFile
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (nPrims)
|
if (nPrims)
|
||||||
{
|
{
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
ensightFile << key << nl;
|
ensightFile.write(key);
|
||||||
|
|
||||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||||
{
|
{
|
||||||
writeData(map(pf, prims, cmpt), ensightFile);
|
ensightFile.write(map(pf, prims, cmpt));
|
||||||
|
|
||||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||||
{
|
{
|
||||||
IPstream fromSlave(Pstream::scheduled, slave);
|
IPstream fromSlave(Pstream::scheduled, slave);
|
||||||
scalarField pf(fromSlave);
|
scalarField pf(fromSlave);
|
||||||
|
|
||||||
writeData(pf, ensightFile);
|
ensightFile.write(pf);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
|
||||||
{
|
|
||||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
|
||||||
toMaster<< map(pf, prims, cmpt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void writeAllFaceDataBinary
|
|
||||||
(
|
|
||||||
const char* key,
|
|
||||||
const labelList& prims,
|
|
||||||
const label nPrims,
|
|
||||||
const Field<Type>& pf,
|
|
||||||
std::ofstream& ensightFile
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (nPrims)
|
|
||||||
{
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
writeEnsDataBinary(key,ensightFile);
|
|
||||||
|
|
||||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
|
||||||
{
|
|
||||||
writeEnsDataBinary(map(pf, prims, cmpt), ensightFile);
|
|
||||||
|
|
||||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
|
||||||
{
|
|
||||||
IPstream fromSlave(Pstream::scheduled, slave);
|
|
||||||
scalarField pf(fromSlave);
|
|
||||||
|
|
||||||
writeEnsDataBinary(pf, ensightFile);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -267,16 +173,14 @@ bool writePatchField
|
|||||||
const Foam::label ensightPatchI,
|
const Foam::label ensightPatchI,
|
||||||
const Foam::faceSets& boundaryFaceSet,
|
const Foam::faceSets& boundaryFaceSet,
|
||||||
const Foam::ensightMesh::nFacePrimitives& nfp,
|
const Foam::ensightMesh::nFacePrimitives& nfp,
|
||||||
Foam::OFstream& ensightFile
|
ensightStream& ensightFile
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (nfp.nTris || nfp.nQuads || nfp.nPolys)
|
if (nfp.nTris || nfp.nQuads || nfp.nPolys)
|
||||||
{
|
{
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
ensightFile
|
ensightFile.writePartHeader(ensightPatchI);
|
||||||
<< "part" << nl
|
|
||||||
<< setw(10) << ensightPatchI << nl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
writeAllFaceData
|
writeAllFaceData
|
||||||
@ -315,61 +219,6 @@ bool writePatchField
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
bool writePatchFieldBinary
|
|
||||||
(
|
|
||||||
const Foam::Field<Type>& pf,
|
|
||||||
const Foam::label patchi,
|
|
||||||
const Foam::label ensightPatchI,
|
|
||||||
const Foam::faceSets& boundaryFaceSet,
|
|
||||||
const Foam::ensightMesh::nFacePrimitives& nfp,
|
|
||||||
std::ofstream& ensightFile
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (nfp.nTris || nfp.nQuads || nfp.nPolys)
|
|
||||||
{
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
writeEnsDataBinary("part",ensightFile);
|
|
||||||
writeEnsDataBinary(ensightPatchI,ensightFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
writeAllFaceDataBinary
|
|
||||||
(
|
|
||||||
"tria3",
|
|
||||||
boundaryFaceSet.tris,
|
|
||||||
nfp.nTris,
|
|
||||||
pf,
|
|
||||||
ensightFile
|
|
||||||
);
|
|
||||||
|
|
||||||
writeAllFaceDataBinary
|
|
||||||
(
|
|
||||||
"quad4",
|
|
||||||
boundaryFaceSet.quads,
|
|
||||||
nfp.nQuads,
|
|
||||||
pf,
|
|
||||||
ensightFile
|
|
||||||
);
|
|
||||||
|
|
||||||
writeAllFaceDataBinary
|
|
||||||
(
|
|
||||||
"nsided",
|
|
||||||
boundaryFaceSet.polys,
|
|
||||||
nfp.nPolys,
|
|
||||||
pf,
|
|
||||||
ensightFile
|
|
||||||
);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void writePatchField
|
void writePatchField
|
||||||
(
|
(
|
||||||
@ -380,6 +229,7 @@ void writePatchField
|
|||||||
const Foam::fileName& postProcPath,
|
const Foam::fileName& postProcPath,
|
||||||
const Foam::word& prepend,
|
const Foam::word& prepend,
|
||||||
const Foam::label timeIndex,
|
const Foam::label timeIndex,
|
||||||
|
const bool binary,
|
||||||
Foam::Ostream& ensightCaseFile
|
Foam::Ostream& ensightCaseFile
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -409,7 +259,7 @@ void writePatchField
|
|||||||
|
|
||||||
word timeFile = prepend + itoa(timeIndex);
|
word timeFile = prepend + itoa(timeIndex);
|
||||||
|
|
||||||
OFstream *ensightFilePtr = NULL;
|
autoPtr<ensightStream> ensightFilePtr;
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
if (timeIndex == 0)
|
if (timeIndex == 0)
|
||||||
@ -426,20 +276,36 @@ void writePatchField
|
|||||||
|
|
||||||
// set the filename of the ensight file
|
// set the filename of the ensight file
|
||||||
fileName ensightFileName(timeFile + "." + pfName);
|
fileName ensightFileName(timeFile + "." + pfName);
|
||||||
ensightFilePtr = new OFstream
|
|
||||||
(
|
if (binary)
|
||||||
postProcPath/ensightFileName,
|
{
|
||||||
runTime.writeFormat(),
|
ensightFilePtr.reset
|
||||||
runTime.writeVersion(),
|
(
|
||||||
runTime.writeCompression()
|
new ensightBinaryStream
|
||||||
);
|
(
|
||||||
|
postProcPath/ensightFileName,
|
||||||
|
runTime
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ensightFilePtr.reset
|
||||||
|
(
|
||||||
|
new ensightAsciiStream
|
||||||
|
(
|
||||||
|
postProcPath/ensightFileName,
|
||||||
|
runTime
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OFstream& ensightFile = *ensightFilePtr;
|
ensightStream& ensightFile = ensightFilePtr();
|
||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
ensightFile << pTraits<Type>::typeName << nl;
|
ensightFile.write(pTraits<Type>::typeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (patchi >= 0)
|
if (patchi >= 0)
|
||||||
@ -468,26 +334,22 @@ void writePatchField
|
|||||||
ensightFile
|
ensightFile
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
delete ensightFilePtr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void ensightFieldAscii
|
void ensightField
|
||||||
(
|
(
|
||||||
const Foam::IOobject& fieldObject,
|
const GeometricField<Type, fvPatchField, volMesh>& vf,
|
||||||
const Foam::ensightMesh& eMesh,
|
const Foam::ensightMesh& eMesh,
|
||||||
const Foam::fileName& postProcPath,
|
const Foam::fileName& postProcPath,
|
||||||
const Foam::word& prepend,
|
const Foam::word& prepend,
|
||||||
const Foam::label timeIndex,
|
const Foam::label timeIndex,
|
||||||
|
const bool binary,
|
||||||
Foam::Ostream& ensightCaseFile
|
Foam::Ostream& ensightCaseFile
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Info<< "Converting field " << fieldObject.name() << endl;
|
Info<< "Converting field " << vf.name() << endl;
|
||||||
|
|
||||||
word timeFile = prepend + itoa(timeIndex);
|
word timeFile = prepend + itoa(timeIndex);
|
||||||
|
|
||||||
@ -512,23 +374,37 @@ void ensightFieldAscii
|
|||||||
const labelList& hexes = meshCellSets.hexes;
|
const labelList& hexes = meshCellSets.hexes;
|
||||||
const labelList& polys = meshCellSets.polys;
|
const labelList& polys = meshCellSets.polys;
|
||||||
|
|
||||||
OFstream *ensightFilePtr = NULL;
|
autoPtr<ensightStream> ensightFilePtr;
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
// set the filename of the ensight file
|
// set the filename of the ensight file
|
||||||
fileName ensightFileName(timeFile + "." + fieldObject.name());
|
fileName ensightFileName(timeFile + "." + vf.name());
|
||||||
ensightFilePtr = new OFstream
|
|
||||||
(
|
if (binary)
|
||||||
postProcPath/ensightFileName,
|
{
|
||||||
runTime.writeFormat(),
|
ensightFilePtr.reset
|
||||||
runTime.writeVersion(),
|
(
|
||||||
IOstream::UNCOMPRESSED
|
new ensightBinaryStream
|
||||||
);
|
(
|
||||||
|
postProcPath/ensightFileName,
|
||||||
|
runTime
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ensightFilePtr.reset
|
||||||
|
(
|
||||||
|
new ensightAsciiStream
|
||||||
|
(
|
||||||
|
postProcPath/ensightFileName,
|
||||||
|
runTime
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OFstream& ensightFile = *ensightFilePtr;
|
ensightStream& ensightFile = ensightFilePtr();
|
||||||
|
|
||||||
GeometricField<Type, fvPatchField, volMesh> vf(fieldObject, mesh);
|
|
||||||
|
|
||||||
if (patchNames.empty())
|
if (patchNames.empty())
|
||||||
{
|
{
|
||||||
@ -548,34 +424,26 @@ void ensightFieldAscii
|
|||||||
<< nl;
|
<< nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
ensightFile
|
ensightFile.write(pTraits<Type>::typeName);
|
||||||
<< pTraits<Type>::typeName << nl
|
ensightFile.writePartHeader(1);
|
||||||
<< "part" << nl
|
|
||||||
<< setw(10) << 1 << nl;
|
|
||||||
|
|
||||||
ensightFile.setf(ios_base::scientific, ios_base::floatfield);
|
|
||||||
ensightFile.precision(5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (meshCellSets.nHexesWedges)
|
if (meshCellSets.nHexesWedges)
|
||||||
{
|
{
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
ensightFile << "hexa8" << nl;
|
ensightFile.write("hexa8");
|
||||||
|
|
||||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||||
{
|
{
|
||||||
writeData
|
scalarField masterData(map(vf, hexes, wedges, cmpt));
|
||||||
(
|
ensightFile.write(masterData);
|
||||||
map(vf, hexes, wedges, cmpt),
|
|
||||||
ensightFile
|
|
||||||
);
|
|
||||||
|
|
||||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||||
{
|
{
|
||||||
IPstream fromSlave(Pstream::scheduled, slave);
|
IPstream fromSlave(Pstream::scheduled, slave);
|
||||||
scalarField data(fromSlave);
|
scalarField data(fromSlave);
|
||||||
writeData(data, ensightFile);
|
ensightFile.write(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -727,68 +595,61 @@ void ensightFieldAscii
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
delete ensightFilePtr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void ensightFieldBinary
|
void ensightPointField
|
||||||
(
|
(
|
||||||
const Foam::IOobject& fieldObject,
|
const GeometricField<Type, pointPatchField, pointMesh>& pf,
|
||||||
const Foam::ensightMesh& eMesh,
|
const Foam::ensightMesh& eMesh,
|
||||||
const Foam::fileName& postProcPath,
|
const Foam::fileName& postProcPath,
|
||||||
const Foam::word& prepend,
|
const Foam::word& prepend,
|
||||||
const Foam::label timeIndex,
|
const Foam::label timeIndex,
|
||||||
|
const bool binary,
|
||||||
Foam::Ostream& ensightCaseFile
|
Foam::Ostream& ensightCaseFile
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Info<< "Converting field (binary) " << fieldObject.name() << endl;
|
Info<< "Converting field " << pf.name() << endl;
|
||||||
|
|
||||||
word timeFile = prepend + itoa(timeIndex);
|
word timeFile = prepend + itoa(timeIndex);
|
||||||
|
|
||||||
const fvMesh& mesh = eMesh.mesh();
|
//const fvMesh& mesh = eMesh.mesh();
|
||||||
//const Time& runTime = mesh.time();
|
//const Time& runTime = mesh.time();
|
||||||
|
|
||||||
const cellSets& meshCellSets = eMesh.meshCellSets();
|
autoPtr<ensightStream> ensightFilePtr;
|
||||||
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;
|
|
||||||
|
|
||||||
std::ofstream *ensightFilePtr = NULL;
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
// set the filename of the ensight file
|
// set the filename of the ensight file
|
||||||
fileName ensightFileName(timeFile + "." + fieldObject.name());
|
fileName ensightFileName(timeFile + "." + pf.name());
|
||||||
ensightFilePtr = new std::ofstream
|
|
||||||
(
|
if (binary)
|
||||||
(postProcPath/ensightFileName).c_str(),
|
{
|
||||||
ios_base::out | ios_base::binary | ios_base::trunc
|
ensightFilePtr.reset
|
||||||
);
|
(
|
||||||
// Check on file opened?
|
new ensightBinaryStream
|
||||||
|
(
|
||||||
|
postProcPath/ensightFileName,
|
||||||
|
eMesh.mesh().time()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ensightFilePtr.reset
|
||||||
|
(
|
||||||
|
new ensightAsciiStream
|
||||||
|
(
|
||||||
|
postProcPath/ensightFileName,
|
||||||
|
eMesh.mesh().time()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ofstream& ensightFile = *ensightFilePtr;
|
ensightStream& ensightFile = ensightFilePtr();
|
||||||
|
|
||||||
GeometricField<Type, fvPatchField, volMesh> vf(fieldObject, mesh);
|
if (eMesh.patchNames().empty())
|
||||||
|
|
||||||
if (patchNames.empty())
|
|
||||||
{
|
{
|
||||||
eMesh.barrier();
|
eMesh.barrier();
|
||||||
|
|
||||||
@ -800,192 +661,44 @@ void ensightFieldBinary
|
|||||||
|
|
||||||
ensightCaseFile
|
ensightCaseFile
|
||||||
<< pTraits<Type>::typeName
|
<< pTraits<Type>::typeName
|
||||||
<< " per element: 1 "
|
<< " per node: 1 "
|
||||||
<< setw(15) << vf.name()
|
<< setw(15) << pf.name()
|
||||||
<< (' ' + prepend + "***." + vf.name()).c_str()
|
<< (' ' + prepend + "***." + pf.name()).c_str()
|
||||||
<< nl;
|
<< nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
writeEnsDataBinary(pTraits<Type>::typeName,ensightFile);
|
ensightFile.write(pTraits<Type>::typeName);
|
||||||
writeEnsDataBinary("part",ensightFile);
|
ensightFile.write("part");
|
||||||
writeEnsDataBinary(1,ensightFile);
|
ensightFile.write(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (meshCellSets.nHexesWedges)
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
if (Pstream::master())
|
ensightFile.write("coordinates");
|
||||||
{
|
|
||||||
writeEnsDataBinary("hexa8",ensightFile);
|
|
||||||
|
|
||||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
Field<Type> uniqueFld(pf.internalField(), eMesh.uniquePointMap());
|
||||||
{
|
|
||||||
writeEnsDataBinary
|
|
||||||
(
|
|
||||||
map(vf, hexes, wedges, cmpt),
|
|
||||||
ensightFile
|
|
||||||
);
|
|
||||||
|
|
||||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||||
{
|
|
||||||
IPstream fromSlave(Pstream::scheduled, slave);
|
|
||||||
scalarField data(fromSlave);
|
|
||||||
writeEnsDataBinary(data, ensightFile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
ensightFile.write(uniqueFld.component(cmpt));
|
||||||
|
|
||||||
|
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||||
{
|
{
|
||||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
IPstream fromSlave(Pstream::scheduled, slave);
|
||||||
toMaster<< map(vf, hexes, wedges, cmpt);
|
scalarField data(fromSlave);
|
||||||
|
ensightFile.write(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
writeAllDataBinary
|
|
||||||
(
|
|
||||||
"penta6",
|
|
||||||
vf,
|
|
||||||
prisms,
|
|
||||||
meshCellSets.nPrisms,
|
|
||||||
ensightFile
|
|
||||||
);
|
|
||||||
|
|
||||||
writeAllDataBinary
|
|
||||||
(
|
|
||||||
"pyramid5",
|
|
||||||
vf,
|
|
||||||
pyrs,
|
|
||||||
meshCellSets.nPyrs,
|
|
||||||
ensightFile
|
|
||||||
);
|
|
||||||
|
|
||||||
writeAllDataBinary
|
|
||||||
(
|
|
||||||
"tetra4",
|
|
||||||
vf,
|
|
||||||
tets,
|
|
||||||
meshCellSets.nTets,
|
|
||||||
ensightFile
|
|
||||||
);
|
|
||||||
|
|
||||||
writeAllDataBinary
|
|
||||||
(
|
|
||||||
"nfaced",
|
|
||||||
vf,
|
|
||||||
polys,
|
|
||||||
meshCellSets.nPolys,
|
|
||||||
ensightFile
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
label ensightPatchI = eMesh.patchPartOffset();
|
|
||||||
|
|
||||||
forAll(allPatchNames, patchi)
|
|
||||||
{
|
|
||||||
const word& patchName = allPatchNames[patchi];
|
|
||||||
|
|
||||||
eMesh.barrier();
|
|
||||||
|
|
||||||
if (patchNames.empty() || patchNames.found(patchName))
|
|
||||||
{
|
{
|
||||||
if
|
Field<Type> uniqueFld(pf.internalField(), eMesh.uniquePointMap());
|
||||||
(
|
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||||
writePatchFieldBinary
|
|
||||||
(
|
|
||||||
vf.boundaryField()[patchi],
|
|
||||||
patchi,
|
|
||||||
ensightPatchI,
|
|
||||||
boundaryFaceSets[patchi],
|
|
||||||
nPatchPrims.find(patchName)(),
|
|
||||||
ensightFile
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
ensightPatchI++;
|
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||||
|
toMaster<< uniqueFld.component(cmpt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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();
|
|
||||||
|
|
||||||
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
|
|
||||||
(
|
|
||||||
writePatchFieldBinary
|
|
||||||
(
|
|
||||||
values,
|
|
||||||
zoneID,
|
|
||||||
ensightPatchI,
|
|
||||||
faceZoneFaceSets[zoneID],
|
|
||||||
nFaceZonePrims.find(faceZoneName)(),
|
|
||||||
ensightFile
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
ensightPatchI++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
ensightFile.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -999,30 +712,42 @@ void ensightField
|
|||||||
const Foam::word& prepend,
|
const Foam::word& prepend,
|
||||||
const Foam::label timeIndex,
|
const Foam::label timeIndex,
|
||||||
const bool binary,
|
const bool binary,
|
||||||
|
const bool nodeValues,
|
||||||
Foam::Ostream& ensightCaseFile
|
Foam::Ostream& ensightCaseFile
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (binary)
|
// Read field
|
||||||
|
GeometricField<Type, fvPatchField, volMesh> vf(fieldObject, eMesh.mesh());
|
||||||
|
|
||||||
|
if (nodeValues)
|
||||||
{
|
{
|
||||||
ensightFieldBinary<Type>
|
tmp<GeometricField<Type, pointPatchField, pointMesh> > pfld
|
||||||
(
|
(
|
||||||
fieldObject,
|
volPointInterpolation::New(eMesh.mesh()).interpolate(vf)
|
||||||
|
);
|
||||||
|
pfld().rename(vf.name());
|
||||||
|
|
||||||
|
ensightPointField<Type>
|
||||||
|
(
|
||||||
|
pfld,
|
||||||
eMesh,
|
eMesh,
|
||||||
postProcPath,
|
postProcPath,
|
||||||
prepend,
|
prepend,
|
||||||
timeIndex,
|
timeIndex,
|
||||||
|
binary,
|
||||||
ensightCaseFile
|
ensightCaseFile
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ensightFieldAscii<Type>
|
ensightField<Type>
|
||||||
(
|
(
|
||||||
fieldObject,
|
vf,
|
||||||
eMesh,
|
eMesh,
|
||||||
postProcPath,
|
postProcPath,
|
||||||
prepend,
|
prepend,
|
||||||
timeIndex,
|
timeIndex,
|
||||||
|
binary,
|
||||||
ensightCaseFile
|
ensightCaseFile
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -38,10 +38,13 @@ SourceFiles
|
|||||||
#include "faceSets.H"
|
#include "faceSets.H"
|
||||||
#include "HashTable.H"
|
#include "HashTable.H"
|
||||||
#include "HashSet.H"
|
#include "HashSet.H"
|
||||||
#include "fvMesh.H"
|
|
||||||
#include "OFstream.H"
|
|
||||||
#include <fstream>
|
|
||||||
#include "PackedBoolList.H"
|
#include "PackedBoolList.H"
|
||||||
|
#include "wordReList.H"
|
||||||
|
#include "scalarField.H"
|
||||||
|
#include "cellShapeList.H"
|
||||||
|
#include "cellList.H"
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -51,6 +54,7 @@ namespace Foam
|
|||||||
class fvMesh;
|
class fvMesh;
|
||||||
class argList;
|
class argList;
|
||||||
class globalIndex;
|
class globalIndex;
|
||||||
|
class ensightStream;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class ensightMesh Declaration
|
Class ensightMesh Declaration
|
||||||
@ -82,8 +86,19 @@ private:
|
|||||||
//- Reference to the OpenFOAM mesh
|
//- Reference to the OpenFOAM mesh
|
||||||
const fvMesh& 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_;
|
||||||
|
|
||||||
//- Set binary file output
|
//- Set binary file output
|
||||||
bool binary_;
|
const bool binary_;
|
||||||
|
|
||||||
//- The ensight part id for the first patch
|
//- The ensight part id for the first patch
|
||||||
label patchPartOffset_;
|
label patchPartOffset_;
|
||||||
@ -109,6 +124,19 @@ private:
|
|||||||
PackedBoolList boundaryFaceToBeIncluded_;
|
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
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
@ -120,7 +148,7 @@ private:
|
|||||||
void writePoints
|
void writePoints
|
||||||
(
|
(
|
||||||
const scalarField& pointsComponent,
|
const scalarField& pointsComponent,
|
||||||
OFstream& ensightGeometryFile
|
ensightStream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
cellShapeList map
|
cellShapeList map
|
||||||
@ -141,14 +169,14 @@ private:
|
|||||||
void writePrims
|
void writePrims
|
||||||
(
|
(
|
||||||
const cellShapeList& cellShapes,
|
const cellShapeList& cellShapes,
|
||||||
OFstream& ensightGeometryFile
|
ensightStream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
void writePolysNFaces
|
void writePolysNFaces
|
||||||
(
|
(
|
||||||
const labelList& polys,
|
const labelList& polys,
|
||||||
const cellList& cellFaces,
|
const cellList& cellFaces,
|
||||||
OFstream& ensightGeometryFile
|
ensightStream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
void writePolysNPointsPerFace
|
void writePolysNPointsPerFace
|
||||||
@ -156,7 +184,7 @@ private:
|
|||||||
const labelList& polys,
|
const labelList& polys,
|
||||||
const cellList& cellFaces,
|
const cellList& cellFaces,
|
||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
OFstream& ensightGeometryFile
|
ensightStream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
void writePolysPoints
|
void writePolysPoints
|
||||||
@ -164,13 +192,13 @@ private:
|
|||||||
const labelList& polys,
|
const labelList& polys,
|
||||||
const cellList& cellFaces,
|
const cellList& cellFaces,
|
||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
OFstream& ensightGeometryFile
|
ensightStream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
void writeAllPolys
|
void writeAllPolys
|
||||||
(
|
(
|
||||||
const labelList& pointToGlobal,
|
const labelList& pointToGlobal,
|
||||||
OFstream& ensightGeometryFile
|
ensightStream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
void writeAllPrims
|
void writeAllPrims
|
||||||
@ -178,13 +206,13 @@ private:
|
|||||||
const char* key,
|
const char* key,
|
||||||
const label nPrims,
|
const label nPrims,
|
||||||
const cellShapeList& cellShapes,
|
const cellShapeList& cellShapes,
|
||||||
OFstream& ensightGeometryFile
|
ensightStream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
void writeFacePrims
|
void writeFacePrims
|
||||||
(
|
(
|
||||||
const faceList& patchFaces,
|
const faceList& patchFaces,
|
||||||
OFstream& ensightGeometryFile
|
ensightStream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
void writeAllFacePrims
|
void writeAllFacePrims
|
||||||
@ -193,19 +221,19 @@ private:
|
|||||||
const labelList& prims,
|
const labelList& prims,
|
||||||
const label nPrims,
|
const label nPrims,
|
||||||
const faceList& patchFaces,
|
const faceList& patchFaces,
|
||||||
OFstream& ensightGeometryFile
|
ensightStream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
void writeNSidedNPointsPerFace
|
void writeNSidedNPointsPerFace
|
||||||
(
|
(
|
||||||
const faceList& patchFaces,
|
const faceList& patchFaces,
|
||||||
OFstream& ensightGeometryFile
|
ensightStream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
void writeNSidedPoints
|
void writeNSidedPoints
|
||||||
(
|
(
|
||||||
const faceList& patchFaces,
|
const faceList& patchFaces,
|
||||||
OFstream& ensightGeometryFile
|
ensightStream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
void writeAllNSided
|
void writeAllNSided
|
||||||
@ -213,14 +241,14 @@ private:
|
|||||||
const labelList& prims,
|
const labelList& prims,
|
||||||
const label nPrims,
|
const label nPrims,
|
||||||
const faceList& patchFaces,
|
const faceList& patchFaces,
|
||||||
OFstream& ensightGeometryFile
|
ensightStream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
void writeAllInternalPoints
|
void writeAllInternalPoints
|
||||||
(
|
(
|
||||||
const pointField& uniquePoints,
|
const pointField& uniquePoints,
|
||||||
const label nPoints,
|
const label nPoints,
|
||||||
OFstream& ensightGeometryFile
|
ensightStream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
void writeAllPatchPoints
|
void writeAllPatchPoints
|
||||||
@ -229,123 +257,7 @@ private:
|
|||||||
const word& patchName,
|
const word& patchName,
|
||||||
const pointField& uniquePoints,
|
const pointField& uniquePoints,
|
||||||
const label nPoints,
|
const label nPoints,
|
||||||
OFstream& ensightGeometryFile
|
ensightStream& ensightGeometryFile
|
||||||
) const;
|
|
||||||
|
|
||||||
void writeAllInternalPointsBinary
|
|
||||||
(
|
|
||||||
const pointField& uniquePoints,
|
|
||||||
const label nPoints,
|
|
||||||
std::ofstream& ensightGeometryFile
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writeAllPatchPointsBinary
|
|
||||||
(
|
|
||||||
label ensightPatchI,
|
|
||||||
const word& patchName,
|
|
||||||
const pointField& uniquePoints,
|
|
||||||
const label nPoints,
|
|
||||||
std::ofstream& ensightGeometryFile
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writeAscii
|
|
||||||
(
|
|
||||||
const fileName& postProcPath,
|
|
||||||
const word& prepend,
|
|
||||||
const label timeIndex,
|
|
||||||
Ostream& ensightCaseFile,
|
|
||||||
const labelList& pointToGlobal,
|
|
||||||
const pointField& uniquePoints,
|
|
||||||
const globalIndex& globalPoints
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writeBinary
|
|
||||||
(
|
|
||||||
const fileName& postProcPath,
|
|
||||||
const word& prepend,
|
|
||||||
const label timeIndex,
|
|
||||||
Ostream& ensightCaseFile,
|
|
||||||
const labelList& pointToGlobal,
|
|
||||||
const pointField& uniquePoints,
|
|
||||||
const globalIndex& globalPoints
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writePrimsBinary
|
|
||||||
(
|
|
||||||
const cellShapeList& cellShapes,
|
|
||||||
std::ofstream& ensightGeometryFile
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writeAllPrimsBinary
|
|
||||||
(
|
|
||||||
const char* key,
|
|
||||||
const label nPrims,
|
|
||||||
const cellShapeList& cellShapes,
|
|
||||||
std::ofstream& ensightGeometryFile
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writePolysNFacesBinary
|
|
||||||
(
|
|
||||||
const labelList& polys,
|
|
||||||
const cellList& cellFaces,
|
|
||||||
std::ofstream& ensightGeometryFile
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writePolysNPointsPerFaceBinary
|
|
||||||
(
|
|
||||||
const labelList& polys,
|
|
||||||
const cellList& cellFaces,
|
|
||||||
const faceList& faces,
|
|
||||||
std::ofstream& ensightGeometryFile
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writePolysPointsBinary
|
|
||||||
(
|
|
||||||
const labelList& polys,
|
|
||||||
const cellList& cellFaces,
|
|
||||||
const faceList& faces,
|
|
||||||
std::ofstream& ensightGeometryFile
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writeAllPolysBinary
|
|
||||||
(
|
|
||||||
const labelList& pointToGlobal,
|
|
||||||
std::ofstream& ensightGeometryFile
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writeAllFacePrimsBinary
|
|
||||||
(
|
|
||||||
const char* key,
|
|
||||||
const labelList& prims,
|
|
||||||
const label nPrims,
|
|
||||||
const faceList& patchFaces,
|
|
||||||
std::ofstream& ensightGeometryFile
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writeFacePrimsBinary
|
|
||||||
(
|
|
||||||
const faceList& patchFaces,
|
|
||||||
std::ofstream& ensightGeometryFile
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writeNSidedPointsBinary
|
|
||||||
(
|
|
||||||
const faceList& patchFaces,
|
|
||||||
std::ofstream& ensightGeometryFile
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writeNSidedNPointsPerFaceBinary
|
|
||||||
(
|
|
||||||
const faceList& patchFaces,
|
|
||||||
std::ofstream& ensightGeometryFile
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writeAllNSidedBinary
|
|
||||||
(
|
|
||||||
const labelList& prims,
|
|
||||||
const label nPrims,
|
|
||||||
const faceList& patchFaces,
|
|
||||||
std::ofstream& ensightGeometryFile
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -355,8 +267,12 @@ public:
|
|||||||
//- Construct from fvMesh
|
//- Construct from fvMesh
|
||||||
ensightMesh
|
ensightMesh
|
||||||
(
|
(
|
||||||
const fvMesh&,
|
const fvMesh& mesh,
|
||||||
const argList& args,
|
const bool noPatches,
|
||||||
|
const bool patches,
|
||||||
|
const wordReList& patchPatterns,
|
||||||
|
const bool faceZones,
|
||||||
|
const wordReList& faceZonePatterns,
|
||||||
const bool binary
|
const bool binary
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -420,8 +336,35 @@ public:
|
|||||||
return patchPartOffset_;
|
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
|
// Other
|
||||||
|
|
||||||
|
//- Update for new mesh
|
||||||
|
void correct();
|
||||||
|
|
||||||
//- When exporting faceZones, check if a given face has to be included
|
//- When exporting faceZones, check if a given face has to be included
|
||||||
// or not (i.e. faces on processor boundaries)
|
// or not (i.e. faces on processor boundaries)
|
||||||
bool faceToBeIncluded(const label faceI) const;
|
bool faceToBeIncluded(const label faceI) const;
|
||||||
|
|||||||
@ -0,0 +1,112 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2010-2010 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/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::ensightStream
|
||||||
|
|
||||||
|
Description
|
||||||
|
Abstract base class for writing Ensight data
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
ensightStream.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef ensightStream_H
|
||||||
|
#define ensightStream_H
|
||||||
|
|
||||||
|
#include "fileName.H"
|
||||||
|
#include "scalarField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class ensightStream Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class ensightStream
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
const fileName name_;
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
ensightStream(const ensightStream&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const ensightStream&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
ensightStream(const fileName& f)
|
||||||
|
:
|
||||||
|
name_(f)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~ensightStream()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
const fileName& name() const
|
||||||
|
{
|
||||||
|
return name_;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void write(const char*) = 0;
|
||||||
|
|
||||||
|
virtual void write(const int) = 0;
|
||||||
|
|
||||||
|
virtual void write(const scalarField&) = 0;
|
||||||
|
|
||||||
|
virtual void write(const List<int>&) = 0;
|
||||||
|
|
||||||
|
virtual void writePartHeader(const label) = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -1,78 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 1991-2010 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/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "ensightWriteBinary.H"
|
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void writeEnsDataBinary
|
|
||||||
(
|
|
||||||
const char* val,
|
|
||||||
std::ofstream& ensFile
|
|
||||||
)
|
|
||||||
{
|
|
||||||
char buffer[80] = {0};
|
|
||||||
strcpy(buffer, val);
|
|
||||||
ensFile.write(buffer, 80*sizeof(char));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void writeEnsDataBinary
|
|
||||||
(
|
|
||||||
const int val,
|
|
||||||
std::ofstream& ensFile
|
|
||||||
)
|
|
||||||
{
|
|
||||||
ensFile.write(reinterpret_cast<const char*>(&val), sizeof(int));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void writeEnsDataBinary
|
|
||||||
(
|
|
||||||
const scalarField& sf,
|
|
||||||
std::ofstream& ensightFile
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (sf.size())
|
|
||||||
{
|
|
||||||
List<float> temp(sf.size());
|
|
||||||
|
|
||||||
forAll(sf, i)
|
|
||||||
{
|
|
||||||
temp[i] = float(sf[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
ensightFile.write
|
|
||||||
(
|
|
||||||
reinterpret_cast<char*>(temp.begin()),
|
|
||||||
sf.size()*sizeof(float)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
|
|
||||||
@ -1,67 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 1991-2010 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/>.
|
|
||||||
|
|
||||||
InApplication
|
|
||||||
foamToEnsight
|
|
||||||
|
|
||||||
Description
|
|
||||||
Collection of functions for binary write in EnSight files
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
ensightWriteBinary.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef ensightWriteBinary_H
|
|
||||||
#define ensightWriteBinary_H
|
|
||||||
|
|
||||||
#include "ensightMesh.H"
|
|
||||||
|
|
||||||
using namespace Foam;
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void writeEnsDataBinary
|
|
||||||
(
|
|
||||||
const char* val,
|
|
||||||
std::ofstream& ensFile
|
|
||||||
);
|
|
||||||
|
|
||||||
void writeEnsDataBinary
|
|
||||||
(
|
|
||||||
const int val,
|
|
||||||
std::ofstream& ensFile
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
void writeEnsDataBinary
|
|
||||||
(
|
|
||||||
const scalarField& sf,
|
|
||||||
std::ofstream& ensightFile
|
|
||||||
);
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -44,15 +44,6 @@ namespace Foam
|
|||||||
|
|
||||||
class faceSets
|
class faceSets
|
||||||
{
|
{
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
|
||||||
faceSets(const faceSets&);
|
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
|
||||||
void operator=(const faceSets&);
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
label nTris;
|
label nTris;
|
||||||
|
|||||||
@ -104,6 +104,11 @@ int main(int argc, char *argv[])
|
|||||||
"write in ASCII format instead of 'C Binary'"
|
"write in ASCII format instead of 'C Binary'"
|
||||||
);
|
);
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"nodeValues",
|
||||||
|
"write values in nodes"
|
||||||
|
);
|
||||||
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
"noPatches",
|
"noPatches",
|
||||||
"suppress writing any patches"
|
"suppress writing any patches"
|
||||||
@ -126,6 +131,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Check options
|
// Check options
|
||||||
const bool binary = !args.optionFound("ascii");
|
const bool binary = !args.optionFound("ascii");
|
||||||
|
const bool nodeValues = args.optionFound("nodeValues");
|
||||||
|
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
|
|
||||||
@ -191,7 +197,29 @@ int main(int argc, char *argv[])
|
|||||||
OFstream& ensightCaseFile = *ensightCaseFilePtr;
|
OFstream& ensightCaseFile = *ensightCaseFilePtr;
|
||||||
|
|
||||||
// Construct the EnSight mesh
|
// Construct the EnSight mesh
|
||||||
ensightMesh eMesh(mesh, args, binary);
|
const bool selectedPatches = args.optionFound("patches");
|
||||||
|
wordReList patchPatterns;
|
||||||
|
if (selectedPatches)
|
||||||
|
{
|
||||||
|
patchPatterns = wordReList(args.optionLookup("patches")());
|
||||||
|
}
|
||||||
|
const bool selectedZones = args.optionFound("faceZones");
|
||||||
|
wordReList zonePatterns;
|
||||||
|
if (selectedZones)
|
||||||
|
{
|
||||||
|
zonePatterns = wordReList(args.optionLookup("faceZones")());
|
||||||
|
}
|
||||||
|
|
||||||
|
ensightMesh eMesh
|
||||||
|
(
|
||||||
|
mesh,
|
||||||
|
args.optionFound("noPatches"),
|
||||||
|
selectedPatches,
|
||||||
|
patchPatterns,
|
||||||
|
selectedZones,
|
||||||
|
zonePatterns,
|
||||||
|
binary
|
||||||
|
);
|
||||||
|
|
||||||
// Set Time to the last time before looking for the lagrangian objects
|
// Set Time to the last time before looking for the lagrangian objects
|
||||||
runTime.setTime(Times.last(), Times.size()-1);
|
runTime.setTime(Times.last(), Times.size()-1);
|
||||||
@ -313,6 +341,11 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
polyMesh::readUpdateState meshState = mesh.readUpdate();
|
polyMesh::readUpdateState meshState = mesh.readUpdate();
|
||||||
|
|
||||||
|
if (meshState != polyMesh::UNCHANGED)
|
||||||
|
{
|
||||||
|
eMesh.correct();
|
||||||
|
}
|
||||||
|
|
||||||
if (timeIndex == 0 || (meshState != polyMesh::UNCHANGED))
|
if (timeIndex == 0 || (meshState != polyMesh::UNCHANGED))
|
||||||
{
|
{
|
||||||
eMesh.write
|
eMesh.write
|
||||||
@ -371,6 +404,7 @@ int main(int argc, char *argv[])
|
|||||||
prepend,
|
prepend,
|
||||||
timeIndex,
|
timeIndex,
|
||||||
binary,
|
binary,
|
||||||
|
nodeValues,
|
||||||
ensightCaseFile
|
ensightCaseFile
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -384,6 +418,7 @@ int main(int argc, char *argv[])
|
|||||||
prepend,
|
prepend,
|
||||||
timeIndex,
|
timeIndex,
|
||||||
binary,
|
binary,
|
||||||
|
nodeValues,
|
||||||
ensightCaseFile
|
ensightCaseFile
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -397,6 +432,7 @@ int main(int argc, char *argv[])
|
|||||||
prepend,
|
prepend,
|
||||||
timeIndex,
|
timeIndex,
|
||||||
binary,
|
binary,
|
||||||
|
nodeValues,
|
||||||
ensightCaseFile
|
ensightCaseFile
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -410,6 +446,7 @@ int main(int argc, char *argv[])
|
|||||||
prepend,
|
prepend,
|
||||||
timeIndex,
|
timeIndex,
|
||||||
binary,
|
binary,
|
||||||
|
nodeValues,
|
||||||
ensightCaseFile
|
ensightCaseFile
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -423,6 +460,7 @@ int main(int argc, char *argv[])
|
|||||||
prepend,
|
prepend,
|
||||||
timeIndex,
|
timeIndex,
|
||||||
binary,
|
binary,
|
||||||
|
nodeValues,
|
||||||
ensightCaseFile
|
ensightCaseFile
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user