maintest.cxx

来自「有限元学习研究用源代码(老外的),供科研人员参考」· CXX 代码 · 共 69 行

CXX
69
字号
#line 6 "mainelevationtest.html"
#include "cogenelevation.hxx"
/*

The class <B>CogenElevation</B> defined in 
cogenelevation.cxx creates the following grid 

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

<H2>Reading the elevation map</H2>

*/
#include "cog/coglib.hxx"
#include "cog1d.hxx"
int main()
{
  cogeometry geom1D = new Cogeometry1D(0.0,1.0,1,wzRegion(2));
  cogenElevation gen = new CogenElevation("cog/elevationinput.ppm",geom1D);
  cogFloat xmin=0,xmax=5,ymin=0,ymax=5;
  cogFloat hmin= 700, hmax=4000;         // boundaries for elevation in meter
  gen->setBorder(xmin,xmax,ymin,ymax,hmin,hmax);
/*

*/
  gen->refinementGlobal(0.4,0.4,0.1);
  gen->faceRefinementGlobal(0.05,1.0);
/*

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

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

/*

 <P>We use here an elevation map - the ppm-file 
test/elevation.ppm. In this file, the color
encodes a short integer which defines the elevation of the grand
canyon in meter.

 <P>The class <B>CogenElevation</B> allows to read this file
and defines the function 

<BLOCKQUOTE>
<B>f(x,y,z) = z - elevation(x,y)</B> 
</BLOCKQUOTE>

appropriately scaled. This function is used to define a geometry using
the scheme similar to 
CogeometrySimpleFunction. For the 

*/
/*
cogeometry	test_cogeometry()
{
 CogeometryElevationMap *map;
 map    = new CogeometryElevationMap("test/elevation.ppm",geom1D);
 return map;
}
*/
/*
*/

⌨️ 快捷键说明

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