{"action":"created","issue":{"url":"https://api.github.com/repos/craffael/lehrfempp/issues/46","repository_url":"https://api.github.com/repos/craffael/lehrfempp","labels_url":"https://api.github.com/repos/craffael/lehrfempp/issues/46/labels{/name}","comments_url":"https://api.github.com/repos/craffael/lehrfempp/issues/46/comments","events_url":"https://api.github.com/repos/craffael/lehrfempp/issues/46/events","html_url":"https://github.com/craffael/lehrfempp/issues/46","id":358130968,"node_id":"MDU6SXNzdWUzNTgxMzA5Njg=","number":46,"title":"CodimMeshDataSet: why accessible only through shared_ptr","user":{"login":"hiptmair","id":33900563,"node_id":"MDQ6VXNlcjMzOTAwNTYz","avatar_url":"https://avatars1.githubusercontent.com/u/33900563?v=4","gravatar_id":"","url":"https://api.github.com/users/hiptmair","html_url":"https://github.com/hiptmair","followers_url":"https://api.github.com/users/hiptmair/followers","following_url":"https://api.github.com/users/hiptmair/following{/other_user}","gists_url":"https://api.github.com/users/hiptmair/gists{/gist_id}","starred_url":"https://api.github.com/users/hiptmair/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hiptmair/subscriptions","organizations_url":"https://api.github.com/users/hiptmair/orgs","repos_url":"https://api.github.com/users/hiptmair/repos","events_url":"https://api.github.com/users/hiptmair/events{/privacy}","received_events_url":"https://api.github.com/users/hiptmair/received_events","type":"User","site_admin":false},"labels":[{"id":948976635,"node_id":"MDU6TGFiZWw5NDg5NzY2MzU=","url":"https://api.github.com/repos/craffael/lehrfempp/labels/design","name":"design","color":"93ed9a","default":false}],"state":"open","locked":false,"assignee":{"login":"craffael","id":15138672,"node_id":"MDQ6VXNlcjE1MTM4Njcy","avatar_url":"https://avatars1.githubusercontent.com/u/15138672?v=4","gravatar_id":"","url":"https://api.github.com/users/craffael","html_url":"https://github.com/craffael","followers_url":"https://api.github.com/users/craffael/followers","following_url":"https://api.github.com/users/craffael/following{/other_user}","gists_url":"https://api.github.com/users/craffael/gists{/gist_id}","starred_url":"https://api.github.com/users/craffael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craffael/subscriptions","organizations_url":"https://api.github.com/users/craffael/orgs","repos_url":"https://api.github.com/users/craffael/repos","events_url":"https://api.github.com/users/craffael/events{/privacy}","received_events_url":"https://api.github.com/users/craffael/received_events","type":"User","site_admin":false},"assignees":[{"login":"craffael","id":15138672,"node_id":"MDQ6VXNlcjE1MTM4Njcy","avatar_url":"https://avatars1.githubusercontent.com/u/15138672?v=4","gravatar_id":"","url":"https://api.github.com/users/craffael","html_url":"https://github.com/craffael","followers_url":"https://api.github.com/users/craffael/followers","following_url":"https://api.github.com/users/craffael/following{/other_user}","gists_url":"https://api.github.com/users/craffael/gists{/gist_id}","starred_url":"https://api.github.com/users/craffael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craffael/subscriptions","organizations_url":"https://api.github.com/users/craffael/orgs","repos_url":"https://api.github.com/users/craffael/repos","events_url":"https://api.github.com/users/craffael/events{/privacy}","received_events_url":"https://api.github.com/users/craffael/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2018-09-07T16:20:14Z","updated_at":"2018-09-08T13:36:31Z","closed_at":null,"author_association":"COLLABORATOR","body":"An object of type `CodimMeshDataSet` can be created only through `make_CodimMeshDataSet`, which returns a shared pointer. What is the problem about \"stand alone\" objects of this type? "},"comment":{"url":"https://api.github.com/repos/craffael/lehrfempp/issues/comments/419642579","html_url":"https://github.com/craffael/lehrfempp/issues/46#issuecomment-419642579","issue_url":"https://api.github.com/repos/craffael/lehrfempp/issues/46","id":419642579,"node_id":"MDEyOklzc3VlQ29tbWVudDQxOTY0MjU3OQ==","user":{"login":"craffael","id":15138672,"node_id":"MDQ6VXNlcjE1MTM4Njcy","avatar_url":"https://avatars1.githubusercontent.com/u/15138672?v=4","gravatar_id":"","url":"https://api.github.com/users/craffael","html_url":"https://github.com/craffael","followers_url":"https://api.github.com/users/craffael/followers","following_url":"https://api.github.com/users/craffael/following{/other_user}","gists_url":"https://api.github.com/users/craffael/gists{/gist_id}","starred_url":"https://api.github.com/users/craffael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craffael/subscriptions","organizations_url":"https://api.github.com/users/craffael/orgs","repos_url":"https://api.github.com/users/craffael/repos","events_url":"https://api.github.com/users/craffael/events{/privacy}","received_events_url":"https://api.github.com/users/craffael/received_events","type":"User","site_admin":false},"created_at":"2018-09-08T13:36:31Z","updated_at":"2018-09-08T13:36:31Z","author_association":"OWNER","body":"I've made the decision to create MeshDataSets always as shared_ptr's to enable future functionality that is mainly related to composability and lazy evaluation. Some of the use cases I have thought of:\r\n```\r\n// cast a mesh data set into another type\r\nauto mds_int = make_CodimMeshDataSet<int>(mesh,0);\r\nauto mds_double = mds_int.cast<double>();\r\n\r\n// compose two mesh dataset, e.g. with an operator+:\r\nauto mds2 = make_codimMeshDataSet<int>(mesh,1);\r\nauto sum = mds_int + mds2;\r\n\r\n// take the sqrt of a mesh dataset\r\nauto sqrt = sqrt(mds_double);\r\n```\r\n\r\nSo far all of this functionality has not been implemented yet, but if we want to implement it at some point, being able to assure that mesh dataset are always stored in shared_ptr's simplifies the implementation enormously because it solves the problem of garbage collection.\r\nIn the example above `mds_double` needs a pointer to `mds_int` (lazy evaluation) and it must be assured that `mds_int` exists as long as `mds_double` exists. So it's natural for `mds_double` to store a shared_ptr to `mds_int`. Similar arguments apply for the other cases.\r\nFinally I want to point out, that it if an object itself knows that it is stored in a shared_ptr, then it can retrieve a reference to that shared_ptr via `std::enable_shared_from_this`."}}
{"actor":{"display_login":"craffael"}}