GitHub PullRequestReviewCommentEvent at 2014-10-30 18:30:37
Repository: dealii
Actor: tjhei
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/dealii/dealii/pulls/comments/19626101","id":19626101,"diff_hunk":"@@ -95,6 +95,324 @@ namespace GridTools\n   }\n \n \n+#ifdef DEAL_II_WITH_P4EST\n+  // This anonymous namespace contains utility for\n+  // the function GridTools::communicate_locally_moved_vertices\n+  namespace\n+  {\n+    /**\n+      * A list of tree+quadrant and their vertex indices.\n+      * The bool vector describes which vertices are of interest\n+      * and should be set on the receiving processes.\n+      */\n+    template <int dim, int spacedim>\n+    struct CellInfo\n+    {\n+      // store all the tree_indices we send/receive consecutively (n_cells entries)\n+      std::vector<unsigned int> tree_index;\n+      // store all the quadrants we send/receive consecutively (n_cells entries)\n+      std::vector<typename dealii::internal::p4est::types<dim>::quadrant> quadrants;\n+      // store for each cell the number of vertices we send/receive\n+      // and then the vertex indices (for each cell: n_vertices+1 entries)\n+      std::vector<unsigned int> vertex_indices;\n+      // store for each cell the vertices we send/receive\n+      // (for each cell n_vertices entries)\n+      std::vector<dealii::Point<spacedim> > vertices;\n+      // for receiving and unpacking data we need to store pointers to the\n+      // first vertex and vertex_index on each cell additionally\n+      // both vectors have as many entries as there are cells\n+      std::vector<unsigned int * > first_vertex_indices;\n+      std::vector<dealii::Point<spacedim>* > first_vertices;\n+\n+      unsigned int bytes_for_buffer () const\n+      {\n+        return (sizeof(unsigned int) +\n+                tree_index.size() * sizeof(unsigned int) +\n+                quadrants.size() * sizeof(typename dealii::internal::p4est\n+                                          ::types<dim>::quadrant) +\n+                vertices.size() * sizeof(dealii::Point<spacedim>)) +\n+               vertex_indices.size() * sizeof(unsigned int);\n+      }\n+\n+      void pack_data (std::vector<char> &buffer) const\n+      {\n+        buffer.resize(bytes_for_buffer());\n+\n+        char *ptr = &buffer[0];\n+\n+        const unsigned int num_cells = tree_index.size();\n+        std::memcpy(ptr, &num_cells, sizeof(unsigned int));\n+        ptr += sizeof(unsigned int);\n+\n+        std::memcpy(ptr,\n+                    &tree_index[0],\n+                    num_cells*sizeof(unsigned int));\n+        ptr += num_cells*sizeof(unsigned int);\n+\n+        std::memcpy(ptr,\n+                    &quadrants[0],\n+                    num_cells * sizeof(typename dealii::internal::p4est::\n+                                       types<dim>::quadrant));\n+        ptr += num_cells*sizeof(typename dealii::internal::p4est::types<dim>::\n+                                quadrant);\n+\n+        std::memcpy(ptr,\n+                    &vertex_indices[0],\n+                    vertex_indices.size() * sizeof(unsigned int));\n+        ptr += vertex_indices.size() * sizeof(unsigned int);\n+\n+        std::memcpy(ptr,\n+                    &vertices[0],\n+                    vertices.size() * sizeof(dealii::Point<spacedim>));\n+        ptr += vertices.size() * sizeof(dealii::Point<spacedim>);\n+\n+        Assert (ptr == &buffer[0]+buffer.size(),\n+                ExcInternalError());\n+\n+      }\n+\n+      void unpack_data (const std::vector<char> &buffer)\n+      {\n+        const char *ptr = &buffer[0];\n+        unsigned int cells;\n+        memcpy(&cells, ptr, sizeof(unsigned int));\n+        ptr += sizeof(unsigned int);\n+\n+        tree_index.resize(cells);\n+        for (unsigned int c=0; c<cells; ++c)\n+          {\n+            const unsigned int *const treeindex\n+              = reinterpret_cast<const unsigned int *const>(ptr);\n+            tree_index[c] = *treeindex;\n+            ptr += sizeof(unsigned int);\n+          }\n+\n+        quadrants.resize(cells);\n+        for (unsigned int c=0; c<cells; ++c)\n+          {\n+            const typename dealii::internal::p4est::types<dim>::quadrant *const quadrant\n+              = reinterpret_cast<const typename dealii::internal::p4est::types<dim>::quadrant *const>(ptr);\n+            quadrants[c] = *quadrant;\n+            ptr += sizeof(typename dealii::internal::p4est::types<dim>::quadrant);\n+          }\n+\n+        vertex_indices.clear();\n+        first_vertex_indices.resize(cells);\n+        std::vector<unsigned int> n_vertices_on_cell(cells);\n+        std::vector<unsigned int> first_indices (cells);\n+        for (unsigned int c=0; c<cells; ++c)\n+          {\n+            // The first 'vertex index' is the number of vertices.\n+            // Additionally, we need to store the pointer to this\n+            // vertex index with respect to the std::vector\n+            const unsigned int *const vertex_index\n+              = reinterpret_cast<const unsigned int *const>(ptr);\n+            first_indices[c] = vertex_indices.size();\n+            vertex_indices.push_back(*vertex_index);\n+            n_vertices_on_cell[c] = *vertex_index;\n+            ptr += sizeof(unsigned int);\n+            for (unsigned int v=0; v<n_vertices_on_cell[c]; ++v)\n+              {\n+                const unsigned int *const vertex_index\n+                  = reinterpret_cast<const unsigned int *const>(ptr);\n+                vertex_indices.push_back(*vertex_index);\n+                ptr += sizeof(unsigned int);\n+              }\n+          }\n+        for (unsigned int c=0; c<cells; ++c)\n+          first_vertex_indices[c] = &vertex_indices[first_indices[c]];\n+\n+        vertices.clear();\n+        first_vertices.resize(cells);\n+        for (unsigned int c=0; c<cells; ++c)\n+          {\n+            // We need to store a pointer to the first vertex.\n+            const dealii::Point<spacedim> *const vertex\n+              = reinterpret_cast<const dealii::Point<spacedim> * const>(ptr);\n+            first_indices[c] = vertices.size();\n+            vertices.push_back(*vertex);\n+            ptr += sizeof(dealii::Point<spacedim>);\n+            for (unsigned int v=1; v<n_vertices_on_cell[c]; ++v)\n+              {\n+                const dealii::Point<spacedim> *const vertex\n+                  = reinterpret_cast<const dealii::Point<spacedim> * const>(ptr);\n+                vertices.push_back(*vertex);\n+                ptr += sizeof(dealii::Point<spacedim>);\n+              }","path":"source/grid/grid_tools.cc","position":147,"original_position":147,"commit_id":"034262d125b1b1ccbae2971368a77de71bc79cf2","original_commit_id":"034262d125b1b1ccbae2971368a77de71bc79cf2","user":{"login":"tjhei","id":1531285,"avatar_url":"https://avatars.githubusercontent.com/u/1531285?v=2","gravatar_id":"","url":"https://api.github.com/users/tjhei","html_url":"https://github.com/tjhei","followers_url":"https://api.github.com/users/tjhei/followers","following_url":"https://api.github.com/users/tjhei/following{/other_user}","gists_url":"https://api.github.com/users/tjhei/gists{/gist_id}","starred_url":"https://api.github.com/users/tjhei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tjhei/subscriptions","organizations_url":"https://api.github.com/users/tjhei/orgs","repos_url":"https://api.github.com/users/tjhei/repos","events_url":"https://api.github.com/users/tjhei/events{/privacy}","received_events_url":"https://api.github.com/users/tjhei/received_events","type":"User","site_admin":false},"body":"same here","created_at":"2014-10-30T18:30:37Z","updated_at":"2014-10-30T18:30:37Z","html_url":"https://github.com/dealii/dealii/pull/186#discussion_r19626101","pull_request_url":"https://api.github.com/repos/dealii/dealii/pulls/186","_links":{"self":{"href":"https://api.github.com/repos/dealii/dealii/pulls/comments/19626101"},"html":{"href":"https://github.com/dealii/dealii/pull/186#discussion_r19626101"},"pull_request":{"href":"https://api.github.com/repos/dealii/dealii/pulls/186"}}},"pull_request":{"url":"https://api.github.com/repos/dealii/dealii/pulls/186","id":22133887,"html_url":"https://github.com/dealii/dealii/pull/186","diff_url":"https://github.com/dealii/dealii/pull/186.diff","patch_url":"https://github.com/dealii/dealii/pull/186.patch","issue_url":"https://api.github.com/repos/dealii/dealii/issues/186","number":186,"state":"open","locked":false,"title":"Fix distort_random for distributed meshes","user":{"login":"masterleinad","id":2423533,"avatar_url":"https://avatars.githubusercontent.com/u/2423533?v=2","gravatar_id":"","url":"https://api.github.com/users/masterleinad","html_url":"https://github.com/masterleinad","followers_url":"https://api.github.com/users/masterleinad/followers","following_url":"https://api.github.com/users/masterleinad/following{/other_user}","gists_url":"https://api.github.com/users/masterleinad/gists{/gist_id}","starred_url":"https://api.github.com/users/masterleinad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/masterleinad/subscriptions","organizations_url":"https://api.github.com/users/masterleinad/orgs","repos_url":"https://api.github.com/users/masterleinad/repos","events_url":"https://api.github.com/users/masterleinad/events{/privacy}","received_events_url":"https://api.github.com/users/masterleinad/received_events","type":"User","site_admin":false},"body":"Previously, distort_random produced unconnected meshes for distributed meshes. Now we don't move vertices that belong to two or more different processes. The resulting mesh is connected.","created_at":"2014-10-02T11:23:38Z","updated_at":"2014-10-30T18:30:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d67da34c811a00e890e0180176ce6dfad63e59f3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dealii/dealii/pulls/186/commits","review_comments_url":"https://api.github.com/repos/dealii/dealii/pulls/186/comments","review_comment_url":"https://api.github.com/repos/dealii/dealii/pulls/comments/{number}","comments_url":"https://api.github.com/repos/dealii/dealii/issues/186/comments","statuses_url":"https://api.github.com/repos/dealii/dealii/statuses/034262d125b1b1ccbae2971368a77de71bc79cf2","head":{"label":"masterleinad:fix_distort_random","ref":"fix_distort_random","sha":"034262d125b1b1ccbae2971368a77de71bc79cf2","user":{"login":"masterleinad","id":2423533,"avatar_url":"https://avatars.githubusercontent.com/u/2423533?v=2","gravatar_id":"","url":"https://api.github.com/users/masterleinad","html_url":"https://github.com/masterleinad","followers_url":"https://api.github.com/users/masterleinad/followers","following_url":"https://api.github.com/users/masterleinad/following{/other_user}","gists_url":"https://api.github.com/users/masterleinad/gists{/gist_id}","starred_url":"https://api.github.com/users/masterleinad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/masterleinad/subscriptions","organizations_url":"https://api.github.com/users/masterleinad/orgs","repos_url":"https://api.github.com/users/masterleinad/repos","events_url":"https://api.github.com/users/masterleinad/events{/privacy}","received_events_url":"https://api.github.com/users/masterleinad/received_events","type":"User","site_admin":false},"repo":{"id":22077233,"name":"dealii","full_name":"masterleinad/dealii","owner":{"login":"masterleinad","id":2423533,"avatar_url":"https://avatars.githubusercontent.com/u/2423533?v=2","gravatar_id":"","url":"https://api.github.com/users/masterleinad","html_url":"https://github.com/masterleinad","followers_url":"https://api.github.com/users/masterleinad/followers","following_url":"https://api.github.com/users/masterleinad/following{/other_user}","gists_url":"https://api.github.com/users/masterleinad/gists{/gist_id}","starred_url":"https://api.github.com/users/masterleinad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/masterleinad/subscriptions","organizations_url":"https://api.github.com/users/masterleinad/orgs","repos_url":"https://api.github.com/users/masterleinad/repos","events_url":"https://api.github.com/users/masterleinad/events{/privacy}","received_events_url":"https://api.github.com/users/masterleinad/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/masterleinad/dealii","description":"","fork":true,"url":"https://api.github.com/repos/masterleinad/dealii","forks_url":"https://api.github.com/repos/masterleinad/dealii/forks","keys_url":"https://api.github.com/repos/masterleinad/dealii/keys{/key_id}","collaborators_url":"https://api.github.com/repos/masterleinad/dealii/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/masterleinad/dealii/teams","hooks_url":"https://api.github.com/repos/masterleinad/dealii/hooks","issue_events_url":"https://api.github.com/repos/masterleinad/dealii/issues/events{/number}","events_url":"https://api.github.com/repos/masterleinad/dealii/events","assignees_url":"https://api.github.com/repos/masterleinad/dealii/assignees{/user}","branches_url":"https://api.github.com/repos/masterleinad/dealii/branches{/branch}","tags_url":"https://api.github.com/repos/masterleinad/dealii/tags","blobs_url":"https://api.github.com/repos/masterleinad/dealii/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/masterleinad/dealii/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/masterleinad/dealii/git/refs{/sha}","trees_url":"https://api.github.com/repos/masterleinad/dealii/git/trees{/sha}","statuses_url":"https://api.github.com/repos/masterleinad/dealii/statuses/{sha}","languages_url":"https://api.github.com/repos/masterleinad/dealii/languages","stargazers_url":"https://api.github.com/repos/masterleinad/dealii/stargazers","contributors_url":"https://api.github.com/repos/masterleinad/dealii/contributors","subscribers_url":"https://api.github.com/repos/masterleinad/dealii/subscribers","subscription_url":"https://api.github.com/repos/masterleinad/dealii/subscription","commits_url":"https://api.github.com/repos/masterleinad/dealii/commits{/sha}","git_commits_url":"https://api.github.com/repos/masterleinad/dealii/git/commits{/sha}","comments_url":"https://api.github.com/repos/masterleinad/dealii/comments{/number}","issue_comment_url":"https://api.github.com/repos/masterleinad/dealii/issues/comments/{number}","contents_url":"https://api.github.com/repos/masterleinad/dealii/contents/{+path}","compare_url":"https://api.github.com/repos/masterleinad/dealii/compare/{base}...{head}","merges_url":"https://api.github.com/repos/masterleinad/dealii/merges","archive_url":"https://api.github.com/repos/masterleinad/dealii/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/masterleinad/dealii/downloads","issues_url":"https://api.github.com/repos/masterleinad/dealii/issues{/number}","pulls_url":"https://api.github.com/repos/masterleinad/dealii/pulls{/number}","milestones_url":"https://api.github.com/repos/masterleinad/dealii/milestones{/number}","notifications_url":"https://api.github.com/repos/masterleinad/dealii/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/masterleinad/dealii/labels{/name}","releases_url":"https://api.github.com/repos/masterleinad/dealii/releases{/id}","created_at":"2014-07-21T19:26:56Z","updated_at":"2014-08-07T08:56:45Z","pushed_at":"2014-10-29T10:43:16Z","git_url":"git://github.com/masterleinad/dealii.git","ssh_url":"git@github.com:masterleinad/dealii.git","clone_url":"https://github.com/masterleinad/dealii.git","svn_url":"https://github.com/masterleinad/dealii","homepage":null,"size":100118,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dealii:master","ref":"master","sha":"0183d66a7083fc70baeda539f4c82be75eabdade","user":{"login":"dealii","id":7506070,"avatar_url":"https://avatars.githubusercontent.com/u/7506070?v=2","gravatar_id":"","url":"https://api.github.com/users/dealii","html_url":"https://github.com/dealii","followers_url":"https://api.github.com/users/dealii/followers","following_url":"https://api.github.com/users/dealii/following{/other_user}","gists_url":"https://api.github.com/users/dealii/gists{/gist_id}","starred_url":"https://api.github.com/users/dealii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dealii/subscriptions","organizations_url":"https://api.github.com/users/dealii/orgs","repos_url":"https://api.github.com/users/dealii/repos","events_url":"https://api.github.com/users/dealii/events{/privacy}","received_events_url":"https://api.github.com/users/dealii/received_events","type":"Organization","site_admin":false},"repo":{"id":21943980,"name":"dealii","full_name":"dealii/dealii","owner":{"login":"dealii","id":7506070,"avatar_url":"https://avatars.githubusercontent.com/u/7506070?v=2","gravatar_id":"","url":"https://api.github.com/users/dealii","html_url":"https://github.com/dealii","followers_url":"https://api.github.com/users/dealii/followers","following_url":"https://api.github.com/users/dealii/following{/other_user}","gists_url":"https://api.github.com/users/dealii/gists{/gist_id}","starred_url":"https://api.github.com/users/dealii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dealii/subscriptions","organizations_url":"https://api.github.com/users/dealii/orgs","repos_url":"https://api.github.com/users/dealii/repos","events_url":"https://api.github.com/users/dealii/events{/privacy}","received_events_url":"https://api.github.com/users/dealii/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dealii/dealii","description":"The development repository for the deal.II finite element library.","fork":false,"url":"https://api.github.com/repos/dealii/dealii","forks_url":"https://api.github.com/repos/dealii/dealii/forks","keys_url":"https://api.github.com/repos/dealii/dealii/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dealii/dealii/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dealii/dealii/teams","hooks_url":"https://api.github.com/repos/dealii/dealii/hooks","issue_events_url":"https://api.github.com/repos/dealii/dealii/issues/events{/number}","events_url":"https://api.github.com/repos/dealii/dealii/events","assignees_url":"https://api.github.com/repos/dealii/dealii/assignees{/user}","branches_url":"https://api.github.com/repos/dealii/dealii/branches{/branch}","tags_url":"https://api.github.com/repos/dealii/dealii/tags","blobs_url":"https://api.github.com/repos/dealii/dealii/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dealii/dealii/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dealii/dealii/git/refs{/sha}","trees_url":"https://api.github.com/repos/dealii/dealii/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dealii/dealii/statuses/{sha}","languages_url":"https://api.github.com/repos/dealii/dealii/languages","stargazers_url":"https://api.github.com/repos/dealii/dealii/stargazers","contributors_url":"https://api.github.com/repos/dealii/dealii/contributors","subscribers_url":"https://api.github.com/repos/dealii/dealii/subscribers","subscription_url":"https://api.github.com/repos/dealii/dealii/subscription","commits_url":"https://api.github.com/repos/dealii/dealii/commits{/sha}","git_commits_url":"https://api.github.com/repos/dealii/dealii/git/commits{/sha}","comments_url":"https://api.github.com/repos/dealii/dealii/comments{/number}","issue_comment_url":"https://api.github.com/repos/dealii/dealii/issues/comments/{number}","contents_url":"https://api.github.com/repos/dealii/dealii/contents/{+path}","compare_url":"https://api.github.com/repos/dealii/dealii/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dealii/dealii/merges","archive_url":"https://api.github.com/repos/dealii/dealii/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dealii/dealii/downloads","issues_url":"https://api.github.com/repos/dealii/dealii/issues{/number}","pulls_url":"https://api.github.com/repos/dealii/dealii/pulls{/number}","milestones_url":"https://api.github.com/repos/dealii/dealii/milestones{/number}","notifications_url":"https://api.github.com/repos/dealii/dealii/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dealii/dealii/labels{/name}","releases_url":"https://api.github.com/repos/dealii/dealii/releases{/id}","created_at":"2014-07-17T14:00:26Z","updated_at":"2014-10-29T16:09:45Z","pushed_at":"2014-10-30T18:08:00Z","git_url":"git://github.com/dealii/dealii.git","ssh_url":"git@github.com:dealii/dealii.git","clone_url":"https://github.com/dealii/dealii.git","svn_url":"https://github.com/dealii/dealii","homepage":"http://www.dealii.org/","size":133210,"stargazers_count":27,"watchers_count":27,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":36,"mirror_url":null,"open_issues_count":13,"forks":36,"open_issues":13,"watchers":27,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dealii/dealii/pulls/186"},"html":{"href":"https://github.com/dealii/dealii/pull/186"},"issue":{"href":"https://api.github.com/repos/dealii/dealii/issues/186"},"comments":{"href":"https://api.github.com/repos/dealii/dealii/issues/186/comments"},"review_comments":{"href":"https://api.github.com/repos/dealii/dealii/pulls/186/comments"},"review_comment":{"href":"https://api.github.com/repos/dealii/dealii/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/dealii/dealii/pulls/186/commits"},"statuses":{"href":"https://api.github.com/repos/dealii/dealii/statuses/034262d125b1b1ccbae2971368a77de71bc79cf2"}}}}