求指点,谢谢。
调试tetgen库时遇到问题
问题代码:
//// 头文件
class memorypool {
public:
void **firstblock, **nowblock;
void *nextitem;
void *deaditemstack;
void **pathblock;
void *pathitem;
int alignbytes;
int itembytes, itemwords;
int itemsperblock;
long items, maxitems;
int unallocateditems;
int pathitemsleft;
memorypool();
memorypool(int, int, int, int);
~memorypool();
void poolinit(int, int, int, int);
void restart();
void *alloc();
void dealloc(void*);
void traversalinit();
void *traverse();
};
//// 函数
void tetgenmesh::memorypool::traversalinit()
{
uintptr_t alignptr;
// Begin the traversal in the first block.
pathblock = firstblock;
// Find the first item in the block. Increment by the size of (void *).
alignptr = (uintptr_t) (pathblock + 1);
// Align with item on an `alignbytes'-byte boundary.
pathitem = (void *)
(alignptr + (uintptr_t) alignbytes -
(alignptr % (uintptr_t) alignbytes));
// Set the number of items left in the current block.
pathitemsleft = itemsperblock;
}
//// 调用
void createtet()
{
// 将点数据输入文件结构
tetgenio in, out;
// 创建 4 个节点的点数据
int num_points = 4;
double* points = new double[num_points * 3];
// 设置节点坐标(这里假设节点坐标已知)
points[0] = 0.0;
points[1] = 0.0;
points[2] = 0.0;
points[3] = 1.0;
points[4] = 0.0;
points[5] = 0.0;
points[6] = 0.0;
points[7] = 1.0;
points[8] = 0.0;
points[9] = 0.0;
points[10] = 0.0;
points[11] = 1.0;
// 将点数据赋值给 tetgenio 对象
in.numberofpoints = num_points;
in.pointlist = points;
// 设置TETGEN现象和标志
// 创建一个TetGen选项对象
tetgenbehavior behavior;
// 设置选项和标志
behavior.quality = 1; // 设置质量约束
behavior.minratio = 1.2; // 设置最小质量比率
behavior.coarsen = 0; // 关闭网格简化
// 调用TETGEN进行四面体化
tetrahedralize(&behavior, &in, &out);
}