Commit e6937f60 authored by Mark Olesen's avatar Mark Olesen Committed by Andrew Heather
Browse files

ENH: add Ensight output support for a labelField (treat like scalarField)

parent c137d3f8
......@@ -326,10 +326,17 @@ void Foam::ensightFile::beginParticleCoordinates(const label nparticles)
}
void Foam::ensightFile::writeList
(
const UList<scalar>& field
)
void Foam::ensightFile::writeList(const UList<label>& field)
{
for (const label val : field)
{
write(scalar(val));
newline();
}
}
void Foam::ensightFile::writeList(const UList<scalar>& field)
{
for (const scalar& val : field)
{
......@@ -347,6 +354,7 @@ void Foam::ensightFile::writeList
}
void Foam::ensightFile::writeList
(
const UList<scalar>& field,
......@@ -368,4 +376,5 @@ void Foam::ensightFile::writeList
}
}
// ************************************************************************* //
......@@ -191,6 +191,9 @@ public:
//- Begin a "particle coordinates" block (measured data)
void beginParticleCoordinates(const label nparticles);
//- Write a list of integers as float values
void writeList(const UList<label>& field);
//- Write a list of floats as "%12.5e" or as binary
// With carriage return after each value (ascii stream)
void writeList(const UList<scalar>& field);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2013-2015 OpenFOAM Foundation
......@@ -29,6 +29,15 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<>
const char* const
Foam::ensightPTraits<Foam::label>::typeName = "scalar";
template<>
const Foam::direction
Foam::ensightPTraits<Foam::label>::componentOrder[] = {0};
template<>
const char* const
Foam::ensightPTraits<Foam::scalar>::typeName = "scalar";
......@@ -47,7 +56,7 @@ const Foam::direction
Foam::ensightPTraits<Foam::vector>::componentOrder[] = {0, 1, 2};
// use mag(sphericalTensor) instead
// Use mag(sphericalTensor) instead
template<>
const char* const
Foam::ensightPTraits<Foam::sphericalTensor>::typeName = "scalar";
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2013-2015 OpenFOAM Foundation
......@@ -29,6 +29,9 @@ Class
Description
Conversion of OpenFOAM pTraits into the Ensight equivalent
For the purpose of traits, integers (label) are treated like
floating point (scalar). Spherical tensors are mapped as a scalar.
\*---------------------------------------------------------------------------*/
#ifndef ensightPTraits_H
......@@ -62,6 +65,12 @@ public:
static const direction componentOrder[];
};
template<>
const char* const ensightPTraits<label>::typeName;
template<>
const direction ensightPTraits<label>::componentOrder[];
template<>
const char* const ensightPTraits<scalar>::typeName;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment