int main(const int argc, const char** argv) {
	double tstart1, tstop1, tstart2, tstop2, tstartall, tstopall;
	
	// start clocking
	tstartall = (double)clock()/(double)CLOCKS_PER_SEC;
	
	// mi will be the cards of the support sets and m is the total card
  std::vector<int> mi;
 	int m;
 	
 	// construct an empty pointset and an index
 	std::vector<std::vector<Field> > pointset;
 	map<std::vector<Field>,int> points_index;
 	
 	//read input (points, mi, m), apply cayley trick 
 	// (now you have the pointset), make the index
 	cayley_trick(pointset, points_index, mi, m);
	
	// compute the big matrix
	// BUT first homogenize the pointset, dirty way..
	vector<vector<Field> > homo_pointset;
	homogenize(pointset,homo_pointset);
	std::cout << homo_pointset << std::endl;
  HD dets(homo_pointset.begin(),homo_pointset.end());
	
	//define the projection
	vector<int> proj = proj_first_coord(PD,m,mi);
	
	// the data structure to hold the res polytope
	int numof_triangs=0, numof_init_Res_vertices;
	Convex_hull_d CH(PD);
	
	//compute the res polytope
	compute_res(pointset,points_index,m,mi,proj,dets,numof_triangs, numof_init_Res_vertices,CH);
	//compute_res_fast(pointset,points_index,m,mi,proj,dets,numof_triangs, numof_init_Res_vertices,CH);
	
	// stop clocking
	tstopall = (double)clock()/(double)CLOCKS_PER_SEC;
	
	// print the vertices of the res polytope
	for (Vertex_iterator_d vit = CH.vertices_begin(); vit != CH.vertices_end(); vit++)
		std::cout << vit->point() << " ";
	std::cout << std::endl;
	
	// print some statistics
	print_statistics(numof_triangs, numof_init_Res_vertices, CH.number_of_vertices(), tstopall-tstartall);
	
	return 0;
}
Exemple #2
0
int compute_results(void)
{
	int i ;

  for (i=0; i<n_len; i++)
	{
		PUT_NRES_FX(i,-GET_NODE_FX(i)); /* reactions to zero */
		PUT_NRES_FY(i,-GET_NODE_FY(i));
		PUT_NRES_MZ(i,-GET_NODE_MZ(i));

		PUT_NRES_POSX(i,u_val[i*3+0]); /* DOF solution */
		PUT_NRES_POSY(i,u_val[i*3+1]);
		PUT_NRES_ROTZ(i,u_val[i*3+2]);
	}

	for (i=0; i<e_len; i++)
	{
		compute_res(i);
		compute_prim_res(i);
	}
	return(OK);
}