📄 mainplist.c
字号:
/* last edit: Ilja Schmelzer -------------- 10-JUN-1994 17:58:40.20 */
/************************************************************************/
/* */
/* <<< I B G >>> - Intersection - Based Grid generation package */
/* */
/* Version 1.1 by Ilja Schmelzer schmelzer@iaas-berlin.d400.de */
/* */
/* to be distributed under IBG license conditions (see "readme.ibg") */
/* */
/************************************************************************/
/*
Intersection-Based Grid Generator Version 1.1
author: Ilja Schmelzer, IAAS,
Mohrenst. 39, D-10117 Berlin Germany
e-mail: schmelzer@iaas-berlin.d400.de
Tel: +49 30 20377 567
Fax: +49 30 200 4975
This example creates a trivial 2D (4 point) grid and includes three
externally defined additional points.
Two of them are nearly identical. This example shows an interesting
property of the Delaunay algorithm as implemented here - only one of
the two very close points - the second one - will be really part of
the grid. Thus, the resulting grid contains 6 instead of 7 points.
*/
#include <stdio.h>
#include <ibg.h>
#include <ibgd.h>
#include <ibgg.h>
#include <ibgapplication.h>
int main()
{
/* the data of the coarse grid - cuboid */
ibgFloat x[2] = {-1.0,1.0},
y[2] = {-1.0,1.0},
z[2] = { 0.0,1.0};
ibGeometry g0;
ibGrid *grid;
ibgPoint p;
/* ibgNameApplication = "test"; */
ibgApplicationInit(); /* calls also ibgdInit and ibGridInit */
g0 = ibgdNew(2); /* trivial geometry: only one region 2 */
/* here we define the external point list: */
ibgpX(p)[0] = 0.3; ibgpX(p)[1] = 0.7;
ibgpType(p) = ibgSRegion; ibgpSegment(p) = 2;
ibgAppendPoint(&ibggExternalPoints, &p);
ibgpX(p)[0] = 0.7; ibgpX(p)[1] = 0.3;
ibgAppendPoint(&ibggExternalPoints, &p);
ibgpX(p)[0] = 0.70000001; ibgpX(p)[1] = 0.3;
ibgAppendPoint(&ibggExternalPoints, &p);
/* remark that this is a dangerous operation. Bad data may lead to
failure of the grid generation. */
/* grid generator call. */
grid=ibGridGenerate(g0, /* geometry description */
100, /* approx. point number (for malloc to minimize realloc) */
2,x,0, /* coarse grid data */
2,y,0, /* 2 values in x and y data field */
1,z,0, /* for the 2D variant only 1 value in z direction */
/* default refinement criteria: */
ibggDefaultRefineRegion,ibgNULL,
ibggDefaultRefineFace,ibgNULL,
ibggDefaultRefineLine,ibgNULL,
ibggDefaultRefineNode,ibgNULL,
ibggDefaultRefineEdge,ibgNULL);
/* end of program: */
ibgNameFile = "test";
ibgOutput(grid);
return ibgdQuit();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -