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

📄 mainpixmaptest.html

📁 有限元学习研究用源代码(老外的),供科研人员参考
💻 HTML
字号:
<TITLE>COG 1.0 - CogenPixmap</TITLE>

<H1>class CogenPixmap</H1>

<PRE>
#include "<A HREF="cogenpixmap.hxx">cogenpixmap.hxx</A>"
</PRE>

The class <B>CogenPixmap</B> defined in <A
HREF="cogenpixmap.cxx">cogenpixmap.cxx</A> creates the following grid 

 <P><IMG SRC="pixmaptest.gif">
 <P>for a geometry defined by the picture:
 <P><IMG SRC="pixmapinput.gif">

<H2>Reading the pixmap</H2>

 <P>The idea is defined by the principle <B>one color - one
region</B>.  If you have more than necessary or a continuum of colors,
the algorithm works too: close enough colors will be identified.
A coarse upper bound is <B>maxcolors</B>:

<PRE>
#include "<A HREF="coglib.hxx">cog/coglib.hxx</A>"
int main()
{
  cogIndex maxcolors=20; // maximal number of colors allowed
  cogenPixmap gen = new CogenPixmap("cog/pixmapinput.ppm",maxcolors);
</PRE>

 <P>Currently we support only <B>PPM</B> format, but it is easy to
transform pictures into this format (I use <B>xv</B> for this
purpose).

<H2>Identifying colors and regions</H2>

 <P>To identify the colors with region numbers, define a list of
colors and their related region numbers:

<PRE>
  int listlength=2, region[3];
  wzColor color[3], black(""), blue("#11f"), yellow("#a70");
  color[0] = black;
  color[1] = blue;	region[1] = wzRegion(3);
  color[2] = yellow;	region[2] = wzRegion(2);
  gen-&gt;fitColorList(listlength,color,region);   
</PRE>

 <P>To find out which colors have been found you can print out the
colors with <B>printColors</B>:

<PRE>
  gen-&gt;printColors();
</PRE>

<H2>Refinement</H2>

 <P>Now, you have to be careful with the refinement. In our case, the
refinement near the faces defined by <B>faceRefinementGlobal</B> is
approximately pixel size:

<PRE>
  gen-&gt;refinementGlobal(0.2,0.2);
  gen-&gt;faceRefinementGlobal(0.0025,1.0);
</PRE>

<H2>Special Points</H2>

 <P> But there are some regions (islands and lakes) too small to be
found with certainty with the global refinement used here.
Especially, the lake near the center will not be found.  To catch this
lake, we add the coordinates of one point inside the lake:

<PRE>
  gen-&gt;addPlanesOfPoint(-0.0901,-0.208);
</PRE>

 <P>Now, we generate the grid and write it out as usual:

<PRE>
  wzgrid grid = (*gen)();
  grid->write("test.sg");
}
</PRE>

⌨️ 快捷键说明

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