proj home

Files   Classes   Functions   Hierarchy  

arcprob.cpp

Go to the documentation of this file.
00001 #include <cmath>
00002 #include <fstream>
00003 using namespace std;
00004 
00005 #include <arcprob.h>
00006 
00007 
00008 arcprob::arcprob( stringc & filename )
00009   : W(0), angle0(0.0), ac(0)
00010 {
00011   reader(filename);
00012 }
00013 
00014 arcprob::~arcprob()
00015 {
00016   delete ac;
00017 }
00018 
00019 void arcprob::reader( stringc & filename )
00020 {
00021   ifstream targ(filename.c_str());
00022   assert(targ.good()==true);
00023   if (targ.good()==false)
00024     return;
00025 
00026   targ >> angle0;
00027   angle0 *= degtorad;
00028   uint N;
00029   targ >> N;
00030   targ >> W;
00031 
00032 cout << SHOW(angle0) << endl;
00033 cout << SHOW(N) << endl;
00034 cout << SHOW(W) << endl;
00035 
00036   assert(W>N);
00037   assert(N>1);
00038   
00039   qi.resize(W);
00040   for (uint i=0; i<W; ++i)
00041     targ >> qi[i];
00042 
00043   if (ac!=0)
00044     delete ac;
00045 
00046   ac = new arcsconnected(5,N);
00047 
00048 for (uint i=0; i<qi.size(); ++i)
00049   cout << SHOW(qi[i]) << endl;
00050     
00051   solveInitialCondition();
00052 }
00053 
00054 void arcprob::solveInitialCondition()
00055 {
00056   assert(ac!=0);
00057   if (ac==0)
00058     return;
00059 
00060   uintc N(ac->N);
00061 
00062   // Let the arcs initially pass through the
00063   // control points.
00064   vector< pt2 > u(N+1);
00065   doublec dx = (double)(W-1) / (double)N;
00066   uint temp;
00067   for (uint i=1; i<N; ++i)
00068   {
00069     temp = (uint)(floor(dx*i));
00070     u[i] = qi[temp];
00071   }
00072   u[0] = qi[0];
00073   u[N] = qi[W-1];
00074 
00075   ac->constructPhi0(angle0,u);
00076 }
00077 

Generated on Fri Mar 4 00:49:25 2011 for Chelton Evans Source by  doxygen 1.5.8