this is a really complicated data structure  re think your test design here  from your comment this seems like it should be as follows a pid should have a mapping to it is averages across timesteps  so this could be type foo set pid  vector double then all you need to have is a set foo s