📄 maintest.html
字号:
<TITLE>COG 2.0: Startup File</TITLE>
<A HREF="mainoctreetest.html">next</A>
<H1>COG 2.0: Startup File</H1>
<P>Let's start with the simplest 3D grid example - a cube,
consisting of six tetrahedra. We need, of course, an include file:
<PRE>
#include "<A HREF="coglib.hxx">cog/coglib.hxx</A>"
int main()
{
</PRE>
<P>We also need a grid generator. For the first example, this grid
generator is of the class <B>CogenOctree</B>. The related pointer type
is <B>cogenOctree</B> (don't use CogenOctree* for a pointer!!!).
<PRE>
cogenOctree gen = new CogenOctree();
</PRE>
<P>Then, we add a cube, with some region number, and boundaries:
<PRE>
gen->addBox(wzRegion(1), 0.0,1.0, 0.0,1.0, 0.0,1.0);
</PRE>
<P>That's all we need for our first 3D test example. Now, we can call
the grid generator:
<PRE>
wzgrid grid = (*gen)();
</PRE>
<P>Now we can use the grid, for example, write it into a file:
<PRE>
grid->write("test.sg");
}
</PRE>
<H2>How to test these test examples</H2>
<P>All these test examples (files with filenames of type
"<B>main*test.html</B>") contain valid test code. This code may be
automatically extracted using the perl scripts <B>run</B> and
<B>use</B>.
<P><B>> run main start</B>
<P>tests this example. You can do it in two steps:
<P><B>> use main start</B>
<BR><B>> run</B>
<P>The command <B>use main xyz</B> extracts the code from
mainxyztest.html into <B>maintest.cxx</B>. The <B>run</B> command
compiles, links and runs the program <B>maintest.cxx</B>.
<P>Now, in our tutorial we continue with
<A HREF="mainoctreetest.html">other possibilities of the class
CogenOctree</A>.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -