ibgoctree.hxx

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

HXX
244
字号
#ifndef ibgoctree_hxx
#define ibgoctree_hxx

#include "ibgtypes.hxx"
#include "ibgotype.hxx"

typedef ibgInteger ibgiNode;
typedef ibgInteger ibgiCell;
class ibgOctreeData;
class ibgOctree;
class ibgOctree3D;
class ibgOctree2D;
class ibgOctree1D;
class ibgOctree0D;
const ibgIndex ibgoHidden = 0x1;
const ibgIndex ibgoVisible = 0x0;

const ibgIndex ibgMaxEdgesOnCube = 8;

class ibgOctreeData: public ibgOctreeType{
protected:
  ibgOctreeData(wzIndex,wztensorgrid,cogeometry,wzmetric,wzchart);
  cogeometry	geo;
  wzmetric	ref;
  wzchart	chart;
public:
  wzRange	nodes;
  wzArray<ibgFloat>  	nX[3];
  wzArray<ibgFloat>  	nx;
  wzArray<ibgFloat>  	ny;
  wzArray<ibgFloat>  	nz;
#ifdef GLEVEL
  wzArray<ibgIndex>	nlevel[3];	
#endif
  wzArray<ibgPoint>	nPoint;
  wzArray<ibgIndex>	nOld;
  wzArray<ibgIndex>	nBoundary;
  wzArray<ibgInteger>	nCell[ibgdMaxCorners];	
  wzArray<ibgInteger>	nNext[ibgdMaxLines];	
  wzArray<ibgInteger>	nUp[  ibgdMaxLinesUp];	
  wzArray<ibgInteger>	nDown[ibgdMaxLinesUp];
  wzStack		nStackInitial;
  wzStackDerived	nStackMetric;
  wzStackDerived	nStackOrthogonalRegularization;
  wzStackDerived	nStackLinearRegularization;
  wzStackDerived	nStackFace;
  wzStackDerived	nStackTest;
  wzArray<wzDiagonalMetricData>	nMetric;
  wzRange	cells;
  wzArray<ibgIndex>	cNode[ibgdMaxCorners];	
  wzArray<ibgIndex>	cBoundary;
  wzRange	bnodes;
  wzArray<ibgIndex>	bnBase;
  wzArray<ibgIndex>	bnType;
  wzArray<ibgInteger>	bnNext[ibgdMaxLines];	
  wzArray<ibgInteger>	bnUp[  ibgdMaxLinesUp];	
  wzArray<ibgInteger>	bnDown[ibgdMaxLinesUp];
  wzArray<ibgIndex>	bnPlane[ibgdMaxPlanes];
  wzRange	lines;
  wzArray<ibgIndex>	lNodeUp;
  wzArray<ibgIndex>	lNodeDown;
  wzArray<ibgIndex>	lFaceUp;
  wzArray<ibgIndex>	lFaceDown;
  wzArray<ibgIndex>	lType;
  wzArray<ibgIndex>	lNode[2];
  wzArray<ibgIndex>	lPlane[ibgdMaxLineSides];
  wzRange 	planes;
  wzArray<ibgIndex>	pNode[4];
  wzArray<ibgIndex>	pCell[2];
  wzArray<ibgIndex>	pEdge;
  wzArray<ibgIndex>	pType;
  wzRange	faces;
  wzArray<ibgPoint>	fPoint;		// flag.f1
  wzArray<ibgPoint>	fPointDown;	// flag.f0
  wzArray<ibgPoint>	fPointUp;	// flag.fo
  wzArray<ibgInteger>	fUp;
  wzArray<ibgInteger>	fDown;
  wzArray<ibgInteger>	fLine;
  wzArray<ibgInteger>	fType;
  wzArray<ibgPoint>	fFlag[3];
  wzArray<ibgInteger>	fNext[2];
  wzArray<ibgInteger>	fEdge[ibgdMaxLineSides];
  wzStack		fStackInitial;
  wzStackDerived	fStackMetric;
  wzStackDerived	fStackDoubleIntersection;
  wzStackDerived	fStackRegularization;
  wzArray<wzDiagonalMetricData>	fMetric;
  wzRange 	edges;
  wzArray<ibgPoint>	ePoint;
  wzArray<ibgPoint>	ePointFace;
  wzArray<ibgPoint>	ePointUp;
  wzArray<ibgPoint>	ePointDown;
  wzArray<ibgInteger>	eFace;
  wzArray<ibgInteger>	eNext;
  wzArray<ibgInteger>	eIdent;
  wzArray<ibgInteger>	ePlane;
  wzArray<ibgInteger>	eVertex[2];
  wzArray<ibgPoint>	eFlag[4];
  wzRange	bcells;
  wzArray<ibgIndex>	bcBase;
  wzArray<ibgIndex>	bcType;
  wzArray<ibgIndex>	bcVertex;
  wzArray<ibgIndex>	bcEdge[ibgMaxEdgesOnCube];
  wzRange	vertices;
  wzArray<ibgPoint>	vPoint;
  wzArray<ibgPoint>	vPointEdge;
  wzArray<ibgPoint>	vPointFace;
  wzArray<ibgPoint>	vPointUp;
  wzArray<ibgPoint>	vPointDown;
  wzArray<ibgInteger>	vEdge;
  wzArray<ibgInteger>	vNext;
  wzArray<ibgInteger>	vIdent;
  wzArray<ibgInteger>	vCell;
  wzArray<ibgPoint>	vFlag[5];
  wzFloat		dmin[wzPointDim];
  // useful definitions of types:
  wzIndex lDirection(wzIndex l) const {return (lType[l] & 0x3);}
  wzIndex pDirection(wzIndex p) const {return (pType[p] & 0x3);}
        
