BUG: foamToVTK produces invalid files (fixes #154)

- broken by commit 2027059b (2016-03-09) where the pTraits
  nComponents type was changed from int to Foam::direction
This commit is contained in:
Mark Olesen 2016-06-21 10:21:17 +02:00
parent a39ffa66f2
commit db467dbcf8
7 changed files with 31 additions and 19 deletions

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.
@ -49,7 +49,8 @@ void Foam::lagrangianWriter::writeIOField(const wordList& objects)
IOField<Type> fld(header);
os_ << object << ' ' << pTraits<Type>::nComponents << ' '
os_ << object << ' '
<< int(pTraits<Type>::nComponents) << ' '
<< fld.size() << " float" << std::endl;
DynamicList<floatScalar> fField(pTraits<Type>::nComponents*fld.size());

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -38,7 +38,8 @@ void Foam::patchWriter::write
{
const GeometricField<Type, fvPatchField, volMesh>& fld = flds[fieldI];
os_ << fld.name() << ' ' << pTraits<Type>::nComponents << ' '
os_ << fld.name() << ' '
<< int(pTraits<Type>::nComponents) << ' '
<< nFaces_ << " float" << std::endl;
DynamicList<floatScalar> fField(pTraits<Type>::nComponents*nFaces_);
@ -74,7 +75,8 @@ void Foam::patchWriter::write
const GeometricField<Type, pointPatchField, pointMesh>& fld =
flds[fieldI];
os_ << fld.name() << ' ' << pTraits<Type>::nComponents << ' '
os_ << fld.name() << ' '
<< int(pTraits<Type>::nComponents) << ' '
<< nPoints_ << " float" << std::endl;
DynamicList<floatScalar> fField(pTraits<Type>::nComponents*nPoints_);
@ -103,7 +105,8 @@ void Foam::patchWriter::write
{
const GeometricField<Type, fvPatchField, volMesh>& fld = flds[fieldI];
os_ << fld.name() << ' ' << pTraits<Type>::nComponents << ' '
os_ << fld.name() << ' '
<< int(pTraits<Type>::nComponents) << ' '
<< nPoints_ << " float" << std::endl;
DynamicList<floatScalar> fField(pTraits<Type>::nComponents*nPoints_);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -71,7 +71,8 @@ void Foam::surfaceMeshWriter::write
const GeometricField<Type, fvsPatchField, surfaceMesh>& fld =
sflds[fieldI];
os_ << fld.name() << ' ' << pTraits<Type>::nComponents << ' '
os_ << fld.name() << ' '
<< int(pTraits<Type>::nComponents) << ' '
<< pp_.size() << " float" << std::endl;
DynamicList<floatScalar> fField(pTraits<Type>::nComponents*pp_.size());

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -74,7 +74,8 @@ void Foam::writeFuns::write
label nValues = mesh.nCells() + superCells.size();
os << vvf.name() << ' ' << pTraits<Type>::nComponents << ' '
os << vvf.name() << ' '
<< int(pTraits<Type>::nComponents) << ' '
<< nValues << " float" << std::endl;
DynamicList<floatScalar> fField(pTraits<Type>::nComponents*nValues);
@ -106,7 +107,8 @@ void Foam::writeFuns::write
const labelList& addPointCellLabels = topo.addPointCellLabels();
const label nTotPoints = mesh.nPoints() + addPointCellLabels.size();
os << pvf.name() << ' ' << pTraits<Type>::nComponents << ' '
os << pvf.name() << ' '
<< int(pTraits<Type>::nComponents) << ' '
<< nTotPoints << " float" << std::endl;
DynamicList<floatScalar> fField(pTraits<Type>::nComponents*nTotPoints);
@ -139,7 +141,8 @@ void Foam::writeFuns::write
const labelList& addPointCellLabels = topo.addPointCellLabels();
const label nTotPoints = mesh.nPoints() + addPointCellLabels.size();
os << vvf.name() << ' ' << pTraits<Type>::nComponents << ' '
os << vvf.name() << ' '
<< int(pTraits<Type>::nComponents) << ' '
<< nTotPoints << " float" << std::endl;
DynamicList<floatScalar> fField(pTraits<Type>::nComponents*nTotPoints);

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -119,8 +119,9 @@ void writeVTKFields
forAll(values, fieldI)
{
Info<< " writing field " << fieldNames[fieldI] << endl;
os << nl << fieldNames[fieldI] << ' ' << pTraits<Type>::nComponents
<< ' ' << values[fieldI].size() << " float" << nl;
os << nl << fieldNames[fieldI] << ' '
<< int(pTraits<Type>::nComponents) << ' '
<< values[fieldI].size() << " float" << nl;
label offset = 0;
forAll(addr, trackI)
{

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -85,7 +85,8 @@ void Foam::vtkSetWriter<Type>::write
forAll(valueSetNames, setI)
{
os << valueSetNames[setI] << ' ' << pTraits<Type>::nComponents << ' '
os << valueSetNames[setI] << ' '
<< int(pTraits<Type>::nComponents) << ' '
<< points.size() << " float" << nl;
const Field<Type>& fld = *valueSets[setI];
@ -169,7 +170,8 @@ void Foam::vtkSetWriter<Type>::write
forAll(valueSetNames, setI)
{
os << valueSetNames[setI] << ' ' << pTraits<Type>::nComponents << ' '
os << valueSetNames[setI] << ' '
<< int(pTraits<Type>::nComponents) << ' '
<< nPoints << " float" << nl;
const List<Field<Type>>& fieldVals = valueSets[setI];

View File

@ -65,7 +65,8 @@ void Foam::CloudToVTK<CloudType>::writeFieldData
) const
{
vtkOs
<< title << ' ' << pTraits<Type>::nComponents << ' '
<< title << ' '
<< int(pTraits<Type>::nComponents) << ' '
<< nParcels << " float" << std::endl;
writeData(vtkOs, binary, data);
}