Skip to content

VtkVtpData::get_point_data() fails silently if data is float32 #490

@aabrown100-git

Description

@aabrown100-git

Description

If VtkVtpData::get_point_data(const std::string& data_name) is used to read an array from a VTP file, and the data for that array happens to be stored as a float32 (rather than float64), this function returns an empty array. I consider this a silent failure.

Reproduction

Use this case for reproduction spatially_variable_robin.zip. This is identical to the spatially variable robin test case, except I modified Y0_spatially_varying_robin.vtp to store the Stiffness array as a float32 array. Run this case and get the error

(base) aaronbrown@Aarons-MacBook-Pro-2 spatially_variable_robin % mpirun -np 4 /Users/aaronbrown/GitHub/svMultiPhysics_aabrown100-git/build/svMultiPhysics-build/bin/svmultiphysics solver.xml 
libc++abi: terminating due to uncaught exception of type BoundaryConditionVtpArrayDimensionException: 'Stiffness' array in VTP file 'Y0_spatially_varying_robin.vtp' has incorrect dimensions. Expected 79 x 1, got 0 x 0
[Aarons-MacBook-Pro-2:88409] *** Process received signal ***
[Aarons-MacBook-Pro-2:88409] Signal: Abort trap: 6 (6)
[Aarons-MacBook-Pro-2:88409] Signal code:  (0)
[Aarons-MacBook-Pro-2:88409] [ 0] 0   libsystem_platform.dylib            0x00007ff80555431d _sigtramp + 29
[Aarons-MacBook-Pro-2:88409] [ 1] 0   ???                                 0x00007ff7b186ee48 0x0 + 140701812059720
[Aarons-MacBook-Pro-2:88409] [ 2] 0   libsystem_c.dylib                   0x00007ff80543a5c6 abort + 126
[Aarons-MacBook-Pro-2:88409] [ 3] 0   libc++abi.dylib                     0x00007ff8054d2170 _ZN10__cxxabiv130__aligned_malloc_with_fallbackEm + 0
[Aarons-MacBook-Pro-2:88409] [ 4] 0   libc++abi.dylib                     0x00007ff8054c32d4 _ZL28demangling_terminate_handlerv + 240
[Aarons-MacBook-Pro-2:88409] [ 5] 0   libobjc.A.dylib                     0x00007ff8051462f7 _ZL15_objc_terminatev + 104
[Aarons-MacBook-Pro-2:88409] [ 6] 0   libc++abi.dylib                     0x00007ff8054d15bb _ZSt11__terminatePFvvE + 6
[Aarons-MacBook-Pro-2:88409] [ 7] 0   libc++abi.dylib                     0x00007ff8054d43d2 __cxa_rethrow + 100
[Aarons-MacBook-Pro-2:88409] [ 8] 0   svmultiphysics                      0x000000010e92dff2 _ZN17BoundaryConditionC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKNS0_6vectorIS6_NS4_IS6_EEEERKNS0_3mapIS6_bNS0_4lessIS6_EENS4_INS0_4pairIS7_bEEEEEERK8faceTypeR16SimulationLogger + 1042
[Aarons-MacBook-Pro-2:88409] [ 9] 0   svmultiphysics                      0x000000010e85102c _ZN22RobinBoundaryConditionC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEbRK8faceTypeR16SimulationLogger + 252
[Aarons-MacBook-Pro-2:88409] [10] 0   svmultiphysics                      0x000000010e8351be _ZN13read_files_ns7read_bcEP10SimulationP18EquationParametersR6eqTypeP27BoundaryConditionParametersR6bcType + 6942
[Aarons-MacBook-Pro-2:88409] [11] 0   svmultiphysics                      0x000000010e84886d _ZN13read_files_ns7read_eqEP10SimulationP18EquationParametersR6eqType + 2429
[Aarons-MacBook-Pro-2:88409] [12] 0   svmultiphysics                      0x000000010e84b567 _ZN13read_files_ns10read_filesEP10SimulationRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE + 1703
[Aarons-MacBook-Pro-2:88409] [13] 0   svmultiphysics                      0x000000010e7a952f main + 1151
[Aarons-MacBook-Pro-2:88409] [14] 0   dyld                                0x00007ff805176530 start + 3056
[Aarons-MacBook-Pro-2:88409] *** End of error message ***
--------------------------------------------------------------------------
prterun noticed that process rank 0 with PID 88409 on node Aarons-MacBook-Pro-2 exited on
signal 6 (Abort trap: 6).
--------------------------------------------------------------------------

The error doesn't reveal that the issue is the Stiffness data is stored in float32. To figure this out, a user would have to go into source code.

Expected behavior

This function should throw an error saying that it could not cast the data to a double array. Even better, this function should handle multiple data types.

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct and Contributing Guidelines

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions