Skip to content
Snippets Groups Projects
Commit d60e5560 authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

[MeL/VTK] Move one of if-cnds in static assert.

parent 80f72c23
No related branches found
No related tags found
No related merge requests found
...@@ -336,8 +336,10 @@ void VtkMeshConverter::convertArray(vtkDataArray& array, ...@@ -336,8 +336,10 @@ void VtkMeshConverter::convertArray(vtkDataArray& array,
return; return;
} }
if constexpr (sizeof(std::int64_t) == sizeof(long long) && // Ensure, vtkTypeInt64Array and vtkLongLongArray are using the same type.
sizeof(long long) == sizeof(long)) static_assert(sizeof(std::int64_t) == sizeof(long long));
if constexpr (sizeof(long long) == sizeof(long))
{ {
// This also covers the vtkTypeInt64Array type, which is derived from // This also covers the vtkTypeInt64Array type, which is derived from
// the vtkLongLongArray type. // the vtkLongLongArray type.
...@@ -348,8 +350,7 @@ void VtkMeshConverter::convertArray(vtkDataArray& array, ...@@ -348,8 +350,7 @@ void VtkMeshConverter::convertArray(vtkDataArray& array,
return; return;
} }
} }
else if constexpr (sizeof(std::int64_t) == sizeof(long long) && else
sizeof(long long) != sizeof(long))
{ {
// This also covers the vtkTypeInt64Array type, which is derived from // This also covers the vtkTypeInt64Array type, which is derived from
// the vtkLongLongArray type. // the vtkLongLongArray type.
...@@ -360,15 +361,6 @@ void VtkMeshConverter::convertArray(vtkDataArray& array, ...@@ -360,15 +361,6 @@ void VtkMeshConverter::convertArray(vtkDataArray& array,
return; return;
} }
} }
else
{
OGS_FATAL(
"Array '{:s}' in VTU file uses unsupported data type '{:s}' not "
"convertible to long or long long. Size of long is {:d}, size of "
"long long is {:d}.",
array.GetName(), array.GetDataTypeAsString(), sizeof(long),
sizeof(long long));
}
// This also covers the vtkTypeUInt8Array type, which is derived from the // This also covers the vtkTypeUInt8Array type, which is derived from the
// vtkUnsignedCharArray type. // vtkUnsignedCharArray type.
...@@ -428,8 +420,11 @@ void VtkMeshConverter::convertArray(vtkDataArray& array, ...@@ -428,8 +420,11 @@ void VtkMeshConverter::convertArray(vtkDataArray& array,
return; return;
} }
if constexpr (sizeof(std::uint64_t) == sizeof(unsigned long long) && // Ensure, vtkTypeUInt64Array and vtkUnsignedLongLongArray are using the
sizeof(unsigned long long) == sizeof(unsigned long)) // same type.
static_assert(sizeof(std::uint64_t) == sizeof(unsigned long long));
if constexpr (sizeof(unsigned long long) == sizeof(unsigned long))
{ {
// This also covers the vtkTypeUInt64Array type, which is derived from // This also covers the vtkTypeUInt64Array type, which is derived from
// the vtkUnsignedLongLongArray type. // the vtkUnsignedLongLongArray type.
...@@ -441,8 +436,7 @@ void VtkMeshConverter::convertArray(vtkDataArray& array, ...@@ -441,8 +436,7 @@ void VtkMeshConverter::convertArray(vtkDataArray& array,
return; return;
} }
} }
else if constexpr (sizeof(std::uint64_t) == sizeof(unsigned long long) && else
sizeof(unsigned long long) != sizeof(unsigned long))
{ {
// This also covers the vtkTypeUInt64Array type, which is derived from // This also covers the vtkTypeUInt64Array type, which is derived from
// the vtkUnsignedLongLongArray type. // the vtkUnsignedLongLongArray type.
...@@ -453,16 +447,6 @@ void VtkMeshConverter::convertArray(vtkDataArray& array, ...@@ -453,16 +447,6 @@ void VtkMeshConverter::convertArray(vtkDataArray& array,
return; return;
} }
} }
else
{
OGS_FATAL(
"Array '{:s}' in VTU file uses unsupported data type '{:s}' "
"not convertible to unsigned long or unsigned long long. Size of "
"unsigned long is {:d}, size of unsigned long long is {:d}, size "
"of std::size_t is {:d}.",
array.GetName(), array.GetDataTypeAsString(), sizeof(unsigned long),
sizeof(unsigned long long), sizeof(std::size_t));
}
WARN( WARN(
"Array '{:s}' in VTU file uses unsupported data type '{:s}' of size " "Array '{:s}' in VTU file uses unsupported data type '{:s}' of size "
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment