Skip to content
Snippets Groups Projects
Commit 16ee9174 authored by mattijs's avatar mattijs
Browse files

ENH: vtkUnstructuredReader: handle more vtk file types

parent ccb510e6
Branches
Tags
No related merge requests found
......@@ -36,14 +36,18 @@ defineTypeNameAndDebug(Foam::vtkUnstructuredReader, 0);
template<>
const char*
Foam::NamedEnum<Foam::vtkUnstructuredReader::vtkDataType, 4>::names[] =
Foam::NamedEnum<Foam::vtkUnstructuredReader::vtkDataType, 8>::names[] =
{
"int",
"unsigned_int",
"long",
"unsigned_long",
"float",
"double",
"string",
"vtkIdType"
};
const Foam::NamedEnum<Foam::vtkUnstructuredReader::vtkDataType, 4>
const Foam::NamedEnum<Foam::vtkUnstructuredReader::vtkDataType, 8>
Foam::vtkUnstructuredReader::vtkDataTypeNames;
......@@ -385,6 +389,9 @@ void Foam::vtkUnstructuredReader::readField
switch (vtkDataTypeNames[dataType])
{
case VTK_INT:
case VTK_UINT:
case VTK_LONG:
case VTK_ULONG:
case VTK_ID:
{
autoPtr<labelIOField> fieldVals
......@@ -406,6 +413,7 @@ void Foam::vtkUnstructuredReader::readField
break;
case VTK_FLOAT:
case VTK_DOUBLE:
{
autoPtr<scalarIOField> fieldVals
(
......@@ -627,7 +635,7 @@ void Foam::vtkUnstructuredReader::read(ISstream& inFile)
}
word primitiveTag(inFile);
if (primitiveTag != "float")
if (primitiveTag != "float" && primitiveTag != "double")
{
FatalIOErrorIn("vtkUnstructuredReader::read(..)", inFile)
<< "Expected 'float' entry but found "
......@@ -809,7 +817,11 @@ void Foam::vtkUnstructuredReader::read(ISstream& inFile)
3*wantedSize
);
if (vtkDataTypeNames[dataType] == VTK_FLOAT)
if
(
vtkDataTypeNames[dataType] == VTK_FLOAT
|| vtkDataTypeNames[dataType] == VTK_DOUBLE
)
{
objectRegistry::iterator iter = reg.find(dataName);
scalarField s(*dynamic_cast<const scalarField*>(iter()));
......
......@@ -28,6 +28,8 @@ Description
Reader for vtk unstructured_grid legacy files. Supports single CELLS, POINTS
etc. entry only.
- all integer types (int, unsigned_int, long etc.) become Foam::label
- all real types (float, double) become Foam::scalar
- POINTS becomes OpenFOAM points
- CELLS gets split into OpenFOAM
- cells
......@@ -69,12 +71,16 @@ public:
enum vtkDataType
{
VTK_INT,
VTK_UINT,
VTK_LONG,
VTK_ULONG,
VTK_FLOAT,
VTK_DOUBLE,
VTK_STRING,
VTK_ID
};
static const NamedEnum<vtkDataType, 4> vtkDataTypeNames;
static const NamedEnum<vtkDataType, 8> vtkDataTypeNames;
//- Enumeration defining the vtk dataset types
......
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