⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 blitz_4.html

📁 A C++ class library for scientific computing
💻 HTML
📖 第 1 页 / 共 4 页
字号:
These curl operators return three-dimensional <CODE>TinyVector</CODE>s of the appropriate numeric type:</P><P><DL COMPACT><DT><CODE>curl(Vx,Vy,Vz)</CODE><DD>2nd order curl operator using the central12 operator.  Factor: <EM>2h</EM><P><DT><CODE>curl4(Vx,Vy,Vz)</CODE><DD>4th order curl operator using the central14 operator.  Factor: <EM>12h</EM><P><DT><CODE>curl(V)</CODE><DD>2nd order curl operator on a 3D vector field (e.g.<CODE>Array&#60;TinyVector&#60;double,3&#62;,3&#62;</CODE>, using the central12 operator.  Factor:<EM>2h</EM><P><DT><CODE>curl4(V)</CODE><DD>4th order curl operator on a 3D vector field, using the central14 operator.Factor: <EM>12h</EM></DL><P>Note that the above are available in normalized versions <CODE>curln</CODE> and<CODE>curl4n</CODE>, which have factors of <CODE>h</CODE>.</P><P><HR SIZE="6"><A NAME="SEC117"></A><TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0><TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_4.html#SEC116"> &lt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_4.html#SEC118"> &gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_4.html#SEC119"> &lt;&lt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_4.html#SEC108"> Up </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_4.html#SEC119"> &gt;&gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz.html#SEC_Top">Top</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_toc.html#SEC_Contents">Contents</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_abt.html#SEC_About"> ? </A>]</TD></TR></TABLE><H3> 4.4.9 Divergence (<EM>nabla cdot</EM>) operators </H3><!--docid::SEC117::--><P>The divergence operators return a scalar value.</P><P><DL COMPACT><DT><CODE>div(Vx,Vy)</CODE><DD>2nd order div operator using the central12 operator.  Factor: <EM>2h</EM><P><DT><CODE>div4(Vx,Vy)</CODE><DD>4th order div operator using the central14 operator.  Factor: <EM>12h</EM><P><DT><CODE>div(Vx,Vy,Vz)</CODE><DD>2nd order div operator using the central12 operator.  Factor: <EM>2h</EM><P><DT><CODE>div4(Vx,Vy,Vz)</CODE><DD>4th order div operator using the central14 operator.  Factor: <EM>12h</EM><P><DT><CODE>div2D(V)</CODE><DD>2nd order div operator on a 2D vector field, using the central12 operator.Factor: <EM>2h</EM><P><DT><CODE>div2D4(V)</CODE><DD>2nd order div operator on a 2D vector field, using the central14 operator.Factor: <EM>12h</EM><P><DT><CODE>div3D(V)</CODE><DD>2nd order div operator on a 3D vector field, using the central12 operator.Factor: <EM>2h</EM><P><DT><CODE>div3D4(V)</CODE><DD>2nd order div operator on a 3D vector field using the central14 operator.Factor: <EM>12h</EM></DL><P>These are available in normalized versions<CODE>divn</CODE>, <CODE>div4n</CODE>, <CODE>div2Dn</CODE>, <CODE>div2D4n</CODE>, <CODE>div3Dn</CODE>, and<CODE>div3D4n</CODE> which have factors of <EM>h</EM>.</P><P><HR SIZE="6"><A NAME="SEC118"></A><TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0><TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_4.html#SEC117"> &lt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_4.html#SEC119"> &gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_4.html#SEC110"> &lt;&lt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_4.html#SEC108"> Up </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_4.html#SEC119"> &gt;&gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz.html#SEC_Top">Top</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_toc.html#SEC_Contents">Contents</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_abt.html#SEC_About"> ? </A>]</TD></TR></TABLE><H3> 4.4.10 Mixed partial derivatives </H3><!--docid::SEC118::--><P><DL COMPACT><DT><CODE>mixed22(A,dim1,dim2)</CODE><DD>2nd order accurate, 2nd mixed partial derivative.  Factor: <EM>4h^2</EM><P><DT><CODE>mixed24(A,dim1,dim2)</CODE><DD>4th order accurate, 2nd mixed partial derivative.  Factor: <EM>144h^2</EM></DL><P>There are also normalized versions of the above, <CODE>mixed22n</CODE> and<CODE>mixed24n</CODE> which have factors <EM>h^2</EM>.</P><P><HR SIZE="6"><A NAME="SEC119"></A><TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0><TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_4.html#SEC118"> &lt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_4.html#SEC120"> &gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_4.html#SEC120"> &lt;&lt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_4.html#SEC104"> Up </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_5.html#SEC121"> &gt;&gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz.html#SEC_Top">Top</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_toc.html#SEC_Contents">Contents</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_abt.html#SEC_About"> ? </A>]</TD></TR></TABLE><H2> 4.5 Declaring your own stencil operators </H2><!--docid::SEC119::--><P>You can declare your own stencil operators using the macro<CODE>BZ_DECLARE_STENCIL_OPERATOR1</CODE>.  For example, here is the declarationof <CODE>Laplacian2D</CODE>:</P><P><TABLE><tr><td>&nbsp;</td><td class=example><pre>BZ_DECLARE_STENCIL_OPERATOR1(Laplacian2D, A)    return -4*A(0,0) + A(-1,0) + A(1,0) + A(0,-1) + A(0,1);BZ_END_STENCIL_OPERATOR</pre></td></tr></table></P><P>To declare a stencil operator on 3 operands, use the macro<CODE>BZ_DECLARE_STENCIL_OPERATOR3</CODE>.  Here is the declaration of <CODE>div</CODE>:</P><P><TABLE><tr><td>&nbsp;</td><td class=example><pre>BZ_DECLARE_STENCIL_OPERATOR3(div,vx,vy,vz)  return central12(vx,firstDim) + central12(vy,secondDim)    + central12(vz,thirdDim);BZ_END_STENCIL_OPERATOR</pre></td></tr></table></P><P>The macros aren't magical; they just declare an inline template functionwith the names and arguments you specify.  For example, the declaration of<CODE>div</CODE> could also be written</P><P><TABLE><tr><td>&nbsp;</td><td class=example><pre>template&#60;class T&#62;                              inline typename T::T_numtype div(T&#38; vx, T&#38; vy, T&#38; vz)   {  return central12(vx,firstDim) + central12(vy,secondDim)                                + central12(vz,thirdDim);}</pre></td></tr></table></P><P>The template parameter <CODE>T</CODE> is an iterator type for arrays.</P><P>You are encouraged to use the macros when possible, because it is possiblethe implementation could be changed in the future.</P><P>To declare a difference operator, use this syntax:</P><P><TABLE><tr><td>&nbsp;</td><td class=example><pre>BZ_DECLARE_DIFF(central12,A) {  return A.shift(1,dim) - A.shift(-1,dim);}</pre></td></tr></table></P><P>The method <CODE>shift(offset,dim)</CODE> retrieves the element at<CODE>offset</CODE> in dimension <CODE>dim</CODE>.</P><P>Stencil operator declarations cannot occur inside a function.  Ifdeclared inside a class, they are scoped by the class.</P><P><HR SIZE="6"><A NAME="SEC120"></A><TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0><TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_4.html#SEC119"> &lt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_5.html#SEC121"> &gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_4.html#SEC104"> &lt;&lt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_4.html#SEC104"> Up </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_5.html#SEC121"> &gt;&gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz.html#SEC_Top">Top</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_toc.html#SEC_Contents">Contents</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_abt.html#SEC_About"> ? </A>]</TD></TR></TABLE><H2> 4.6 Applying a stencil </H2><!--docid::SEC120::--><P>The syntax for applying a stencil is:</P><P><TABLE><tr><td>&nbsp;</td><td class=example><pre>applyStencil(stencilname(),A,B,C...,F);</pre></td></tr></table></P><P>Where <CODE>stencilname</CODE> is the name of the stencil, and <CODE>A,B,C,...,F</CODE>are the arrays on which the stencil operates.</P><P>For examples, see <TT>`examples/stencil.cpp'</TT> and <TT>`examples/stencil2.cpp'</TT>.</P><P>Blitz++ interrogates the stencil object to find out how large its footprintis.  It only applies the stencil over the region of the arrays where itwon't overrun the boundaries.</P><P><A NAME="Customised Arrays"></A><HR SIZE="6"><TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0><TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_4.html#SEC104"> &lt;&lt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_5.html#SEC121"> &gt;&gt; </A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz.html#SEC_Top">Top</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_toc.html#SEC_Contents">Contents</A>]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="blitz_abt.html#SEC_About"> ? </A>]</TD></TR></TABLE><BR>  <FONT SIZE="-1">This document was generatedby <I>Julian Cummings</I> on <I>October, 14  2005</I>using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html"><I>texi2html</I></A></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -