9 {
return std::max<double>(a,0.0);}
11 {
return std::min<double>(a,0.0);}
18 double Lx = 1.0;
double dx = Lx/(nx-1);
20 std::cout<<
"creating mesh nx= "<<nx<<
" Lx= "<<Lx<<std::endl;
27 std::cout<<
"creating FMMEikonalSolver1d ... "<<std::endl;
28 FMMEikonalSolver1d fmm(&mesh);
31 double xc = 0.5;
double radius = 0.1;
32 std::valarray<double> phi0(nx),
T(nx);
35 double x = mesh.
nodeArray[nN*3+0];
double d2 = (x-xc)*(x-xc) - radius*radius;
39 std::cout<<
"phi0 :"<<std::endl;
42 std::cout<<
"x= "<<mesh.
nodeArray[nN*3+0]<<
" phi["<<nN<<
"] = "<<phi0[nN]<<std::endl;
44 double zeroTol=1.0e-4;
double trialTol = 1.0e-1;
int verbose = 10;
66 std::valarray<double> phi0p = phi0.apply(
pos);
68 std::valarray<double> phi0m = phi0.apply(
neg);
69 std::valarray<double> Tp(
T);
70 std::valarray<double> Tm(
T);
71 std::valarray<double> nodalSpeeds(1.0,nx);
73 fmm.solve(&phi0p[0],&nodalSpeeds[0],&Tp[0],zeroTol,trialTol,verbose);
74 std::cout<<
"phi0p= "<<std::endl;
75 std::copy(&phi0p[0],&phi0p[0]+nx,std::ostream_iterator<double>(std::cout,
" , "));
77 std::cout<<
"Tp= "<<std::endl;
78 std::copy(&Tp[0],&Tp[0]+nx,std::ostream_iterator<double>(std::cout,
" , "));
81 fmm.solve(&phi0m[0],&nodalSpeeds[0],&Tm[0],zeroTol,trialTol,verbose);
82 std::cout<<
"phi0m= "<<std::endl;
83 std::copy(&phi0m[0],&phi0m[0]+nx,std::ostream_iterator<double>(std::cout,
" , "));
85 std::cout<<
"Tm= "<<std::endl;
86 std::copy(&Tm[0],&Tm[0]+nx,std::ostream_iterator<double>(std::cout,
" , "));
90 std::cout<<
"T= "<<std::endl;
91 std::copy(&
T[0],&
T[0]+nx,std::ostream_iterator<double>(std::cout,
" , "));
94 std::cout<<
"cleaning up"<<std::endl;