<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Rodbourn's Blog</title>
        <link>http://www.charlesrcook.com/Default.aspx</link>
        <description />
        <language>en-US</language>
        <copyright>Rodbourn</copyright>
        <generator>Subtext Version 2.5.2.0</generator>
        <image>
            <title>Rodbourn's Blog</title>
            <url>http://www.charlesrcook.com/images/RSS2Image.gif</url>
            <link>http://www.charlesrcook.com/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <item>
            <title>NVIDIA GPU Technology Conference 2012</title>
            <category>School</category>
            <category>Technical Computing</category>
            <link>http://www.charlesrcook.com/archive/2012/04/27/nvidia-gpu-technology-conference-2012.aspx</link>
            <description>&lt;p&gt;NVIDIA's &lt;a href="http://en.wikipedia.org/wiki/CUDA" target="_blank"&gt;CUDA&lt;/a&gt; is making headway into the CFD field with some exciting performance increases.  As a researcher and developer working with CFD I am interested in learning as much as possible about how to use CUDA (or more generally the GPU) to enhance my simulation capabilities.
&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.gputechconf.com/page/home.html"&gt;&lt;img src="/images/www_charlesrcook_com/042712_2308_NVIDIAGPUTe1.png" alt="" border="0" /&gt;&lt;/a&gt;
	&lt;/p&gt;&lt;p&gt;NVIDIA is hosting &lt;a href="http://www.gputechconf.com/page/home.html" target="_blank"&gt;a GPU Technology Conference&lt;/a&gt; in San Jose, California from May 14&lt;sup&gt;th&lt;/sup&gt; to 17&lt;sup&gt;th&lt;/sup&gt; (2012) which has many sessions on CUDA.  In particular they have 29 sessions on CFD which are very interesting: &lt;a href="http://tinyurl.com/7apaz7d"&gt;http://tinyurl.com/7apaz7d&lt;/a&gt;
	&lt;/p&gt;&lt;p&gt;Definitely check it out if you are interested in numerical simulations!
&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p style="margin-left: 36pt"&gt;"GTC advances awareness of high performance computing, and connects the scientists, engineers, researchers, and developers who use GPUs to tackle enormous computational challenges.
&lt;/p&gt;&lt;p style="margin-left: 36pt"&gt;GTC 2012 will feature the latest breakthroughs and the most amazing content in GPU-enabled computing. Spanning 4 full days of world-class education delivered by some of the greatest minds in GPU computing, GTC will showcase the dramatic impact that parallel computing is having on scientific research and commercial applications." &lt;a href="http://www.gputechconf.com/page/home.html"&gt;GTC&lt;/a&gt;
	&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;img src="http://www.charlesrcook.com/aggbug/73.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Rodbourn</dc:creator>
            <guid>http://www.charlesrcook.com/archive/2012/04/27/nvidia-gpu-technology-conference-2012.aspx</guid>
            <pubDate>Fri, 27 Apr 2012 23:07:55 GMT</pubDate>
            <comments>http://www.charlesrcook.com/archive/2012/04/27/nvidia-gpu-technology-conference-2012.aspx#feedback</comments>
            <wfw:commentRss>http://www.charlesrcook.com/comments/commentRss/73.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Higher dimensional partial integration</title>
            <category>Mathematics</category>
            <link>http://www.charlesrcook.com/archive/2012/04/25/higher-dimensional-partial-integration.aspx</link>
            <description>&lt;p&gt;This post is in regards &lt;a href="http://en.wikipedia.org/wiki/Integration_by_parts"&gt;higher dimensional partial integration&lt;/a&gt;, a topic of vector calculus.  Here I show a quick and non-formal way of integrating by parts in higher dimensions.  
&lt;/p&gt;&lt;p&gt;Consider the volume integration over omega which is bounded by the manifold gamma.  Omega is assumed an open bounded subset of R^n, and gamma assumed a piecewise smooth boundary.  These assumptions are required by Stoke's theorem.
&lt;/p&gt;&lt;p&gt;&lt;img src="/images/www_charlesrcook_com/042612_0219_Higherdimen1.png" alt="" /&gt;
	&lt;/p&gt;&lt;p&gt;&lt;img src="/images/www_charlesrcook_com/042612_0219_Higherdimen2.png" alt="" /&gt;
	&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;First apply the product rule under the integral.
&lt;/p&gt;&lt;p&gt;&lt;img src="/images/www_charlesrcook_com/042612_0219_Higherdimen3.png" alt="" /&gt;
	&lt;/p&gt;&lt;p&gt;Second, use Stoke's theorem to evaluate the volume integral
&lt;/p&gt;&lt;p&gt;&lt;img src="/images/www_charlesrcook_com/042612_0219_Higherdimen4.png" alt="" /&gt;
	&lt;/p&gt;&lt;p&gt;Here, the surface integral is projected against the outward facing normal, g-hat.  The right hand side remains unchanged.  Simply re-arrange to get:
&lt;/p&gt;&lt;p&gt;&lt;img src="/images/www_charlesrcook_com/042612_0219_Higherdimen5.png" alt="" /&gt;
	&lt;/p&gt;&lt;p&gt;As a matter of notation, let
&lt;/p&gt;&lt;p&gt;
		&lt;img src="/images/www_charlesrcook_com/042612_0219_Higherdimen6.png" alt="" /&gt;
	&lt;/p&gt;&lt;p&gt;To arrive at
&lt;/p&gt;&lt;p&gt;&lt;img src="/images/www_charlesrcook_com/042612_0219_Higherdimen7.png" alt="" /&gt;
	&lt;/p&gt;&lt;p&gt;I find it interesting to look at the case where omega is one dimensional, as the above expression quickly collapses down to the more well know expression of partial integration:
&lt;/p&gt;&lt;p&gt;&lt;img src="/images/www_charlesrcook_com/042612_0219_Higherdimen8.png" alt="" /&gt;
	&lt;/p&gt;&lt;p&gt;The justification of "left minus right" on the right had side's evaluation is now seen as a result of the outward facing normals at the evaluation points x_0 and x_1.
&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;img src="http://www.charlesrcook.com/aggbug/72.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Rodbourn</dc:creator>
            <guid>http://www.charlesrcook.com/archive/2012/04/25/higher-dimensional-partial-integration.aspx</guid>
            <pubDate>Thu, 26 Apr 2012 02:19:03 GMT</pubDate>
            <comments>http://www.charlesrcook.com/archive/2012/04/25/higher-dimensional-partial-integration.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://www.charlesrcook.com/comments/commentRss/72.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Some essential tools for new graduate students</title>
            <category>School</category>
            <link>http://www.charlesrcook.com/archive/2012/04/25/some-essential-tools-for-new-graduate-students.aspx</link>
            <description>&lt;p&gt;A higher quality of work is expected of graduate students by advisors, peers and others.  One of the best ways to start producing a higher quality of work is to start using more advanced tools to produce your work.  These particular tools will help you produce material that visually impresses and assists you in producing graduate student quality material.  
&lt;/p&gt;&lt;h1&gt;LaTeX
&lt;/h1&gt;&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/LaTeX"&gt;&lt;img src="/images/www_charlesrcook_com/042512_2006_Someessenti1.png" alt="" border="0" /&gt;&lt;/a&gt;
	&lt;/p&gt;&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/LaTeX"&gt;LaTeX&lt;/a&gt; is a "document markup language and document preparation system" that makes your work of print quality.  Instead of a "&lt;strong&gt;w&lt;/strong&gt;hat &lt;strong&gt;y&lt;/strong&gt;ou &lt;strong&gt;s&lt;/strong&gt;ee &lt;strong&gt;i&lt;/strong&gt;s &lt;strong&gt;w&lt;/strong&gt;hat &lt;strong&gt;y&lt;/strong&gt;ou &lt;strong&gt;g&lt;/strong&gt;et" (WYSIWYG) editing paradigm used in visual programs such as Microsoft Word, LaTeX is designed as "&lt;strong&gt;w&lt;/strong&gt;hat &lt;strong&gt;y&lt;/strong&gt;ou &lt;strong&gt;s&lt;/strong&gt;ee &lt;strong&gt;i&lt;/strong&gt;s &lt;strong&gt;w&lt;/strong&gt;hat &lt;strong&gt;y&lt;/strong&gt;ou &lt;strong&gt;m&lt;/strong&gt;ean".
&lt;/p&gt;&lt;p&gt;Instead of managing a document visually, where you are constantly adjusting spacing, styles, positions, etcetera you simply work directly with the content. Then, after you have created your content, you apply a style after the fact.  This is true for content which you are publishing, you provide them with the LaTeX document, and then they apply their own styling rules.  Most journals, publishers, and thesis submissions accept LaTeX as the document source, so it's a good idea to get familiar with LaTeX early.  You don't want to be struggling with LaTeX while trying to get your thesis out the door under a time crunch.
&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;h2&gt;Windows Editor
&lt;/h2&gt;&lt;p&gt;&lt;a href="http://www.texniccenter.org/"&gt;&lt;img src="/images/www_charlesrcook_com/042512_2006_Someessenti2.png" alt="" border="0" /&gt;&lt;/a&gt;
	&lt;/p&gt;&lt;p&gt;For working with LaTeX in a Windows environment, I would highly suggest &lt;a href="http://www.texniccenter.org/"&gt;TeXniCenter&lt;/a&gt;.  
&lt;/p&gt;&lt;p style="margin-left: 36pt"&gt;"TeXnicCenter is a feature rich and easy-to-use integrated environment for creating LaTeX documents on the Windows platform. Its powerful editor and its tight integration with the LaTeX environment helps you to concentrate on what matters: The content of your document. TeXnicCenter is Free Open Source Software (GPL)."&lt;span style="color:#333333; font-family:Trebuchet MS; font-size:9pt; background-color:white"&gt;&lt;strong&gt;
				&lt;a href="http://www.texniccenter.org/"&gt;&lt;/a&gt;&lt;/strong&gt;TeXnicCenter&lt;strong&gt;
			&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-left: 36pt"&gt;
 &lt;/p&gt;&lt;h2&gt;Linux Editor
&lt;/h2&gt;&lt;p&gt;&lt;a href="http://kile.sourceforge.net/"&gt;&lt;img src="/images/www_charlesrcook_com/042512_2006_Someessenti3.png" alt="" border="0" /&gt;&lt;/a&gt;
	&lt;/p&gt;&lt;p&gt;For working with LaTeX in a Linux environment, I would highly suggest Kile.
&lt;/p&gt;&lt;p style="margin-left: 36pt"&gt;&lt;span style="color:black; background-color:white"&gt;"Kile &lt;/span&gt;&lt;span style="background-color:white"&gt;is an integrated L&lt;sup&gt;A&lt;/sup&gt;T&lt;sub&gt;E&lt;/sub&gt;X environment for the&lt;span style="color:black"&gt; KDE &lt;/span&gt;desktop.&lt;span style="color:black"&gt; Kile &lt;/span&gt;gives you the ability to use all the functionalities of L&lt;sup&gt;A&lt;/sup&gt;T&lt;sub&gt;E&lt;/sub&gt;X in a graphical interface, giving you easy, immediate, and customized access to all programs for L&lt;sup&gt;A&lt;/sup&gt;T&lt;sub&gt;E&lt;/sub&gt;X code completion, compiling, postprocessing, debugging, conversion and viewing tools; you also get very handy wizards, a L&lt;sup&gt;A&lt;/sup&gt;T&lt;sub&gt;E&lt;/sub&gt;X reference and a powerful project management." &lt;a href="http://kile.sourceforge.net/Documentation/html/introduction.html"&gt;Kile&lt;/a&gt;&lt;/span&gt;
	&lt;/p&gt;&lt;h2&gt;TeXPoint
&lt;/h2&gt;&lt;p&gt;&lt;a href="http://texpoint.necula.org/index.html"&gt;&lt;img src="/images/www_charlesrcook_com/042512_2006_Someessenti4.png" alt="" border="0" /&gt;&lt;/a&gt;
	&lt;/p&gt;&lt;p&gt;TexPoint is a very useful tool for including equations and LaTeX content within PowerPoint presentations.  The website is not the most impressive, but the add-in for PowerPoint makes including equations in a presentation remarkably simple and beautiful.  You can edit the equations in place using LaTeX markup.  This is far superior to MathML and other visual equation editors out there.  You can copy your equations from your thesis directly into your presentation with high quality images.
