{"action":"created","issue":{"url":"https://api.github.com/repos/geodynamics/aspect/issues/528","labels_url":"https://api.github.com/repos/geodynamics/aspect/issues/528/labels{/name}","comments_url":"https://api.github.com/repos/geodynamics/aspect/issues/528/comments","events_url":"https://api.github.com/repos/geodynamics/aspect/issues/528/events","html_url":"https://github.com/geodynamics/aspect/issues/528","id":87875233,"number":528,"title":"Improve get_vector_double","user":{"login":"bangerth","id":7504421,"avatar_url":"https://avatars.githubusercontent.com/u/7504421?v=3","gravatar_id":"","url":"https://api.github.com/users/bangerth","html_url":"https://github.com/bangerth","followers_url":"https://api.github.com/users/bangerth/followers","following_url":"https://api.github.com/users/bangerth/following{/other_user}","gists_url":"https://api.github.com/users/bangerth/gists{/gist_id}","starred_url":"https://api.github.com/users/bangerth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bangerth/subscriptions","organizations_url":"https://api.github.com/users/bangerth/orgs","repos_url":"https://api.github.com/users/bangerth/repos","events_url":"https://api.github.com/users/bangerth/events{/privacy}","received_events_url":"https://api.github.com/users/bangerth/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-12T23:01:55Z","updated_at":"2015-06-13T02:33:51Z","closed_at":null,"body":"`multicomponent.cc` has a curious function `get_vector_double()` which has now also been copied to `diffusion_dislocation.cc` in #502. We should come up with a better name for the function and maybe move it to `utilities.h` or similar."},"comment":{"url":"https://api.github.com/repos/geodynamics/aspect/issues/comments/111657885","html_url":"https://github.com/geodynamics/aspect/issues/528#issuecomment-111657885","issue_url":"https://api.github.com/repos/geodynamics/aspect/issues/528","id":111657885,"user":{"login":"bangerth","id":7504421,"avatar_url":"https://avatars.githubusercontent.com/u/7504421?v=3","gravatar_id":"","url":"https://api.github.com/users/bangerth","html_url":"https://github.com/bangerth","followers_url":"https://api.github.com/users/bangerth/followers","following_url":"https://api.github.com/users/bangerth/following{/other_user}","gists_url":"https://api.github.com/users/bangerth/gists{/gist_id}","starred_url":"https://api.github.com/users/bangerth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bangerth/subscriptions","organizations_url":"https://api.github.com/users/bangerth/orgs","repos_url":"https://api.github.com/users/bangerth/repos","events_url":"https://api.github.com/users/bangerth/events{/privacy}","received_events_url":"https://api.github.com/users/bangerth/received_events","type":"User","site_admin":false},"created_at":"2015-06-13T02:33:51Z","updated_at":"2015-06-13T02:33:51Z","body":"Let's not worry about this for #502 itself, but deal with it as a follow-up.\r\n\r\nMy preference would be to have a function of the kind\r\n```\r\n  /**\r\n   * Given an array @p values, consider three cases:\r\n   * - If it has size @p N, return the original array.\r\n   * - If it has size one, return an array of size @p N where all\r\n   *   elements are equal to the one element of @p value.\r\n   * - If it has any other size, throw an exception that uses\r\n   *   @p id_text as an identifying string.\r\n   *\r\n   * This function is typically used for parameter lists that can either\r\n   * contain different values for each of a set of objects (e.g., for\r\n   * each compositional field), or contain a single value that is then\r\n   * used for each object.\r\n   */\r\n  template <typename T>\r\n  std::vector<T>\r\n  possibly_extend_from_1_to_N (const std::vector<T> &values,\r\n                                                     const unsigned int N,\r\n                                                     const std::string &id_text); \r\n```\r\nThe function would then be called as in\r\n```\r\n  densities\r\n   =possibly_extend_from_1_to_N(Utilities::string_to_double(Utilities::split_string(prm.get(\"Densities\"))),\r\n                                                      n_fields,\r\n                                                      \"Material model/Diffusion dislocation/Densities\");\r\n```\r\n"}}