{"action":"created","comment":{"url":"https://api.github.com/repos/firedrakeproject/firedrake/pulls/comments/34671389","id":34671389,"diff_hunk":"@@ -604,10 +604,23 @@ def init_cell_orientations(self, expr):\n         body.append(ast.Decl(\"double\", \"dot\"))\n         body.append(ast.Assign(\"dot\", 0.0))\n         body.append(ast.Decl(\"int\", \"i\"))\n-        body.append(ast.For(ast.Assign(\"i\", 0), ast.Less(\"i\", 3), ast.Incr(\"i\", 1),\n-                            [ast.Assign(v0(\"i\"), ast.Sub(coords(1, \"i\"), coords(0, \"i\"))),\n-                             ast.Assign(v1(\"i\"), ast.Sub(coords(2, \"i\"), coords(0, \"i\"))),\n-                             ast.Assign(x(\"i\"), 0.0)]))\n+\n+        # if triangle, use v0 = x1 - x0, v1 = x2 - x0\n+        # otherwise, for the various quads, use v0 = x2 - x0, v1 = x1 - x0\n+        # recall reference element ordering:\n+        # triangle: 2        quad: 1 3\n+        #           0 1            0 2\n+        if self.ufl_cell() == ufl.Cell('triangle', 3):\n+            body.append(ast.For(ast.Assign(\"i\", 0), ast.Less(\"i\", 3), ast.Incr(\"i\", 1),\n+                                [ast.Assign(v0(\"i\"), ast.Sub(coords(1, \"i\"), coords(0, \"i\"))),\n+                                 ast.Assign(v1(\"i\"), ast.Sub(coords(2, \"i\"), coords(0, \"i\"))),\n+                                 ast.Assign(x(\"i\"), 0.0)]))\n+        else:","path":"firedrake/mesh.py","position":19,"original_position":19,"commit_id":"9726c805d489d76f0fb9454670476d60324a3ef4","original_commit_id":"9726c805d489d76f0fb9454670476d60324a3ef4","user":{"login":"miklos1","id":4210841,"avatar_url":"https://avatars.githubusercontent.com/u/4210841?v=3","gravatar_id":"","url":"https://api.github.com/users/miklos1","html_url":"https://github.com/miklos1","followers_url":"https://api.github.com/users/miklos1/followers","following_url":"https://api.github.com/users/miklos1/following{/other_user}","gists_url":"https://api.github.com/users/miklos1/gists{/gist_id}","starred_url":"https://api.github.com/users/miklos1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miklos1/subscriptions","organizations_url":"https://api.github.com/users/miklos1/orgs","repos_url":"https://api.github.com/users/miklos1/repos","events_url":"https://api.github.com/users/miklos1/events{/privacy}","received_events_url":"https://api.github.com/users/miklos1/received_events","type":"User","site_admin":false},"body":"Maybe\r\n```elif self.ufl_cell() == ufl.Cell('quadrilateral', 3):```\r\nand later `else: raise `some exception, just to make sure nothing else will accidentally catch a code path it wasn't tested with?","created_at":"2015-07-15T12:14:00Z","updated_at":"2015-07-15T12:14:00Z","html_url":"https://github.com/firedrakeproject/firedrake/pull/553#discussion_r34671389","pull_request_url":"https://api.github.com/repos/firedrakeproject/firedrake/pulls/553","_links":{"self":{"href":"https://api.github.com/repos/firedrakeproject/firedrake/pulls/comments/34671389"},"html":{"href":"https://github.com/firedrakeproject/firedrake/pull/553#discussion_r34671389"},"pull_request":{"href":"https://api.github.com/repos/firedrakeproject/firedrake/pulls/553"}}},"pull_request":{"url":"https://api.github.com/repos/firedrakeproject/firedrake/pulls/553","id":40015185,"html_url":"https://github.com/firedrakeproject/firedrake/pull/553","diff_url":"https://github.com/firedrakeproject/firedrake/pull/553.diff","patch_url":"https://github.com/firedrakeproject/firedrake/pull/553.patch","issue_url":"https://api.github.com/repos/firedrakeproject/firedrake/issues/553","number":553,"state":"open","locked":false,"title":"add alternate init_cell_orientation code for quads","user":{"login":"dorugeber","id":5711063,"avatar_url":"https://avatars.githubusercontent.com/u/5711063?v=3","gravatar_id":"","url":"https://api.github.com/users/dorugeber","html_url":"https://github.com/dorugeber","followers_url":"https://api.github.com/users/dorugeber/followers","following_url":"https://api.github.com/users/dorugeber/following{/other_user}","gists_url":"https://api.github.com/users/dorugeber/gists{/gist_id}","starred_url":"https://api.github.com/users/dorugeber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dorugeber/subscriptions","organizations_url":"https://api.github.com/users/dorugeber/orgs","repos_url":"https://api.github.com/users/dorugeber/repos","events_url":"https://api.github.com/users/dorugeber/events{/privacy}","received_events_url":"https://api.github.com/users/dorugeber/received_events","type":"User","site_admin":false},"body":"I claim that the orientation is currently flipped for quads.  This hadn't led to problems so far, since they were consistent with each other but rarely used directly.\r\n\r\nHowever, I found issues when running bendy code, which uses orientations more natively (via CellNormal, which flips depending on the CellNormal).  In particular, the CellNormal field on a cubed sphere was pointing radially inwards when visualised in Paraview, which on an icosahedral sphere mesh it was pointing outwards.","created_at":"2015-07-15T12:05:12Z","updated_at":"2015-07-15T12:14:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7e3cbcc59b55c476f14195048cd5f21f887f87ce","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/firedrakeproject/firedrake/pulls/553/commits","review_comments_url":"https://api.github.com/repos/firedrakeproject/firedrake/pulls/553/comments","review_comment_url":"https://api.github.com/repos/firedrakeproject/firedrake/pulls/comments{/number}","comments_url":"https://api.github.com/repos/firedrakeproject/firedrake/issues/553/comments","statuses_url":"https://api.github.com/repos/firedrakeproject/firedrake/statuses/9726c805d489d76f0fb9454670476d60324a3ef4","head":{"label":"firedrakeproject:cell_orientation_fix","ref":"cell_orientation_fix","sha":"9726c805d489d76f0fb9454670476d60324a3ef4","user":{"login":"firedrakeproject","id":5558005,"avatar_url":"https://avatars.githubusercontent.com/u/5558005?v=3","gravatar_id":"","url":"https://api.github.com/users/firedrakeproject","html_url":"https://github.com/firedrakeproject","followers_url":"https://api.github.com/users/firedrakeproject/followers","following_url":"https://api.github.com/users/firedrakeproject/following{/other_user}","gists_url":"https://api.github.com/users/firedrakeproject/gists{/gist_id}","starred_url":"https://api.github.com/users/firedrakeproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firedrakeproject/subscriptions","organizations_url":"https://api.github.com/users/firedrakeproject/orgs","repos_url":"https://api.github.com/users/firedrakeproject/repos","events_url":"https://api.github.com/users/firedrakeproject/events{/privacy}","received_events_url":"https://api.github.com/users/firedrakeproject/received_events","type":"Organization","site_admin":false},"repo":{"id":13384052,"name":"firedrake","full_name":"firedrakeproject/firedrake","owner":{"login":"firedrakeproject","id":5558005,"avatar_url":"https://avatars.githubusercontent.com/u/5558005?v=3","gravatar_id":"","url":"https://api.github.com/users/firedrakeproject","html_url":"https://github.com/firedrakeproject","followers_url":"https://api.github.com/users/firedrakeproject/followers","following_url":"https://api.github.com/users/firedrakeproject/following{/other_user}","gists_url":"https://api.github.com/users/firedrakeproject/gists{/gist_id}","starred_url":"https://api.github.com/users/firedrakeproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firedrakeproject/subscriptions","organizations_url":"https://api.github.com/users/firedrakeproject/orgs","repos_url":"https://api.github.com/users/firedrakeproject/repos","events_url":"https://api.github.com/users/firedrakeproject/events{/privacy}","received_events_url":"https://api.github.com/users/firedrakeproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/firedrakeproject/firedrake","description":"Firedrake is an automated system for the portable solution of partial differential equations using the finite element method (FEM)","fork":false,"url":"https://api.github.com/repos/firedrakeproject/firedrake","forks_url":"https://api.github.com/repos/firedrakeproject/firedrake/forks","keys_url":"https://api.github.com/repos/firedrakeproject/firedrake/keys{/key_id}","collaborators_url":"https://api.github.com/repos/firedrakeproject/firedrake/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/firedrakeproject/firedrake/teams","hooks_url":"https://api.github.com/repos/firedrakeproject/firedrake/hooks","issue_events_url":"https://api.github.com/repos/firedrakeproject/firedrake/issues/events{/number}","events_url":"https://api.github.com/repos/firedrakeproject/firedrake/events","assignees_url":"https://api.github.com/repos/firedrakeproject/firedrake/assignees{/user}","branches_url":"https://api.github.com/repos/firedrakeproject/firedrake/branches{/branch}","tags_url":"https://api.github.com/repos/firedrakeproject/firedrake/tags","blobs_url":"https://api.github.com/repos/firedrakeproject/firedrake/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/firedrakeproject/firedrake/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/firedrakeproject/firedrake/git/refs{/sha}","trees_url":"https://api.github.com/repos/firedrakeproject/firedrake/git/trees{/sha}","statuses_url":"https://api.github.com/repos/firedrakeproject/firedrake/statuses/{sha}","languages_url":"https://api.github.com/repos/firedrakeproject/firedrake/languages","stargazers_url":"https://api.github.com/repos/firedrakeproject/firedrake/stargazers","contributors_url":"https://api.github.com/repos/firedrakeproject/firedrake/contributors","subscribers_url":"https://api.github.com/repos/firedrakeproject/firedrake/subscribers","subscription_url":"https://api.github.com/repos/firedrakeproject/firedrake/subscription","commits_url":"https://api.github.com/repos/firedrakeproject/firedrake/commits{/sha}","git_commits_url":"https://api.github.com/repos/firedrakeproject/firedrake/git/commits{/sha}","comments_url":"https://api.github.com/repos/firedrakeproject/firedrake/comments{/number}","issue_comment_url":"https://api.github.com/repos/firedrakeproject/firedrake/issues/comments{/number}","contents_url":"https://api.github.com/repos/firedrakeproject/firedrake/contents/{+path}","compare_url":"https://api.github.com/repos/firedrakeproject/firedrake/compare/{base}...{head}","merges_url":"https://api.github.com/repos/firedrakeproject/firedrake/merges","archive_url":"https://api.github.com/repos/firedrakeproject/firedrake/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/firedrakeproject/firedrake/downloads","issues_url":"https://api.github.com/repos/firedrakeproject/firedrake/issues{/number}","pulls_url":"https://api.github.com/repos/firedrakeproject/firedrake/pulls{/number}","milestones_url":"https://api.github.com/repos/firedrakeproject/firedrake/milestones{/number}","notifications_url":"https://api.github.com/repos/firedrakeproject/firedrake/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/firedrakeproject/firedrake/labels{/name}","releases_url":"https://api.github.com/repos/firedrakeproject/firedrake/releases{/id}","created_at":"2013-10-07T13:07:44Z","updated_at":"2015-06-29T02:50:31Z","pushed_at":"2015-07-15T12:05:12Z","git_url":"git://github.com/firedrakeproject/firedrake.git","ssh_url":"git@github.com:firedrakeproject/firedrake.git","clone_url":"https://github.com/firedrakeproject/firedrake.git","svn_url":"https://github.com/firedrakeproject/firedrake","homepage":"http://firedrakeproject.org","size":17707,"stargazers_count":16,"watchers_count":16,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":63,"forks":9,"open_issues":63,"watchers":16,"default_branch":"master"}},"base":{"label":"firedrakeproject:master","ref":"master","sha":"6d59899abf900240b77b32c13dfa772c3ea1256b","user":{"login":"firedrakeproject","id":5558005,"avatar_url":"https://avatars.githubusercontent.com/u/5558005?v=3","gravatar_id":"","url":"https://api.github.com/users/firedrakeproject","html_url":"https://github.com/firedrakeproject","followers_url":"https://api.github.com/users/firedrakeproject/followers","following_url":"https://api.github.com/users/firedrakeproject/following{/other_user}","gists_url":"https://api.github.com/users/firedrakeproject/gists{/gist_id}","starred_url":"https://api.github.com/users/firedrakeproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firedrakeproject/subscriptions","organizations_url":"https://api.github.com/users/firedrakeproject/orgs","repos_url":"https://api.github.com/users/firedrakeproject/repos","events_url":"https://api.github.com/users/firedrakeproject/events{/privacy}","received_events_url":"https://api.github.com/users/firedrakeproject/received_events","type":"Organization","site_admin":false},"repo":{"id":13384052,"name":"firedrake","full_name":"firedrakeproject/firedrake","owner":{"login":"firedrakeproject","id":5558005,"avatar_url":"https://avatars.githubusercontent.com/u/5558005?v=3","gravatar_id":"","url":"https://api.github.com/users/firedrakeproject","html_url":"https://github.com/firedrakeproject","followers_url":"https://api.github.com/users/firedrakeproject/followers","following_url":"https://api.github.com/users/firedrakeproject/following{/other_user}","gists_url":"https://api.github.com/users/firedrakeproject/gists{/gist_id}","starred_url":"https://api.github.com/users/firedrakeproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firedrakeproject/subscriptions","organizations_url":"https://api.github.com/users/firedrakeproject/orgs","repos_url":"https://api.github.com/users/firedrakeproject/repos","events_url":"https://api.github.com/users/firedrakeproject/events{/privacy}","received_events_url":"https://api.github.com/users/firedrakeproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/firedrakeproject/firedrake","description":"Firedrake is an automated system for the portable solution of partial differential equations using the finite element method (FEM)","fork":false,"url":"https://api.github.com/repos/firedrakeproject/firedrake","forks_url":"https://api.github.com/repos/firedrakeproject/firedrake/forks","keys_url":"https://api.github.com/repos/firedrakeproject/firedrake/keys{/key_id}","collaborators_url":"https://api.github.com/repos/firedrakeproject/firedrake/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/firedrakeproject/firedrake/teams","hooks_url":"https://api.github.com/repos/firedrakeproject/firedrake/hooks","issue_events_url":"https://api.github.com/repos/firedrakeproject/firedrake/issues/events{/number}","events_url":"https://api.github.com/repos/firedrakeproject/firedrake/events","assignees_url":"https://api.github.com/repos/firedrakeproject/firedrake/assignees{/user}","branches_url":"https://api.github.com/repos/firedrakeproject/firedrake/branches{/branch}","tags_url":"https://api.github.com/repos/firedrakeproject/firedrake/tags","blobs_url":"https://api.github.com/repos/firedrakeproject/firedrake/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/firedrakeproject/firedrake/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/firedrakeproject/firedrake/git/refs{/sha}","trees_url":"https://api.github.com/repos/firedrakeproject/firedrake/git/trees{/sha}","statuses_url":"https://api.github.com/repos/firedrakeproject/firedrake/statuses/{sha}","languages_url":"https://api.github.com/repos/firedrakeproject/firedrake/languages","stargazers_url":"https://api.github.com/repos/firedrakeproject/firedrake/stargazers","contributors_url":"https://api.github.com/repos/firedrakeproject/firedrake/contributors","subscribers_url":"https://api.github.com/repos/firedrakeproject/firedrake/subscribers","subscription_url":"https://api.github.com/repos/firedrakeproject/firedrake/subscription","commits_url":"https://api.github.com/repos/firedrakeproject/firedrake/commits{/sha}","git_commits_url":"https://api.github.com/repos/firedrakeproject/firedrake/git/commits{/sha}","comments_url":"https://api.github.com/repos/firedrakeproject/firedrake/comments{/number}","issue_comment_url":"https://api.github.com/repos/firedrakeproject/firedrake/issues/comments{/number}","contents_url":"https://api.github.com/repos/firedrakeproject/firedrake/contents/{+path}","compare_url":"https://api.github.com/repos/firedrakeproject/firedrake/compare/{base}...{head}","merges_url":"https://api.github.com/repos/firedrakeproject/firedrake/merges","archive_url":"https://api.github.com/repos/firedrakeproject/firedrake/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/firedrakeproject/firedrake/downloads","issues_url":"https://api.github.com/repos/firedrakeproject/firedrake/issues{/number}","pulls_url":"https://api.github.com/repos/firedrakeproject/firedrake/pulls{/number}","milestones_url":"https://api.github.com/repos/firedrakeproject/firedrake/milestones{/number}","notifications_url":"https://api.github.com/repos/firedrakeproject/firedrake/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/firedrakeproject/firedrake/labels{/name}","releases_url":"https://api.github.com/repos/firedrakeproject/firedrake/releases{/id}","created_at":"2013-10-07T13:07:44Z","updated_at":"2015-06-29T02:50:31Z","pushed_at":"2015-07-15T12:05:12Z","git_url":"git://github.com/firedrakeproject/firedrake.git","ssh_url":"git@github.com:firedrakeproject/firedrake.git","clone_url":"https://github.com/firedrakeproject/firedrake.git","svn_url":"https://github.com/firedrakeproject/firedrake","homepage":"http://firedrakeproject.org","size":17707,"stargazers_count":16,"watchers_count":16,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":63,"forks":9,"open_issues":63,"watchers":16,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/firedrakeproject/firedrake/pulls/553"},"html":{"href":"https://github.com/firedrakeproject/firedrake/pull/553"},"issue":{"href":"https://api.github.com/repos/firedrakeproject/firedrake/issues/553"},"comments":{"href":"https://api.github.com/repos/firedrakeproject/firedrake/issues/553/comments"},"review_comments":{"href":"https://api.github.com/repos/firedrakeproject/firedrake/pulls/553/comments"},"review_comment":{"href":"https://api.github.com/repos/firedrakeproject/firedrake/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/firedrakeproject/firedrake/pulls/553/commits"},"statuses":{"href":"https://api.github.com/repos/firedrakeproject/firedrake/statuses/9726c805d489d76f0fb9454670476d60324a3ef4"}}}}