📄 mainoctreetest.html
字号:
<TITLE>COG 2.1: Rectangular boxes</TITLE><H1>Rectangular Boxes</H1> <P>Let's consider now how to create grids for simple rectangulargeometries with <B><A HREF="cogenoctree.html">cogenOctree</A></B>: <P><IMG SRC="octreetest.gif"><PRE>#include "<A HREF="coglib.hxx">cog/coglib.hxx</A>"int main(){ cogenOctree gen = new CogenOctree();</PRE> <P>We can add a lot of rectangular boxes, with different regionnumbers:<PRE> gen->addBox(wzRegion(2), 0.0,0.4, 0.0,0.5); gen->addBox(wzRegion(3), 0.2,0.8, 0.3,1.0); gen->addBox(wzRegion(4), 0.4,1.0, 0.7,1.0);</PRE> <P>If we do not define it with <B>setBorder</B>, the grid generatordefines the covering box (here the standard unit cube). The coarsegrid includes all bounding planes of the regions (in x-direction theplanes 0.0, 0.2, 0.4, 1.0) and if we like some additional planes too:<PRE> gen->addPlaneX(0.9); gen->addPlaneY(0.9);</PRE> <P>An additional possibility is a regular refinement in eachdirection:<PRE> gen->refinementGlobal(0.2,0.1);</PRE> <P>subdivides each rectangle as long as the size in x-resp. y-direction is below 0.2 resp. 0.1. The refinement is binarystarting from the nodes which have been already defined. Thus, theresulting distances may be lower than the given distance, but greaterthan 1/2 of this distance. <P>Another refinement possibility is the regular subdivision:<PRE>// gen->setRegularRefinementX(3);</PRE> <P>subdivides each rectangle in x-direction into four parts (threeadditional planes). But this is not recommended - it leads to badpoint order and problems with the Delaunay algorithm if the refinementis too large. Later, we learn later much better ways to control <A HREF="mainreftest.html">refinement</A>. <P>What remains is the same as before:<PRE> wzgrid grid = (*gen)(); grid->write("test.sg");}</PRE> <P>If you want to write out only some of the regions (probably youdon't want to write out the default region 1) this is possible bywriting out <A HREF="mainmaterialtest.html">material numbers</A> instead ofregion numbers and using the "invalid" material. <P>Now, let's continue with the definition of <A HREF="mainfacetest.html">boundary conditions</A>. <P>Of course, the possibilities of <B>CogenOctree</B> are availablealso for <A HREF="mainoctree3dtest.html">3D grid generation</A>.<H2>Known Bugs</H2> <P>It is possible to define nonconvex regions as a union ofrectangles (for example by replacing wzRegion(4) by wzRegion(3) in theprevious example). In this case, the inner edge is cut off. <P>To avoid this, to use different region numbers (artificialsubdivision of regions). This avoids non-convex regions. For thispossibility it is useful to write out <A HREF="mainmaterialtest.html">material numbers</A> instead ofregion numbers. <P>The other possibility is to define different <A HREF="mainfacetest.html">boundary conditions</A> on differentparts of the boundary (artificial subdivision of boundary faces).This avoids non-convex boundary faces.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -