📄 ibgoutput.h
字号:
/* last edit: Ilja Schmelzer -------------- 20-OCT-1994 11:21:38.49 */
/************************************************************************/
/* */
/* <<< 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") */
/* */
/************************************************************************/
#ifndef IBGOUTPUT_H
#define IBGOUTPUT_H
#ifndef IBG_H
#include "ibg.h"
#endif
#include <stdio.h>
/*
This file contains definitions which will be used in the output- and transfer-
functions of the IBG examples. It is not part (that means not necessary) for
grid generation and geometry description. So, it can be easily replaced or
omitted by the application. The definitions given here allow to control
the output:
o materials and boundary conditions
o names
o selection information (selecting segments for output)
o color information (defining colors for every segment)
o output window
o point and cell identifier (numbers for debugging)
o output- and transfer-functions
We recommend to use the functions defined here in your output- and transfer-
functions and to control (or to give the user the control over) the global
parameters.
<<< FUNCTIONS: >>>
*/
void ibgOutputInit();
/*
Initializes the external paramters. Call it once at the begin, and change the
global parameters only after this call.
*/
void ibgOutput(ibGrid *g);
/* Initializes grid-dependend data. Call it if you have a new grid. */
/* tests if a segment u of type ibgOSType is selected: */
ibgBoolean ibgOSelected(ibgSegment u);
/* tests if a regoin/face/line/node u is selected: */
ibgBoolean ibgOSelectedRegion(ibgSegment u);
ibgBoolean ibgOSelectedFace(ibgSegment u, ibgSegment left, ibgSegment right);
ibgBoolean ibgOSelectedLine(ibgSegment u);
ibgBoolean ibgOSelectedNode(ibgSegment u);
/* if ibgIdPoint (ibgIdCell) defines the identifier of the point (cell): */
ibgBoolean ibgIdentPoint(int n, char* ident);
ibgBoolean ibgIdentCell(int c, char* ident);
/* window handling: */
ibgBoolean ibgInWindow(ibgPoint *n);
#define ibgIsInWindow(n) (ibgWindow ? ibgInWindow(n) : ibgTrue )
ibgBoolean ibgWindowCoord(ibgPoint *n, ibgFloat *x);
/* get color identifier: */
int ibgColorRegion(ibgSegment u);
int ibgColorFace(ibgSegment u, ibgSegment left, ibgSegment right);
int ibgColorLine(ibgSegment u);
int ibgColorNode(ibgSegment u);
/* Sets a color for a color identifier. The color is defined by a string
in the standard X11 hexadecimal color specification:
#RGB (4 bits each of red, green and blue)
#RRGGBB (8 bits each of red, green and blue)
#RRRGGGBBB (12 bits each of red, green and blue)
#RRRRGGGGBBBB (16 bits each of red, green and blue)
Each of the letters represents a hexadecimal digit. In the shorter formats, the
specified values are interpreted as the most significant bits of a 16-bit
value. For example, #3a7 and #3000a0007000 are equivalent.
If the X11 color name file "rgb.txt" is available (see ibgreadcolors in
"ibgoutput.c") also names as defined in this file can be used.
*/
ibgBoolean ibgOSetColor(int id, char* colorname);
/* declares a new color: */
int ibgDeclareColor(char* name, char* value);
/* declares a new output- or transfer-function: */
int ibgDeclareFileMode(char* mode, char* filetype,
int (*output)(ibGrid *g, FILE *file)
);
/* default output- and transfer-functions: */
int ibGridSave (ibGrid *gg, FILE *file);
int ibGridWrite (ibGrid *gg, FILE *file);
int ibgToSimplex (ibGrid *gg, FILE *file);
ibGrid *ibGridLoad (FILE *file);
ibGrid *ibGridRead (FILE *file);
ibGrid *ibgOtSimplex (FILE *file);
/*
<<< GLOBAL PARAMETERS: >>>
*/
/*
material information:
For every region a material may be defined. It must be a positive integer
lower than ibgSMAX. if ibgMOn then the material number will be used for
selection, naming and color definition of regions.
For every boundary face a boundary condition may be defined. It must be a
positive integer lower than ibgSMAX. if ibgBCOn then the bopundary conditions
will be used for selection, naming and color definition of boundary faces.
*/
extern int ibgMaterial[ibgSMAX];
extern ibgBoolean ibgMOn;
extern int ibgBCondition[ibgSMAX];
extern ibgBoolean ibgBCOn;
/* recommended name conventions: */
static const int ibgRSpace = 1;
static const int ibgMAir = 1;
static const int ibgBCDirichlet = 1;
static const int ibgBCNeumann = 2;
static const int ibgBCMixed = 3;
/* ibgBCDefault is a function defining the default boundary condition for the
default boundary between two regions u1 and u2 which has to be defined by the
user. The default is Dirichlet. Even if ibgMOn the input are the region numbers
(not the material). */
extern int (*ibgBCDefault)(ibgSegment u1, ibgSegment u2);
int ibgBCDefaultDirichlet(ibgSegment u1, ibgSegment u2);
int ibgBCDefaultNeumann(ibgSegment u1, ibgSegment u2);
int ibgBCDefaultMixed(ibgSegment u1, ibgSegment u2);
int ibgBCDefaultMax(ibgSegment u1, ibgSegment u2);
int ibgBCDefaultMin(ibgSegment u1, ibgSegment u2);
/*
names:
*/
extern char* ibgSname[IBGSTMAX];
extern char* ibgNameRegion[ibgSMAX];
extern char* ibgNameFace[ibgSMAX];
extern char* ibgNameLine[ibgSMAX];
extern char* ibgNameNode[ibgSMAX];
extern char* ibgNameMaterial[ibgSMAX];
extern char* ibgNameBCondition[ibgSMAX];
extern char* ibgNameApplication;
/*
segment-oriented selection information
these parameters allow to control which segments have to be part of the output
*/
extern ibgSegmentType ibgOSType;
/* what will be selected in the following regions, faces, lines or nodes */
extern ibgBoolean ibgOutputType[IBGSTMAX];
/* which segment types have to be part of the output */
extern ibgBoolean ibgOSOutside; /* to include the outside boundary */
extern int ibgOSMode; /* selection mode for ibgOSType */
typedef enum{
ibgOSModAll, /* all segments */
ibgOSModOne, /* only segment ibgOSSegment */
ibgOSModSpecial, /* segments with ibgOSSpecial[u] */
ibgOSModList, /* the segments from the list. */
ibgOSModName, /* the segments named ibgOSName */
ibgOSModNamed, /* the segments with names */
ibgOSModNothing
}ibgOSModType;
extern ibgSegment ibgOSSegment;
extern ibgBoolean ibgOSSpecial[ibgSMAX];
extern int ibgOSListLength;
#define ibgOSMaxLength 100
extern ibgSegment ibgOSList[ibgOSMaxLength];
extern char* ibgOSName;
#define ibgOSNoName ibgNULL
/*
controls behaviour of ibgOutputStart
*/
extern ibgBoolean ibgResetGrid;
/*
controls point and cell identifiers:
*/
extern int ibgIdPoint; /* which type of identifier for points */
extern int ibgIdCell; /* which type of identifier for cells */
typedef enum{
ibgIdModOff,
ibgIdModOn,
ibgIdModTyp,
ibgIdModSegment,
ibgIdModMaterial,
ibgIdModNType,
ibgIdModNSegment,
ibgIdModNMaterial,
ingIdModNothing
}ibgIdModType;
/* The alternative segment/material is controlled independent of ibgMOn/ibgBCOn
to allow "double information" --- by color and by identifier --- in one
picture. The last three modes use the related names (instead of numbers).
*/
/*
window defining the visible part:
*/
extern ibgBoolean ibgWindow; /* allows to avoid tests */
extern ibgFloat ibgWAlpha,ibgWBeta;
extern ibgFloat ibgWX[ibgDIM];
extern ibgFloat ibgWXMin[ibgDIM];
extern ibgFloat ibgWXMax[ibgDIM];
/*
color data (rgb values):
*/
extern int ibgColRegion[ibgSMAX];
extern int ibgColFace[ibgSMAX];
extern int ibgColLine[ibgSMAX];
extern int ibgColNode[ibgSMAX];
extern int ibgColMaterial[ibgSMAX];
extern int ibgColBCondition[ibgSMAX];
typedef struct{
unsigned r;
unsigned g;
unsigned b;
}ibgColor;
static const int ibgColOn = (0xffff);
static const int ibgColOff = (0x0);
#define ibgColorMAX 0xff
extern ibgColor ibgColorOf[ibgColorMAX];
extern char* ibgColorName[ibgColorMAX];
extern int ibgColorFree;
extern int ibgColorCurrent;
/*
which color has to be used for a boundary face between two regions?
*/
extern int ibgColDoubleBoundary; /* above regions are selected */
extern int ibgColSingleBoundary; /* one region is selected */
extern int ibgColOutsideBoundary; /* one region is outside */
typedef enum{
ibgColModZero, /* zero color value */
ibgColModMax, /* the maximum of left and right */
ibgColModMin, /* the minimum of left and right */
ibgColModSelf, /* the selected region */
ibgColModOther, /* the region which is not selected */
ibgColModBC, /* the boundary condition */
ibgColModNothing
}ibgColModType;
/* default color identifier: */
static const int ibgColBackground = 0;
static const int ibgColError = 1;
static const int ibgColForeground = 2;
static const int ibgColDefaultNode = 3;
static const int ibgColDefaultLine = 4;
static const int ibgColDefaultFace = 5;
static const int ibgColDefaultBCondition = 5; /* 6,7,8 for std. BC */
static const int ibgColDefaultRegion = 9;
static const int ibgColDefaultMaterial = 9;
/*
File output format data:
*/
#define ibgFileModMAX 50
extern char* ibgNameFile;
extern int ibgFileMode;
extern int ibgFileModFree;
extern char* ibgFileType[ibgFileModMAX];
extern char* ibgFileModName[ibgFileModMAX];
extern int (*(ibgFileOutput[ibgFileModMAX]))(ibGrid *g, FILE *file);
static const int ibgFileModNone = 0;
static const int ibgFileModSave = 1;
static const int ibgFileModWrite = 2;
static const int ibgFileModSimplex = 3;
/* the current grid. To set the current grid use ibgOutputStart. */
extern ibGrid *ibggCurrent;
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -