📄 mainuniontest.html
字号:
<TITLE>COG 2.0: union</TITLE>
<A HREF="main2Dtest.html">next</A>
<H1>COG 2.0: union</H1>
<P>Now, let's consider how to combine geometries defined in different
coordinates:
<P><IMG SRC="uniontest.gif">
<P>Now, a key concept of COG becomes important: the independence
between geometry description and grid generation. Until now, there
was a very close connection between the geometry and the resulting
grid.
<P>Now it becomes important to understand that the connection is not
as strong as it seems to be. The geometry is always global. The grid
may be defined only on a part of the global geometry.
<P>First, let's create two test generators - one with curved
geometry, another with rectangular geometry:
<PRE>
#include "<A HREF="coglib.hxx">cog/coglib.hxx</A>"
int main()
{
cogenOctree base = new CogenOctree();
base->addBox(wzRegion(2), 0.15,0.4,-1.5,1.5);
base->addBox(wzRegion(4), 0.2,0.3);
</PRE>
<P>Note the "global" character of region 4: we have not given
y-values, thus, the geometry definition is unbounded, defines the
whole ring. This defines the circle on the right half.
<P>But the box for the grid generation (implicitly defined by the
first call as [0.15,0.4]x[-1.5,1.5]) is not modified. Thus, only in
the left half polar coordinates will be choosen.
<PRE>
cogenRefine base_ref = new CogenRefine(base->generator());
base_ref->faceRefinementGlobal(0.02,1.0);
base_ref->refinementGlobal(0.05,0.15);
base_ref->refinementInRegion(0.02,0.3,1.0,wzRegion(4));
base_ref->refinementNearFace(0.002,0.3,0, wzFace(2));
wzcoordinates cpolar = new wzPolarCoordinates;
cogenChart polar = new CogenChart(base_ref->generator(),cpolar);
cogenOctree ortho = new CogenOctree;
wzIndex i1 = ortho->addBox(wzRegion(2),-0.4,0.4,-0.5,0.5);
wzIndex i2 = ortho->addBox(wzRegion(6),-0.05,0.05);
ortho->setFaceOfBox(wzFace(2),i1);
ortho->setFaceOfBox(wzFace(3),i2);
cogenRefine ortho_ref = new CogenRefine(ortho->generator());
ortho_ref->refinementGlobal(0.05,0.05);
ortho_ref->faceRefinementGlobal(0.005,1.0);
</PRE>
<P>Now, we define a union and add these two generators:
<PRE>
cogenComposite gen = new CogenUnion;
gen->add(polar->generator());
gen->add(ortho_ref->generator());
</PRE>
<P>That's all.
<P>Note that the first set of coordinates will be preferred in its
own box. (Try out how changing the order modifies the grid!)
<P>Instead, in the geometry the region with higher region number is
preferred. That's why the ring (region 4) is hidden behind the bar
(region 6).
<PRE>
wzgrid grid = (*gen)();
grid->write("test.sg");
}
</PRE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -