Files Classes Functions Hierarchy
#include <arcprob.h>
Public Member Functions | |
| arcprob () | |
| Construct at a later point. | |
| ~arcprob () | |
| Memory cleanup. | |
| arcprob (stringc &filename) | |
| Read the problem from the text file. | |
| void | solveInitialCondition () |
| Approximate first solution. | |
| void | reader (stringc &filename) |
| Read the problem from the text file. | |
Public Attributes | |
| uint | W |
| Number of control points. | |
| double | angle0 |
| The initial angle (radians). | |
| vector< pt2 > | qi |
| Control points. | |
| arcsconnected * | ac |
| Line of continuously connected arcs. | |
Definition at line 17 of file arcprob.h.
| arcprob::arcprob | ( | ) | [inline] |
| arcprob::~arcprob | ( | ) |
Memory cleanup.
Definition at line 14 of file arcprob.cpp.
References ac.
00015 { 00016 delete ac; 00017 }
| arcprob::arcprob | ( | stringc & | filename | ) |
| void arcprob::reader | ( | stringc & | filename | ) |
Read the problem from the text file.
The format expected is the following.
45.0 3 7 0.0,0.0 1.0,1.1 1.5,2.8 2.8,4.2 4.8,4.0 6.8,4.2 8.1,5.5
Definition at line 19 of file arcprob.cpp.
References ac, angle0, degtorad, qi, SHOW, solveInitialCondition(), and W.
Referenced by arcprob().
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 }
| void arcprob::solveInitialCondition | ( | ) |
Approximate first solution.
Definition at line 54 of file arcprob.cpp.
References ac, angle0, arcsconnected::constructPhi0(), arcsconnected::N, qi, and W.
Referenced by reader().
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 }
Line of continuously connected arcs.
Definition at line 31 of file arcprob.h.
Referenced by reader(), solveInitialCondition(), test07(), and ~arcprob().
| double arcprob::angle0 |
The initial angle (radians).
Definition at line 25 of file arcprob.h.
Referenced by reader(), and solveInitialCondition().
| vector< pt2 > arcprob::qi |
Control points.
Definition at line 28 of file arcprob.h.
Referenced by reader(), and solveInitialCondition().
Number of control points.
Definition at line 22 of file arcprob.h.
Referenced by reader(), and solveInitialCondition().
1.5.8