📄 mainuniontest.html
字号:
<TITLE>COG 2.1: Unions</TITLE><A HREF="main2Dtest.html">next</A><H1>Unions</H1> <P>Now, let's consider how to define unions of the simple geometrieswe are already able to define: combine geometries defined in differentcoordinates: <P><IMG SRC="uniontest.gif"> <IMG SRC="union1test.gif"> <IMG SRC="union2test.gif"> <P>Now, a key concept of COG becomes important: the independencebetween geometry description and grid generation. Until now, therewas a very close connection between the geometry and the resultinggrid. <P>Now it becomes important to understand that the connection is notas strong as it seems to be. The geometry is always global. The gridmay be defined only on a part of the global geometry. <P>First, let's create two test generators - one with curvedgeometry, another with rectangular geometry:<PRE>#include "<A HREF="coglib.hxx">cog/coglib.hxx</A>"int main(){ cogenOctree base = new CogenOctree(); base->addBox(wzRegion(1), 0.15,0.4,-1.5,1.5); base->addBox(wzRegion(2), 0.2,0.3);</PRE> <P>Note the "global" character of region 4: we have not giveny-values, thus, the geometry definition is unbounded, defines thewhole ring. This defines the circle on the right half. <P>But the box for the grid generation (implicitly defined by thefirst call as [0.15,0.4]x[-1.5,1.5]) is not modified. Thus, only inthe left half polar coordinates will be choosen.<PRE> base->faceRefinementGlobal(0.02,0.5); base->refinementGlobal(0.05,0.15); cogenRefine base_ref = new CogenRefine(base->generator()); base_ref->refinementInRegion(0.02,0.3,1.0,wzRegion(2)); base_ref->refinementNearFace(0.002,0.3,0, wzFace(1)); wz2dmap cpolar = new wz2Dpolar; cogenChart polar = new CogenChart(base_ref->generator(),cpolar); cogenOctree ortho = new CogenOctree; wzIndex i1 = ortho->addBox(wzRegion(1),-0.4,0.4,-0.5,0.5); wzIndex i2 = ortho->addBox(wzRegion(3),-0.05,0.05); ortho->setFaceOfBox(wzFace(1),i1); ortho->setFaceOfBox(wzFace(3),i2);// cogenRefine ortho_ref = new CogenRefine(ortho->generator()); ortho->refinementGlobal(0.05,0.05); ortho->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()); gen->add(ortho->generator());</PRE> <P>That's all. <P>Note that the first set of coordinates will be preferred in itsown box. (Try out how changing the order modifies the grid!) <P>Instead, in the geometry the region with higher region number ispreferred. 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 + -