mainspheretest.html

来自「有限元学习研究用源代码(老外的),供科研人员参考」· HTML 代码 · 共 62 行

HTML
62
字号
<TITLE>COG 2.0: spherical coordinates</TITLE>

<H1>COG 2.0: spherical coordinates</H1>

 <P>See <A HREF="mainpolartest.html">the polar coordinate example</A>
for general instructions about curved coordinates.

 <P>The first coordinate is the radius <B>r</B>, then the angle
<B>theta</B> (between -wzPi/2 and wzPi/2), the last is the angle
<B>phi</B> (between -wzPi and wzPi).

 <P>The example below creates a spherical grid with a full sphere
inside

 <P><IMG SRC="spheretest.gif">

<PRE>
#include "<A HREF="coglib.hxx">cog/coglib.hxx</A>"
int main()
{
  cogenOctree base = new CogenOctree();
  wzIndex i2 = base-&gt;addBox(wzRegion(2), 0.0,0.3);
  wzIndex i3 = base-&gt;addBox(wzRegion(3), 
	0.0,0.4, 0.0,wzPi/2, -1.9, -1.0);
  wzIndex i4 = base-&gt;addBox(wzRegion(4), 
	0.0,0.4, 0.0,wzPi/2, 0.0,wzPi/2);
//	0.0,0.4, 0.0,1.0, 0.0,wzPi/2);
  base-&gt;setFaceOfBox(wzFace(2),i2);
  base-&gt;setFaceOfBox(wzFace(3),i3);
//  base-&gt;setFaceOfBox(wzFace(4),i4);
  base-&gt;refinementGlobal(0.2,0.2, 0.2);
//  base-&gt;addPlaneX(0.4);
  base-&gt;addPlaneY(wzPi/2);
  base-&gt;addPlaneY(-wzPi/2);
  base-&gt;addPlaneZ(wzPi);
  base-&gt;addPlaneZ(-wzPi);

  wzcoordinates sphere = new wzSphericalCoordinates;
  cogenChart gen = new CogenChart(base-&gt;generator(),sphere);

  wzgrid grid = (*gen)();
  ibgOutput(grid);
  grid->write("test.sg",wzDefaultSegmentDescription);
}
</PRE>

<H2>Known Bugs</H2>

 <P>"edge problems" occur if, as in this example, the critical regions
of the coordinates (the axis (r == 0), the origin) are part of the
boundary.  They may be ignored.

 <P>Defining regions outside the domain of definition causes errors.
Be careful if the boundaries are correct: non-negative for X, -wzPi/2
to wzPi/2 for Y, -wzPi to wzPi for Z

 <P>Defining different regions for (phi==wzPi) and (phi==-wzPi) causes
errors.  Be careful that the region numbers coinside there.



⌨️ 快捷键说明

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