{"action":"closed","issue":{"url":"https://api.github.com/repos/KratosMultiphysics/Kratos/issues/128","repository_url":"https://api.github.com/repos/KratosMultiphysics/Kratos","labels_url":"https://api.github.com/repos/KratosMultiphysics/Kratos/issues/128/labels{/name}","comments_url":"https://api.github.com/repos/KratosMultiphysics/Kratos/issues/128/comments","events_url":"https://api.github.com/repos/KratosMultiphysics/Kratos/issues/128/events","html_url":"https://github.com/KratosMultiphysics/Kratos/issues/128","id":212805515,"number":128,"title":"model_part.GetElement(Id) silently creates new elements","user":{"login":"msandre","id":22290001,"avatar_url":"https://avatars3.githubusercontent.com/u/22290001?v=3","gravatar_id":"","url":"https://api.github.com/users/msandre","html_url":"https://github.com/msandre","followers_url":"https://api.github.com/users/msandre/followers","following_url":"https://api.github.com/users/msandre/following{/other_user}","gists_url":"https://api.github.com/users/msandre/gists{/gist_id}","starred_url":"https://api.github.com/users/msandre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/msandre/subscriptions","organizations_url":"https://api.github.com/users/msandre/orgs","repos_url":"https://api.github.com/users/msandre/repos","events_url":"https://api.github.com/users/msandre/events{/privacy}","received_events_url":"https://api.github.com/users/msandre/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"pooyan-dadvand","id":8911479,"avatar_url":"https://avatars0.githubusercontent.com/u/8911479?v=3","gravatar_id":"","url":"https://api.github.com/users/pooyan-dadvand","html_url":"https://github.com/pooyan-dadvand","followers_url":"https://api.github.com/users/pooyan-dadvand/followers","following_url":"https://api.github.com/users/pooyan-dadvand/following{/other_user}","gists_url":"https://api.github.com/users/pooyan-dadvand/gists{/gist_id}","starred_url":"https://api.github.com/users/pooyan-dadvand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pooyan-dadvand/subscriptions","organizations_url":"https://api.github.com/users/pooyan-dadvand/orgs","repos_url":"https://api.github.com/users/pooyan-dadvand/repos","events_url":"https://api.github.com/users/pooyan-dadvand/events{/privacy}","received_events_url":"https://api.github.com/users/pooyan-dadvand/received_events","type":"User","site_admin":false},"assignees":[{"login":"pooyan-dadvand","id":8911479,"avatar_url":"https://avatars0.githubusercontent.com/u/8911479?v=3","gravatar_id":"","url":"https://api.github.com/users/pooyan-dadvand","html_url":"https://github.com/pooyan-dadvand","followers_url":"https://api.github.com/users/pooyan-dadvand/followers","following_url":"https://api.github.com/users/pooyan-dadvand/following{/other_user}","gists_url":"https://api.github.com/users/pooyan-dadvand/gists{/gist_id}","starred_url":"https://api.github.com/users/pooyan-dadvand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pooyan-dadvand/subscriptions","organizations_url":"https://api.github.com/users/pooyan-dadvand/orgs","repos_url":"https://api.github.com/users/pooyan-dadvand/repos","events_url":"https://api.github.com/users/pooyan-dadvand/events{/privacy}","received_events_url":"https://api.github.com/users/pooyan-dadvand/received_events","type":"User","site_admin":false}],"milestone":null,"comments":4,"created_at":"2017-03-08T17:42:23Z","updated_at":"2017-03-14T18:33:32Z","closed_at":"2017-03-14T18:33:31Z","body":"If I call `model_part.GetElement(Id)` with non-existing Id, it inserts a new element in the model part and returns it without throwing an error. This is most certainly not what the programmer intended since for creating elements one should use `model_part.CreateNewElement(\"SomeElement\",` NewId, ...)`.\r\n\r\nI would suggest changing \r\n\r\nElementType& Mesh::GetElement(IndexType ElementId)\r\n {\r\n        return (*mpElements)[ElementId];\r\n }\r\n\r\nto something like\r\n\r\nElementType& Mesh::GetElement(IndexType ElementId)\r\n {\r\n        auto i = mpElements->find(ElementId);\r\n        assert(i != mpElements->end());\r\n        return *i;\r\n }\r\n\r\nwith similar changes to pGetElement, pGetNode, GetNode, pGetCondition, GetCondition.\r\n\r\n@pooyan is this possible?\r\n"}}
{"actor":{"display_login":"msandre"}}