&lt;/p&gt;&lt;h1&gt;Mendely
&lt;/h1&gt;&lt;p&gt;&lt;img src="/images/www_charlesrcook_com/042512_2006_Someessenti5.png" alt="" /&gt;
	&lt;/p&gt;&lt;p&gt;As a graduate student, you will go through dozens if not hundreds of articles and papers in PDF form.  &lt;a href="http://www.mendeley.com/"&gt;Mendeley&lt;/a&gt;, simply put, makes this manageable.  It automatically creates the citations for your PDFs and allows you to organize, annotate and highlight your documents.  It's also a social service, so you may use it to collaborate with your peers.  Further, the citations are given in LaTeX format so that it is highly compatible with the above mentioned tools.
&lt;/p&gt;&lt;p style="margin-left: 36pt"&gt;&lt;span style="background-color:white"&gt;"Mendeley is a free&lt;span style="color:#333333"&gt; &lt;strong&gt;reference manager&lt;/strong&gt; &lt;/span&gt;and&lt;span style="color:#333333"&gt; &lt;strong&gt;academic social network&lt;/strong&gt; &lt;/span&gt;that can help you organize your research, collaborate with others online, and discover the latest research." &lt;a href="http://www.mendeley.com/"&gt;Mendeley&lt;/a&gt;&lt;/span&gt;
	&lt;/p&gt;&lt;h1&gt;Grammarly
&lt;/h1&gt;&lt;p&gt;&lt;a href="http://www.grammarly.com/"&gt;&lt;img src="/images/www_charlesrcook_com/042512_2006_Someessenti6.png" alt="" border="0" /&gt;&lt;/a&gt;
	&lt;/p&gt;&lt;p&gt;As an engineering graduate student, my grammar could always use some help.  Grammarly is like a very powerful spell-check in Microsoft Word.  It is compatible with LaTeX code and is targeted towards Academics.  It even detects any accidental plagiarism.  It is exceptional at telling you WHY your sentences are broken instead of just auto correcting.
&lt;/p&gt;&lt;p&gt;&lt;span style="background-color:white"&gt;"Grammarly is an automated proofreader and your personal grammar coach. Check your writing for grammar, punctuation, style and much more." &lt;a href="http://www.grammarly.com/"&gt;Grammarly&lt;/a&gt;&lt;/span&gt;
	&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;Give these tools a try; all but Grammarly and TeXPoint are free.  &lt;/p&gt;&lt;img src="http://www.charlesrcook.com/aggbug/71.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Rodbourn</dc:creator>
            <guid>http://www.charlesrcook.com/archive/2012/04/25/some-essential-tools-for-new-graduate-students.aspx</guid>
            <pubDate>Wed, 25 Apr 2012 20:06:28 GMT</pubDate>
            <comments>http://www.charlesrcook.com/archive/2012/04/25/some-essential-tools-for-new-graduate-students.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://www.charlesrcook.com/comments/commentRss/71.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Simple method to constrain stored procedures by a collection</title>
            <category>Web Programming</category>
            <link>http://www.charlesrcook.com/archive/2012/04/07/simple-method-to-constrain-stored-procedures-by-a-collection.aspx</link>
            <description>&lt;p&gt;Passing a collection of ID's to filter a SQL query within a stored procedure is not natively supported.  Consider &lt;a href="http://vyaskn.tripod.com/passing_arrays_to_stored_procedures.htm"&gt;this article&lt;/a&gt; which discusses methods for passing arrays into a stored procedure.
