mainextracttest.html

来自「Delaunay三角形的网格剖分程序」· HTML 代码 · 共 65 行

HTML
65
字号
<TITLE>COG 2.1: Extracting geometries</TITLE><H1>Extracting Geometries from a Cogenerator</H1> <P>Usually we create the geometry description and the grid generatorinput together.  This is usually convenient because, if we know thegeometry, we can use appropriate grid generation parameters.  <P>But the grid generation algorithm and the geometry description arecompletely separated from modular point of view.  We can extract thegeometry description from one cogenerator and use it in another one.Of course, often the grids will be worse.  But this possibility isespecially interesting for the user of the public domain version: inthis version the grid generation with curved cooridinates and unionsis forbidden, but the use of the related geometries is allowed. <P>For example, the following code creates geometry and gridgenerator <A HREF="mainwzcomplextest.html#wing">for the wing</A>:<PRE>#include &lt;math.h&gt;#include "coglib.hxx"int main(){  cogenOctree ortho = new CogenOctree();  wz2dmap c2,ce;  wzFloat h=0.3,b=0.2;  wzFloat h0 = h/(1+b),hr=sqrt(h*h+(1+b)*(1+b)),phi=atan2(h,1+b);  wzFloat delta=0.02;  ce = new wz2Dexp();  ce-&gt;stretch(hr);  ce-&gt;rotate(-phi);  ce-&gt;shift(-b,h);  wz2Dshukovski* cs = new  wz2Dshukovski(ce);  cs-&gt;setYofCircleCenter(h0);  c2 = cs;  ortho-&gt;addBox(wzRegion(1),0,10.0);  ortho-&gt;addBox(wzRegion(2),-10,0.02);  cogenChart chart = new CogenChart(ortho-&gt;generator(),c2);</PRE> <P>Now, in the public domain version the grid generator cannot beused. So, we use a standard grid generator which is available:<PRE>  cogenOctree other = new CogenOctree();  other-&gt;setBorder(-2.0,2.0,-1,1);  cogenRefine gen   = new CogenRefine(other-&gt;generator());  other-&gt;refinementGlobal(0.05,0.05,0.1);  gen-&gt;refinementNearPoint(0.02,0.02,0, 0.2,0.2,0, 1.0,0.0,0);  gen-&gt;refinementNearPoint(0.05,0.05,0, 0.5,0.5,0, -1.0,0.0,0);/**/</PRE><PRE>//  wzgrid grid = (*other)();  wzgrid grid = (*other)(chart-&gt;geometry());//  wzgrid grid = (*gen)();//  wzgrid grid = (*gen)(chart-&gt;geometry());  grid->write("test.sg");}</PRE>

⌨️ 快捷键说明

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