diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/files b/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/files index 421e8392b8..044aa6ae43 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/files +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/files @@ -1,5 +1,6 @@ -ensightMesh.C -ensightCloud.C +ensightOutputCloud.C +meshSubsetHelper.C + foamToEnsight.C EXE = $(FOAM_APPBIN)/foamToEnsight diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/options b/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/options index e2fc5311ff..dc8f10f1f1 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/options +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/options @@ -3,14 +3,12 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/fileFormats/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/conversion/lnInclude EXE_LIBS = \ -ldynamicMesh \ -lfileFormats \ - -lsampling \ -lgenericPatchFields \ -llagrangian \ -lconversion diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/cellSets.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/cellSets.H deleted file mode 100644 index 54887f662a..0000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/cellSets.H +++ /dev/null @@ -1,112 +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 . - -Class - Foam::cellSets - -Description - -\*---------------------------------------------------------------------------*/ - -#ifndef cellSets_H -#define cellSets_H - -#include "labelList.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class cellSets Declaration -\*---------------------------------------------------------------------------*/ - -class cellSets -{ -public: - - label nTets; - label nPyrs; - label nPrisms; - label nHexesWedges; - label nPolys; - - labelList tets; - labelList pyrs; - labelList prisms; - labelList wedges; - labelList hexes; - labelList polys; - - - // Constructors - - //- Construct given the number ov cells - cellSets(const label nCells) - : - nTets(0), - nPyrs(0), - nPrisms(0), - nHexesWedges(0), - nPolys(0), - - tets(nCells), - pyrs(nCells), - prisms(nCells), - wedges(nCells), - hexes(nCells), - polys(nCells) - {} - - - // Member Functions - - void setSize(const label nCells) - { - nTets = 0; - nPyrs = 0; - nPrisms = 0; - nHexesWedges = 0; - nPolys = 0; - - tets.setSize(nCells); - pyrs.setSize(nCells); - prisms.setSize(nCells); - wedges.setSize(nCells); - hexes.setSize(nCells); - polys.setSize(nCells); - } - -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H index bda9220acb..912f48b28a 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H @@ -38,8 +38,7 @@ if (timeDirs.size() > 1 && Pstream::master()) if (meshMoving) { - Info<< "found." << nl - << " Writing meshes for every timestep." << endl; + Info<< "found. Writing meshes for every timestep." << endl; } else { diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightAsciiStream.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightAsciiStream.H deleted file mode 100644 index ceccc987ae..0000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightAsciiStream.H +++ /dev/null @@ -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 . - -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& 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 - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightBinaryStream.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightBinaryStream.H deleted file mode 100644 index d1c3d6e3b3..0000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightBinaryStream.H +++ /dev/null @@ -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 . - -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 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(&val), sizeof(int)); - } - - virtual void write(const scalarField& sf) - { - if (sf.size()) - { - List temp(sf.size()); - - forAll(sf, i) - { - temp[i] = float(sf[i]); - } - - str_().write - ( - reinterpret_cast(temp.begin()), - sf.size()*sizeof(float) - ); - } - } - - virtual void write(const List& sf) - { - str_().write - ( - reinterpret_cast(sf.begin()), - sf.size()*sizeof(int) - ); - } - - virtual void writePartHeader(const label partI) - { - write("part"); - write(partI); - } - -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCaseTail.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCaseTail.H deleted file mode 100644 index 5a18a953c7..0000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCaseTail.H +++ /dev/null @@ -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; -} diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C deleted file mode 100644 index 1755c7d2a1..0000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C +++ /dev/null @@ -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 . - -\*---------------------------------------------------------------------------*/ - -#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 -tmp> -volField -( - const fvMeshSubset& meshSubsetter, - const GeometricField& vf -) -{ - if (meshSubsetter.hasSubMesh()) - { - tmp> tfld - ( - meshSubsetter.interpolate(vf) - ); - tfld.ref().checkOut(); - tfld.ref().rename(vf.name()); - return tfld; - } - else - { - return vf; - } -} - - -template -tmp> -volField -( - const fvMeshSubset& meshSubsetter, - const typename GeometricField::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> tvf - ( - new GeometricField - ( - io, - df.mesh(), - dimensioned("0", df.dimensions(), Zero), - zeroGradientFvPatchField::typeName - ) - ); - tvf.ref().primitiveFieldRef() = df; - tvf.ref().correctBoundaryConditions(); - - if (meshSubsetter.hasSubMesh()) - { - const GeometricField& vf = tvf(); - - tmp> tfld - ( - meshSubsetter.interpolate(vf) - ); - tfld.ref().checkOut(); - tfld.ref().rename(vf.name()); - return tfld; - } - else - { - return tvf; - } -} - - -//template -//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 -// ( -// volField(meshSubsetter, fld), -// eMesh, -// dataDir, -// timeIndex, -// nodeValues, -// ensightCaseFile -// ); -//} - - -template -Field map -( - const Field& vf, - const labelList& map1, - const labelList& map2 -) -{ - Field 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 -void writeField -( - const char* key, - const Field& vf, - ensightStream& os -) -{ - if (returnReduce(vf.size(), sumOp