BUG: incorrect symmTensor order for some ensight output (fixes #243)

- affects foamToEnsightParts, sampled surfaces

- Use ensightPTraits mechanism throughout to avoid this issue
This commit is contained in:
Mark Olesen
2016-09-23 09:10:57 +02:00
parent 0c168c43fa
commit 3c25f26aab
3 changed files with 24 additions and 34 deletions

View File

@ -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();

View File

@ -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();
}
}
}

View File

@ -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);
}
}