This commit is contained in:
James E McClure 2018-09-10 17:29:48 -04:00
parent 686df1c6b7
commit fea083fc82
3 changed files with 19 additions and 7 deletions

View File

@ -6,11 +6,13 @@ Double connected edge list (DECL)
Vertex::Vertex(){
size_ = 0;
vertex_data.resize(24);
}
Vertex::~Vertex(){
}
void Vertex::add(Point P){
vertex_data.push_back(P.x);
vertex_data.push_back(P.y);
@ -82,6 +84,10 @@ DECL::~DECL(){
}
unsigned long int DECL::Face(unsigned long int index){
return FaceData(index);
}
void DECL::LocalIsosurface(const DoubleArray A, double value, const int i, const int j, const int k){
Point P,Q;
Point PlaceHolder;
@ -231,14 +237,16 @@ void DECL::LocalIsosurface(const DoubleArray A, double value, const int i, const
// Now add the local values to the DECL data structure
if (nTris>0){
//printf("Construct halfedge structure... \n");
// printf(" Construct %i triangles \n",nTris);
FaceData.resize(TriangleCount);
//printf("Construct halfedge structure... \n");
//printf(" Construct %i triangles \n",nTris);
halfedge.data.resize(6,nTris*3);
int idx_edge=0;
for (int idx=0; idx<TriangleCount; idx++){
int V1 = Triangles(0,idx);
int V2 = Triangles(1,idx);
int V3 = Triangles(2,idx);
FaceData(idx) = idx_edge;
// first edge: V1->V2
halfedge.data(0,idx_edge) = V1; // first vertex
halfedge.data(1,idx_edge) = V2; // second vertex
@ -263,7 +271,7 @@ void DECL::LocalIsosurface(const DoubleArray A, double value, const int i, const
halfedge.data(4,idx_edge) = idx_edge-1; // previous edge
halfedge.data(5,idx_edge) = idx_edge-2; // next edge
idx_edge++;
// printf(" ***tri %i ***edge %i *** \n",idx, idx_edge);
//printf(" ***tri %i ***edge %i *** \n",idx, idx_edge);
}
//printf(" parsing halfedge structure\n");
int EdgeCount=idx_edge;
@ -299,7 +307,7 @@ void DECL::LocalIsosurface(const DoubleArray A, double value, const int i, const
P.x += i;
P.y += j;
P.z += k;
cellvertices(idx) = P;
vertex.assign(idx,P);
}
}

View File

@ -50,6 +50,7 @@ public:
Vertex vertex;
Halfedge halfedge;
void LocalIsosurface(const DoubleArray A, double value, int i, int j, int k);
unsigned long int Face(unsigned long int index);
double origin(int edge);
double EdgeAngle(int edge);
@ -58,7 +59,6 @@ public:
unsigned long int VertexCount;
private:
unsigned long int *face_data;
Array <unsigned long int> FaceData;
};

View File

@ -42,6 +42,10 @@ int main(int argc, char **argv)
for (j=0; j<Ny-1; j++){
for (i=0; i<Nx-1; i++){
sphere.LocalIsosurface(Phase,0.f,i,j,k);
for (unsigned long int idx=0; idx<sphere.TriangleCount; idx++){
unsigned long int edge = sphere.Face(idx);
}
}
}
}