📄 wzgrid.cxx
字号:
#include <stdlib.h>#include <stdio.h>#include "wzoutput.hxx"#include "wzgrid.hxx"#include "wzview.hxx"#include "cogwarnings.hxx"#ifndef SGIconst wzIndex sxGridMaterials = 100;#endifextern wzName wzNameFile;void wzGrid::test(){ ;}wzDelaunayGenerator::wzDelaunayGenerator(wzIndex griddim, wzIndex spacedim, wzIndex fdim) // :_grid(new wzGrid(griddim,spacedim)) :wzGrid(griddim,spacedim,fdim) ,Grid(*this) ,CellSphere(Grid.cells) ,st(Grid.cells){ for(int i=0;i<IBG2CTMAX;i++) CFree[i] = 0;}wzInteger wzGrid::setFloatValue(const wzPointToFloat& f, wzInteger i){ wzIndex n; if(i<0){cogInfoInvalidFloatValue(); return -1;} if(floatvalues.invalid(i+1)){ floatvalues = i+1; if(floatvalues.invalid(i+1)){cogInfoInvalidFloatValue(); return -1;} } wzRangeLoop(points,n){ Point[n].f(i) = f(Point[n]); } return i;}wzGrid::wzGrid(wzIndex griddim, wzIndex spacedim, wzIndex fdim) :points(sizeof(wzPoint)) ,Point(points.base) ,PointCell(points) ,cells(3*sizeof(wzInteger)) ,CellSegment(cells.base) ,CellType(cells.base,1,sizeof(wzInteger)) ,CellData(cells.base,2,sizeof(wzInteger)) ,data(sizeof(wzInteger)) ,Data(data.base) ,floatvalues(wzPointDimFloat){ gridDim = griddim; spaceDim = spacedim; firstRegion=firstFace=firstEdge=firstNode=1; lastRegion=lastFace=lastEdge=lastNode=0; sxConstructor(); wzCurrentData::grid = this; if(fdim) floatvalues.create(fdim);}/*//void ibg2OtSimplex(wzGrid* gg, FILE *file);wzGrid::wzGrid(char *file){ FILE *ff = fopen(file,"r"); sxConstructor(); // ibg2OtSimplex(this,ff); fclose(ff); sxRefresh();}*/void wzDelaunayGenerator::setOutsideBoundaryMode(wzBoolean i){}extern "C"{void sxDefaultInitLoop(sxGrid g, sxSimplex s);void sxDefaultDestroyGrid(sxGrid g);int wzGridDefineSimplex(sxGrid g, sxSimplex s);}wzIndex wzGrid::sxConstructor(){ int i; boxNotDefined = 1;#ifndef SGI int t; for(t=0;t<sxIteratorTypes;t++){ numOfSimplices[t] = 0; numOfMaterials[t] = sxGridMaterials; material[t] = new int[numOfMaterials[t]]; for(i=0;i<=numOfMaterials[t];i++) material[t][i] = 1; }#endif // initLoop = sxDefaultInitLoop; destroyGrid = 0; // C mechanism should cause an error. C++ - allocation!!! // setSimplexData= wzGridDefineSimplex; return 0;}wzIndex wzGrid::sxRefresh(){ numOfSimplices[sxCells] = cells.last(); numOfSimplices[sxNodes] = points.last(); return 0;}extern "C" int wzGridDefineSimplex(sxGrid grid, sxSimplex s){ wzgrid g = (wzGrid *)(grid); int i,j;begin: i=s->index; switch(s->iterator_type){ case sxCells: if(i > g->lastRegion) goto end_of_loop; s->material = g->CellSegment[i]; if(!g->material[sxCells][s->material]){s->index++; goto begin;} s->node = g->ccn(i) - 1; for(j=1;j<=s->numberOfNodes;i++){ s->coordinates[j]=((double*)&(g->Point[s->node[j]]))-1; } break; case sxNodes: if(i > g->points.last()) goto end_of_loop; s->material = (int) g->Point[i].segment().region(); if(!g->material[sxNodes][s->material]){s->index++; goto begin;} s->priv.node_space[1] = i; s->coordinates[1] = ((double*)&(g->Point[s->node[i]]))-1; } return sxDefined; end_of_loop: return sxEndOfLoop;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -