ENH: consolidate vtk classes into 'Foam::vtk' namespace

- elminate the foamVtkFormatter operator() in favour of xmlAttr.
  Improves readability and the purpose is clearer.
This commit is contained in:
Mark Olesen
2017-06-13 14:10:07 +02:00
parent edc1bd2230
commit cde12ad9e5
81 changed files with 1249 additions and 1408 deletions

View File

@ -32,12 +32,12 @@ License
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
void Foam::foamVtkOutput::writeCellSetFaces
void Foam::vtk::writeCellSetFaces
(
const primitiveMesh& mesh,
const cellSet& set,
const fileName& baseName,
const foamVtkOutput::outputOptions outOpts
const vtk::outputOptions outOpts
)
{
outputOptions opts(outOpts);
@ -47,11 +47,11 @@ void Foam::foamVtkOutput::writeCellSetFaces
std::ofstream os((baseName + (legacy_ ? ".vtk" : ".vtp")).c_str());
autoPtr<foamVtkOutput::formatter> format = opts.newFormatter(os);
autoPtr<vtk::formatter> format = opts.newFormatter(os);
if (legacy_)
{
legacy::fileHeader(format(), set.name(), vtkFileTag::POLY_DATA);
legacy::fileHeader(format(), set.name(), vtk::fileTag::POLY_DATA);
}
//-------------------------------------------------------------------------
@ -109,7 +109,7 @@ void Foam::foamVtkOutput::writeCellSetFaces
// Write points and faces as polygons
legacy::beginPoints(os, pp.nPoints());
foamVtkOutput::writeList(format(), pp.localPoints());
vtk::writeList(format(), pp.localPoints());
format().flush();
// connectivity count without additional storage (done internally)
@ -129,17 +129,17 @@ void Foam::foamVtkOutput::writeCellSetFaces
const face& f = pp.localFaces()[facei];
format().write(f.size()); // The size prefix
foamVtkOutput::writeList(format(), f);
vtk::writeList(format(), f);
}
format().flush();
// Write data - faceId/cellId
legacy::dataHeader(os, vtkFileTag::CELL_DATA, pp.size(), 1);
legacy::dataHeader(os, vtk::fileTag::CELL_DATA, pp.size(), 1);
os << "cellID 1 " << pp.size() << " int" << nl;
foamVtkOutput::writeList(format(), faceValues);
vtk::writeList(format(), faceValues);
format().flush();
}

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
InNamespace
Foam::foamVtkOutput
Foam::vtk
Description
Write faces of cellSet to vtk polydata file.
@ -45,11 +45,11 @@ SourceFiles
namespace Foam
{
class primitiveMesh;
class primitiveMesh;
class cellSet;
class fileName;
namespace foamVtkOutput
namespace vtk
{
//- Write perimeter faces of cellset to vtk polydata file.
@ -59,10 +59,10 @@ void writeCellSetFaces
const primitiveMesh& mesh,
const cellSet& set,
const fileName& baseName,
const foamVtkOutput::outputOptions outOpts
const vtk::outputOptions outOpts
);
} // End namespace foamVtkOutput
} // End namespace vtk
} // End namespace Foam

View File

