{"id":2215,"date":"2024-04-26T14:00:05","date_gmt":"2024-04-26T18:00:05","guid":{"rendered":"https:\/\/brickisland.net\/DDGSpring2024\/?p=2215"},"modified":"2024-04-26T14:53:07","modified_gmt":"2024-04-26T18:53:07","slug":"assignment-6-coding-vector-field-decomposition-and-design-due-5-5","status":"publish","type":"post","link":"https:\/\/brickisland.net\/DDGSpring2024\/2024\/04\/26\/assignment-6-coding-vector-field-decomposition-and-design-due-5-5\/","title":{"rendered":"Assignment 6 [Coding]: Vector Field Decomposition and Design (Due date 5\/06)"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/brickisland.net\/DDGSpring2019\/wp-content\/uploads\/2019\/05\/Screen-Shot-2019-05-01-at-8.16.51-PM-1024x475.png\" width=\"501\" height=\"232\" \/><\/p>\n<p><strong>Note:<\/strong> For the final assignment, you can do either this assignment or A5. Overall, you just need to be sure you completed A0 and A1, as well as 4 of the assignments A2\u2013A6 (your choice which ones.) Also, you <em>cannot<\/em>\u00a0use late days on this assignment since it\u2019s the last one.<\/p>\n<p>Please implement the following routines in:<\/p>\n<ol>\n<li><tt>projects\/vector-field-decomposition\/tree-cotree.[js\/cpp]<\/tt>:\n<ol>\n<li><tt>buildPrimalSpanningTree<\/tt><\/li>\n<li><tt>inPrimalSpanningTree<\/tt><\/li>\n<li><tt>buildDualSpanningCotree<\/tt><\/li>\n<li><tt>inDualSpanningCotree<\/tt><\/li>\n<li><tt>buildGenerators<\/tt><\/li>\n<\/ol>\n<\/li>\n<li><tt>projects\/vector-field-decomposition\/harmonic-bases.[js\/cpp]<\/tt>:\n<ol>\n<li><tt>buildClosedPrimalOneForm<\/tt><\/li>\n<li><tt>compute<\/tt><tt><\/tt><\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p>In addition, please implement <strong>either<\/strong> Hodge Decomposition, or Trivial Connections (on surfaces of genus 0):<\/p>\n<p><strong>Hodge Decomposition<\/strong>: Please implement the following routines in<\/p>\n<ol>\n<li><tt>projects\/vector-field-decomposition\/hodge-decomposition.[js\/cpp]<\/tt>:\n<ol>\n<li><tt>constructor<\/tt><\/li>\n<li><tt>computeExactComponent<\/tt><\/li>\n<li><tt>computeCoExactComponent<\/tt><\/li>\n<li><tt>computeHarmonicComponent<\/tt><\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p><strong>Trivial Connections on Surfaces of Genus 0:<\/strong> Please implement <tt>computeConnections<\/tt> in <tt>projects\/direction-field-design\/trivial-connections.[js\/cpp]<\/tt>. This file has function signatures for trivial connections on arbitrary surfaces, but for this assignment we are only requiring you to compute the connection form on simply-connected surfaces where you don&#8217;t have to worry about the <em>period matrix<\/em>. You are, of course, welcome to implement the general algorithm if you would like to!<\/p>\n<p><strong>Notes:<\/strong><tt><\/tt><\/p>\n<ul>\n<li>Recall that <em>homology generators<\/em> are a set of loops which somehow describe all of the interesting loops on a surface. For example, here are the two homology generators for the torus.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/brickisland.net\/DDGSpring2019\/wp-content\/uploads\/2019\/05\/Artboard-1.png\" width=\"314\" height=\"231\" \/><\/li>\n<li>Your <tt>buildGenerators<\/tt> function should implement the <em>Tree-Cotree<\/em> algorithm, which is Algorithm 5 of section 8.2 of the notes.<\/li>\n<li>In <tt>tree-cotree.[js\/cpp]<\/tt> the trees are stored using the dictionaries <tt>vertexParent<\/tt> and <tt>faceParent<\/tt>. You should store the primal spanning tree by storing the parent of vertex <tt>v<\/tt> in <tt>vertexParent[v]<\/tt>. The root should be its own parent. Similarly, you should store the dual spanning cotree by storing the parent of face <tt>f<\/tt> in <tt>faceParent[f]<\/tt>.<\/li>\n<li>The Tree Cotree algorithm finds homology generators on the <em>dual mesh<\/em>. That is to say, you should take each <em>dual edge<\/em> which is not in either spanning tree, and form a loop by following its endpoint back up the dual cotree until they meet at the root of the dual cotree. Even though we&#8217;re thinking of these homology generators as loops on the dual mesh, we still store them as lists of ordinary halfedges, since edges in the dual mesh are in 1-1 correspondence with edges in the primal graph.<\/li>\n<li><tt>buildClosedPrimalOneForm<\/tt> should use a homology generator to construct a closed primal 1-form as described in section 8.22 of the notes.<\/li>\n<li>The <tt>compute<\/tt> function in <tt>HarmonicBases<\/tt> should compute a harmonic basis using Algorithm 6 in section 8.2 of the notes. If you choose to implement Hodge decomposition for the assignment, you are welcome to use your Hodge decomposition code to solve for $d\\alpha$. Otherwise, you can just ignore the <tt>hodgeDecomposition<\/tt> parameter and directly solve the linear system $\\Delta \\alpha = \\delta \\omega$ to find $\\alpha$. (Recall that $\\delta$ is the <em>codifferential<\/em>, which we talked a lot about in the Discrete Exterior Calculus assignment).<\/li>\n<\/ul>\n<p><strong>Notes (Hodge Decomposition):<\/strong><\/p>\n<ul>\n<li>The procedure for Hodge Decomposition is given as Algorithm 3 in section 8.1 of the Notes.<\/li>\n<li>Note that the <tt>SparseMatrix<\/tt> class has an <tt>invertDiagonal<\/tt> function that you can use to invert diagonal matrices.<\/li>\n<li>For <tt>computeCoExactComponent<\/tt>, you should compute the coexact component $\\delta \\beta$ of a differential form $\\omega$ by solving the equation $d\\delta \\beta = d\\omega$. As stated in the notes, the most convenient way of doing this is to define a dual 0-form $\\tilde \\beta := *\\beta$, and then to solve $d*d \\tilde \\beta = d \\omega$. Then you can compute $\\delta \\beta$ using the fact that $\\delta \\beta = *d*\\beta = *d\\tilde\\beta$. When doing these computations, you should keep tract of whether your forms are primal forms or dual forms, recalling that hodge stars take you from primal forms to dual forms, and hodge star inverses take you from dual forms to primal forms. (THis is discussed in detail in section 8.1.3 of the notes.<\/li>\n<li>Note that the 2-form Laplacian <tt>B<\/tt> is not necessarily positive definite, so you should use an LU solver instead of a Cholesky solver when solving systems involving <tt>B<\/tt>.<\/li>\n<\/ul>\n<p><strong>Notes (Trivial Connections):<\/strong><\/p>\n<ul>\n<li>The <tt>trivial-connection[-js]<\/tt> file is structured for implementing the full trivial connections algorithm on arbitrary surfaces. Since that&#8217;s tricky, we&#8217;re only requiring that you compute connections on topological spheres. You should implement this in the <tt>computeConnections()<\/tt> function, and it should pass the tests labeled &#8220;computeConnections on a sphere&#8221;.<\/li>\n<li>Even though we&#8217;re working with spheres, it is still helpful to use the formulation of Trivial connections given in section 8.4.1 of the notes. In particular, you should solve the optimization problem given in Exercise 8.21.<\/li>\n<li>On a sphere, there are no harmonic 1-forms, so the $\\gamma$ part of your Hodge decomposition will always be 0. Furthermore, the sphere has no homology generators, so the problem simplifies to \\[\\min_{\\delta \\beta} \\;\\|\\delta\\beta\\|^2\\;\\text{s.t.}\\; d\\delta\\beta = u\\]<\/li>\n<li>Following the notes, we observe that the constraint $d\\delta\\beta = u$ determines $\\beta$ up to a constant, and that constant is annihilated by $\\delta$. So you can find the connection 1-form $\\delta \\beta$ with a single linear solve.<\/li>\n<\/ul>\n<p><strong>Warning:<\/strong> You <em>cannot<\/em> use late days on this assignment since it&#8217;s the last one.<\/p>\n<p>The assignment is due on the date listed on the calendar, at\u00a0<strong>5:59:59pm Eastern<\/strong>\u00a0(<em>not<\/em>\u00a0at midnight!). Further hand-in instructions can be found on\u00a0<a href=\"http:\/\/brickisland.net\/DDGSpring2024\/assignments\/\">this page<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Note: For the final assignment, you can do either this assignment or A5. Overall, you just need to be sure you completed A0 and A1, as well as 4 of the assignments A2\u2013A6 (your choice which ones.) Also, you cannot\u00a0use late days on this assignment since it\u2019s the last one. Please implement the following routines &hellip; <a href=\"https:\/\/brickisland.net\/DDGSpring2024\/2024\/04\/26\/assignment-6-coding-vector-field-decomposition-and-design-due-5-5\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Assignment 6 [Coding]: Vector Field Decomposition and Design (Due date 5\/06)&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":"","_links_to":"","_links_to_target":""},"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/brickisland.net\/DDGSpring2024\/wp-json\/wp\/v2\/posts\/2215"}],"collection":[{"href":"https:\/\/brickisland.net\/DDGSpring2024\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/brickisland.net\/DDGSpring2024\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/brickisland.net\/DDGSpring2024\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/brickisland.net\/DDGSpring2024\/wp-json\/wp\/v2\/comments?post=2215"}],"version-history":[{"count":9,"href":"https:\/\/brickisland.net\/DDGSpring2024\/wp-json\/wp\/v2\/posts\/2215\/revisions"}],"predecessor-version":[{"id":2405,"href":"https:\/\/brickisland.net\/DDGSpring2024\/wp-json\/wp\/v2\/posts\/2215\/revisions\/2405"}],"wp:attachment":[{"href":"https:\/\/brickisland.net\/DDGSpring2024\/wp-json\/wp\/v2\/media?parent=2215"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/brickisland.net\/DDGSpring2024\/wp-json\/wp\/v2\/categories?post=2215"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/brickisland.net\/DDGSpring2024\/wp-json\/wp\/v2\/tags?post=2215"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}