inline void dc3(int *str,int *sa,const int &n,const int &m)
{
    int *strn(str+n);
    int *san(sa+n),tb((n+1)/3),ta(0),tbc(0),i,j,k;
    str[n]=str[n+1]=0;
    for(i=0; i<n; ++i)
        if(i%3)
            wa[tbc++]=i;
    sort(str+2,wa,wb,tbc,m);
    sort(str+1,wb,wa,tbc,m);
    sort(str,wa,wb,tbc,m);
    for(i=j=1,strn[F(wb[0])]=0; i<tbc; ++i)
        strn[F(wb[i])]=c0(str,wb[i-1],wb[i])?j-1:j++;
    if(j<tbc)
        dc3(strn,san,tbc,j);
    else
        for(i=0; i<tbc; ++i)
            san[strn[i]]=i;
    for(i=0; i<tbc; ++i)
        if(san[i]<tb)
            wb[ta++]=san[i]*3;
    if(n%3==1)
        wb[ta++]=n-1;
    sort(str,wb,wa,ta,m);
    for(i=0; i<tbc; ++i)
        wv[wb[i]=G(san[i])]=i;
    for(i=j=k=0; i<ta && j<tbc;)
        sa[k++]=c12(str,wb[j]%3,wa[i],wb[j])?wa[i++]:wb[j++];
    while(i<ta)
        sa[k++]=wa[i++];
    while(j<tbc)
        sa[k++]=wb[j++];
}
Ejemplo n.º 2
0
void dc3(int *r, int *sa, int n, int m) {
    int j, *rn = r + n, *san = sa + n, ta = 0, tb = (n + 1) / 3, tbc = 0, p;
    r[n] = r[n + 1] = 0;
    rep(i, n)
    if (i % 3 != 0) wa[tbc++] = i;
    rsort(r + 2, wa, wb, tbc, m);
    rsort(r + 1, wb, wa, tbc, m);
    rsort(r, wa, wb, tbc, m);
    for (p = 1, rn[F(wb[0])] = 0, j = 1; j < tbc; j++)
        rn[F(wb[j])] = c0(r, wb[j - 1], wb[j]) ? p - 1 : p++;
    if (p < tbc) dc3(rn, san, tbc, p);
    else rep(i, tbc)
    san[rn[i]] = i;
    rep(i, tbc)
    if (san[i] < tb) wb[ta++] = san[i] * 3;
    if (n % 3 == 1) wb[ta++] = n - 1;
    rsort(r, wb, wa, ta, m);
    rep(i, tbc)
    wv[wb[i] = G(san[i])] = i;
    int i;
    for (i = j = p = 0; i < ta && j < tbc; p++)
        sa[p] = c12(wb[j] % 3, r, wa[i], wb[j]) ? wa[i++] : wb[j++];
    for (; i < ta; p++) sa[p] = wa[i++];
    for (; j < tbc; p++) sa[p] = wb[j++];
}
inline bool c12(const int *str,const int &k,const int &a,const int &b)
{
    if(k==2)
        return str[a]<str[b] || str[a]==str[b] && c12(str,1,a+1,b+1);
    else
        return str[a]<str[b] || str[a]==str[b] && wv[a+1]<wv[b+1];
}
Ejemplo n.º 4
0
TEST_F(CollectionTest, CtorHashSet) {
  int const v[] = { 'A', 'B', 'C' };
  Collection_<int> c1(v, ARRAYSIZE(v));
  EXPECT_EQ(ARRAYSIZE(v), c1.Count());

  HashSet_<int> set(c1);
  EXPECT_EQ(ARRAYSIZE(v), set.Count());

  Collection_<int> c12(set);
  EXPECT_EQ(ARRAYSIZE(v), c12.Count());
}
Ejemplo n.º 5
0
void testHand() {

	Hand h1;
	Card c1(1); // Normal 1
	Card c2(2);// Normal 2
	Card c3(3);// Normal 3
	Card c4(4);// Normal 4
	Card c11(11);// Normal 11
	Card c12(12);// Normal 12
	Card sb(13, SKIP_BO); // Skipbo

	h1.add(c1);
	assert(h1.getTopNum() == c1.getNumber()); //Checks if card was added

	h1.add(c3);
	h1.add(c2);
	h1.order(); 

	assert(h1.getTopNum() == c3.getNumber()); // C3 should be at the top after it gets ordered

	h1.add(sb);
	h1.add(c12);
	h1.add(c11);
	h1.order(); 

	assert(h1.getTopNum() == sb.getNumber()); // Skipbos always at the top

	h1.add(c4);
	assert(h1.getTopNum() == c4.getNumber()); // Added new card, out of order
	h1.order();
	assert(h1.getTopNum() == sb.getNumber()); // Skipbos always at the top

	// Testing the remove function:
	assert(h1.remove(c4) == c4);
	assert(h1.remove(sb) == sb);
	assert(h1.remove(c11) == c11);

	// Adding a new card out of order
	h1.add(c3);
	h1.order();
	// Removing all cards and checking if hand is fully ordered:
	assert(h1.getTopNum() == c12.getNumber());
	assert(h1.remove(c12) == c12);
	assert(h1.getTopNum() == c3.getNumber());
	assert(h1.remove(c3) == c3);
	assert(h1.getTopNum() == c3.getNumber()); // C3 remains at end because two c3 cards were added
	assert(h1.remove(c3) == c3);
	assert(h1.getTopNum() == c2.getNumber());
	assert(h1.remove(c2) == c2);
	assert(h1.getTopNum() == c1.getNumber());
	
	
}
Ejemplo n.º 6
0
void dc3(int *r, int *sa, int n, int m) {
  int i, j, *rn = r + n;
  int *san = sa + n, ta = 0, tb = (n + 1) / 3, tbc = 0, p;
  r[n] = r[n + 1] = 0;
  for (i = 0; i < n; i++) { if (i % 3 != 0) { wa[tbc++] = i; } }
  Sort(r + 2, wa, wb, tbc, m);
  Sort(r + 1, wb, wa, tbc, m);
  Sort(r, wa, wb, tbc, m);
  for (p = 1, rn[F(wb[0])] = 0, i = 1; i < tbc; i++) {
    rn[F(wb[i])] = c0(r, wb[i - 1], wb[i]) ? p - 1 : p++;
  }
  if (p < tbc) { dc3(rn, san, tbc, p); }
  else { for (i = 0; i < tbc; i++) { san[rn[i]] = i; } }
  for (i = 0; i < tbc; i++) { if (san[i] < tb) { wb[ta++] = san[i] * 3; } }
  if (n % 3 == 1) { wb[ta++] = n - 1; }
  Sort(r, wb, wa, ta, m);
  for (i = 0; i < tbc; i++) { wv[wb[i] = G(san[i])] = i; }
  for (i = 0, j = 0, p = 0; i < ta && j < tbc; p++) {
    sa[p] = c12(wb[j] % 3, r, wa[i], wb[j]) ? wa[i++] : wb[j++];
  }
  for (; i < ta; p++) { sa[p] = wa[i++]; }
  for (; j < tbc; p++) { sa[p] = wb[j++]; }
}
Ejemplo n.º 7
0
void Scene::init(){
	primitives = new Primitive*[25];
	nrOfPrimitives = 0;
    
    //wall at0,0,1
    Vec3 v121( 0,0, 1 );
	primitives[nrOfPrimitives] = new PlanePrim( v121, -13.0f );
	primitives[nrOfPrimitives]->getMaterial()->setReflection( 1 );
	primitives[nrOfPrimitives]->getMaterial()->setDiffuse( 0.0f );
    primitives[nrOfPrimitives]->getMaterial()->setSpecular(1.0f);
    Color c121( 1,1,1 );
	primitives[nrOfPrimitives++]->getMaterial()->setColor(c121);
    
    
    //wall at 0 0 -1
    Vec3 v12( 0,0, -1 );
	primitives[nrOfPrimitives] = new PlanePrim( v12, 13.0f );
	primitives[nrOfPrimitives]->getMaterial()->setReflection( 1.0f );
	primitives[nrOfPrimitives]->getMaterial()->setDiffuse( 0.0f );
    primitives[nrOfPrimitives]->getMaterial()->setSpecular(1.0f);
    Color c12( 0.3f,0.3f,0.7f );
	primitives[nrOfPrimitives++]->getMaterial()->setColor(c12);
    //-
    
    //the ground
    Vec3 v1( 0,1, 0 );
	primitives[nrOfPrimitives] = new CheckerBoard( v1, 3.4f );
	primitives[nrOfPrimitives]->getMaterial()->setReflection( 0.7f );
	primitives[nrOfPrimitives]->getMaterial()->setDiffuse( 1.0f );
    primitives[nrOfPrimitives]->getMaterial()->setSpecular(0.0f);
    Color c1( 0.3f, 0.3f, 0.7f );
	primitives[nrOfPrimitives++]->getMaterial()->setColor(c1);
    //
    
    
    // 0 -1 0
    Vec3 v13( 0,-1, 0 );
	primitives[nrOfPrimitives] = new PlanePrim( v13, -3.4f );
	primitives[nrOfPrimitives]->getMaterial()->setReflection( 1 );
	primitives[nrOfPrimitives]->getMaterial()->setDiffuse( 1.0f );
    primitives[nrOfPrimitives]->getMaterial()->setSpecular(1.0f - primitives[nrOfPrimitives]->getMaterial()->getDiffuse());
    Color c13( 1,1,1 );
	primitives[nrOfPrimitives++]->getMaterial()->setColor(c13);
    //
    
	//middle sphere
    Vec3 v2( 0, 1, 8 );
	primitives[nrOfPrimitives] = new Sphere( v2, 1.0f );
	primitives[nrOfPrimitives]->getMaterial()->setReflection( 1 );
    primitives[nrOfPrimitives]->getMaterial()->setDiffuse( 0.2 );
    primitives[nrOfPrimitives]->getMaterial()->setSpecular(1.0f - primitives[nrOfPrimitives]->getMaterial()->getDiffuse());
    Color c2( 1,1,1);
	primitives[nrOfPrimitives++]->getMaterial()->setColor( c2 );
	//-
    
    //left sphere
    Vec3 v3( -5.5f, -0.5, 7 );
    Color c3( 0.7f, 0.7f, 0 );
	primitives[nrOfPrimitives] = new Sphere( v3, 2 );
	primitives[nrOfPrimitives]->getMaterial()->setReflection( 0.6f );
	primitives[nrOfPrimitives]->getMaterial()->setDiffuse( 0.9f );
    primitives[nrOfPrimitives]->getMaterial()->setSpecular(1.0f - primitives[nrOfPrimitives]->getMaterial()->getDiffuse());
	primitives[nrOfPrimitives++]->getMaterial()->setColor( c3 );
    //-
    
    //right sphere
    Vec3 v31( 5.5f, -0.5, 7 );
    Color c31( 0.7f, 0.0f, 0 );
	primitives[nrOfPrimitives] = new Sphere( v31, 2 );
	primitives[nrOfPrimitives]->getMaterial()->setReflection( 0.6f );
	primitives[nrOfPrimitives]->getMaterial()->setDiffuse( 0.9f );
    primitives[nrOfPrimitives]->getMaterial()->setSpecular(1.0f);
	primitives[nrOfPrimitives++]->getMaterial()->setColor( c31 );
    //-
    
    //a light
    Vec3 v4( 3, 2.5f, 3 );
    Color c4(0.7f,0.7f,0.7f);
	primitives[nrOfPrimitives] = new Sphere( v4, 0.5f );
	primitives[nrOfPrimitives]->isLight = true;
	primitives[nrOfPrimitives++]->getMaterial()->setColor( c4 );
	//--
    
    //another light
    Vec3 v5( 0, 5, 10 );
    Color c5( 0.6f, 0.6f, 0.8f );
	primitives[nrOfPrimitives] = new Sphere( v5, 0.5f );
	primitives[nrOfPrimitives]->isLight = true;
	primitives[nrOfPrimitives++]->getMaterial()->setColor( c5 );
	//--    
}
Ejemplo n.º 8
0
int c12(int k,int *r,int a,int b)
{if(k==2) return r[a]<r[b]||r[a]==r[b]&&c12(1,r,a+1,b+1);
 else return r[a]<r[b]||r[a]==r[b]&&wv[a+1]<wv[b+1];}