@ -32,12 +32,12 @@ License
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
void Foam::foamVtkOutput::writeFaceSet
void Foam::vtk::writeFaceSet
(
const primitiveMesh& mesh,
const faceSet& set,
const fileName& baseName,
const foamVtkOutput::outputOptions outOpts
const vtk::outputOptions outOpts
)
{
outputOptions opts(outOpts);
@ -47,11 +47,11 @@ void Foam::foamVtkOutput::writeFaceSet
std::ofstream os((baseName + (legacy_ ? ".vtk" : ".vtp")).c_str());
autoPtr<foamVtkOutput::formatter> format = opts.newFormatter(os);
autoPtr<vtk::formatter> format = opts.newFormatter(os);
if (legacy_)
{
legacy::fileHeader(format(), set.name(), vtkFileTag::POLY_DATA);
legacy::fileHeader(format(), set.name(), vtk::fileTag::POLY_DATA);
}
//-------------------------------------------------------------------------
@ -70,7 +70,7 @@ void Foam::foamVtkOutput::writeFaceSet
// Write points and faces as polygons
legacy::beginPoints(os, pp.nPoints());
foamVtkOutput::writeList(format(), pp.localPoints());
vtk::writeList(format(), pp.localPoints());
format().flush();
// connectivity count without additional storage (done internally)
@ -89,18 +89,18 @@ void Foam::foamVtkOutput::writeFaceSet
const face& f = pp.localFaces()[facei];
format().write(f.size()); // The size prefix
foamVtkOutput::writeList(format(), f);
vtk::writeList(format(), f);
}
format().flush();
// Write data - faceId/cellId
legacy::dataHeader(os, vtkFileTag::CELL_DATA, pp.size(), 1);
legacy::dataHeader(os, vtk::fileTag::CELL_DATA, pp.size(), 1);
os << "faceID 1 " << pp.size() << " int" << nl;
foamVtkOutput::writeList(format(), faceLabels);
vtk::writeList(format(), faceLabels);
format().flush();
}

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
InNamespace
Foam::foamVtkOutput
Foam::vtk
Description
Write faceSet to vtk polydata file.
@ -46,7 +46,7 @@ class primitiveMesh;
class faceSet;
class fileName;
namespace foamVtkOutput
namespace vtk
{
//- Write pointSet to vtk polydata file.
@ -56,11 +56,11 @@ void writeFaceSet
const primitiveMesh& mesh,
const faceSet& set,
const fileName& baseName,
const foamVtkOutput::outputOptions outOpts
const vtk::outputOptions outOpts
);
} // End namespace foamVtkOutput
} // End namespace vtk
} // End namespace Foam

View File

@ -31,12 +31,12 @@ License
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
void Foam::foamVtkOutput::writePointSet
void Foam::vtk::writePointSet
(
const primitiveMesh& mesh,
const pointSet& set,
const fileName& baseName,
const foamVtkOutput::outputOptions outOpts
const vtk::outputOptions outOpts
)
{
outputOptions opts(outOpts);
@ -46,11 +46,11 @@ void Foam::foamVtkOutput::writePointSet
std::ofstream os((baseName + (legacy_ ? ".vtk" : ".vtp")).c_str());
autoPtr<foamVtkOutput::formatter> format = opts.newFormatter(os);
autoPtr<vtk::formatter> format = opts.newFormatter(os);
if (legacy_)
{
legacy::fileHeader(format(), set.name(), vtkFileTag::POLY_DATA);
legacy::fileHeader(format(), set.name(), vtk::fileTag::POLY_DATA);
}
//-------------------------------------------------------------------------
@ -60,15 +60,15 @@ void Foam::foamVtkOutput::writePointSet
// Write points
legacy::beginPoints(os, pointLabels.size());
foamVtkOutput::writeList(format(), mesh.points(), pointLabels);
vtk::writeList(format(), mesh.points(), pointLabels);
format().flush();
// Write data - pointID
legacy::dataHeader(os, vtkFileTag::POINT_DATA, pointLabels.size(), 1);
legacy::dataHeader(os, vtk::fileTag::POINT_DATA, pointLabels.size(), 1);
os << "pointID 1 " << pointLabels.size() << " int" << nl;
foamVtkOutput::writeList(format(), pointLabels);
vtk::writeList(format(), pointLabels);
format().flush();
}

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
InNamespace
Foam::foamVtkOutput
Foam::vtk
Description
Write pointSet to vtk polydata file.
@ -46,7 +46,7 @@ class primitiveMesh;
class pointSet;
class fileName;
namespace foamVtkOutput
namespace vtk
{
//- Write pointSet to vtk polydata file.
@ -56,11 +56,11 @@ void writePointSet
const primitiveMesh& mesh,
const pointSet& set,
const fileName& baseName,
const foamVtkOutput::outputOptions outOpts
const vtk::outputOptions outOpts
);
} // End namespace foamVtkOutput
} // End namespace vtk
} // End namespace Foam