{"action":"created","comment":{"url":"https://api.github.com/repos/ufz/ogs5/pulls/comments/61436615","id":61436615,"diff_hunk":"@@ -59,39 +58,42 @@ CElement::CElement(int CoordFlag, const int order)\n \t//\n \tdim = CoordFlag / 10;\n \tcoordinate_system = CoordFlag;\n-\tfor (i = 0; i < 4; i++)\n+\tfor (int i = 0; i < 4; i++)\n \t\tunit[i] = 0.0;\n+\n+\tint dim_jacobian = 1;\n+\tint size_dshapefct = 6;\n+\tint size_dshapefctHQ = 9;\n+\tint max_intgration_points = 27;\n \tswitch (dim)\n \t{\n \t\tcase 1: // OK\n \t\t\t// Memory allocated for maxium 3 nodes elements\n-\t\t\tJacobian = new double[1];\n-\t\t\tinvJacobian = new double[1];\n-\t\t\tshapefct = new double[2];\n-\t\t\tshapefctHQ = new double[3];\n-\t\t\tdshapefct = new double[6];\n-\t\t\tdshapefctHQ = new double[9];\n+\t\t\tdim_jacobian = 1;\n+\t\t\tsize_dshapefct = 3 * max_intgration_points;\n+\t\t\tsize_dshapefctHQ = 3 * max_intgration_points;\n \t\t\tbreak;\n \t\tcase 2:\n \t\t\t// Memory allocated for maxium 9 nodes elements\n-\t\t\tJacobian = new double[4];\n-\t\t\tinvJacobian = new double[4];\n-\t\t\tshapefct = new double[4];\n-\t\t\tshapefctHQ = new double[9];\n-\t\t\tdshapefct = new double[18];\n-\t\t\tdshapefctHQ = new double[18];\n+\t\t\tdim_jacobian = 4;\n+\t\t\tsize_dshapefct = 18 * max_intgration_points;\n+\t\t\tsize_dshapefctHQ = 18 * max_intgration_points;\n \t\t\tbreak;\n \t\tcase 3:\n \t\t\t// Memory allocated for maxium 20 nodes elements\n-\t\t\tJacobian = new double[9];\n-\t\t\tinvJacobian = new double[9];\n-\t\t\tshapefct = new double[8];\n-\t\t\tshapefctHQ = new double[20];\n-\t\t\tdshapefct = new double[24];\n-\t\t\tdshapefctHQ = new double[60];\n+\t\t\tdim_jacobian = 9;\n+\t\t\tsize_dshapefct = 24 * max_intgration_points;\n+\t\t\tsize_dshapefctHQ = 60 * max_intgration_points;\n \t\t\t//\n \t\t\tbreak;\n \t}\n+\n+\tJacobian = new double[dim_jacobian];","path":"FEM/fem_ele.cpp","position":107,"original_position":107,"commit_id":"d54a2bc3cf9bacda821060490bc31ecd5f13498a","original_commit_id":"d54a2bc3cf9bacda821060490bc31ecd5f13498a","user":{"login":"norihiro-w","id":800408,"avatar_url":"https://avatars.githubusercontent.com/u/800408?v=3","gravatar_id":"","url":"https://api.github.com/users/norihiro-w","html_url":"https://github.com/norihiro-w","followers_url":"https://api.github.com/users/norihiro-w/followers","following_url":"https://api.github.com/users/norihiro-w/following{/other_user}","gists_url":"https://api.github.com/users/norihiro-w/gists{/gist_id}","starred_url":"https://api.github.com/users/norihiro-w/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/norihiro-w/subscriptions","organizations_url":"https://api.github.com/users/norihiro-w/orgs","repos_url":"https://api.github.com/users/norihiro-w/repos","events_url":"https://api.github.com/users/norihiro-w/events{/privacy}","received_events_url":"https://api.github.com/users/norihiro-w/received_events","type":"User","site_admin":false},"body":"can add prefix `_` as this is a member variable?","created_at":"2016-04-28T14:30:38Z","updated_at":"2016-04-28T14:30:38Z","html_url":"https://github.com/ufz/ogs5/pull/38#discussion_r61436615","pull_request_url":"https://api.github.com/repos/ufz/ogs5/pulls/38","_links":{"self":{"href":"https://api.github.com/repos/ufz/ogs5/pulls/comments/61436615"},"html":{"href":"https://github.com/ufz/ogs5/pull/38#discussion_r61436615"},"pull_request":{"href":"https://api.github.com/repos/ufz/ogs5/pulls/38"}}},"pull_request":{"url":"https://api.github.com/repos/ufz/ogs5/pulls/38","id":68046946,"html_url":"https://github.com/ufz/ogs5/pull/38","diff_url":"https://github.com/ufz/ogs5/pull/38.diff","patch_url":"https://github.com/ufz/ogs5/pull/38.patch","issue_url":"https://api.github.com/repos/ufz/ogs5/issues/38","number":38,"state":"open","locked":false,"title":"Improvement in shape function computation","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":"In the previous versions, the computations of shape functions are conducted within the local assembly over each element, which is redundant for the elements with the same type. \r\n\r\nIn this PR, a class is introduced for computing shape functions _N_ and their derivatives with respect to the local coordinates d _N_  /d xi. The class is used to compute  _N_  and d _N_  /d xi at each integration points of all involved element types in a FEM computation, and it also holds all the computation results for later usage in the process of Neumann BC and the local assembly. During the local assembly, the derivatives of shape functions with respect to the global local coordinates are computed and cached before any numerical integration happens. By this way, \r\n- the redundancy in the shape function computation is reduced significantly, \r\n- the associated memory usage is less.\r\n\r\nFor the problem with big mesh or many time steps, the speedup of this improvement vs the previous versions could be distinct (20% has been reported).\r\n\r\nSince all local shape function computations have been replaced with the cached data  acquisition, all benchmarks give tiny errors in their results against to that obtained by the previous versions.","created_at":"2016-04-27T12:46:05Z","updated_at":"2016-04-28T14:30:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b103cebcaf8adc9015dd374456c6780fba8ab25b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ufz/ogs5/pulls/38/commits","review_comments_url":"https://api.github.com/repos/ufz/ogs5/pulls/38/comments","review_comment_url":"https://api.github.com/repos/ufz/ogs5/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ufz/ogs5/issues/38/comments","statuses_url":"https://api.github.com/repos/ufz/ogs5/statuses/d54a2bc3cf9bacda821060490bc31ecd5f13498a","head":{"label":"wenqing:shapefct_cache","ref":"shapefct_cache","sha":"d54a2bc3cf9bacda821060490bc31ecd5f13498a","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":50520335,"name":"ogs5","full_name":"wenqing/ogs5","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/ogs5","description":"Official repository of the OpenGeoSys THM/C simulator","fork":true,"url":"https://api.github.com/repos/wenqing/ogs5","forks_url":"https://api.github.com/repos/wenqing/ogs5/forks","keys_url":"https://api.github.com/repos/wenqing/ogs5/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wenqing/ogs5/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wenqing/ogs5/teams","hooks_url":"https://api.github.com/repos/wenqing/ogs5/hooks","issue_events_url":"https://api.github.com/repos/wenqing/ogs5/issues/events{/number}","events_url":"https://api.github.com/repos/wenqing/ogs5/events","assignees_url":"https://api.github.com/repos/wenqing/ogs5/assignees{/user}","branches_url":"https://api.github.com/repos/wenqing/ogs5/branches{/branch}","tags_url":"https://api.github.com/repos/wenqing/ogs5/tags","blobs_url":"https://api.github.com/repos/wenqing/ogs5/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wenqing/ogs5/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wenqing/ogs5/git/refs{/sha}","trees_url":"https://api.github.com/repos/wenqing/ogs5/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wenqing/ogs5/statuses/{sha}","languages_url":"https://api.github.com/repos/wenqing/ogs5/languages","stargazers_url":"https://api.github.com/repos/wenqing/ogs5/stargazers","contributors_url":"https://api.github.com/repos/wenqing/ogs5/contributors","subscribers_url":"https://api.github.com/repos/wenqing/ogs5/subscribers","subscription_url":"https://api.github.com/repos/wenqing/ogs5/subscription","commits_url":"https://api.github.com/repos/wenqing/ogs5/commits{/sha}","git_commits_url":"https://api.github.com/repos/wenqing/ogs5/git/commits{/sha}","comments_url":"https://api.github.com/repos/wenqing/ogs5/comments{/number}","issue_comment_url":"https://api.github.com/repos/wenqing/ogs5/issues/comments{/number}","contents_url":"https://api.github.com/repos/wenqing/ogs5/contents/{+path}","compare_url":"https://api.github.com/repos/wenqing/ogs5/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wenqing/ogs5/merges","archive_url":"https://api.github.com/repos/wenqing/ogs5/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wenqing/ogs5/downloads","issues_url":"https://api.github.com/repos/wenqing/ogs5/issues{/number}","pulls_url":"https://api.github.com/repos/wenqing/ogs5/pulls{/number}","milestones_url":"https://api.github.com/repos/wenqing/ogs5/milestones{/number}","notifications_url":"https://api.github.com/repos/wenqing/ogs5/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wenqing/ogs5/labels{/name}","releases_url":"https://api.github.com/repos/wenqing/ogs5/releases{/id}","deployments_url":"https://api.github.com/repos/wenqing/ogs5/deployments","created_at":"2016-01-27T16:20:38Z","updated_at":"2016-01-27T16:20:43Z","pushed_at":"2016-04-27T11:05:11Z","git_url":"git://github.com/wenqing/ogs5.git","ssh_url":"git@github.com:wenqing/ogs5.git","clone_url":"https://github.com/wenqing/ogs5.git","svn_url":"https://github.com/wenqing/ogs5","homepage":"http://www.opengeosys.org","size":5616,"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":"884821570f80b9ec17840b165e75fbc0197c1de5","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":41413218,"name":"ogs5","full_name":"ufz/ogs5","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/ogs5","description":"Official repository of the OpenGeoSys THM/C simulator","fork":false,"url":"https://api.github.com/repos/ufz/ogs5","forks_url":"https://api.github.com/repos/ufz/ogs5/forks","keys_url":"https://api.github.com/repos/ufz/ogs5/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ufz/ogs5/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ufz/ogs5/teams","hooks_url":"https://api.github.com/repos/ufz/ogs5/hooks","issue_events_url":"https://api.github.com/repos/ufz/ogs5/issues/events{/number}","events_url":"https://api.github.com/repos/ufz/ogs5/events","assignees_url":"https://api.github.com/repos/ufz/ogs5/assignees{/user}","branches_url":"https://api.github.com/repos/ufz/ogs5/branches{/branch}","tags_url":"https://api.github.com/repos/ufz/ogs5/tags","blobs_url":"https://api.github.com/repos/ufz/ogs5/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ufz/ogs5/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ufz/ogs5/git/refs{/sha}","trees_url":"https://api.github.com/repos/ufz/ogs5/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ufz/ogs5/statuses/{sha}","languages_url":"https://api.github.com/repos/ufz/ogs5/languages","stargazers_url":"https://api.github.com/repos/ufz/ogs5/stargazers","contributors_url":"https://api.github.com/repos/ufz/ogs5/contributors","subscribers_url":"https://api.github.com/repos/ufz/ogs5/subscribers","subscription_url":"https://api.github.com/repos/ufz/ogs5/subscription","commits_url":"https://api.github.com/repos/ufz/ogs5/commits{/sha}","git_commits_url":"https://api.github.com/repos/ufz/ogs5/git/commits{/sha}","comments_url":"https://api.github.com/repos/ufz/ogs5/comments{/number}","issue_comment_url":"https://api.github.com/repos/ufz/ogs5/issues/comments{/number}","contents_url":"https://api.github.com/repos/ufz/ogs5/contents/{+path}","compare_url":"https://api.github.com/repos/ufz/ogs5/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ufz/ogs5/merges","archive_url":"https://api.github.com/repos/ufz/ogs5/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ufz/ogs5/downloads","issues_url":"https://api.github.com/repos/ufz/ogs5/issues{/number}","pulls_url":"https://api.github.com/repos/ufz/ogs5/pulls{/number}","milestones_url":"https://api.github.com/repos/ufz/ogs5/milestones{/number}","notifications_url":"https://api.github.com/repos/ufz/ogs5/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ufz/ogs5/labels{/name}","releases_url":"https://api.github.com/repos/ufz/ogs5/releases{/id}","deployments_url":"https://api.github.com/repos/ufz/ogs5/deployments","created_at":"2015-08-26T08:13:48Z","updated_at":"2016-04-12T18:21:37Z","pushed_at":"2016-04-27T12:46:06Z","git_url":"git://github.com/ufz/ogs5.git","ssh_url":"git@github.com:ufz/ogs5.git","clone_url":"https://github.com/ufz/ogs5.git","svn_url":"https://github.com/ufz/ogs5","homepage":"http://www.opengeosys.org","size":6212,"stargazers_count":8,"watchers_count":8,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":12,"forks":21,"open_issues":12,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ufz/ogs5/pulls/38"},"html":{"href":"https://github.com/ufz/ogs5/pull/38"},"issue":{"href":"https://api.github.com/repos/ufz/ogs5/issues/38"},"comments":{"href":"https://api.github.com/repos/ufz/ogs5/issues/38/comments"},"review_comments":{"href":"https://api.github.com/repos/ufz/ogs5/pulls/38/comments"},"review_comment":{"href":"https://api.github.com/repos/ufz/ogs5/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ufz/ogs5/pulls/38/commits"},"statuses":{"href":"https://api.github.com/repos/ufz/ogs5/statuses/d54a2bc3cf9bacda821060490bc31ecd5f13498a"}}}}