Skip to content

map_and_read_data does not flatten coordinate array before passing it to C++ #236

@r-walloner

Description

@r-walloner

If I follow the example given in help(precice.Participant.map_and_read_data), map_and_read_data throws the following error.

Traceback (most recent call last):
  File "/home/robin/uni/ba-repo/investigate_relativeReadTime/B/B.py", line 24, in <module>
    data = participant.map_and_read_data("A-Mesh", "A-Data", coordinates, 0)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "cyprecice/cyprecice.pyx", line 1000, in cyprecice.Participant.map_and_read_data
  File "<stringsource>", line 48, in vector.from_py.__pyx_convert_vector_from_py_double
TypeError: only length-1 arrays can be converted to Python scalars

The problematic line seems to be this one.
It seems to assume the coordinates are already flattened: [x_0, y_0, x_1, y_1, ...], but they are not: [(x_0, y_0), (x_1, y_1), ...].

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions