diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/convertLagrangian.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/convertLagrangian.H index 46989a4e648d9cb5cf4a19ef66efaac956a0f1ea..7f94597067f41bc47e63fee58dc5a7ec367ae3d0 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/convertLagrangian.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/convertLagrangian.H @@ -56,7 +56,7 @@ if (doLagrangian) { autoPtr os = ensCase.newCloud(cloudName); - ensightCloud::writePositions + ensightOutput::writeCloudPositions ( mesh, cloudName, @@ -104,7 +104,7 @@ if (doLagrangian) autoPtr os = ensCase.newCloudData(cloudName, fieldName); - wrote = ensightCloud::writeCloudField + wrote = ensightOutput::writeCloudField ( fieldObject, fieldExists, os ); @@ -114,7 +114,7 @@ if (doLagrangian) autoPtr os = ensCase.newCloudData(cloudName, fieldName); - wrote = ensightCloud::writeCloudField + wrote = ensightOutput::writeCloudField ( fieldObject, fieldExists, os ); diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C index 68815b8bfe0c0c7f132f88c635bf0c4abc1bdba8..e90b8462403bb1c1379a4d1d6d19d173ae971983 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C @@ -99,8 +99,8 @@ Note #include "ensightCase.H" #include "ensightGeoFile.H" #include "ensightMesh.H" -#include "ensightOutput.H" #include "ensightOutputCloud.H" +#include "ensightOutputVolField.H" #include "fvMeshSubsetProxy.H" // local files diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/writeVolFields.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/writeVolFields.H index 98f388d9ecc242d0e9f39996cd7258ffb415089b..f72c74db590ab6e9d7816449895c403463056999 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/writeVolFields.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/writeVolFields.H @@ -62,11 +62,11 @@ bool writeVolField autoPtr os = ensCase.newData(field.name()); - bool wrote = ensightOutput::writeField + bool wrote = ensightOutput::writeVolField ( field, ensMesh, - os, + os.ref(), nodeValues ); diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/convertLagrangian.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/convertLagrangian.H index 827500474b206a389b29d6bb817906394026c1ef..ce1f9b4d64c46f0a05c29654c99ce0fa95abc921 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/convertLagrangian.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/convertLagrangian.H @@ -55,7 +55,7 @@ if (doLagrangian) { autoPtr os = ensCase.newCloud(cloudName); - ensightCloud::writePositions + ensightOutput::writeCloudPositions ( mesh, cloudName, @@ -103,7 +103,7 @@ if (doLagrangian) autoPtr os = ensCase.newCloudData(cloudName, fieldName); - wrote = ensightCloud::writeCloudField + wrote = ensightOutput::writeCloudField ( fieldObject, fieldExists, os ); @@ -113,7 +113,7 @@ if (doLagrangian) autoPtr os = ensCase.newCloudData(cloudName, fieldName); - wrote = ensightCloud::writeCloudField + wrote = ensightOutput::writeCloudField ( fieldObject, fieldExists, os ); diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C index 4aa572c43646006d4f0c9f6c099aec7bfb027076..c3460ea729a0298964e58f3ae986f7afe87cc0db 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C @@ -94,8 +94,8 @@ Note #include "ensightCase.H" #include "ensightGeoFile.H" #include "ensightParts.H" -#include "ensightSerialOutput.H" #include "ensightOutputCloud.H" +#include "ensightOutputVolField.H" #include "fvMeshSubsetProxy.H" // local files diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/writeVolFields.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/writeVolFields.H index 303f97ad532daf72f82e17c38e683cf6c9a28bf8..017ef31bf00f38b2c65aa8e5df72a6bde0d2b5d2 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/writeVolFields.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/writeVolFields.H @@ -61,11 +61,12 @@ bool writeVolField autoPtr os = ensCase.newData(field.name()); - bool wrote = ensightSerialOutput::writeField + // Currently serial only + bool wrote = ensightOutput::Serial::writeVolField ( field, ensParts, - os + os.ref() ); tfield.clear(); diff --git a/src/conversion/ensight/output/ensightOutput.H b/src/conversion/ensight/output/ensightOutput.H deleted file mode 100644 index 2649fd5b769b83665cefc77f91d57795b259290f..0000000000000000000000000000000000000000 --- a/src/conversion/ensight/output/ensightOutput.H +++ /dev/null @@ -1,164 +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 . - -Class - Foam::ensightOutput - -Description - A collection of functions for writing ensight file content in parallel. - -SourceFiles - ensightOutput.C - ensightOutputTemplates.C - -\*---------------------------------------------------------------------------*/ - -#ifndef ensightOutput_H -#define ensightOutput_H - -#include "ensightFile.H" -#include "ensightMesh.H" -#include "autoPtr.H" -#include "volFields.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class ensightOutput Declaration -\*---------------------------------------------------------------------------*/ - -class ensightOutput -{ - // Private Methods - - //- Write field content (component-wise) for the given ensight element type - template class FieldContainer, class Type> - static void writeFieldContent - ( - const char* key, - const FieldContainer& fld, - ensightFile& os - ); - - //- Write a field of faces values as an indirect list, - // using the face ids from ensightFaces - template - static bool writeFaceField - ( - const Field& fld, - const ensightFaces&, - ensightFile& os - ); - - //- Write a field of faces values as a sublist, - // using the sublist sizes ensightFaces - template - static bool writeFaceSubField - ( - const Field& fld, - const ensightFaces&, - ensightFile& os - ); - - //- Write a field of cell values as an indirect list, - // using the cell ids from ensightCells - template - static bool writeCellField - ( - const Field& fld, - const ensightCells&, - ensightFile& os - ); - - - //- Write volume field component-wise - template - static bool writeField - ( - const GeometricField& vf, - const ensightMesh& ensMesh, - ensightFile& os - ); - - //- Write point field component-wise - template - static bool ensightPointField - ( - const GeometricField& pf, - const ensightMesh& ensMesh, - ensightFile& os - ); - - //- No null constructor - ensightOutput() = delete; - - -public: - - // Public Methods - - //- Write volume field component-wise - template - static bool writeField - ( - const GeometricField&, - const ensightMesh& ensMesh, - ensightFile& os, - const bool nodeValues - ); - - - //- Write volume field component-wise - template - static inline bool writeField - ( - const GeometricField& vf, - const ensightMesh& ensMesh, - autoPtr& output, - const bool nodeValues = false - ) - { - return writeField(vf, ensMesh, output.ref(), nodeValues); - } - -}; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository - #include "ensightOutputTemplates.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/conversion/ensight/output/ensightOutputVolField.H b/src/conversion/ensight/output/ensightOutputVolField.H new file mode 100644 index 0000000000000000000000000000000000000000..fd3bf9506ad2421c9ea0111535d70f10945b4525 --- /dev/null +++ b/src/conversion/ensight/output/ensightOutputVolField.H @@ -0,0 +1,148 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016-2019 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 . + +InNamespace + Foam::ensightOutput + +Description + A collection of functions for writing volField content in ensight format. + +\*---------------------------------------------------------------------------*/ + +#ifndef ensightOutputVolField_H +#define ensightOutputVolField_H + +#include "ensightOutput.H" +#include "ensightPart.H" +#include "ensightParts.H" +#include "ensightPartFaces.H" +#include "ensightPartCells.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declarations +class ensightMesh; + +namespace ensightOutput +{ + +/*---------------------------------------------------------------------------*\ + Namespace ensightOutput::Detail +\*---------------------------------------------------------------------------*/ + +namespace Detail +{ + +//- Write volume field component-wise +template +bool writeVolField +( + const GeometricField& vf, + const ensightMesh& ensMesh, + ensightFile& os +); + +//- Write point field component-wise +template +bool writePointField +( + const GeometricField& pf, + const ensightMesh& ensMesh, + ensightFile& os +); + +} // End namespace Detail + + +/*---------------------------------------------------------------------------*\ + Namespace ensightOutput +\*---------------------------------------------------------------------------*/ + +//- Write volume field component-wise +template +bool writeVolField +( + const GeometricField&, + const ensightMesh& ensMesh, + ensightFile& os, + const bool nodeValues = false +); + + +/*---------------------------------------------------------------------------*\ + Namespace ensightOutput::Serial +\*---------------------------------------------------------------------------*/ + +namespace Serial +{ + +//- Write volume field component-wise for specified faces +template +bool writeVolField +( + const GeometricField& vf, + const ensightPartFaces& part, + ensightFile& os +); + + +//- Write volume field component-wise for specified cells +template +bool writeVolField +( + const GeometricField& vf, + const ensightPartCells& part, + ensightFile& os +); + + +//- Write volume field component-wise +template +bool writeVolField +( + const GeometricField& vf, + const ensightParts& list, + ensightFile& os +); + +} // End namespace Serial + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace ensightOutput +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "ensightOutputVolFieldTemplates.C" +#endif + +#endif + +// ************************************************************************* // diff --git a/src/conversion/ensight/output/ensightOutputTemplates.C b/src/conversion/ensight/output/ensightOutputVolFieldTemplates.C similarity index 62% rename from src/conversion/ensight/output/ensightOutputTemplates.C rename to src/conversion/ensight/output/ensightOutputVolFieldTemplates.C index 5176845e6f1de45b5a35d4d7b41afd4f6db22bed..4a22d74d8a67b7a1509ccf025c3ee9e2478bb22b 100644 --- a/src/conversion/ensight/output/ensightOutputTemplates.C +++ b/src/conversion/ensight/output/ensightOutputVolFieldTemplates.C @@ -23,191 +23,29 @@ License \*---------------------------------------------------------------------------*/ -#include "ensightFile.H" -#include "ensightOutput.H" -#include "ensightPTraits.H" +#include "ensightOutputVolField.H" +#include "ensightMesh.H" #include "fvMesh.H" -#include "volFields.H" -#include "IOField.H" -#include "OFstream.H" -#include "IOmanip.H" -#include "Time.H" -#include "volPointInterpolation.H" #include "globalIndex.H" -#include "uindirectPrimitivePatch.H" +#include "volPointInterpolation.H" #include "interpolation.H" #include "linear.H" #include "processorFvPatch.H" +#include "uindirectPrimitivePatch.H" -// * * * * * * * * * * Static Private Member Functions * * * * * * * * * * * // - -template class FieldContainer, class Type> -void Foam::ensightOutput::writeFieldContent -( - const char* key, - const FieldContainer& fld, - ensightFile& os -) -{ - if (returnReduce(fld.size(), sumOp