&lt;/p&gt;&lt;p&gt;Constraining a stored procedure's query has a simple work around, however.  Passing the ID collection as a comma deliminated string allows the query to use LIKE to constrain the results.  Note that the preceding and trailing commas are necessary.  An example demonstrates how to do this easily.
&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:blue"&gt;DECLARE&lt;/span&gt; @Ids &lt;span style="color:blue"&gt;varchar&lt;span style="color:gray"&gt;(&lt;span style="color:fuchsia"&gt;max&lt;span style="color:gray"&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:blue"&gt;set&lt;/span&gt; @Ids &lt;span style="color:gray"&gt;=&lt;/span&gt;
			&lt;span style="color:red"&gt;',1,2,3,4,5,'&lt;span style="color:gray"&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;&lt;span style="color:blue"&gt;Select&lt;/span&gt;
			&lt;span style="color:gray"&gt;*&lt;/span&gt;
			&lt;span style="color:blue"&gt;from&lt;/span&gt; [TableName]
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New; font-size:10pt"&gt;    &lt;span style="color:blue"&gt;WHERE&lt;/span&gt; @Ids &lt;span style="color:gray"&gt;LIKE&lt;span style="color:blue"&gt;
					&lt;span style="color:gray"&gt;(&lt;span style="color:red"&gt;'%,'&lt;/span&gt; +&lt;/span&gt;
					&lt;span style="color:fuchsia"&gt;cast&lt;span style="color:gray"&gt;(&lt;/span&gt;TableID &lt;span style="color:blue"&gt;as&lt;/span&gt;
						&lt;span style="color:blue"&gt;varchar&lt;span style="color:gray"&gt;(&lt;/span&gt;50&lt;span style="color:gray"&gt;))&lt;/span&gt;
							&lt;span style="color:gray"&gt;+&lt;/span&gt;
							&lt;span style="color:red"&gt;',%'&lt;span style="color:gray"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;img src="http://www.charlesrcook.com/aggbug/70.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Rodbourn</dc:creator>
            <guid>http://www.charlesrcook.com/archive/2012/04/07/simple-method-to-constrain-stored-procedures-by-a-collection.aspx</guid>
            <pubDate>Sat, 07 Apr 2012 20:12:00 GMT</pubDate>
            <comments>http://www.charlesrcook.com/archive/2012/04/07/simple-method-to-constrain-stored-procedures-by-a-collection.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://www.charlesrcook.com/comments/commentRss/70.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Adding an existing folder to a visual studio project</title>
            <link>http://www.charlesrcook.com/archive/2012/02/02/adding-an-existing-folder-to-a-visual-studio-project.aspx</link>
            <description>&lt;p&gt;Including existing files in Visual Studio is easily performed by right clicking a folder and selecting 'add existing item', however, there is not a 'add existing folder' option.
&lt;/p&gt;&lt;p&gt;The solution is quite simple, but not as hinted by the existence of 'add exiting item'.  Simply click the 'Show all files' button at the top of the Solution Explorer and right click the folder desired and select 'include in project'.
&lt;/p&gt;&lt;p&gt;The process is simple enough, but a bit obscure due to the presence of 'add existing item'.
&lt;/p&gt;&lt;img src="http://www.charlesrcook.com/aggbug/69.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Rodbourn</dc:creator>
            <guid>http://www.charlesrcook.com/archive/2012/02/02/adding-an-existing-folder-to-a-visual-studio-project.aspx</guid>
            <pubDate>Thu, 02 Feb 2012 17:07:40 GMT</pubDate>
            <comments>http://www.charlesrcook.com/archive/2012/02/02/adding-an-existing-folder-to-a-visual-studio-project.aspx#feedback</comments>
            <wfw:commentRss>http://www.charlesrcook.com/comments/commentRss/69.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Extrapolate Errors for p&gt;3</title>
            <category>Technical Computing</category>
            <link>http://www.charlesrcook.com/archive/2011/12/03/extrapolate-errors-for-p3.aspx</link>
            <description>&lt;p&gt;Running some test cases pointed out that the extrapolation from first order Lagrange basis functions to those higher than third order cubic Lagrange basis functions were in error.  The extrapolated functions had high degrees of oscillations.  The bug has been&lt;a href="https://answers.launchpad.net/dolfin/+question/180447"&gt; reported to the developers&lt;/a&gt;.  They have put in a check so that the first release will throw an error instead of attempting an extrapolation.
&lt;/p&gt;&lt;p&gt;So it's back to traditional interpolation methods.  Keep this in mind when viewing the code from the last two posts.&lt;/p&gt;&lt;img src="http://www.charlesrcook.com/aggbug/68.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Rodbourn</dc:creator>
            <guid>http://www.charlesrcook.com/archive/2011/12/03/extrapolate-errors-for-p3.aspx</guid>
            <pubDate>Sun, 04 Dec 2011 04:45:33 GMT</pubDate>
            <comments>http://www.charlesrcook.com/archive/2011/12/03/extrapolate-errors-for-p3.aspx#feedback</comments>
            <wfw:commentRss>http://www.charlesrcook.com/comments/commentRss/68.aspx</wfw:commentRss>
        </item>
        <item>
            <title>A C++ Interpolation Class for Tabled Data</title>
            <category>Technical Computing</category>
            <link>http://www.charlesrcook.com/archive/2011/11/29/a-c-interpolation-class-for-tabled-data.aspx</link>
            <description>&lt;p&gt;I have wrapped the interpolation method using the Fenics Project into a template class.  The class is template on the interpolation basis function so that the user may choose the order of interpolation.  The class also contains an array of y values so that it may serve as a table of values.  Part of this is a map to the variable name for convenience when calling for tabled values.
&lt;/p&gt;&lt;p&gt;Since all the work goes into extrapolating to a higher basis function when the Constructor is called, lookups are cheap to retrieve.  The cost should be about the level of evaluating a polynomial of the order of the interpolation level (since the weights are known).
&lt;/p&gt;&lt;p&gt;An example of it being used:
&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p style="background: white" /&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color:black; font-family:Consolas"&gt;    boost::shared_ptr&amp;lt;Vector&amp;gt; xs (&lt;span style="color:blue"&gt;new&lt;span style="color:black"&gt; Vector(n));
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="background: white" /&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color:black; font-family:Consolas"&gt;    boost::shared_ptr&amp;lt;Vector&amp;gt; ys1 (&lt;span style="color:blue"&gt;new&lt;span style="color:black"&gt; Vector(n));
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="background: white" /&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color:black; font-family:Consolas"&gt;    boost::shared_ptr&amp;lt;Vector&amp;gt; ys2 (&lt;span style="color:blue"&gt;new&lt;span style="color:black"&gt; Vector(n));
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white" /&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color:black; font-family:Consolas"&gt;    std::vector&amp;lt;boost::shared_ptr&amp;lt;Vector&amp;gt; &amp;gt; yss;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="background: white" /&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color:black; font-family:Consolas"&gt;    std::vector&amp;lt;string&amp;gt; names;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white" /&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color:black; font-family:Consolas"&gt;    &lt;span style="color:green"&gt;// Populate test data&lt;span style="color:black"&gt;
						&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="background: white" /&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color:black; font-family:Consolas"&gt;    &lt;span style="color:blue"&gt;for&lt;span style="color:black"&gt;(&lt;span style="color:blue"&gt;int&lt;span style="color:black"&gt; i=0; i&amp;lt;n; i++)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="background: white" /&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color:black; font-family:Consolas"&gt;    {
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="background: white" /&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color:black; font-family:Consolas"&gt;        xs-&amp;gt;setitem(i,i+i*0.1);
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="background: white" /&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color:black; font-family:Consolas"&gt;        ys1-&amp;gt;setitem(i,(*xs)[i]*(*xs)[i]);
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="background: white" /&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color:black; font-family:Consolas"&gt;        ys2-&amp;gt;setitem(i,(*xs)[i]*(*xs)[i]*(*xs)[i]);
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="background: white" /&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color:black; font-family:Consolas"&gt;    }
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white" /&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color:black; font-family:Consolas"&gt;    yss.push_back(ys1);
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="background: white" /&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color:black; font-family:Consolas"&gt;    names.push_back(&lt;span style="color:#a31515"&gt;"squared"&lt;span style="color:black"&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white" /&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color:black; font-family:Consolas"&gt;    yss.push_back(ys2);
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="background: white" /&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color:black; font-family:Consolas"&gt;    names.push_back(&lt;span style="color:#a31515"&gt;"cubed"&lt;span style="color:black"&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white" /&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color:black; font-family:Consolas"&gt;    InterpolationTable&amp;lt;Interpolate3::FunctionSpace&amp;gt; interpTable (xs, yss, names);
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white" /&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color:black; font-family:Consolas"&gt;    std::cout &amp;lt;&amp;lt; interpTable.eval(0,2.12) &amp;lt;&amp;lt; &lt;span style="color:#a31515"&gt;"\t"&lt;span style="color:black"&gt; &amp;lt;&amp;lt; interpTable.eval(&lt;span style="color:#a31515"&gt;"squared"&lt;span style="color:black"&gt;,2.12) &amp;lt;&amp;lt; &lt;span style="color:#a31515"&gt;"\n"&lt;span style="color:black"&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style="background: white" /&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="color:black; font-family:Consolas"&gt;    std::cout &amp;lt;&amp;lt; interpTable.eval(1,2.12) &amp;lt;&amp;lt; &lt;span style="color:#a31515"&gt;"\t"&lt;span style="color:black"&gt; &amp;lt;&amp;lt; interpTable.eval(&lt;span style="color:#a31515"&gt;"cubed"&lt;span style="color:black"&gt;,2.12) &amp;lt;&amp;lt; &lt;span style="color:#a31515"&gt;"\n"&lt;span style="color:black"&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;The code listing:
&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// InterpolationTable.h&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// Class for interpolating tabled values using the Fenics Project.&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// Charles R. Cook  v1.0  29 Nov 2011&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// Copyright (c) 2011 Charles R. Cook&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// http://www.charlesrcook.com&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;//&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// Permission is hereby granted, free of charge, to any person obtaining a copy&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// of this software and associated documentation files (the "Software"), to&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// deal in the Software without restriction, including without limitation the&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// sell copies of the Software, and to permit persons to whom the Software is&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// furnished to do so, subject to the following conditions:&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;//&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// The above copyright notice and this permission notice shall be included in&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// all copies or substantial portions of the Software.&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;//&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// IN THE SOFTWARE.&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:blue; font-family:Consolas; font-size:10pt"&gt;#ifndef&lt;span style="color:black"&gt; _INTERPOLATIONTABLE_H
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:blue; font-family:Consolas; font-size:10pt"&gt;#define&lt;span style="color:black"&gt; _INTERPOLATIONTABLE_H
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:blue; font-family:Consolas; font-size:10pt"&gt;#include&lt;span style="color:black"&gt; &lt;span style="color:#a31515"&gt;&amp;lt;dolfin.h&amp;gt;&lt;span style="color:black"&gt;
					&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:blue; font-family:Consolas; font-size:10pt"&gt;#include&lt;span style="color:black"&gt; &lt;span style="color:#a31515"&gt;"Interpolate1.h"&lt;span style="color:black"&gt;
					&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:blue; font-family:Consolas; font-size:10pt"&gt;#include&lt;span style="color:black"&gt; &lt;span style="color:#a31515"&gt;"Interpolate2.h"&lt;span style="color:black"&gt;
					&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:blue; font-family:Consolas; font-size:10pt"&gt;#include&lt;span style="color:black"&gt; &lt;span style="color:#a31515"&gt;"Interpolate3.h"&lt;span style="color:black"&gt;
					&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:blue; font-family:Consolas; font-size:10pt"&gt;#include&lt;span style="color:black"&gt; &lt;span style="color:#a31515"&gt;"Interpolate4.h"&lt;span style="color:black"&gt;
					&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:blue; font-family:Consolas; font-size:10pt"&gt;using&lt;span style="color:black"&gt; &lt;span style="color:blue"&gt;namespace&lt;span style="color:black"&gt; dolfin;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:blue; font-family:Consolas; font-size:10pt"&gt;template&lt;span style="color:black"&gt; &amp;lt;&lt;span style="color:blue"&gt;class&lt;span style="color:black"&gt; TFunctionSpace&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:blue; font-family:Consolas; font-size:10pt"&gt;class&lt;span style="color:black"&gt; InterpolationTable
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;{
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:blue; font-family:Consolas; font-size:10pt"&gt;public&lt;span style="color:black"&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    InterpolationTable(boost::shared_ptr&amp;lt;Vector&amp;gt; xs_in,
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;            std::vector&amp;lt;boost::shared_ptr&amp;lt;Vector&amp;gt; &amp;gt; ys_in);
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    InterpolationTable(boost::shared_ptr&amp;lt;Vector&amp;gt; xs_in,
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;            std::vector&amp;lt;boost::shared_ptr&amp;lt;Vector&amp;gt; &amp;gt; ys_in,
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;            std::vector&amp;lt;std::string&amp;gt; names_in);
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    &lt;span style="color:blue"&gt;double&lt;span style="color:black"&gt; eval(&lt;span style="color:blue"&gt;int&lt;span style="color:black"&gt; index, &lt;span style="color:blue"&gt;double&lt;span style="color:black"&gt; x);
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    &lt;span style="color:blue"&gt;double&lt;span style="color:black"&gt; eval(std::string name, &lt;span style="color:blue"&gt;double&lt;span style="color:black"&gt; x);
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    &lt;span style="color:green"&gt;// These vectors contain the raw data&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    boost::shared_ptr&amp;lt;Vector&amp;gt; xs;
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    boost::shared_ptr&amp;lt;std::vector&amp;lt;boost::shared_ptr&amp;lt;Vector&amp;gt; &amp;gt; &amp;gt; ys;
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    &lt;span style="color:green"&gt;// The mesh (defined as nodes at x locations)&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    boost::shared_ptr&amp;lt;Mesh&amp;gt; mesh;
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    boost::shared_ptr&amp;lt;Interpolate1::FunctionSpace&amp;gt; V1;
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    boost::shared_ptr&amp;lt;TFunctionSpace&amp;gt; V2;
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    boost::shared_ptr&amp;lt;std::vector&amp;lt;Function&amp;gt; &amp;gt; fy1;
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    boost::shared_ptr&amp;lt;std::vector&amp;lt;Function&amp;gt; &amp;gt; fy2;
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    boost::shared_ptr&amp;lt;std::vector&amp;lt;std::string&amp;gt; &amp;gt; Names;
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:blue; font-family:Consolas; font-size:10pt"&gt;private&lt;span style="color:black"&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    &lt;span style="color:blue"&gt;void&lt;span style="color:black"&gt; Setup(boost::shared_ptr&amp;lt;Vector&amp;gt; xs_in,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;            std::vector&amp;lt;boost::shared_ptr&amp;lt;Vector&amp;gt; &amp;gt; ys_in);
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    boost::shared_ptr&amp;lt;std::map&amp;lt;std::string,&lt;span style="color:blue"&gt;int&lt;span style="color:black"&gt;&amp;gt; &amp;gt; mapping;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;};
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:blue; font-family:Consolas; font-size:10pt"&gt;template&lt;span style="color:black"&gt; &amp;lt;&lt;span style="color:blue"&gt;class&lt;span style="color:black"&gt; TFunctionSpace&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:blue; font-family:Consolas; font-size:10pt"&gt;double&lt;span style="color:black"&gt; InterpolationTable&amp;lt;TFunctionSpace&amp;gt;::eval(
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;        std::string name, &lt;span style="color:blue"&gt;double&lt;span style="color:black"&gt; x)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;{
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    &lt;span style="color:blue"&gt;if&lt;span style="color:black"&gt;((*Names).size()==0)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;        &lt;span style="color:blue"&gt;throw&lt;span style="color:black"&gt; (&lt;span style="color:#a31515"&gt;"names not defined"&lt;span style="color:black"&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    &lt;span style="color:green"&gt;// check key exists in map&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    &lt;span style="color:blue"&gt;if&lt;span style="color:black"&gt; ((*mapping).find(name) == (*mapping).end() )
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;        &lt;span style="color:blue"&gt;throw&lt;span style="color:black"&gt; (&lt;span style="color:#a31515"&gt;"name was not found"&lt;span style="color:black"&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    &lt;span style="color:blue"&gt;int&lt;span style="color:black"&gt; index = (*mapping)[name];
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    &lt;span style="color:blue"&gt;return&lt;span style="color:black"&gt; eval(index, x);
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;}
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:blue; font-family:Consolas; font-size:10pt"&gt;template&lt;span style="color:black"&gt; &amp;lt;&lt;span style="color:blue"&gt;class&lt;span style="color:black"&gt; TFunctionSpace&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:blue; font-family:Consolas; font-size:10pt"&gt;double&lt;span style="color:black"&gt; InterpolationTable&amp;lt;TFunctionSpace&amp;gt;::eval(
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;        &lt;span style="color:blue"&gt;int&lt;span style="color:black"&gt; index, &lt;span style="color:blue"&gt;double&lt;span style="color:black"&gt; x)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;{
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    &lt;span style="color:blue"&gt;if&lt;span style="color:black"&gt;(index &amp;gt;= (*ys).size())
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;        &lt;span style="color:blue"&gt;throw&lt;span style="color:black"&gt; (&lt;span style="color:#a31515"&gt;"index out of range"&lt;span style="color:black"&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    &lt;span style="color:blue"&gt;if&lt;span style="color:black"&gt;(x &amp;lt; mesh-&amp;gt;coordinates()[0] ||
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;            x &amp;gt; mesh-&amp;gt;coordinates()[(*mesh).num_cells()])
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;        &lt;span style="color:blue"&gt;throw&lt;span style="color:black"&gt; (&lt;span style="color:#a31515"&gt;"x location out of range"&lt;span style="color:black"&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    &lt;span style="color:blue"&gt;return&lt;span style="color:black"&gt; (*fy2)[index](x);
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;}
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:blue; font-family:Consolas; font-size:10pt"&gt;template&lt;span style="color:black"&gt; &amp;lt;&lt;span style="color:blue"&gt;class&lt;span style="color:black"&gt; TFunctionSpace&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:blue; font-family:Consolas; font-size:10pt"&gt;void&lt;span style="color:black"&gt; InterpolationTable&amp;lt;TFunctionSpace&amp;gt;::Setup(
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;        boost::shared_ptr&amp;lt;Vector&amp;gt; xs_in,
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;        std::vector&amp;lt;boost::shared_ptr&amp;lt;Vector&amp;gt; &amp;gt; ys_in)
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;{
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    &lt;span style="color:green"&gt;// copy the x locations in&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    xs = xs_in;
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    &lt;span style="color:green"&gt;// copy the data in&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    &lt;span style="color:blue"&gt;for&lt;span style="color:black"&gt; (uint i=0; i&amp;lt;ys_in.size(); i++)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    {
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;        (*ys)[i] = ys_in[i];
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    }
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    &lt;span style="color:green"&gt;// Setup the mesh to interpolate on&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    &lt;span style="color:green"&gt;// Note the count is the number of elements, not nodes&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    &lt;span style="color:green"&gt;//  when the interval is constructed&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    &lt;span style="color:blue"&gt;for&lt;span style="color:black"&gt;(uint i=0; i&amp;lt;xs-&amp;gt;size(); i++)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;        mesh-&amp;gt;coordinates()[i] = (*xs)[i];
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    &lt;span style="color:green"&gt;// Setup the Function space(s)&lt;span style="color:black"&gt;
				&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    &lt;span style="color:blue"&gt;for&lt;span style="color:black"&gt; (uint i=0; i&amp;lt;ys-&amp;gt;size(); i++)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    {
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;        Function fv1(V1,(*ys)[i]);
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;        fy1-&amp;gt;push_back(fv1);
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;        Function fv2(V2);
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;        fv2.extrapolate(fv1);
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;        fy2-&amp;gt;push_back(fv2);
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    }
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;}
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:blue; font-family:Consolas; font-size:10pt"&gt;template&lt;span style="color:black"&gt; &amp;lt;&lt;span style="color:blue"&gt;class&lt;span style="color:black"&gt; TFunctionSpace&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;InterpolationTable&amp;lt;TFunctionSpace&amp;gt;::InterpolationTable(boost::shared_ptr&amp;lt;Vector&amp;gt; xs_in,
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;        std::vector&amp;lt;boost::shared_ptr&amp;lt;Vector&amp;gt; &amp;gt; ys_in,
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;        std::vector&amp;lt;std::string&amp;gt; names_in) :
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;            xs(&lt;span style="color:blue"&gt;new&lt;span style="color:black"&gt; Vector(xs_in-&amp;gt;size())),
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;            ys(&lt;span style="color:blue"&gt;new&lt;span style="color:black"&gt; std::vector&amp;lt;boost::shared_ptr&amp;lt;Vector&amp;gt; &amp;gt; (ys_in.size())),
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;            mesh(&lt;span style="color:blue"&gt;new&lt;span style="color:black"&gt; Interval(xs_in-&amp;gt;size()-1,0,1)),
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;            V1(&lt;span style="color:blue"&gt;new&lt;span style="color:black"&gt; Interpolate1::FunctionSpace(mesh)),
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;            V2(&lt;span style="color:blue"&gt;new&lt;span style="color:black"&gt; TFunctionSpace(mesh)),
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;            fy1(&lt;span style="color:blue"&gt;new&lt;span style="color:black"&gt; std::vector&amp;lt;Function&amp;gt;),
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;            fy2(&lt;span style="color:blue"&gt;new&lt;span style="color:black"&gt; std::vector&amp;lt;Function&amp;gt;),
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;            Names(&lt;span style="color:blue"&gt;new&lt;span style="color:black"&gt; std::vector&amp;lt;std::string&amp;gt;),
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;            mapping(&lt;span style="color:blue"&gt;new&lt;span style="color:black"&gt; std::map&amp;lt;std::string, &lt;span style="color:blue"&gt;int&lt;span style="color:black"&gt;&amp;gt;)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;{
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    Setup(xs_in, ys_in);
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    (*Names) = names_in;
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    &lt;span style="color:blue"&gt;for&lt;span style="color:black"&gt;(uint i=0; i &amp;lt; (*Names).size(); i++)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;        (*mapping)[(*Names)[i]] = i;
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;}
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:blue; font-family:Consolas; font-size:10pt"&gt;template&lt;span style="color:black"&gt; &amp;lt;&lt;span style="color:blue"&gt;class&lt;span style="color:black"&gt; TFunctionSpace&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;InterpolationTable&amp;lt;TFunctionSpace&amp;gt;::InterpolationTable(boost::shared_ptr&amp;lt;Vector&amp;gt; xs_in,
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;        std::vector&amp;lt;boost::shared_ptr&amp;lt;Vector&amp;gt; &amp;gt; ys_in) :
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;            xs(&lt;span style="color:blue"&gt;new&lt;span style="color:black"&gt; Vector(xs_in-&amp;gt;size())),
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;            ys(&lt;span style="color:blue"&gt;new&lt;span style="color:black"&gt; std::vector&amp;lt;boost::shared_ptr&amp;lt;Vector&amp;gt; &amp;gt; (ys_in.size())),
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;            mesh(&lt;span style="color:blue"&gt;new&lt;span style="color:black"&gt; Interval(xs_in-&amp;gt;size()-1,0,1)),
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;            V1(&lt;span style="color:blue"&gt;new&lt;span style="color:black"&gt; Interpolate1::FunctionSpace(mesh)),
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;            V2(&lt;span style="color:blue"&gt;new&lt;span style="color:black"&gt; TFunctionSpace(mesh)),
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;            fy1(&lt;span style="color:blue"&gt;new&lt;span style="color:black"&gt; std::vector&amp;lt;Function&amp;gt;),
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;            fy2(&lt;span style="color:blue"&gt;new&lt;span style="color:black"&gt; std::vector&amp;lt;Function&amp;gt;),
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;            Names(&lt;span style="color:blue"&gt;new&lt;span style="color:black"&gt; std::vector&amp;lt;std::string&amp;gt;),
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;            mapping(&lt;span style="color:blue"&gt;new&lt;span style="color:black"&gt; std::map&amp;lt;std::string, &lt;span style="color:blue"&gt;int&lt;span style="color:black"&gt;&amp;gt;)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;{
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    Setup(xs_in, ys_in);
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;}
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:blue; font-family:Consolas; font-size:10pt"&gt;#endif&lt;span style="color:black"&gt; &lt;span style="color:green"&gt;/* _INTERPOLATIONTABLE_H */&lt;span style="color:black"&gt;
					&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;
		&lt;/span&gt; &lt;/p&gt;&lt;img src="http://www.charlesrcook.com/aggbug/67.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Rodbourn</dc:creator>
            <guid>http://www.charlesrcook.com/archive/2011/11/29/a-c-interpolation-class-for-tabled-data.aspx</guid>
            <pubDate>Tue, 29 Nov 2011 17:27:17 GMT</pubDate>
            <comments>http://www.charlesrcook.com/archive/2011/11/29/a-c-interpolation-class-for-tabled-data.aspx#feedback</comments>
            <slash:comments>27</slash:comments>
            <wfw:commentRss>http://www.charlesrcook.com/comments/commentRss/67.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Interpolation/Curve Fitting in C++ with the Fenics Project in 1D, 2D and 3D</title>
            <category>Technical Computing</category>
            <link>http://www.charlesrcook.com/archive/2011/11/23/interpolationcurve-fitting-in-c-with-the-fenics-project-in-1d.aspx</link>
            <description>&lt;p&gt;My recent research has been with the &lt;a href="http://fenicsproject.org/"&gt;Fenics Project&lt;/a&gt;, which is an amazing finite element project.  In general it provides the tools needed to solve differential equations with the finite element method.  For some examples check out their website and view the demos and applications (my interest is in CFD).
&lt;/p&gt;&lt;p&gt;In my particular code I need to interpolate tabulated properties (steam tables) with some reasonable level of accuracy.  The solution in MATLAB is straight forward, call interp1:
&lt;/p&gt;&lt;p&gt;&lt;span style="color:black; font-family:Courier New"&gt;&lt;span style="font-size:10pt"&gt;y_i = interp1(xs, ys, x_i, &lt;span style="color:#a020f0"&gt;'cubic'&lt;span style="color:black"&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12pt"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;Where xs and ys are vectors of known x and y values and y_i is the interpolated value at x_i.  
&lt;/p&gt;&lt;p&gt;The code I am working on is already using the Fenics Project to solve a set of PDEs, so I wanted to see if I could use it for the interpolation as well through the finite element's basis functions.  As the title of this post indicates, it can be done and here is how through a code snippet.
&lt;/p&gt;&lt;p&gt;In C++…
&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// Setup data vectors&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;Vector xs(n);
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;Vector ys(n);
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// Populate test data (this would be the tabulated data)&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:blue; font-family:Consolas; font-size:10pt"&gt;for&lt;span style="color:black"&gt;(&lt;span style="color:blue"&gt;int&lt;span style="color:black"&gt; i=0; i&amp;lt;n; i++)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;{
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    xs.setitem(i,i+i*0.1);
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    ys.setitem(i,xs[i]*xs[i]);
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;}
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// Setup the mesh to interpolate on&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// Note the count is the number of elements, not nodes.
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// there are general n-1 elements than nodes.&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;Interval mesh (n-1,0,1);
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:blue; font-family:Consolas; font-size:10pt"&gt;for&lt;span style="color:black"&gt;(&lt;span style="color:blue"&gt;int&lt;span style="color:black"&gt; i=0; i&amp;lt;n; i++)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;    mesh.coordinates()[i] = xs[i];
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// create the function space of order one.&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// this is done so that dof maps directly to&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// data points.  This provides a linear interpolation.&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;Interpolate1::FunctionSpace V (mesh);
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// copy the data into the function space&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;Function fy (V, ys);
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// Create quadratic function space (quadratic interpolation)&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;Interpolate2::FunctionSpace V2 (mesh);
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;Function fy2 (V2);
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// 'fit' to the quadratic basis functions through least squares&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;fy2.extrapolate(fy);
&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;
 &lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:green; font-family:Consolas; font-size:10pt"&gt;// The fitted function is now available in fy2 as a quadratic fit&lt;span style="color:black"&gt;
			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;std::cout &amp;lt;&amp;lt; &lt;span style="color:#a31515"&gt;"O(1): "&lt;span style="color:black"&gt; &amp;lt;&amp;lt; fy(2)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;        &amp;lt;&amp;lt; &lt;span style="color:#a31515"&gt;"\tO(2): "&lt;span style="color:black"&gt; &amp;lt;&amp;lt; fy2(2)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="background: white"&gt;&lt;span style="color:black; font-family:Consolas; font-size:10pt"&gt;        &amp;lt;&amp;lt; &lt;span style="color:#a31515"&gt;"\n"&lt;span style="color:black"&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;  
 &lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;Note that two UFL files (form files) are needed for this snippet.
&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;Interpolate1.ufl
&lt;/p&gt;&lt;p&gt;# First order (linear) lagrange elements (polynomials)
&lt;/p&gt;&lt;p&gt;element = FiniteElement("Lagrange", interval, 1)
&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;Interpolate2.ufl
&lt;/p&gt;&lt;p&gt;# Second order lagrange elements (polynomials)
&lt;/p&gt;&lt;p&gt;element = FiniteElement("Lagrange", interval, 2)
&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;To create higher order fitting you can change the element to be of the desired order (instead of 2).
&lt;/p&gt;&lt;p&gt;The very nice feature of interpolation through this method is that it will work in two dimensions and three dimensions as well.  To do so, the elements would be updated to 2-d or 3-d element types instead of 'interval' (say triangle or tetrahedral).  &lt;strong&gt;Too cool&lt;/strong&gt;!
&lt;/p&gt;&lt;img src="http://www.charlesrcook.com/aggbug/66.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Rodbourn</dc:creator>
            <guid>http://www.charlesrcook.com/archive/2011/11/23/interpolationcurve-fitting-in-c-with-the-fenics-project-in-1d.aspx</guid>
            <pubDate>Wed, 23 Nov 2011 21:07:43 GMT</pubDate>
            <comments>http://www.charlesrcook.com/archive/2011/11/23/interpolationcurve-fitting-in-c-with-the-fenics-project-in-1d.aspx#feedback</comments>
            <wfw:commentRss>http://www.charlesrcook.com/comments/commentRss/66.aspx</wfw:commentRss>
        </item>
        <item>
            <title>A bit more on the personal side …</title>
            <link>http://www.charlesrcook.com/archive/2011/11/22/a-bit-more-on-the-personal-side.aspx</link>
            <description>&lt;p&gt;The posts so far have been rather technical in nature, but this post is a bit different.  It's a bit more personal as I am sharing my recent &lt;strong&gt;engagement&lt;/strong&gt; to my amazing fiancée &lt;strong&gt;Kristy&lt;/strong&gt;.  
&lt;/p&gt;&lt;p&gt;It's an exciting time and I can't wait to see what's down the road for us.  We have started planning for the wedding which is roughly two years out.  The process is being well documented on her blog, &lt;a href="http://idotimes2.blogspot.com/"&gt;I Do Times Two&lt;/a&gt;.  
&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p style="text-align: center"&gt;&lt;img src="/images/www_charlesrcook_com/112311_0142_Abitmoreont1.jpg" alt="" /&gt;&lt;br /&gt;&lt;a href="http://www.freedigitalphotos.net/images/view_photog.php?photogid=1962"&gt;image source&lt;/a&gt;&lt;/p&gt;&lt;img src="http://www.charlesrcook.com/aggbug/65.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Rodbourn</dc:creator>
            <guid>http://www.charlesrcook.com/archive/2011/11/22/a-bit-more-on-the-personal-side.aspx</guid>
            <pubDate>Wed, 23 Nov 2011 01:42:34 GMT</pubDate>
            <comments>http://www.charlesrcook.com/archive/2011/11/22/a-bit-more-on-the-personal-side.aspx#feedback</comments>
            <slash:comments>46</slash:comments>
            <wfw:commentRss>http://www.charlesrcook.com/comments/commentRss/65.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Update Summer 2011</title>
            <category>School</category>
            <category>Web Programming</category>
            <link>http://www.charlesrcook.com/archive/2011/06/20/update-summer-2011.aspx</link>
            <description>&lt;p&gt;I have been lax in updating posts on the blog.  Mostly this is because I have been transitioning from web development to my Ph.D. research work in Aerospace Engineering over the last two or so years.  The topic of the blog thus far has been mostly web development related, with less significant posts on the topic recently.&lt;/p&gt;  &lt;p&gt;I’ve decided to transition the blog into my current focus, research, as my personal focus has also shifted (it is a personal blog after all).  As part of this I have updated the blog engine itself (&lt;a href="http://subtextproject.com/" target="_blank"&gt;subtext&lt;/a&gt;).  Many thanks to those at subtext for maintaining a blog so well that after three years of update neglect an automated update script goes flawlessly!&lt;/p&gt;  &lt;p&gt;Over the past couple of years I have worked with gravity currents for my Masters research in Aerospace Engineering.  Some of the research effort was spent in Davos, Switzerland at &lt;a href="http://www.slf.ch/english_EN" target="_blank"&gt;WSL SFL&lt;/a&gt; (Summer 2010).  I earned my MS this last May (2011), and am starting a new research project for my Ph.D. on Cryogenic Thermal and Fluid Physics.  My focus is as one might imagine computational.  I’m looking forward to delving deeply into the topic over the next few years.&lt;/p&gt;  &lt;p&gt;More to come!&lt;/p&gt;&lt;img src="http://www.charlesrcook.com/aggbug/64.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Rodbourn</dc:creator>
            <guid>http://www.charlesrcook.com/archive/2011/06/20/update-summer-2011.aspx</guid>
            <pubDate>Mon, 20 Jun 2011 19:18:37 GMT</pubDate>
            <comments>http://www.charlesrcook.com/archive/2011/06/20/update-summer-2011.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://www.charlesrcook.com/comments/commentRss/64.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>
