Console Interface


The SCATMECH library provides functions for querying a user for data and for displaying program status. This page describes how these functions behave. Their functionality can be subdivided into a number of topics:

Note that use of the interactive console functions is optional to the programmer. There are other ways of transferring data to and from the library. For example, all classes inheriting Model have a function set_parameter defined to set model parameters. Furthermore, the template class Model_Ptr<model> has a function operator=(const string& name), which enables a particular instance of the class to be created.

Single value entry

The simplest functions query the user for a single value and are described in User Interface Functions. These routines always present the user with a default value, given in brackets (e.g. < >). The user can type in a specific value followed by return, or accept the default value by just pressing return without entering anything else. For example:

	  Wavelength [um] <0.532> :

Here, the user can accept the default of 0.532 μm, or type in something else.

Top of Page.

Dielectric function entry

The class dielectric_function has functions AskUser which query the user. When the user is asked for an optical constant or dielectric function, he has a number of options. Consider the following prompt:

Substrate [n, (n,k), or filename] <(4.15,0.05)> :

If the user just presses return, then the substrate optical constant will be taken to be 4.15+i0.05. If the user responds with a single number, then the program will ask for the value of k. For example,

Substrate [n, (n,k), or filename] <(4.15,0.05)> :1.5
Substrate (k) <0.05> :

If the user wishes to enter both n and k simultaneously, then he can type them both as a complex number:

Substrate [n, (n,k), or filename] <(4.15,0.05)> :(1.5,0)

The user can also enter the name of a file containing the tabulated wavelength dependence of the optical constants. This file should contain three whitespace-delimited columns of data, where the first column is the wavelength, the second is the index (n), and the third is the extinction coefficient (k). For example:

0.3   1.56   0.01   
0.4   1.54   0.00   
0.5   1.53   0.00   
0.6   1.51   0.00  

The library will linearly interpolate between tabulated values.

Top of Page.

Film stack entry

The class dielectric_stack has functions AskUser which query the user. If the library queries for information about a stack of films, it will prompt the user with something like:

Films on rough surface
(':filename', or index and thickness) <> :

The user can accept the default (no films) by pressing return. The user can also type an index (as a complex number pair) and thickness. For example:

Films on rough surface
(':filename', or index and thickness, or a blank line) <> :(2.1,0) 0.3
Layer #2:

Films are entered in the order that they are deposited onto the sample. That is, the most buried film is entered first. A blank line will complete the description of the film stack. The index can also be entered as a filename as described above. For example, if the file TiO2 contains a tabulation of the optical properties of a common coating material, then:

Films on rough surface
(':filename', or index and thickness, or a blank line) <> :TiO2 0.3
Layer #2:

Finally, one can specify a film stack using a file containing the film information by entering a colon (:) followed by the filename:

Films on rough surface
(':filename', or index and thickness, or a blank line) <> ::filmfile

The film description file contains two columns. The first column is the material (specified by complex number or filename), and the second column is the thickness. Again, the films are entered in the order in which they are deposited. For example, the following is an appropriate file for an interference filter:

MgF 0.185
ZnS 0.109
MgF 0.185
ZnS 0.109
MgF 0.185
ZnS 0.109
MgF 0.185
ZnS 0.218
MgF 0.185
ZnS 0.109
MgF 0.185
ZnS 0.109
MgF 0.185
ZnS 0.109
MgF 0.185
Top of Page.

Model entry

The template class Model_Ptr<model> has an operator defined that enables statements like,

Model_Ptr<BRDF_Model> brdf = Get_Model_Ptr();
Model_Ptr<Slope_Distribution_Function> sdf = Get_Model_Ptr();
Model_Ptr<SphericalScatterer> sphere = Get_Model_Ptr();

which will query the user for a specific model and assign a pointer to an instantiation of that model. For example, if the first of these statements is executed, then the user will see,

-- Available BRDF_Model Classes --
(A) <MENU> Roughness_BRDF_Model
(B) <MENU> Facet_BRDF_Model
(C) <MENU> Lambertian_BRDF_Model
(D) <MENU> Local_BRDF_Model
(E) <MENU> Instrument_BRDF_Model
(F) First_Diffuse_BRDF_Model

(?) Turn on descriptions

Choose one <A> :

The user can either enter the letter preceeding the choice or the entire name of the class. The <MENU> indication tells the user that there are more models under that menu item. For example, if the user types A and return, then he will see the menu

-- Available Roughness_BRDF_Model Classes --
(A) Microroughness_BRDF_Model
(B) Correlated_Roughness_BRDF_Model
(C) <MENU> Roughness_Stack_BRDF_Model
(D) Two_Face_BRDF_Model

