mainviewtest.html

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

HTML
73
字号
<TITLE>COG 2.0: cogenOctree</TITLE>

<A HREF="mainfacetest.html">next</A>

<H1>COG 2.0: CogenOctree</H1>

 <P>Let's consider now some additional possibilities of the octree grid
generator <B>CogenOctree</B>.  Here and in the following we use 2D
examples, because it seems easier to get a feeling what happens.

<PRE>
#include "<A HREF="coglib.hxx">cog/coglib.hxx</A>"
int main()
{
  cogenOctree gen = new CogenOctree();
</PRE>

 <P>We can add a lot of rectangular boxes, with different region
numbers:

<PRE>
  wzIndex i1 = gen-&gt;addBox(wzRegion(2), 0.0,0.4, 0.0,0.5, 0.0,0.6);
  wzIndex i2 = gen-&gt;addBox(wzRegion(3), 0.2,0.8, 0.3,1.0, 0.4,1.0);
  gen-&gt;setFaceOfBox(wzFace(2),i1);
  gen-&gt;setFaceOfBox(wzFace(3),i2);
  gen-&gt;setFaceOfBoxSide(wzFace(4),i1,wzX);
  gen-&gt;setFaceOfBoxSide(wzFace(5),i2,wzXdown);
</PRE>

 <P>The grid generator defines a covering box (here the standard unit
cube), includes all planes (in x-direction the planes 0.0, 0.2, 0.4,
1.0) and if we like some additional planes too:

<PRE>
  gen-&gt;addPlaneZ(0.9);
</PRE>

 <P>An additional possibility is a regular refinement in each
direction:

<PRE>
  gen-&gt;setRegularRefinementX(1);
  gen-&gt;setRegularRefinementY(1);
</PRE>

 <P>subdivides each rectangle in x-direction into four parts (three
additional planes), in y-direction into five parts (four additional
planes).  But we do not recommend to use this possibility - only for
small values.  Instead, we learn later how to control <A
HREF="mainreftest.html">refinement</A>.

 <P>What remains is the same as before:

<PRE>
//  cogOutput(gen-&gt;geometry);
  wzgrid grid = (*gen)();
  ibgOutput(grid);
  grid->write("test.sg");
}
</PRE>

 <P>Similar to <A HREF="mainstarttest.html">mainstarttest.html</A>,
you can extract and test the code in this example using the perl
scripts <B>run</B> and <B>use</B>:

 <P><B>&gt; run main octree</B>

 <P>Now, let's continue with the definition of
 <A HREF="mainfacetest.html">boundary conditions</A>.

 <P>Of course, the possibilities of <B>CogenOctree</B> are available
also for <A HREF="mainoctree3dtest.html">3D grid generation</A>.

⌨️ 快捷键说明

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