  static const ibgInteger	outside; // should be 0!!!
  static const ibgInteger	nothing; // should be <0!!!
  ibgBoolean is_undefined(ibgInteger n){return n<=0;}
  ibgBoolean is_defined  (ibgInteger n){return n>0;}
  ibgBoolean is_nothing  (ibgInteger n){return n<0;}
  ibgBoolean is_outside  (ibgInteger n){return n==outside;}
  static ibgIndex	maxFacesOnLine;
  //  virtual ibgiNode	refine(ibgiNode,ibgdLine)	{return 0;}
  virtual ibgiNode	plumb(ibgiNode,ibgdLine,ibgdLine)	{return 0;}
  virtual ibgiNode	plumbForced(ibgiNode n,ibgdLine r1,ibgdLine r2){return plumb(n,r1,r2);}
  // debugging features:
  void po();
  void pn(ibgiNode);
  void pq(ibgiCell);
  void pp(ibgIndex);
  void pe(ibgIndex);
  void pf(ibgIndex);
  void pl(ibgIndex);
  void pb(ibgIndex);
  void pc(ibgIndex);
  void t();
  void getPointList(wzpoints pointlist);
private:
  void initialize(wztensorgrid);
};

class ibgOctree: public wzProxyTarget, public ibgOctreeData{ 
protected:
  friend class CogenOctree;
  ibgOctree(ibgIndex dim,wztensorgrid,cogeometry,wzmetric,wzchart);
  void nInitializeMetric(ibgiNode);
  void nMetricalRefinement(ibgiNode);
  void nOrthogonalRegularization(ibgiNode);
  void nLinearRegularization(ibgiNode);
  wzIndex nFindFaces(ibgiNode);
  wzIndex lFindFaces(wzIndex);
  void fInitializeMetric(wzIndex);
  void fMetricalRefinement(wzIndex);
  void fRegularization(wzIndex);
  void fDoubleIntersection(wzIndex);
  void fLongSideIntersection(wzIndex);
  void findFaces();
  void findEdges();
  void findVertices();
  //  virtual void	refine(ibgiNode) = 0;
  void	refine(ibgiNode);
  virtual ibgiNode	plumb(ibgiNode,ibgdLine,ibgdLine) {return 0;}
  ibgIndex createSimpleBoundaryNode(ibgIndex node);
  ibgIndex createSimpleLine(ibgIndex no, ibgIndex n1, ibgIndex d);
  ibgIndex createSimplePlane(ibgIndex line, ibgIndex side);
  ibgIndex createSimpleBoundaryCube(ibgIndex base);
  ibgiNode refineBoundaryLine(ibgIndex l);
  void refineNearFace(wzIndex f);
  ibgIndex splitBoundaryLine(ibgiNode nu, ibgIndex dir, ibgiNode nh);
  void noteEdgeOnCube(ibgIndex p, ibgIndex e, ibgIndex s);
  ibgIndex getPlane(ibgIndex line, ibgIndex side);
  virtual ibgiNode	refine(ibgiNode,ibgdLine){return 0;}
  wzIndex freeFace;
public:
  void generate();
  void generateWithoutEdges();
  void test();
  void setMinimalDistance(wzFloat dx=wzInfty, wzFloat dy=wzInfty, wzFloat dz=wzInfty)
  {dmin[0]=dx;dmin[1]=dy;dmin[2]=dz;}
  static wzFloat LongSideIntersectionFactor;
};