(?) Turn on descriptions
(^) Return to previous menu

Choose one <A> :

When one is not in the top level listing of models, then one can return to the previous menu by typing a caret (^) and return. By typing a question mark (?) and return, one can get more descriptive names of the models:

-- Available BRDF_Model Classes --
(A) <MENU> Roughness_BRDF_Model.............Models requiring a power spectrum.
(B) <MENU> Facet_BRDF_Model.................Specular point approximation.
(C) <MENU> Lambertian_BRDF_Model............A constant, fully-depolarizing
                                            BRDF.
(D) <MENU> Local_BRDF_Model.................All models for discrete defects.
(E) <MENU> Instrument_BRDF_Model............A virtual class for effective BRDF
                                            models for instrument functions
(F) First_Diffuse_BRDF_Model................Model for the single scattering
                                            from a diffuse material.

(?) Turn off descriptions
(^) Return to previous menu

Choose one <A> :

The user can type the full name of any model shown or hidden in a lower level menu. For example, the following response will cause the program to use Microroughness_BRDF_Model:

-- Available BRDF_Model Classes --
(A) <MENU> Roughness_BRDF_Model
(B) <MENU> Facet_BRDF_Model
(C) <MENU> Lambertian_BRDF_Model
(D) <MENU> Local_BRDF_Model
(E) <MENU> Instrument_BRDF_Model
(F) First_Diffuse_BRDF_Model

(?) Turn on descriptions

Choose one <A> :Microroughness_BRDF_Model
Top of Page.

Redirection

The user has the option to redirect input from a file. Redirection is accomplished by typing <filename at the prompt. The program will then accept data contained in the file filename as input. When a line beginning with the character > is found in the file, input will continue from the original stream. Nesting of such input files can be performed almost indefinitely. For example, the following data contained in a file (say, sphere) can be used as input to Example1:

Bobbert_Vlieger_BRDF_Model
silicon   ; substrate (assume file silicon exists)
0.325     ; Wavelength [um]
.1        ; Density [um^-2]
psl       ; Particle material (assume file psl exists)
0.05      ; Radius [um]
(1,0)     ; Particle coating material 
0.0       ; Particle coating thickness
sio2      ; substrate film (assume file sio2 exists)
0.0015    ; substrate film thickness [um]
.000      ; delta [um] 
          ; lmax  (use default)
          ; order (-1 = exact) (use default)
          ; NIA (use default)
          ; iterative improvement steps (use default)
          ; A-matrix option  (use default)
>

Note the use of comments in this file. Comments are anything past whitespace that is not used by the querying function. However, it is safest to use the semicolon (;) before the comment, since then the default values can be used. This file can be used as input to Example1, when the program asks for the model:

Incident Angle  <45> :
Initial Scattering Angle  <45> :
Final Scattering Angle  <45> :
Step Scattering Angle  <1> :
Initial Azimuthal Angle  <0> :
Final Azimuthal Angle  <180> :
Step Azimuthal Angle  <2> :

-- Available BRDF_Model Classes --
(A) <MENU> Roughness_BRDF_Model
(B) <MENU> Facet_BRDF_Model
(C) <MENU> Lambertian_BRDF_Model
(D) <MENU> Local_BRDF_Model
(E) <MENU> Instrument_BRDF_Model
(F) First_Diffuse_BRDF_Model

(?) Turn on descriptions

Choose one <A> :<sphere

Note that if there are errors in the redirected input file, such as a misspelling of a model name or a dielectric function file, continued execution of the program will probably result in errors. The program will alert the user of the initial error and allow the user to re-enter the data, but will simply receive the next line of data, which will be out of context.

Top of Page.

Searching for files

As mentioned above, in order to obtain information about optical properties, film stacks, or redirected input files, some routines may attempt to access a file during execution. These routines will search in the current directory for the file. If the file is not found in the current directory, an attempt will be made to access the environment variable SCATMECH. If it exists the routines will use its contents to search for the file. The environment variable should contain a list of directories to search, separated by semicolons, and each directory should include the final directory delimiter ("\" or "/"). For example, in Windows the SCATMECH variable might be set to something like

	C:\DATA\OPTPROP\;C:\DATA\GRATINGS\

In a UNIX-like system, the SCATMECH variable might be set to something like

	~/data/optprop/;~/data/gratings/

Top of Page.


For More Information

SCATMECH Technical Information and Questions
Optical Technology Division (OTD) Home Page
OTD Technical Inquiries
OTD Website Comments

Current SCATMECH version: 6.00 (February 2008)
This page first online: Version 4.00 (July 2003)
This page last modified: Version 6.00 (February 2008)