📄 maincharfunctest.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 > 0 in the region and ≤ 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& 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->setBorder(0.0,1.0, 0.0,1.0); wzRegion inner_box = wzRegion(2); base->addBox(inner_box, 0.1,0.9, 0.1,0.9); cogeometry geom0 = base->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->inRegion(inner_box);</PRE> <P>What remains is standard:<PRE> base->refinementGlobal(0.1,0.05); wzgrid grid = (*base)(geom); grid->write("test.sg");}</PRE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -