Hello everyone,
I have question concerning the use of mesh functions in python. Usually, when assigning values to a mesh function in python, I do something like the following:
f = MeshFunction('bool', mesh, 2)
for T in cells(mesh):
f[T] = some_array[T.index()]
Unfortunately, at some Point this loop starts taking forever (when the number of unknowns is very high) and takes much longer than solving the linear Systems. (Maybe I am already doing something wrong to cause this?)
So I noticed that MeshFunction has a method set_values() which should hopefully (please correct me in case I am wrong) be a "vectorized" version of the above for-loop and therefore faster. So I want to do something like
f.set_values(some_array)
But how do I use this set_value() method? According to the docstring it takes a "std::vector" as Input but this is a C++ Data Type and I have no idea what this translates to in python. What do I need to pass to the method?
I would be grateful for any help on this matter and clarification on how to interpret the docstring and why the for-loop is so slow.
regards