Ejemplo n.º 9
0
int read_multiplet_data(int lineno, char filename[], opt* opts,
						vector<string> *listname, vector<metab_template> *Tems, vector<double> *x,
						char chemshift[], int s, char inputdir[])
// read in metabolite multiplet data, note at present this assumes the file
// is ordered in groups corresponding to different metabolites
{
	vector<string> names(lineno);// name characters the first line
	matrix c1(lineno);
	matrix c2(lineno);
	matrix c3(lineno);
	matrix c4(lineno);
	matrix c5(lineno);
	//matrix c6(lineno);
	matrix c7(lineno);
	matrixI c8(lineno);
	// for ph
	vector<string> names2(lineno);
	matrix c11(lineno);
	matrix c12(lineno);
	
	
	int count = 0;
	double pst, ped;
	
	int nl = read_datf(&names,&c1, &c2, &c3, &c4, &c5, &c7, &c8, filename);
	
	if (nl < 0)
	{
		return nl;
	}
	
	
	if ((*opts).usechemshift == 1)
	{
		int nl2 = read_dat_chemshift(&names2, &c11,&c12, chemshift, s);
		if (nl2 < 0)
		{
			return nl2;
		}
		
		if (nl != nl2)
		{
			printf("Different number of multiplets, exiting ...\n");
			system("PAUSE");
			exit(1);
			//return -999;
		}
		for (unsigned int j = 0; j < nl2; j++)
		{
			if (!((c12[j][0]+50)<0.0000001))
			{
				//	if(names[j].compare(names2[j]) == 0 && c11[j][0] == c1[j][0])
				//{
				c1[j][0] = c12[j][0];
				//}else{
				//	printf("something wrong with multi chemshift, exiting ...\n");
				//	system("PAUSE");
				//	exit(1);
				//}
			}
		}
	}
	
	
	char prevname[80]=" ";
	char name[80] = {'\0'};
	char lis[80] = {'\0'};
	metab_template templa("",(*x).size());
	
	for (unsigned int i  = 0; i < (*listname).size(); i++)
	{
		strcpy(lis,(*listname)[i].c_str());
		
		for (int it = 0; it < nl; it++)
		{
			strcpy(name,names[it].c_str());
			if (!strcmp(lis,name) && c8[it][0]==1) // find a match in the list
			{
				if (!strcmp(prevname, " ")&& c8[it][0]==1)//first prevname do not match prevname
				{
					metab_template templa1(name,(*x).size());
					templa = templa1;
				}
				
				if (strcmp(prevname,name) && strcmp(prevname, " ") && c8[it][0]==1) // make a new template
				{
					metab_template templa1(name,(*x).size());
					templa = templa1;
				}
				
				strcpy(prevname,name);
				
				for (unsigned int n2 = 0; n2<(*opts).st.size(); n2++)
				{
					if ((*opts).st[n2]>(*opts).ed[n2])
					{
						pst = (*opts).ed[n2];
						ped = (*opts).st[n2];
					} else {
						ped = (*opts).ed[n2];
						pst = (*opts).st[n2];
					}
					if ((c5[it][0]+50)<0.0000001)
					{
						if (!((c7[it][0]+50)<0.0000001))
						{
							if (c1[it][0]<ped+(15.0*(*opts).log_fwhh_prop_var)+c7[it][0]
								&& c1[it][0]>pst-(15.0*(*opts).log_fwhh_prop_var)-c7[it][0])
							{
								count = 1;
							}
						} else {
							if (c1[it][0]<ped+(15.0*(*opts).log_fwhh_prop_var)+(*opts).rdelta
								&& c1[it][0]>pst-(15.0*(*opts).log_fwhh_prop_var)-(*opts).rdelta)
							{
								count = 1;
							}
						}
					} else {
						if (!((c7[it][0]+50)<0.0000001))
						{
							if (c5[it][0]<ped+(15.0*(*opts).log_fwhh_prop_var)+c7[it][0]
								&& c5[it][0]>pst-(15.0*(*opts).log_fwhh_prop_var)-c7[it][0])
							{
								count = 1;
							}
						} else {
							if (c5[it][0]<ped+(15.0*(*opts).log_fwhh_prop_var)+(*opts).rdelta
								&& c5[it][0]>pst-(15.0*(*opts).log_fwhh_prop_var)-(*opts).rdelta)
							{
								count = 1;
							}
						}
					}
				}
				if (count == 1)
				{
					if((c2[it][0]+1 <0.0000001) && (c2[it][0]+1 > -0.0000001))
					{
						if (c3[it].size()!=c4[it].size())
						{
							cout<<"\nNo. of protons do not match no. of J constant for metabolite "<<names[it]<<", exiting ...\n";
							//system("PAUSE");
							exit(1);
						}
						double prot=0;
						
						for(unsigned int locit=0;locit<c4[it].size();locit++)
							prot+=c4[it][locit];
						vector<double> weights(c4[it]);
						for(unsigned int locit=0;locit<c4[it].size();locit++)
							weights[locit]/=prot;
						
						//multiplet_site ms(prot, c1[it][0]);
						multiplet_site ms(&c2[it], c1[it][0], &c3[it], prot,
										  x, c5[it][0],-50, c7[it][0], opts);
						
						// vector<unsigned int> c2int(c2[it].size(),0);
						//vecftoi(c2[it], c2int);
						ms.setup_param_extra(c3[it],weights);
						templa.add_multiplet(ms);
					} else if ((c2[it][0]+2 <0.0000001) && (c2[it][0]+2 > -0.0000001)) {
						
						//multiplet_site new_mult2(&pos_vec,&nprot_vec, &x);
						//cout << "c2 "<<c2[it][0] << endl;
						
						vector<double> raster(0.0);
						double vec_el;
						
						multiplet_site ms(&c2[it], c1[it][0], &c3[it], c4[it][0],
										  x, c5[it][0], -50, c7[it][0], opts);
						
						if (c3[it].size() == 2)
						{
							// raster
							//printf("find input raster\n");
							raster.clear();
							char fdirR[3000]={'\0'};
							strcpy(fdirR,inputdir);
							strcat(fdirR,name);
							strcat(fdirR,".txt");
							ifstream inA3_str(fdirR);
							//cout<<"route "<< fdirR<<endl;
							//cout<<"file is "<< inA3_str<< endl;
							
							//if (!inA3_str)
							//cout<<"empty, no file "<< inA3_str<< endl;
							//int tst = 1;
							int tst2 = 0;
							
							while(inA3_str.good())
							{
								tst2 = tst2 +1;
								
								inA3_str>>vec_el;
								//cout<<"vec_el ppm "<<vec_el<<",tst2 " <<tst2<<endl;
								inA3_str.ignore(1);
								inA3_str.peek();
								if (tst2%2 != 0)
								{
									//cout<<"tst2 " <<tst2<<endl;
									if(vec_el<=max(c3[it][1],c3[it][0]) && vec_el>=min(c3[it][1],c3[it][0]))
									{
																			
											inA3_str>>vec_el;
										raster.push_back(vec_el);
										tst2 = tst2 +1;
									} 
								}

							}
							/*cout<<"tst = " <<tst<<endl;
							cout<<"raster1 = "<< raster[0]<<"rasterE = "<<raster[raster.size()-1]<<endl;
							//cout << "c3 "<<c3[it].size()<<endl;
							//for (int ii = 0; ii <raster.size(); ii++)
							//cout<<"raster "<< raster[ii] << " ";
							FILE *outM;
							outM = fopen("raster.txt","w");
							// wirte to file the metabolites in range for anaylsis
							for (unsigned int cv = 0; cv <raster.size(); cv++)
							{
								fprintf(outM, "%f",raster[cv]);
								if (cv <=(raster.size()-1))
								{
									fprintf(outM, "\n");
								}
							}
							fclose(outM);*/
							
							
							ms.raster_setup(abs(c3[it][1]-c3[it][0]), &raster);
						} else {
							printf("Wrong ppm ranges for raster (-2) in J_constant, exiting ...\n");
							system("PAUSE");
							exit(1);
						}
						templa.add_multiplet(ms);
						
					} else {
Ejemplo n.º 10
0
int c12(int k, int *r, int a, int b) {
  if (k == 2) { return r[a] < r[b] || (r[a] == r[b] && c12(1, r, a + 1, b + 1)); }
  else { return r[a] < r[b] || (r[a] == r[b] && wv[a + 1] < wv[b + 1]); }
}
Ejemplo n.º 11
0
int main(int argc, char* argv[])
{
  Polycurve_conic_traits_2 traits;
    //polycurve constructors
  Polycurve_conic_traits_2::Construct_x_monotone_curve_2
    construct_x_mono_polycurve = traits.construct_x_monotone_curve_2_object();
  Polycurve_conic_traits_2::Construct_curve_2  construct_polycurve =
    traits.construct_curve_2_object();

   //create a curve

  Conic_curve_2 c3(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
                   Conic_point_2(Algebraic(0), Algebraic(0)),
                   Conic_point_2(Algebraic(3), Algebraic(9)));
  Conic_curve_2 c4(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
                   Conic_point_2(Algebraic(3), Algebraic(9)),
                   Conic_point_2(Algebraic(5), Algebraic(25)));
  Conic_curve_2 c5(0,1,0,1,0,0, CGAL::COUNTERCLOCKWISE,
                   Conic_point_2(Algebraic(-25), Algebraic(-5)),
                   Conic_point_2(Algebraic(0), Algebraic(0)));

  Conic_curve_2 c6(1,1,0,6,-26,162,CGAL::COUNTERCLOCKWISE,
                   Conic_point_2(Algebraic(-7), Algebraic(13)),
                   Conic_point_2(Algebraic(-3), Algebraic(9)));
  Conic_curve_2 c7(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
                   Conic_point_2(Algebraic(-3), Algebraic(9)),
                   Conic_point_2(Algebraic(0), Algebraic(0)));
  Conic_curve_2 c8(0,1,0,-1,0,0, CGAL::COUNTERCLOCKWISE,
                   Conic_point_2(Algebraic(0), Algebraic(0)),
                   Conic_point_2(Algebraic(4), Algebraic(-2)));

  Conic_curve_2 c9(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
                   Conic_point_2(Algebraic(-5), Algebraic(25)),
                   Conic_point_2(Algebraic(5), Algebraic(25)));
  Conic_curve_2 c10(58, 72, -48, 0, 0, -360);

  //This vector is used to store curves that will be used to create polycurve
  std::vector<Conic_curve_2> conic_curves;
  conic_curves.push_back(c9);

  //construct poly-curve
  Polycurve_conic_traits_2::Curve_2 conic_polycurve =
    construct_polycurve(conic_curves.begin(), conic_curves.end());

  Conic_curve_2 c11(0,1,0,-1,0,0,CGAL::COUNTERCLOCKWISE,
                     Conic_point_2(Algebraic(25), Algebraic(-5)),
                     Conic_point_2(Algebraic(0), Algebraic(0)));
  Conic_curve_2 c12(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
                     Conic_point_2(Algebraic(0), Algebraic(0)),
                     Conic_point_2(Algebraic(5), Algebraic(25)));
  conic_curves.clear();
  conic_curves.push_back(c11);
  conic_curves.push_back(c12);

  //construct poly-curve
  Polycurve_conic_traits_2::Curve_2 conic_polycurve_2 =
    construct_polycurve(conic_curves.begin(), conic_curves.end());

  /* VERY IMPORTANT
   * For efficiency reasons, we recommend users not to construct
   * x-monotone conic arc directly, but rather use the Make_x_monotone_2
   * functor supplied by the conic-arc traits class to convert conic curves
   * to x-monotone curves.
   */
  Conic_x_monotone_curve_2 xc3(c3);
  Conic_x_monotone_curve_2 xc4(c4);
  Conic_x_monotone_curve_2 xc5(c5);
  Conic_x_monotone_curve_2 xc6(c6);
  Conic_x_monotone_curve_2 xc7(c7);
  Conic_x_monotone_curve_2 xc8(c8);


  //This vector is used to store curves that will be used to create
  //X-monotone-polycurve
  std::vector<Conic_x_monotone_curve_2> xmono_conic_curves_2;
  xmono_conic_curves_2.push_back(xc5);
  xmono_conic_curves_2.push_back(xc3);
  xmono_conic_curves_2.push_back(xc4);


  //construct x-monotone poly-curve
  Pc_x_monotone_curve_2 conic_x_mono_polycurve_1 =
    construct_x_mono_polycurve(xmono_conic_curves_2.begin(),
                               xmono_conic_curves_2.end());

  xmono_conic_curves_2.clear();
  xmono_conic_curves_2.push_back(xc6);
  xmono_conic_curves_2.push_back(xc7);
  xmono_conic_curves_2.push_back(xc8);
  //construct x-monotone poly-curve
  Pc_x_monotone_curve_2 conic_x_mono_polycurve_2 =
    construct_x_mono_polycurve(xmono_conic_curves_2.begin(),
                               xmono_conic_curves_2.end());

  xmono_conic_curves_2.clear();
  xmono_conic_curves_2.push_back(xc5);

  Pc_x_monotone_curve_2 x_polycurve_push =
    construct_x_mono_polycurve(xmono_conic_curves_2.begin(),
                               xmono_conic_curves_2.end());
  Polycurve_conic_traits_2::X_monotone_subcurve_2 xcurve_push =
    Polycurve_conic_traits_2::X_monotone_subcurve_2(c5);
  //traits.construct_x_monotone_curve_2_object()(c5);

  xmono_conic_curves_2.clear();
  xmono_conic_curves_2.push_back(xc3);
  xmono_conic_curves_2.push_back(xc4);
  Pc_x_monotone_curve_2 base_curve =
    construct_x_mono_polycurve(xmono_conic_curves_2.begin(),
                               xmono_conic_curves_2.end());

  //curves for push_back
  Conic_curve_2 c13(1,1,0,-50,12,660,CGAL::COUNTERCLOCKWISE,
                    Conic_point_2(Algebraic(25), Algebraic(-7)),
                    Conic_point_2(Algebraic(25), Algebraic(-5)));
  Conic_curve_2 c14(0,1,0,-1,0,0,CGAL::COUNTERCLOCKWISE,
                    Conic_point_2(Algebraic(25), Algebraic(-5)),
                    Conic_point_2(Algebraic(0), Algebraic(0)));
  Conic_curve_2 c15(-1,0,0,0,1,0,CGAL::COUNTERCLOCKWISE,
                    Conic_point_2(Algebraic(0), Algebraic(0)),
                    Conic_point_2(Algebraic(5), Algebraic(25)));
  conic_curves.clear();
  conic_curves.push_back(c13);
  conic_curves.push_back(c14);
  Polycurve_conic_traits_2::Curve_2 base_curve_push_back =
    construct_polycurve(conic_curves.begin(), conic_curves.end());

  conic_curves.push_back(c15);
  Polycurve_conic_traits_2::Curve_2 Expected_push_back_result =
    construct_polycurve(conic_curves.begin(), conic_curves.end());

  // //checking the orientattion consistency
  // Conic_curve_2 c21(0,1,0,1,0,0,CGAL::CLOCKWISE,
  //                  Conic_point_2(Algebraic(9), Algebraic(-3)),
  //                  Conic_point_2(Algebraic(0), Algebraic(0)));
  // Conic_curve_2 c20(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
  //                   Conic_point_2(Algebraic(0), Algebraic(0)),
  //                   Conic_point_2(Algebraic(3), Algebraic(9)));
  //  Conic_x_monotone_curve_2 xc20(c20);
  //  Conic_x_monotone_curve_2 xc21(c21);
  //  xmono_conic_curves_2.clear();
  //  xmono_conic_curves_2.push_back(xc20);
  // xmono_conic_curves_2.push_back(xc21);
  // Pc_x_monotone_curve_2 eric_polycurve =
  //   construct_x_mono_polycurve(xmono_conic_curves_2.begin(),
  //                              xmono_conic_curves_2.end());
  // std::cout << "the polycurve is: " << eric_polycurve << std::endl;

  // std::cout<< std::endl;

  //check_compare_x_2(xc3, xc5);

  // check_equal();
  // std::cout<< std::endl;

   //check_intersect(conic_x_mono_polycurve_1, conic_x_mono_polycurve_2);
   //std::cout<< std::endl;

  // check_compare_end_points_xy_2();
  // std::cout<< std::endl;

  //check_split(conic_x_mono_polycurve_1, conic_x_mono_polycurve_2);
  // std::cout<< std::endl;

  //check_make_x_monotne_curve(conic_polycurve_2);
   //std::cout<< std::endl;

  // check_is_vertical();
  // std::cout<< std::endl;

  //check_compare_y_at_x_2();
  //std::cout<< std::endl;

  //adds the segment to the right.
  //check_push_back(base_curve_push_back, c15);
  //std::cout<< std::endl;

  //adds the segment to the left.
  //check_push_front(base_curve, xcurve_push);
  //std::cout<< std::endl;

  // check_are_mergable();
  // std::cout<< std::endl;

  // check_merge_2();
  // std::cout<< std::endl;

  // check_construct_opposite();
  // std::cout<< std::endl;

  // check_compare_y_at_x_right();
  // std::cout<< std::endl;

  // check_compare_y_at_x_left();
  // std::cout<< std::endl;
  //check_compare_points(conic_x_mono_polycurve_1);

  //number of segments
  //std::cout << "Number of segments: "
  //          << traits.number_of_points_2_object()(base_curve_push_back)
  //          << std::endl;

  check_trim(conic_x_mono_polycurve_1, atoi(argv[1]), atoi(argv[2]),
             atoi(argv[3]), atoi(argv[4]));
  std::cout << std::endl;

  //std::cout << (atoi(argv[1]) + atoi(argv[2])) << std::endl;
  // Conic_traits_2 con_traits;
  // Conic_curve_2 cc3(1,0,0,0,-1,0,CGAL::COUNTERCLOCKWISE,
  //                   Conic_point_2(Algebraic(0), Algebraic(0)),
  //                   Conic_point_2(Algebraic(3), Algebraic(9)));
  // Conic_x_monotone_curve_2 xcc3(cc3);
  // Conic_point_2       ps2(0, 0);
  // Conic_point_2       pt2(3, 9);
  // std::cout << "conic curve is : " << xcc3 << std::endl;
  // Conic_x_monotone_curve_2 trimmed_curve =
  //   con_traits.trim_2_object()(xc3, ps2, pt2);
  // std::cout << "trimmed conic curve is : " << trimmed_curve << std::endl;

  return 0;
}