GitHub PullRequestReviewCommentEvent at 2014-11-12 13:26:46
Repository: ogs
Actor: wenqing
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/ufz/ogs/pulls/comments/20218018","id":20218018,"diff_hunk":"@@ -0,0 +1,575 @@\n+/*!\n+  \\file NodePartitionedMeshReader.cpp\n+  \\author Wenqing Wang\n+  \\date   2014.08\n+  \\brief  Define members of class NodePartitionedMeshReader to read node-wise partitioned mesh with MPI functions.\n+\n+  \\copyright\n+  Copyright (c) 2014, OpenGeoSys Community (http://www.opengeosys.org)\n+             Distributed under a Modified BSD License.\n+               See accompanying file LICENSE.txt or\n+               http://www.opengeosys.org/project/license\n+\n+*/\n+\n+#include \"NodePartitionedMeshReader.h\"\n+\n+// ThirdParty/logog\n+#include \"logog/include/logog.hpp\"\n+\n+#include \"BaseLib/RunTime.h\"\n+#include \"BaseLib/FileTools.h\"\n+\n+#include \"MeshLib/NodePartitionedMesh.h\"\n+#include \"MeshLib/Node.h\"\n+\n+#include \"Elements/Element.h\"\n+#include \"Elements/Line.h\"\n+#include \"Elements/Hex.h\"\n+#include \"Elements/Prism.h\"\n+#include \"Elements/Pyramid.h\"\n+#include \"Elements/Quad.h\"\n+#include \"Elements/Tet.h\"\n+#include \"Elements/Tri.h\"\n+\n+using namespace MeshLib;\n+\n+namespace FileIO\n+{\n+MeshLib::NodePartitionedMesh* NodePartitionedMeshReader::read(MPI_Comm comm, const std::string &file_name_base)\n+{\n+    BaseLib::RunTime timer;\n+    timer.start();\n+\n+    MPI_Comm_size(comm, &_size);\n+    _size_str = std::to_string(_size);\n+    MPI_Comm_rank(comm, &_rank);\n+\n+    // Always try binary file first\n+    std::string fname_new = file_name_base + \"_partitioned_msh_cfg\" + _size_str + \".bin\";\n+\n+    NodePartitionedMesh *mesh = nullptr;\n+\n+    MPI_File fh;\n+    int file_status = MPI_File_open(comm, &fname_new[0],\n+                                    MPI_MODE_RDONLY, MPI_INFO_NULL, &fh);\n+    if(file_status)\n+    {\n+        INFO(\"-->Reading ASCII mesh file ...\");\n+\n+        mesh = readASCII(comm, file_name_base);\n+    }\n+    else\n+    {\n+        MPI_File_close(&fh);\n+        INFO(\"-->Reading binary mesh file ...\");\n+\n+        mesh = readBinary(comm, file_name_base);\n+    }\n+\n+    INFO(\"\\t\\n>>Total elapsed time in reading mesh:%f s\\n\", timer.elapsed());\n+\n+    MPI_Barrier(comm);\n+\n+    return mesh;\n+}\n+\n+MeshLib::NodePartitionedMesh* NodePartitionedMeshReader::readBinary(MPI_Comm comm, const std::string &file_name)\n+{\n+    //----------------------------------------------------------------------------------\n+    // Read headers\n+    MPI_File fh;\n+    char ftype[] = \"native\";\n+    int file_status = 0;\n+    const std::string fname_header = file_name +  \"_partitioned_msh_\";\n+    const std::string fname_num_p_ext = _size_str + \".bin\";\n+\n+    std::string fname_new_base = fname_header + \"cfg\" + fname_num_p_ext;\n+    file_status = MPI_File_open(comm, &fname_new_base[0], MPI_MODE_RDONLY,\n+                                MPI_INFO_NULL, &fh);\n+    if(file_status) // Failed to open the file\n+    {\n+        printMessage(fname_new_base);\n+        return nullptr;\n+    }\n+\n+    const long num_controls = 14;\n+    /*\n+    Array that contains integer numbers of the partition data header\n+    and its size is 14.\n+            0:    Number of all nodes of a partition,\n+            1:    Number of nodes for linear element of a parition,\n+            2:    Number of non-ghost elements of a partition,\n+            3:    Number of ghost element of a partition,\n+            4:    Number of active nodes for linear element of a parition,\n+            5:    Number of all active nodes a parition,\n+            6:    Number of nodes for linear element of global mesh,\n+            7:    Number of all nodes of global mesh,\n+            8~12: Offsets of positions of partitions in the data arrays,\n+            13:   Reserved for exra flag.\n+    */\n+    long mesh_controls[num_controls];\n+\n+    MPI_Offset offset_new;\n+    offset_new = _rank * num_controls * sizeof(long);\n+    MPI_File_set_view(fh, offset_new, MPI_LONG, MPI_LONG, ftype, MPI_INFO_NULL);\n+    MPI_File_read(fh, mesh_controls, num_controls, MPI_LONG, MPI_STATUS_IGNORE); //_all\n+    MPI_File_close(&fh);\n+    _num_nodes_part = mesh_controls[0];\n+    _num_regular_elems_part = mesh_controls[2];\n+    _num_ghost_elems_part = mesh_controls[3];\n+\n+    //----------------------------------------------------------------------------------\n+    // Read Nodes\n+    fname_new_base = fname_header + \"nod\" + fname_num_p_ext;\n+    file_status = MPI_File_open(comm, &fname_new_base[0], MPI_MODE_RDONLY,\n+                                MPI_INFO_NULL, &fh);\n+    if(file_status) // Failed to open the file\n+    {\n+        printMessage(fname_new_base);\n+        return nullptr;\n+    }\n+\n+    MPI_Datatype MPI_node;\n+    NodeData *s_nodes = (NodeData *)malloc(sizeof(NodeData) * _num_nodes_part);","path":"FileIO/MPI_IO/NodePartitionedMeshReader.cpp","position":null,"original_position":134,"commit_id":"570b72e5ca2d4a64ad960e282835e8330bbb9471","original_commit_id":"079d4a9d76d5da47ef7c93ae0fa8caf37aff1be4","user":{"login":"wenqing","id":1343839,"avatar_url":"https://avatars.githubusercontent.com/u/1343839?v=3","gravatar_id":"","url":"https://api.github.com/users/wenqing","html_url":"https://github.com/wenqing","followers_url":"https://api.github.com/users/wenqing/followers","following_url":"https://api.github.com/users/wenqing/following{/other_user}","gists_url":"https://api.github.com/users/wenqing/gists{/gist_id}","starred_url":"https://api.github.com/users/wenqing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wenqing/subscriptions","organizations_url":"https://api.github.com/users/wenqing/orgs","repos_url":"https://api.github.com/users/wenqing/repos","events_url":"https://api.github.com/users/wenqing/events{/privacy}","received_events_url":"https://api.github.com/users/wenqing/received_events","type":"User","site_admin":false},"body":"Changed.","created_at":"2014-11-12T13:26:46Z","updated_at":"2014-11-12T13:26:46Z","html_url":"https://github.com/ufz/ogs/pull/487#discussion_r20218018","pull_request_url":"https://api.github.com/repos/ufz/ogs/pulls/487","_links":{"self":{"href":"https://api.github.com/repos/ufz/ogs/pulls/comments/20218018"},"html":{"href":"https://github.com/ufz/ogs/pull/487#discussion_r20218018"},"pull_request":{"href":"https://api.github.com/repos/ufz/ogs/pulls/487"}}},"pull_request":{"url":"https://api.github.com/repos/ufz/ogs/pulls/487","id":21857480,"html_url":"https://github.com/ufz/ogs/pull/487","diff_url":"https://github.com/ufz/ogs/pull/487.diff","patch_url":"https://github.com/ufz/ogs/pull/487.patch","issue_url":"https://api.github.com/repos/ufz/ogs/issues/487","number":487,"state":"open","locked":false,"title":"Class for parallel reading of partitioned mesh data","user":{"login":"wenqing","id":1343839,"avatar_url":"https://avatars.githubusercontent.com/u/1343839?v=3","gravatar_id":"","url":"https://api.github.com/users/wenqing","html_url":"https://github.com/wenqing","followers_url":"https://api.github.com/users/wenqing/followers","following_url":"https://api.github.com/users/wenqing/following{/other_user}","gists_url":"https://api.github.com/users/wenqing/gists{/gist_id}","starred_url":"https://api.github.com/users/wenqing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wenqing/subscriptions","organizations_url":"https://api.github.com/users/wenqing/orgs","repos_url":"https://api.github.com/users/wenqing/repos","events_url":"https://api.github.com/users/wenqing/events{/privacy}","received_events_url":"https://api.github.com/users/wenqing/received_events","type":"User","site_admin":false},"body":"Along with commit 4cda158,  member function ``stop()`` of class CPUTime and RunTime were removed, and the calling of the function has been removed in the related files.  ","created_at":"2014-09-26T15:55:58Z","updated_at":"2014-11-12T13:26:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1cf75ff76b7bc4b4dc2b6fc7ecc80c066b264a01","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ufz/ogs/pulls/487/commits","review_comments_url":"https://api.github.com/repos/ufz/ogs/pulls/487/comments","review_comment_url":"https://api.github.com/repos/ufz/ogs/pulls/comments/{number}","comments_url":"https://api.github.com/repos/ufz/ogs/issues/487/comments","statuses_url":"https://api.github.com/repos/ufz/ogs/statuses/570b72e5ca2d4a64ad960e282835e8330bbb9471","head":{"label":"wenqing:read_pMesh","ref":"read_pMesh","sha":"570b72e5ca2d4a64ad960e282835e8330bbb9471","user":{"login":"wenqing","id":1343839,"avatar_url":"https://avatars.githubusercontent.com/u/1343839?v=3","gravatar_id":"","url":"https://api.github.com/users/wenqing","html_url":"https://github.com/wenqing","followers_url":"https://api.github.com/users/wenqing/followers","following_url":"https://api.github.com/users/wenqing/following{/other_user}","gists_url":"https://api.github.com/users/wenqing/gists{/gist_id}","starred_url":"https://api.github.com/users/wenqing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wenqing/subscriptions","organizations_url":"https://api.github.com/users/wenqing/orgs","repos_url":"https://api.github.com/users/wenqing/repos","events_url":"https://api.github.com/users/wenqing/events{/privacy}","received_events_url":"https://api.github.com/users/wenqing/received_events","type":"User","site_admin":false},"repo":{"id":12785911,"name":"ogs","full_name":"wenqing/ogs","owner":{"login":"wenqing","id":1343839,"avatar_url":"https://avatars.githubusercontent.com/u/1343839?v=3","gravatar_id":"","url":"https://api.github.com/users/wenqing","html_url":"https://github.com/wenqing","followers_url":"https://api.github.com/users/wenqing/followers","following_url":"https://api.github.com/users/wenqing/following{/other_user}","gists_url":"https://api.github.com/users/wenqing/gists{/gist_id}","starred_url":"https://api.github.com/users/wenqing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wenqing/subscriptions","organizations_url":"https://api.github.com/users/wenqing/orgs","repos_url":"https://api.github.com/users/wenqing/repos","events_url":"https://api.github.com/users/wenqing/events{/privacy}","received_events_url":"https://api.github.com/users/wenqing/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wenqing/ogs","description":"OGS source code","fork":true,"url":"https://api.github.com/repos/wenqing/ogs","forks_url":"https://api.github.com/repos/wenqing/ogs/forks","keys_url":"https://api.github.com/repos/wenqing/ogs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wenqing/ogs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wenqing/ogs/teams","hooks_url":"https://api.github.com/repos/wenqing/ogs/hooks","issue_events_url":"https://api.github.com/repos/wenqing/ogs/issues/events{/number}","events_url":"https://api.github.com/repos/wenqing/ogs/events","assignees_url":"https://api.github.com/repos/wenqing/ogs/assignees{/user}","branches_url":"https://api.github.com/repos/wenqing/ogs/branches{/branch}","tags_url":"https://api.github.com/repos/wenqing/ogs/tags","blobs_url":"https://api.github.com/repos/wenqing/ogs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wenqing/ogs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wenqing/ogs/git/refs{/sha}","trees_url":"https://api.github.com/repos/wenqing/ogs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wenqing/ogs/statuses/{sha}","languages_url":"https://api.github.com/repos/wenqing/ogs/languages","stargazers_url":"https://api.github.com/repos/wenqing/ogs/stargazers","contributors_url":"https://api.github.com/repos/wenqing/ogs/contributors","subscribers_url":"https://api.github.com/repos/wenqing/ogs/subscribers","subscription_url":"https://api.github.com/repos/wenqing/ogs/subscription","commits_url":"https://api.github.com/repos/wenqing/ogs/commits{/sha}","git_commits_url":"https://api.github.com/repos/wenqing/ogs/git/commits{/sha}","comments_url":"https://api.github.com/repos/wenqing/ogs/comments{/number}","issue_comment_url":"https://api.github.com/repos/wenqing/ogs/issues/comments/{number}","contents_url":"https://api.github.com/repos/wenqing/ogs/contents/{+path}","compare_url":"https://api.github.com/repos/wenqing/ogs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wenqing/ogs/merges","archive_url":"https://api.github.com/repos/wenqing/ogs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wenqing/ogs/downloads","issues_url":"https://api.github.com/repos/wenqing/ogs/issues{/number}","pulls_url":"https://api.github.com/repos/wenqing/ogs/pulls{/number}","milestones_url":"https://api.github.com/repos/wenqing/ogs/milestones{/number}","notifications_url":"https://api.github.com/repos/wenqing/ogs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wenqing/ogs/labels{/name}","releases_url":"https://api.github.com/repos/wenqing/ogs/releases{/id}","created_at":"2013-09-12T14:33:21Z","updated_at":"2014-07-07T15:53:31Z","pushed_at":"2014-11-12T13:25:41Z","git_url":"git://github.com/wenqing/ogs.git","ssh_url":"git@github.com:wenqing/ogs.git","clone_url":"https://github.com/wenqing/ogs.git","svn_url":"https://github.com/wenqing/ogs","homepage":"www.opengeosys.org","size":9377,"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":"ufz:master","ref":"master","sha":"d66bffc7114e659d01377241e002858a21ad40ba","user":{"login":"ufz","id":767517,"avatar_url":"https://avatars.githubusercontent.com/u/767517?v=3","gravatar_id":"","url":"https://api.github.com/users/ufz","html_url":"https://github.com/ufz","followers_url":"https://api.github.com/users/ufz/followers","following_url":"https://api.github.com/users/ufz/following{/other_user}","gists_url":"https://api.github.com/users/ufz/gists{/gist_id}","starred_url":"https://api.github.com/users/ufz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ufz/subscriptions","organizations_url":"https://api.github.com/users/ufz/orgs","repos_url":"https://api.github.com/users/ufz/repos","events_url":"https://api.github.com/users/ufz/events{/privacy}","received_events_url":"https://api.github.com/users/ufz/received_events","type":"Organization","site_admin":false},"repo":{"id":1701384,"name":"ogs","full_name":"ufz/ogs","owner":{"login":"ufz","id":767517,"avatar_url":"https://avatars.githubusercontent.com/u/767517?v=3","gravatar_id":"","url":"https://api.github.com/users/ufz","html_url":"https://github.com/ufz","followers_url":"https://api.github.com/users/ufz/followers","following_url":"https://api.github.com/users/ufz/following{/other_user}","gists_url":"https://api.github.com/users/ufz/gists{/gist_id}","starred_url":"https://api.github.com/users/ufz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ufz/subscriptions","organizations_url":"https://api.github.com/users/ufz/orgs","repos_url":"https://api.github.com/users/ufz/repos","events_url":"https://api.github.com/users/ufz/events{/privacy}","received_events_url":"https://api.github.com/users/ufz/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ufz/ogs","description":"OGS source code","fork":false,"url":"https://api.github.com/repos/ufz/ogs","forks_url":"https://api.github.com/repos/ufz/ogs/forks","keys_url":"https://api.github.com/repos/ufz/ogs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ufz/ogs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ufz/ogs/teams","hooks_url":"https://api.github.com/repos/ufz/ogs/hooks","issue_events_url":"https://api.github.com/repos/ufz/ogs/issues/events{/number}","events_url":"https://api.github.com/repos/ufz/ogs/events","assignees_url":"https://api.github.com/repos/ufz/ogs/assignees{/user}","branches_url":"https://api.github.com/repos/ufz/ogs/branches{/branch}","tags_url":"https://api.github.com/repos/ufz/ogs/tags","blobs_url":"https://api.github.com/repos/ufz/ogs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ufz/ogs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ufz/ogs/git/refs{/sha}","trees_url":"https://api.github.com/repos/ufz/ogs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ufz/ogs/statuses/{sha}","languages_url":"https://api.github.com/repos/ufz/ogs/languages","stargazers_url":"https://api.github.com/repos/ufz/ogs/stargazers","contributors_url":"https://api.github.com/repos/ufz/ogs/contributors","subscribers_url":"https://api.github.com/repos/ufz/ogs/subscribers","subscription_url":"https://api.github.com/repos/ufz/ogs/subscription","commits_url":"https://api.github.com/repos/ufz/ogs/commits{/sha}","git_commits_url":"https://api.github.com/repos/ufz/ogs/git/commits{/sha}","comments_url":"https://api.github.com/repos/ufz/ogs/comments{/number}","issue_comment_url":"https://api.github.com/repos/ufz/ogs/issues/comments/{number}","contents_url":"https://api.github.com/repos/ufz/ogs/contents/{+path}","compare_url":"https://api.github.com/repos/ufz/ogs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ufz/ogs/merges","archive_url":"https://api.github.com/repos/ufz/ogs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ufz/ogs/downloads","issues_url":"https://api.github.com/repos/ufz/ogs/issues{/number}","pulls_url":"https://api.github.com/repos/ufz/ogs/pulls{/number}","milestones_url":"https://api.github.com/repos/ufz/ogs/milestones{/number}","notifications_url":"https://api.github.com/repos/ufz/ogs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ufz/ogs/labels{/name}","releases_url":"https://api.github.com/repos/ufz/ogs/releases{/id}","created_at":"2011-05-04T14:09:57Z","updated_at":"2014-09-02T11:52:00Z","pushed_at":"2014-11-12T11:49:57Z","git_url":"git://github.com/ufz/ogs.git","ssh_url":"git@github.com:ufz/ogs.git","clone_url":"https://github.com/ufz/ogs.git","svn_url":"https://github.com/ufz/ogs","homepage":"www.opengeosys.org","size":17007,"stargazers_count":13,"watchers_count":13,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":29,"mirror_url":null,"open_issues_count":61,"forks":29,"open_issues":61,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ufz/ogs/pulls/487"},"html":{"href":"https://github.com/ufz/ogs/pull/487"},"issue":{"href":"https://api.github.com/repos/ufz/ogs/issues/487"},"comments":{"href":"https://api.github.com/repos/ufz/ogs/issues/487/comments"},"review_comments":{"href":"https://api.github.com/repos/ufz/ogs/pulls/487/comments"},"review_comment":{"href":"https://api.github.com/repos/ufz/ogs/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/ufz/ogs/pulls/487/commits"},"statuses":{"href":"https://api.github.com/repos/ufz/ogs/statuses/570b72e5ca2d4a64ad960e282835e8330bbb9471"}}}}