📄 mainpolartest.html
字号:
<TITLE>COG 2.1: polar coordinates</TITLE><A HREF="main2Dtest.html">next</A><H1>COG 2.1: polar coordinates</H1> <P>Now, let's consider how to create curved grids with coordinatetransformations. As an example, we use polar coordinates. Thisallows to define curved geometries based on the previous method forrectangular geometries: <P><IMG SRC="polartest.gif"> <P>First, we create a rectangular grid and geometry with some <A HREF="mainoctreetest.html">regions</A>, <A HREF="mainfacetest.html">faces</A> and <A HREF="mainreftest.html">refinement</A> as before:<PRE>#include "<A HREF="coglib.hxx">cog/coglib.hxx</A>"int main(){ cogenOctree base = new CogenOctree(); wzIndex i1 = base->addBox(wzRegion(2), 0.0,0.4,-0.3,1.5); wzIndex i2 = base->addBox(wzRegion(3), 0.2,0.3); wzIndex i3 = base->addBox(wzRegion(4), 0.2,0.3, 0.3,1.0); base->setFaceOfBox(wzFace(2),i1); base->setFaceOfBox(wzFace(3),i2); base->setFaceOfBox(wzFace(4),i3); base->refinementGlobal(0.05,0.3);// base->omitEdgeComputation();</PRE> <P>But we should have in mind that we want to use polarcoordinates. Thus, the minimal value which is allowed here for thefirst coordinate (the radius) is zero. Else, the program will fail.But the extremal values (radius 0, angles -Pi, Pi) are allowed:<PRE> base->addPlaneY(wzPi); base->addPlaneY(-wzPi);</PRE> <P>Now we apply the polar coordinates to this rectangular geometry:<PRE> wz2dmap polar = new wz2Dpolar; cogenChart gen = new CogenChart(base->generator(),polar);</PRE> <P>We can apply some conform affine transformations: <UL> <LI> <B>shift</B> defines a translation; <LI> <B>stretch</B> defines an isotropic stretch/shrink; <LI> <B>rotate</B> rotates in counter-clockwise direction, with anglegiven in radian. <LI> <B>switchXY</B> switches the X and Y directions (reflectionfor the line (y=x). </UL> <P>Subsequent operations will be composed. Note that the order matters.<PRE> polar->rotate(0.7*wzPi); polar->switchXY(); polar->stretch(2); polar->shift(10,-10); polar->print();</PRE> <P>Then we compute the grid as usual:<PRE> wzgrid grid = (*gen)(); grid->write("test.sg");}</PRE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -