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

📄 wzgrid.hxx

📁 Delaunay三角形的网格剖分程序
💻 HXX
字号:
#ifndef wzgrid_hxx#define wzgrid_hxxextern "C"{#include "sxgrid/sxgridint.h"}#include "cog.hxx"#include "ibgtypes.hxx"#include "wzcelltype.hxx"class wzGrid;class wziCell;class wziNode;class wzDelaunayGenerator;//typedef wzGrid* wzgrid;class ibgSphere{public:	wzFloat x1[wzPointDim],x2[wzPointDim];};class ibgDelaunayMarker{public:  wzSimpleRange	dsl;  wzSimpleRange	nsl;  wzArray<int>	dsc;  wzArray<int>	dscl[IBG2CSMAX];  wzArray<int>	nsc;  wzArray<int>	nsco;  wzArray<int>	nscs;  ibgDelaunayMarker();};//  the code containing ibg2 should be removed step by stepclass wzGrid  :public wzProxyTarget  // may be added in some future;  ,public sxGridData{  wzIndex sxConstructor();	// constructor for the C structure sxGridData;  wzIndex sxRefresh();		// actualizes the sxGridData part;private:  void write(char* file, int* cnum, int ncells, int nfaces);public:  // for fast transfer - may be removed later:  wzSimpleRange	out;  wzArray<wzInteger>   	COutNext;  wzArray<wzInteger>   	COutside;  //  int	lastCOut,maxCOut;  //  int	*COutNext,*C_Outside;  //  ibg2TopologyRec	Topology;  int	firstRegion,lastRegion;  int	firstFace,lastFace;  int	firstEdge,lastEdge;  int	firstNode,lastNode;  //  ibgSegment cellSegment(ibgIndex c  wzGrid(wzIndex griddim, wzIndex spacedim, wzIndex fdim=0);  wzGrid(char* file);  virtual ~wzGrid(){;}  void write(char* file);  void write(char* file, wzSegmentDescription& d);public:			//  the old stuff: remove step by step  //  int	gridDim,spaceDim;	// now part of sxGridData   //  wzFloat xmin[wzPointDim],xmax[wzPointDim]; //part of sxGridData, as mincoord, with shift!!!  wzRange	points;  wzArray<wzPoint>	Point;  wzArray<wzIndex>	PointCell;  wzRange	cells;  wzArray<wzCellType>	CellType;  wzArray<wzISegment>	CellSegment;  wzArray<wzIndex>	CellData;  wzSimpleRange	data;  wzArray<wzInteger>	Data;  wzFixedRange	floatvalues;  int	gdim() const {return gridDim;}  int	xdim() const {return spaceDim;}  wzISegment 	ccu(wzInteger cc) const {return CellSegment[cc];}  wzCellType	cct(wzInteger cc) const {return CellType[cc];}  wzInteger* 	ccn(wzInteger cc) {return &(Data[CellData[cc]]);}  wzInteger* 	ccs(wzInteger cc)     {return &(Data[CellData[cc]+wzCellTypepoints[CellType[cc]]]);}  wzInteger* 	ccs(wzInteger cc, wzCellType t)     {return &(Data[CellData[cc]+wzCellTypepoints[t]]);}  wzInteger	ccleft(wzInteger cc, wzCellType t)    {return Data[CellData[cc]+wzCellTypeSExtL(t)];}  wzInteger	ccright(wzInteger cc, wzCellType t)    {return Data[CellData[cc]+wzCellTypeSExtR(t)];}  wzISegment	culeft(wzInteger cc, wzCellType t)    {wzInteger c=ccleft(cc,t); return (c<0)?-c:ccu(c);}  wzISegment	curight(wzInteger cc, wzCellType t)    {wzInteger c=ccright(cc,t); return (c<0)?-c:ccu(c);}  wzISegment& 	ccu(wzInteger cc) {return CellSegment[cc];}  wzCellType&	cct(wzInteger cc) {return CellType[cc];}  wzFloat*	cnx(wzInteger nn) {return Point[nn].X;}  wzPoint*	cnd(wzInteger nn) {return &(Point[nn]);}  wzFloat*	cnf(wzInteger nn) {return (Point[nn].X+wzPointDim);}  wzIndex	cnt(wzInteger nn) const {return (Point[nn].S.codim());}  wzISegment	cnu(wzInteger nn) const {return (Point[nn].S.index());}  void  	cns(wzInteger nn,wzISegmentTypes t,wzISegment u)  {Point[nn].S = wzSegment((wzIndex)(u),(wzDimension)(t));}  wzIndex&	cnc(wzInteger nn) {return PointCell[nn];}  wzFloat	cgmin(wzIndex dd) const {return mincoord[(dd)+1];}  wzFloat	cgmax(wzIndex dd) const {return maxcoord[(dd)+1];}  wzFloat&	cgmin(wzIndex dd) {return mincoord[(dd)+1];}  wzFloat&	cgmax(wzIndex dd) {return maxcoord[(dd)+1];}  wzBoolean	ccdef(wzInteger cc) {return (CellSegment[cc]>0);}  wzBoolean	ccout(wzInteger cc) {return (CellSegment[cc]==0);}  wzBoolean	ccund(wzInteger cc) {return (CellType[cc]==wzCellType0Nothing);}  void  test();  void  pn(wzInteger n); // info about grid node n;  void  pc(wzInteger c); // info about grid cell c;  void  pr(wzInteger r); // info about grid parts of region r;  void  pf(wzInteger f); // info about grid parts of face f;  void  pg();		 // info about the grid;  wzInteger createFloatValue()    {return floatvalues.create()-1;}  wzInteger createFloatValue(const wzPointToFloat& f)    {return setFloatValue(f,floatvalues.create()-1);}  wzInteger createFloatValue(wzFloat (*f)(const wzPoint& p))    {return createFloatValue (* new wzSimplePointToFloat(f));}  wzInteger setFloatValue(wzFloat (*f)(const wzPoint& p), wzInteger n)    {return setFloatValue (* new wzSimplePointToFloat(f), n);}  wzInteger setFloatValue(const wzPointToFloat& f, wzInteger n);  wzIndex   floatValues() const {return floatvalues.last();}};typedef wzProxy<wzGrid> wzgrid;class wzDelaunayGenerator//:public wzProxyTarget  :public wzGrid  ,private ibgDelaunayMarker {  wzIndex regionModus;  wzIndex faceModus;public:  //  wzgrid   _grid;  wzGrid&  Grid;  wzDelaunayGenerator(wzIndex griddim, wzIndex spacedim, wzIndex fdim=0);  virtual ~wzDelaunayGenerator(){;}  wzgrid   grid() const {return &Grid;}  void setOutsideBoundaryMode(wzBoolean i);  wzArray<ibgSphere>	CellSphere;  int	CFree[IBG2CTMAX];  virtual void	defineRegions(cogeometry g);  virtual void	createFaces(cogeometry g);  virtual void 	defineRegionOfCell(int c, cogeometry g);  virtual void 	defineFaceOfCell(int c, cogeometry g);  virtual void 	defineFaceOutside(int c, cogeometry g);  void 	Delaunay(wzpoints list, cogeometry g);  void 	Delaunay(wzpoints list);  void 	include(wzpoints list);  void 	initializeDelaunayBox(wzFloat* min, wzFloat* max);  int 	Delaunay0(wzpoints list);  int 	Delaunay1(wzpoints list);  int 	Delaunay2(wzpoints list);  int 	Delaunay3(wzpoints list);  int 	g1find(wzFloat *xx, int c0);  int 	g2find(wzFloat *xx, int c0);  int 	g3find(wzFloat *xx, int c0);  int	xdim() const {return Grid.spaceDim;}  int	gdim() const {return Grid.gridDim;}  wzISegment 	ccu(wzInteger cc) const {return Grid.CellSegment[cc];}  wzCellType	cct(wzInteger cc) const {return Grid.CellType[cc];}  wzInteger* 	ccn(wzInteger cc) {return &(Grid.Data[Grid.CellData[cc]]);}  wzInteger* 	ccs(wzInteger cc)   {return &(Grid.Data[Grid.CellData[cc]+wzCellTypepoints[Grid.CellType[cc]]]);}  wzInteger* 	ccs(wzInteger cc, wzCellType t)   {return &(Grid.Data[Grid.CellData[cc]+wzCellTypepoints[t]]);}  wzInteger	ccleft(wzInteger cc, wzCellType t)  {return Grid.Data[Grid.CellData[cc]+wzCellTypeSExtL(t)];}  wzInteger	ccright(wzInteger cc, wzCellType t)  {return Grid.Data[Grid.CellData[cc]+wzCellTypeSExtR(t)];}  wzISegment& 	ccu(wzInteger cc) {return Grid.CellSegment[cc];}  wzCellType&	cct(wzInteger cc) {return Grid.CellType[cc];}  ibgSphere&	ccv(wzInteger cc) {return CellSphere[cc];}  wzFloat*	cnx(wzInteger nn) {return Grid.Point[nn].X;}  wzPoint*	cnd(wzInteger nn) {return &(Grid.Point[nn]);}  wzFloat*	cnf(wzInteger nn) {return (Grid.Point[nn].X+wzPointDim);}  wzIndex	cnt(wzInteger nn) const {return (Grid.Point[nn].S.codim());}  wzISegment	cnu(wzInteger nn) const {return (Grid.Point[nn].S.index());}  void  	cns(wzInteger nn,wzISegmentTypes t,wzISegment u)  {Grid.Point[nn].S = wzSegment((wzIndex)(u),(wzDimension)(t));}  wzIndex&	cnc(wzInteger nn) {return Grid.PointCell[nn];}  wzFloat	cgmin(wzIndex dd) const {return Grid.mincoord[(dd)+1];}  wzFloat	cgmax(wzIndex dd) const {return Grid.maxcoord[(dd)+1];}  wzFloat&	cgmin(wzIndex dd) {return Grid.mincoord[(dd)+1];}  wzFloat&	cgmax(wzIndex dd) {return Grid.maxcoord[(dd)+1];}  wzBoolean	ccdef(wzInteger cc) {return (Grid.CellSegment[cc]>0);}  wzBoolean	ccout(wzInteger cc) {return (Grid.CellSegment[cc]==0);}  wzBoolean	ccund(wzInteger cc) {return (Grid.CellType[cc]==wzCellType0Nothing);}  wzIndex	createCell(wzCellType t)  {    wzIndex cc=CFree[t];     if(cc){CFree[t] = -Grid.CellSegment[cc];    }else{cc=Grid.cells.create(); Grid.CellData[cc]=Grid.data.create(wzCellTypesize[t]);}    Grid.CellSegment[cc]=0; Grid.CellType[cc]=t; return cc;  }  void		destroyCell(wzIndex cc)  {    wzCellType t  = Grid.CellType[cc]; Grid.CellType[cc]=wzCellType0Nothing;    Grid.CellSegment[cc] = -CFree[t];    CFree[t] = cc;  }  //  void 	DelaunayOld(wzpoints list, cogeometry g);  //  void	MakeRegions(cogeometry g);  //  void	MaklFaces(cogeometry g);  //  void	MakeEdges(cogeometry g);  //  void	MaklNodes(cogeometry g);  //  int	gceleFace(int c, wzISegment m0, wzISegment m1);  //  int 	gcellSetFace(int c, wzISegment m0, wzISegment m1);  //  int 	cRegion(int c);  //  void 	cSetRegion(int c);  //  int 	g2swapm(int c, int i);  //  void 	g2swapd(int c);  void 	g2segment(int c);  int 	g3segment1(int c);  int 	g3segment2(int c);  //  int 	g3cvol(int c);  //  int 	g3CHalf(int c);  int 	g3EDelete(int cb, int eb);  int 	g3SDelete(int cb, int sb);  int 	g34Swap(int c1, int c2, int c3, int c4);  wzArray<int>	st;};typedef wzProxy<wzDelaunayGenerator> wzdelaunayGenerator;class wziCell{  wzIndex i;  friend class wzGrid;};class wziNode{  wzIndex i;  friend class wzGrid;};extern int ibgFaceOutside;extern int ibgErrorneousFace;extern int ibgSetDefaultFace;wzgrid wzGridContinuation3D(wzgrid grid2D, wzFloat dz, wzIndex nz=1);wzgrid wzGridGenerate(cogeometry cog, int dim, wzpoints pp);void wzGridInit();class wzViewer;void  	wzView(wzgrid g);void	declareGrid(wzViewer& v, wzgrid g);#endif

⌨️ 快捷键说明

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