diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloudTemplates.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloudTemplates.C index efcd11beb97a27dce18d974bfde8e0a19ee2a6c7..ac2559f17cfbb66b78a53c52e2a405c6daee4b1e 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloudTemplates.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloudTemplates.C @@ -57,10 +57,10 @@ void Foam::writeCloudField val = Zero; } - for (direction i=0; i < pTraits<Type>::nComponents; ++i) + for (direction d=0; d < pTraits<Type>::nComponents; ++d) { - label cmpt = ensightPTraits<Type>::componentOrder[i]; - os.write( component(val, cmpt) ); + label cmpt = ensightPTraits<Type>::componentOrder[d]; + os.write(component(val, cmpt)); if (++count % 6 == 0) { @@ -84,10 +84,10 @@ void Foam::writeCloudField val = Zero; } - for (direction i=0; i < pTraits<Type>::nComponents; ++i) + for (direction d=0; d < pTraits<Type>::nComponents; ++d) { - label cmpt = ensightPTraits<Type>::componentOrder[i]; - os.write( component(val, cmpt) ); + label cmpt = ensightPTraits<Type>::componentOrder[d]; + os.write(component(val, cmpt)); if (++count % 6 == 0) { @@ -168,9 +168,9 @@ void Foam::ensightCloudField } filePtr = new ensightFile(dataDir, postFileName, format); + // description filePtr->write ( - // description string(postFileName + " <" + pTraits<Type>::typeName + ">") ); filePtr->newline(); diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.C b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.C index 2c92bee9cc43b47aa3c0c017ed378fa37d996d2e..148aa4014532744730f5f2c5e279c8f4609f3c51 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/ensightOutputFunctions.C @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "ensightOutputFunctions.H" +#include "ensightPTraits.H" #include "passiveParticle.H" #include "IOField.H" @@ -171,11 +172,8 @@ void Foam::ensightLagrangianField // when writing positions ensightFile os(dataDir, postFileName, format); - os.write - ( - // description - string(postFileName + " with " + pTraits<Type>::typeName + " values") - ); + // description + os.write(string(postFileName + " <" + pTraits<Type>::typeName + ">")); os.newline(); IOField<Type> field(fieldObject); @@ -187,21 +185,20 @@ void Foam::ensightLagrangianField { Type val = field[i]; - if (mag(val) < 1.0e-90) + if (mag(val) < 1e-90) { val = Zero; } - for (direction cmpt=0; cmpt < pTraits<Type>::nComponents; cmpt++) + for (direction d=0; d < pTraits<Type>::nComponents; ++d) { - os.write( component(val, cmpt) ); - } + label cmpt = ensightPTraits<Type>::componentOrder[d]; + os.write(component(val, cmpt)); - count += pTraits<Type>::nComponents; - - if (count % 6 == 0) - { - os.newline(); + if (++count % 6 == 0) + { + os.newline(); + } } } diff --git a/src/conversion/ensight/part/ensightPartTemplates.C b/src/conversion/ensight/part/ensightPartTemplates.C index 32be0caef8d65593ea71bf2108c9ea39d97b31c3..13186460402ed81739c7856b4af8120470fb3385 100644 --- a/src/conversion/ensight/part/ensightPartTemplates.C +++ b/src/conversion/ensight/part/ensightPartTemplates.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,6 +27,7 @@ Description \*---------------------------------------------------------------------------*/ #include "ensightPart.H" +#include "ensightPTraits.H" // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // @@ -45,13 +46,9 @@ void Foam::ensightPart::writeField if (perNode) { os.writeKeyword("coordinates"); - for - ( - direction cmpt=0; - cmpt < pTraits<Type>::nComponents; - ++cmpt - ) + for (direction d=0; d < pTraits<Type>::nComponents; ++d) { + label cmpt = ensightPTraits<Type>::componentOrder[d]; writeFieldList(os, field.component(cmpt), labelUList::null()); } } @@ -65,13 +62,9 @@ void Foam::ensightPart::writeField { os.writeKeyword(elementTypes()[elemI]); - for - ( - direction cmpt=0; - cmpt < pTraits<Type>::nComponents; - ++cmpt - ) + for (direction d=0; d < pTraits<Type>::nComponents; ++d) { + label cmpt = ensightPTraits<Type>::componentOrder[d]; writeFieldList(os, field.component(cmpt), idList); } }