typedef wzProxy<ibgOctree> ibgoctree;

class ibgOctree3D: public ibgOctree{
  static const ibgIndex 	firstCorner;
  static const ibgIndex 	lastCorner;
  //  void		refine(ibgiNode);
  ibgiNode	refine(ibgiNode,ibgdLine);
  ibgiNode	plumb(ibgiNode,ibgdLine,ibgdLine);
  ibgiNode	plumbForced(ibgiNode,ibgdLine,ibgdLine);
  ibgiCell 	splitCell(ibgiCell qq, unsigned ro);
  ibgiCell 	qref1(ibgiCell qq, unsigned ro);
  ibgiCell 	qref2(ibgiCell qq, unsigned ro);
public:
  static const ibgIndex 	Lines;
  static const ibgIndex 	Planes;
  static const ibgIndex 	Corners;
  static const ibgIndex 	LineSides;
  static const ibgIndex 	PlaneSides;
  static const ibgIndex 	PlaneCorners;
  ibgOctree3D(wztensorgrid,cogeometry,wzmetric,wzchart);
};

class ibgOctree2D: public ibgOctree{
  //  void		refine(ibgiNode);
  ibgiNode	refine(ibgiNode,ibgdLine);
  ibgiNode	plumb(ibgiNode,ibgdLine,ibgdLine);
public:
  static const ibgIndex 	Lines;
  static const ibgIndex 	Planes;
  static const ibgIndex 	LineSides;
  static const ibgIndex 	PlaneCorners;
  ibgOctree2D(wztensorgrid,cogeometry,wzmetric,wzchart);
};

class ibgOctree1D: public ibgOctree{
  //  void		refine(ibgiNode);
  ibgiNode	refine(ibgiNode,ibgdLine);
public:
  static const ibgIndex 	Lines;
  ibgOctree1D(wztensorgrid,cogeometry,wzmetric,wzchart);
};

class ibgOctree0D: public ibgOctree{
public:
  //  void		refine(ibgiNode);
  ibgOctree0D(wztensorgrid,cogeometry,wzmetric,wzchart);
};

ibgoctree ibgOctreeCreate(wztensorgrid,cogeometry,wzmetric,wzchart);

void ibgGetPoints(wzpoints p, ibgoctree oct);

typedef enum {
  cdirnnn,cdirpnn,cdirnpn,cdirppn,cdirnnp,cdirpnp,cdirnpp,cdirppp,cdir000
}ibgOctreeCornerDirection;

#endif

⌨️ 快捷键说明

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