lmm_constraint_t lmm_constraint_new(lmm_system_t sys, void *id, double bound_value) { lmm_constraint_t cnst = NULL; s_lmm_element_t elem; cnst = xbt_new0(s_lmm_constraint_t, 1); cnst->id = id; cnst->id_int = Global_const_debug_id++; xbt_swag_init(&(cnst->element_set), xbt_swag_offset(elem, element_set_hookup)); xbt_swag_init(&(cnst->active_element_set), xbt_swag_offset(elem, active_element_set_hookup)); cnst->bound = bound_value; cnst->usage = 0; cnst->shared = 1; insert_constraint(sys, cnst); return cnst; }
lmm_constraint_t lmm_constraint_new(lmm_system_t sys, void *id, double bound_value) { lmm_constraint_t cnst = nullptr; s_lmm_element_t elem; cnst = xbt_new0(s_lmm_constraint_t, 1); cnst->id = id; cnst->id_int = Global_const_debug_id++; xbt_swag_init(&(cnst->enabled_element_set), xbt_swag_offset(elem, enabled_element_set_hookup)); xbt_swag_init(&(cnst->disabled_element_set), xbt_swag_offset(elem, disabled_element_set_hookup)); xbt_swag_init(&(cnst->active_element_set), xbt_swag_offset(elem, active_element_set_hookup)); cnst->bound = bound_value; cnst->concurrency_maximum=0; cnst->concurrency_current=0; cnst->concurrency_limit=sg_concurrency_limit; cnst->usage = 0; cnst->sharing_policy = 1; /* FIXME: don't hardcode the value */ insert_constraint(sys, cnst); return cnst; }
bool CGALBuilder::triangulate() { typedef CGAL::Triangulation_vertex_base_with_info_2<VertexInfo,CGAL::Kernel3> VertexBase; typedef CGAL::Triangulation_face_base_with_info_2<FaceInfo,CGAL::Kernel3> Info; typedef CGAL::Constrained_triangulation_face_base_2<CGAL::Kernel3,Info> FaceBase; typedef CGAL::Triangulation_data_structure_2<VertexBase,FaceBase> TDS; typedef CGAL::Exact_predicates_tag Tag; typedef CGAL::Constrained_triangulation_2<CGAL::Kernel3,TDS,Tag> CT; typedef CT::Vertex_handle VertexHandle; typedef CT::Face_iterator FaceIterator; QList<CGAL::Point3> points3=primitive.getPoints(); int total=points3.size(); if(total<3) return false; else if(total==3) return true; CT ct; TDS::size_type count=0; for(CGALPolygon* pg: primitive.getCGALPolygons()) { QList<int> indexes=pg->getIndexes(); if(indexes.size()<3) continue; CGALProjection* pro=pg->getProjection(); QList<CGAL::Point2> points2; for(auto i: indexes) { CGAL::Point2 p2=pro->project(points3.at(i)); VertexHandle h=ct.insert(p2); h->info().index = i; points2.append(p2); ++count; } #if CGAL_VERSION_NR < CGAL_VERSION_NUMBER(4,6,0) insert_constraint(ct,points2.begin(),points2.end(),true); #else ct.insert_constraint(points2.begin(),points2.end(),true); #endif } if(count<3||ct.number_of_vertices()<count) return false; if(ct.number_of_faces()>3) markDomains(ct); primitive.clearPolygons(); for(FaceIterator f=ct.finite_faces_begin(); f!=ct.finite_faces_end(); ++f) { if(f->info().inDomain()) { auto* pg=primitive.createCGALPolygon(); for(auto i=0; i<3; ++i) { VertexInfo info=f->vertex(i)->info(); if(info.isValid()) pg->append(info.index); } pg->calculatePlane(); } } return true; }