BUG: ensight: symmTensor writing

This commit is contained in:
mattijs
2013-08-13 10:19:10 +01:00
parent 66ac8ec1cc
commit 472fbded89
4 changed files with 165 additions and 9 deletions

View File

@ -33,6 +33,7 @@ License
#include "ensightBinaryStream.H"
#include "ensightAsciiStream.H"
#include "globalIndex.H"
#include "ensightPTraits.H"
using namespace Foam;
@ -198,7 +199,7 @@ void writePatchField
ensightCaseFile.setf(ios_base::left);
ensightCaseFile
<< pTraits<Type>::typeName
<< ensightPTraits<Type>::typeName
<< " per element: 1 "
<< setw(15) << pfName
<< (' ' + prepend + "****." + pfName).c_str()
@ -230,7 +231,7 @@ void writePatchField
if (Pstream::master())
{
ensightFile.write(pTraits<Type>::typeName);
ensightFile.write(ensightPTraits<Type>::typeName);
}
if (patchi >= 0)
@ -341,14 +342,14 @@ void ensightField
ensightCaseFile.setf(ios_base::left);
ensightCaseFile
<< pTraits<Type>::typeName
<< ensightPTraits<Type>::typeName
<< " per element: 1 "
<< setw(15) << vf.name()
<< (' ' + prepend + "****." + vf.name()).c_str()
<< nl;
}
ensightFile.write(pTraits<Type>::typeName);
ensightFile.write(ensightPTraits<Type>::typeName);
ensightFile.writePartHeader(1);
}
@ -555,14 +556,14 @@ void ensightPointField
ensightCaseFile.setf(ios_base::left);
ensightCaseFile
<< pTraits<Type>::typeName
<< ensightPTraits<Type>::typeName
<< " per node: 1 "
<< setw(15) << pf.name()
<< (' ' + prepend + "****." + pf.name()).c_str()
<< nl;
}
ensightFile.write(pTraits<Type>::typeName);
ensightFile.write(ensightPTraits<Type>::typeName);
ensightFile.writePartHeader(1);
}

View File

@ -0,0 +1,46 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "ensightPTraits.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const char* const Foam::ensightPTraits<Foam::scalar>::typeName =
Foam::pTraits<Foam::scalar>::typeName;
const char* const Foam::ensightPTraits<Foam::vector>::typeName =
Foam::pTraits<Foam::vector>::typeName;
const char* const Foam::ensightPTraits<Foam::sphericalTensor>::typeName =
Foam::pTraits<Foam::scalar>::typeName;
const char* const Foam::ensightPTraits<Foam::symmTensor>::typeName =
"tensor symm";
const char* const Foam::ensightPTraits<Foam::tensor>::typeName =
Foam::pTraits<Foam::tensor>::typeName;
// ************************************************************************* //

View File

@ -0,0 +1,108 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 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 <http://www.gnu.org/licenses/>.
Class
Foam::ensightPTraits
Description
Conversion of OpenFOAM pTraits into the Ensight equivalent
\*---------------------------------------------------------------------------*/
#ifndef ensightPTraits_H
#define ensightPTraits_H
#include "pTraits.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class ensightPTraits Declaration
\*---------------------------------------------------------------------------*/
template<class PrimitiveType>
class ensightPTraits
{
public:
// Static data members
static const char* const typeName;
};
template<>
class ensightPTraits<scalar>
{
public:
static const char* const typeName;
};
template<>
class ensightPTraits<vector>
{
public:
static const char* const typeName;
};
template<>
class ensightPTraits<sphericalTensor>
{
public:
static const char* const typeName;
};
template<>
class ensightPTraits<symmTensor>
{
public:
static const char* const typeName;
};
template<>
class ensightPTraits<tensor>
{
public:
static const char* const typeName;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -29,6 +29,7 @@ License
#include "OSspecific.H"
#include "IOmanip.H"
#include "ensightPartFaces.H"
#include "ensightPTraits.H"
#include "makeSurfaceWriterMethods.H"
@ -89,7 +90,7 @@ void Foam::ensightSurfaceWriter::writeTemplate
<< "model: 1 " << osGeom.name().name() << nl
<< nl
<< "VARIABLE" << nl
<< pTraits<Type>::typeName << " per "
<< ensightPTraits<Type>::typeName << " per "
<< word(isNodeValues ? "node:" : "element:") << setw(10) << 1
<< " " << fieldName
<< " " << surfaceName.c_str() << ".***." << fieldName << nl
@ -107,7 +108,7 @@ void Foam::ensightSurfaceWriter::writeTemplate
osGeom << ensPart;
// Write field
osField.writeKeyword(pTraits<Type>::typeName);
osField.writeKeyword(ensightPTraits<Type>::typeName);
ensPart.writeField(osField, values, isNodeValues);
}