Commit 7f308ddfe5fa033c4facaae6edb0114e8f7f8e9b

Authored by dmayerich
1 parent a4e4dd55

allow reversal of the output file

Showing 2 changed files with 10 additions and 6 deletions   Show diff stats
CMakeLists.txt
... ... @@ -10,7 +10,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}")
10 10 set(Boost_USE_STATIC_LIBS ON)
11 11 set(Boost_USE_MULTITHREADED ON)
12 12 set(Boost_USE_STATIC_RUNTIME OFF)
13   -find_package( Boost 1.54.0 COMPONENTS program_options )
  13 +find_package( Boost 1.49.0 COMPONENTS program_options )
14 14  
15 15 #set up CUDA
16 16 find_package(CUDA)
... ...
main.cpp
... ... @@ -33,11 +33,12 @@ int main(int argc, char* argv[])
33 33 ("input-file,i", po::value<string>(), "Input file containing material information.")
34 34 ("input-format,f", po::value<string>()->default_value("wavenumber,n,k"), "Format string identifying the order of material properties in the input file. Options include: microns, wavenumber, n (real RI), k (imaginary RI), A (absorbance), Xp (real Chi), Xpp (imaginary Chi).\n\nThe default [microns,n,k] will load a material file with columns representing the wavelength in microns, followed by the real and imaginary parts of the refractive index.")
35 35 ("output-file,o", po::value<string>()->default_value("out.txt"), "Output file containing the processed material information.")
36   - ("output-format,t", po::value<string>()->default_value("wavenumber,n,k"), "Format string for the output file (similar to --input-format).")
  36 + ("output-format,t", po::value<string>()->default_value("wavenumber,n,k"), "Format string for the output file (similar to --input-format).")
37 37 ("scaling,s", po::value<ptype>()->default_value(1.0), "Scaling value for the absorbance parameter. This value gives the thickness (in microns) of the measured material.")
38 38 ("n0,n", po::value<ptype>()->default_value(1.48), "Average effective refractive index. This is required when computing the real refractive index from the absorption.")
39 39 ("padding,p", po::value<int>()->default_value(2), "Padding factor used to remove edge artifacts in the Kramers-Kronig computation for computing the real RI from absorption. The default value of p=2 is sufficient in most cases.")
40   - ("resolution,r", po::value<int>(), "Resolution of the spectrum. The default value is based on the number of spectral samples provided in the input file.");
  40 + ("resolution,r", po::value<int>(), "Resolution of the spectrum. The default value is based on the number of spectral samples provided in the input file.")
  41 + ("reverse,v", "reverse the order of the output file");
41 42  
42 43 po::positional_options_description pos;
43 44 pos.add("input-file", 1);
... ... @@ -52,7 +53,7 @@ int main(int argc, char* argv[])
52 53 cout<<desc<<endl;
53 54 return 1;
54 55 }
55   -
  56 +
56 57 //if the input file is given, load it, otherwise exit
57 58 if(vm.count("input-file"))
58 59 {
... ... @@ -72,12 +73,15 @@ int main(int argc, char* argv[])
72 73 R = vm["resolution"].as<int>();
73 74  
74 75 //compute the real refractive index
75   - rts::material<ptype> N = M.computeN(vm["n0"].as<ptype>(),
  76 + rts::material<ptype> N = M.computeN(vm["n0"].as<ptype>(),
76 77 R,
77 78 vm["padding"].as<int>());
78 79  
79 80 //output the file using the standard format
80   - N.save(vm["output-file"].as<string>(), vm["output-format"].as<string>());
  81 + bool reverse_order = false;
  82 + if(vm.count("reverse"))
  83 + reverse_order = true;
  84 + N.save(vm["output-file"].as<string>(), vm["output-format"].as<string>(), reverse_order);
81 85  
82 86 return 0;
83 87 }
... ...