Node::Node(gzFile& myfile, MatProps* matprops_ptr) { gzread(myfile, &(id), sizeof(int)); gzread(myfile, &(info), sizeof(int)); gzread(myfile, (key), sizeof(unsigned) * 2); gzread(myfile, (coord), sizeof(double) * 2); gzread(myfile, &(elevation), sizeof(double)); // double resolution = 0; // int i = Get_max_resolution(&resolution); // if (i != 0) { // printf("error in Get_max_resolution\n"); // exit(1); // } // double xcoord = coord[0] * (matprops_ptr->LENGTH_SCALE); // double ycoord = coord[1] * (matprops_ptr->LENGTH_SCALE); // i = Get_elevation(resolution, xcoord, ycoord, &elevation); // if (i != 0) { // printf("error in Get_elevation\n"); // exit(1); // } // elevation = elevation / matprops_ptr->LENGTH_SCALE; zero_flux(); num_assoc_elem = 0; }
Node::Node(unsigned* keyi, double* coordi, int inf, double elev, int yada) { int i; id = 0; /* keith added this so save_node wouldn't write an uninitialized variable and valgrind wouldn't flag an error. id is used in ../repartition/BSFC_update_and_send_elements.C */ info = INIT; for (i = 0; i < DIMENSION; i++) coord[i] = *(coordi + i); for (i = 0; i < KEYLENGTH; i++) key[i] = *(keyi + i); info = inf; //geoflow stuff zero_flux(); elevation = elev; /* if((coord[0]==0)||(coord[1]==0)){ printf("inode=%d node={%u,%u} coord=(%20g,%20g)\n",yada,key[0],key[1],coord[0],coord[1]); assert(coord[0]*coord[1]); } */ return; }
Node:: Node(unsigned* keyi, double* coordi, MatProps* matprops_ptr) { int i; id =0; /* keith added this so save_node wouldn't write an uninitialized variable and valgrind wouldn't flag an error. id is used in ../repartition/BSFC_update_and_send_elements.C */ order =0; /* keith added this for no good reason, so if you don't know that this is right find out, keith isn't responsible for any errors it may cause because right now the node order is unused, it shouldn't be used, but I wanted to see if assigning it zero gets rid of what looks like a "self contained" memory error */ nextptr =0; preptr = 0; sol = 0; sol_deleted = 0; connection_id = -1; info = INIT; for(i=0; i<DIMENSION; i++) coord[i] = *(coordi+i); for(i=0; i<KEYLENGTH; i++) key[i] = *(keyi+i); dof[0] = INIT; dof[1] = INIT; zero_flux(); // find the max resolution of the GIS info and then get the elevation at this node double resolution = 0; double xcoord = coord[0]*(matprops_ptr->LENGTH_SCALE); double ycoord = coord[1]*(matprops_ptr->LENGTH_SCALE); i = Get_max_resolution(&resolution); if(i != 0) { printf("error in Get_max_resolution\n"); exit(1); } i = Get_elevation(resolution, xcoord, ycoord, &elevation); if(i != 0) { printf("error in Get_elevation(%d) r=%g (x,y)=(%g,%g) e=%g\n",i,resolution,xcoord,ycoord,elevation); exit(1); } elevation = elevation/matprops_ptr->LENGTH_SCALE; /* if((unsigned) 1548032885 == key[0]) printf("created the missing node...\n"); */ /* if((coord[0]==0)||(coord[1]==0)){ printf("node={%u,%u} coord=(%20g,%20g)\n",key[0],key[1],coord[0],coord[1]); assert(coord[0]*coord[1]); } */ }
Node::Node(unsigned* keyi, double* coordi, int inf, int ord, MatProps* matprops_ptr) //for refined { int i; id =0; /* keith added this so save_node wouldn't write an uninitialized variable and valgrind wouldn't flag an error. id is used in ../repartition/BSFC_update_and_send_elements.C */ nextptr =0; preptr = 0; sol = 0; sol_deleted = 0; connection_id = -1; info = INIT; for(i=0; i<DIMENSION; i++) coord[i] = *(coordi+i); for(i=0; i<KEYLENGTH; i++) key[i] = *(keyi+i); dof[0] = INIT; dof[1] = INIT; info=inf; order=ord; //geoflow stuff zero_flux(); // find the max resolution of the GIS info and then get the elevation at this node double resolution = 0; i = Get_max_resolution(&resolution); if(i != 0) { printf("error in Get_max_resolution\n"); exit(1); } double xcoord = coord[0]*(matprops_ptr->LENGTH_SCALE); double ycoord = coord[1]*(matprops_ptr->LENGTH_SCALE); i = Get_elevation(resolution, xcoord, ycoord, &elevation); if(i != 0) { printf("error in Get_elevation\n"); exit(1); } elevation = elevation/matprops_ptr->LENGTH_SCALE; /* if((unsigned) 1548032885 == key[0]) printf("created the missing node111111...\n");*/ /* if((coord[0]==0)||(coord[1]==0)){ printf("node={%u,%u} coord=(%20g,%20g)\n",key[0],key[1],coord[0],coord[1]); assert(coord[0]*coord[1]); } */ return; }
Node::Node(unsigned* keyi, double* coordi, MatProps* matprops_ptr) { int i; id = 0; /* keith added this so save_node wouldn't write an uninitialized variable and valgrind wouldn't flag an error. id is used in ../repartition/BSFC_update_and_send_elements.C */ info = INIT; for (i = 0; i < DIMENSION; i++) coord[i] = *(coordi + i); for (i = 0; i < KEYLENGTH; i++) key[i] = *(keyi + i); zero_flux(); // find the max resolution of the GIS info and then get the elevation at this node double resolution = 0; double xcoord = coord[0] * (matprops_ptr->LENGTH_SCALE); double ycoord = coord[1] * (matprops_ptr->LENGTH_SCALE); i = Get_max_resolution(&resolution); if (i != 0) { printf("error in Get_max_resolution\n"); exit(1); } i = Get_elevation(resolution, xcoord, ycoord, &elevation); if (i != 0) { printf("error in Get_elevation(%d) r=%g (x,y)=(%g,%g) e=%g\n", i, resolution, xcoord, ycoord, elevation); exit(1); } elevation = elevation / matprops_ptr->LENGTH_SCALE; /* if((unsigned) 1548032885 == key[0]) printf("created the missing node...\n"); */ /* if((coord[0]==0)||(coord[1]==0)){ printf("node={%u,%u} coord=(%20g,%20g)\n",key[0],key[1],coord[0],coord[1]); assert(coord[0]*coord[1]); } */ }