{"action":"created","issue":{"url":"https://api.github.com/repos/KratosMultiphysics/Kratos/issues/1100","repository_url":"https://api.github.com/repos/KratosMultiphysics/Kratos","labels_url":"https://api.github.com/repos/KratosMultiphysics/Kratos/issues/1100/labels{/name}","comments_url":"https://api.github.com/repos/KratosMultiphysics/Kratos/issues/1100/comments","events_url":"https://api.github.com/repos/KratosMultiphysics/Kratos/issues/1100/events","html_url":"https://github.com/KratosMultiphysics/Kratos/issues/1100","id":277829839,"number":1100,"title":"Cross product calculation","user":{"login":"GuillermoCasas","id":18554357,"avatar_url":"https://avatars1.githubusercontent.com/u/18554357?v=4","gravatar_id":"","url":"https://api.github.com/users/GuillermoCasas","html_url":"https://github.com/GuillermoCasas","followers_url":"https://api.github.com/users/GuillermoCasas/followers","following_url":"https://api.github.com/users/GuillermoCasas/following{/other_user}","gists_url":"https://api.github.com/users/GuillermoCasas/gists{/gist_id}","starred_url":"https://api.github.com/users/GuillermoCasas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GuillermoCasas/subscriptions","organizations_url":"https://api.github.com/users/GuillermoCasas/orgs","repos_url":"https://api.github.com/users/GuillermoCasas/repos","events_url":"https://api.github.com/users/GuillermoCasas/events{/privacy}","received_events_url":"https://api.github.com/users/GuillermoCasas/received_events","type":"User","site_admin":false},"labels":[{"id":538395919,"url":"https://api.github.com/repos/KratosMultiphysics/Kratos/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"open","locked":false,"assignee":{"login":"RiccardoRossi","id":8059665,"avatar_url":"https://avatars1.githubusercontent.com/u/8059665?v=4","gravatar_id":"","url":"https://api.github.com/users/RiccardoRossi","html_url":"https://github.com/RiccardoRossi","followers_url":"https://api.github.com/users/RiccardoRossi/followers","following_url":"https://api.github.com/users/RiccardoRossi/following{/other_user}","gists_url":"https://api.github.com/users/RiccardoRossi/gists{/gist_id}","starred_url":"https://api.github.com/users/RiccardoRossi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RiccardoRossi/subscriptions","organizations_url":"https://api.github.com/users/RiccardoRossi/orgs","repos_url":"https://api.github.com/users/RiccardoRossi/repos","events_url":"https://api.github.com/users/RiccardoRossi/events{/privacy}","received_events_url":"https://api.github.com/users/RiccardoRossi/received_events","type":"User","site_admin":false},"assignees":[{"login":"RiccardoRossi","id":8059665,"avatar_url":"https://avatars1.githubusercontent.com/u/8059665?v=4","gravatar_id":"","url":"https://api.github.com/users/RiccardoRossi","html_url":"https://github.com/RiccardoRossi","followers_url":"https://api.github.com/users/RiccardoRossi/followers","following_url":"https://api.github.com/users/RiccardoRossi/following{/other_user}","gists_url":"https://api.github.com/users/RiccardoRossi/gists{/gist_id}","starred_url":"https://api.github.com/users/RiccardoRossi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RiccardoRossi/subscriptions","organizations_url":"https://api.github.com/users/RiccardoRossi/orgs","repos_url":"https://api.github.com/users/RiccardoRossi/repos","events_url":"https://api.github.com/users/RiccardoRossi/events{/privacy}","received_events_url":"https://api.github.com/users/RiccardoRossi/received_events","type":"User","site_admin":false},{"login":"maceligueta","id":8899917,"avatar_url":"https://avatars0.githubusercontent.com/u/8899917?v=4","gravatar_id":"","url":"https://api.github.com/users/maceligueta","html_url":"https://github.com/maceligueta","followers_url":"https://api.github.com/users/maceligueta/followers","following_url":"https://api.github.com/users/maceligueta/following{/other_user}","gists_url":"https://api.github.com/users/maceligueta/gists{/gist_id}","starred_url":"https://api.github.com/users/maceligueta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maceligueta/subscriptions","organizations_url":"https://api.github.com/users/maceligueta/orgs","repos_url":"https://api.github.com/users/maceligueta/repos","events_url":"https://api.github.com/users/maceligueta/events{/privacy}","received_events_url":"https://api.github.com/users/maceligueta/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2017-11-29T16:55:49Z","updated_at":"2017-11-29T17:19:54Z","closed_at":null,"author_association":"MEMBER","body":"If I am not mistaken, the implementation of the CrossProduct from math_utils.h fails if the same vector is fed to the function as the output and as one of the factors, bacause its components are modified during the calculation. I tried it in the following simplified implementation, which shows the erroneous behaviour:\r\n\r\n`#include <iostream>\r\nusing namespace std;\r\n\r\nstatic inline void CrossProduct(\r\n    double c[2], \r\n    const double a[2], \r\n    const double b[2]\r\n    )\r\n{\r\n    c[0] = a[1]*b[2] - a[2]*b[1];\r\n    c[1] = a[2]*b[0] - a[0]*b[2];\r\n    c[2] = a[0]*b[1] - a[1]*b[0];\r\n}\r\n\r\nint main()\r\n{   \r\n    double a[3] = {1,0,0};\r\n    double b[3] = {0,1.0};\r\n    double c[3] = {3,3,3};\r\n    CrossProduct(b, a, b);\r\n    cout << b[0] << b[1] << b[2];\r\n\r\n    return 0;\r\n}`\r\n\r\nAnd the result is 000 instead of 001."},"comment":{"url":"https://api.github.com/repos/KratosMultiphysics/Kratos/issues/comments/347932066","html_url":"https://github.com/KratosMultiphysics/Kratos/issues/1100#issuecomment-347932066","issue_url":"https://api.github.com/repos/KratosMultiphysics/Kratos/issues/1100","id":347932066,"user":{"login":"maceligueta","id":8899917,"avatar_url":"https://avatars0.githubusercontent.com/u/8899917?v=4","gravatar_id":"","url":"https://api.github.com/users/maceligueta","html_url":"https://github.com/maceligueta","followers_url":"https://api.github.com/users/maceligueta/followers","following_url":"https://api.github.com/users/maceligueta/following{/other_user}","gists_url":"https://api.github.com/users/maceligueta/gists{/gist_id}","starred_url":"https://api.github.com/users/maceligueta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maceligueta/subscriptions","organizations_url":"https://api.github.com/users/maceligueta/orgs","repos_url":"https://api.github.com/users/maceligueta/repos","events_url":"https://api.github.com/users/maceligueta/events{/privacy}","received_events_url":"https://api.github.com/users/maceligueta/received_events","type":"User","site_admin":false},"created_at":"2017-11-29T17:19:54Z","updated_at":"2017-11-29T17:19:54Z","author_association":"OWNER","body":"Using a copy makes it slower, though."}}
{"actor":{"display_login":"maceligueta"}}