Detailed instructions for building the user-defined cathode routine
In the 'special' unconventional cathode versions of the CPO programs the user supplies a routine called cathode2.cpp or cathode3.cpp (for the CPO2D and CPO3D programs respectively) that needs to be built into the 'direct-linked-library' routine cathode2.dll or cathode3.dll that can be called by the programs.
2. Essential files.
The files cathode2.dll and/or cathode3.dll must be in the same directory as the CPO execution files.
If the control data files mentioned above are used they must also be in the same directory as the CPO execution files.
Other files that are needed (and which could be in other directories) are:
(1) the source files cathode2.cpp and cathode3.cpp mentioned above,
(2) the files cathode2.dsw and cathode3.dsw that are called when cathoden.cpp is changed, and
(3) any other files that are needed for the building the dll file.
All these files are automatically downloaded from the CD. The user should be careful to make copies of the .cpp and .dat files that are not read-only before they are altered.
3. Making changes to the user-supplied cathode routine.
(1) Make a copy of the .cpp file that you are going to change.
(2) Make sure that Visual C++ is present on the computer. Using Windows Explorer or My Computer, double-click on the file cathoden.dsw (the Visual C++ project file) and the Visual C++ environment will load up as shown in the analogous note on the scattering option.
If the source code is not present in the editor window, click once on the cathoden.cpp file as show in the screen capture above.
(3) Make the changes to the source code (if any are required). The cathoden.dll can now be re-built. To do this press F7 or click on Build/Build cathoden.dll/.
(4) If cathoden.cpp has recently been overwritten with a new routine it is necessary to click on Build/Rebuild All. If an error message concerning the vc60.pdb file appears then try Build/Clean, followed by Build/Rebuild All.
(5) The new cathoden.dll can then be found in the subdirectory c:\cpo\debug\ (if you are working from c:\cpo\).
(6) The new cathoden.dll should then be copied back to the directory that has the execution files (usually c:\cpo\). You might have to be in MSDOS to do this. After cathode2.dll or cathode3.dll have been created they might be ‘hidden’ files, in which case they would have to be dealt with as follows before they can be copied to another directory:
(a) Go to My Computer or Windows Explorer.
(b) Select View/Folder Options.
(c) Select the middle tab ‘View’.
(d) Select ‘Hidden files’/’Show all files’.
(e) Unselect ‘Hide file extensions for known file types’.
(7) You can then run the CPO program.
4. Debugging cathode2.cpp or cathode3.cpp.
These instruction apply to the 3D program, but the instructions for 2D are analogous.
It is assumed that the directory cpo contains cpo3d.exe, cathode3.cpp, cathode3.dll, cathode3.dsw and cathode3.dat. The data file, such as test2d08.dat or test3d08.dat, should be copied to the cpo directory. If another directory is used, it should contain all these files.
Step 1: Load up the Visual C++ environment and load up the cathode3 workspace.
Step 2: Select the option PROJECT->SETTINGS and set the executable program as shown in the analogous note on the scattering option.
Note that the executable that will call the cathode3.dll is set in the box labelled Executable for debug session.
This step will only have to be done the first time.
Place the cursor on the line of the cathode3.cpp program you are interested in debugging and press cntrl-F10 (run to cursor). The cpo3d program should then load. Run the CPO3D program in the normal way, giving it the data file (eg test3d08.dat) as its input file. When CPO3D calls the DLL it should pause the execution of the program at the line where the cursor was placed.
Once the program has paused on the line in the cathode3.cpp, the single-step facilities should work (to see what these are select Debug on the menu). To inspect the value of a variable or array, hold the mouse over the variable and its value will be displayed.
Return to cathode option.