⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 maincharfunctest.html

📁 Delaunay三角形的网格剖分程序
💻 HTML
字号:
<TITLE>COG 2.1: Charfunction for regions</TITLE><PRE>#include "<A HREF="coglib.hxx">cog/coglib.hxx</A>"</PRE><H1>Defining Regions by Characteristic Function</H1> <P>A region may be defined by their <B>characteristic function</B>which is &gt; 0 in the region and &le; 0 outside.  For example, todefine the region in this picture: <P><IMG SRC="charfunctest.gif"> <P>we can use the following simple function:<PRE>wzFloat hyperbel(const wzPoint&amp; p){  return (p[0]+0.05)*(p[0]+0.05) - 4*(p[1]-0.5)*(p[1]-0.5);}</PRE> <P>There are also a lot of <A HREF="mainfunctiontest.html">otherpossibilities to define functions</A>, especially functions defined ongrids.  Now we define a simple octree grid generator and define thisfunction <I>hyperbel</I> on it's geometry <A HREF="mainfunctiontest.html">as usual</A>:<PRE>int main(){  cogenOctree base = new CogenOctree();  base-&gt;setBorder(0.0,1.0, 0.0,1.0);  wzRegion inner_box = wzRegion(2);  base-&gt;addBox(inner_box, 0.1,0.9, 0.1,0.9);  cogeometry geom0 = base-&gt;geometry();  wzIndex    place = 0;  cogeometry geomf = new CogeometryFunctionOnRegions(geom0,hyperbel,place);</PRE> <P>Now we have to create the geometry defined by this characteristic function:<PRE>  wzFloat level = 0.03;  CogeometryCharFunction* geom = new CogeometryCharFunction	(geomf,wzRegion(3),place,level);</PRE> <P>We want to use the characteristic function only inside the <I>inner_box</I>:<PRE>  geom-&gt;inRegion(inner_box);</PRE> <P>What remains is standard:<PRE>  base-&gt;refinementGlobal(0.1,0.05);  wzgrid grid = (*base)(geom);  grid-&gt;write("test.sg");}</PRE>

⌨️ 快捷键说明

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