Changes between Version 12 and Version 13 of EditPath


Ignore:
Timestamp:
2008-05-14T15:41:45Z (12 years ago)
Author:
Gary J. Ferland
Comment:

seting data path by editing path.h

Legend:

Unmodified
Added
Removed
Modified
  • EditPath

    v12 v13  
    11= Setting the path =
     2
     3'''The skinny on editing the path'''
     4If you will build the code using the make file in source or source/sys_XXX then the path will be
     5properly set for you.  You can go on to the next step, CompileCode.
    26
    37There are vast amounts of atomic data that the code must reference in order to compute a model.  These are the files that live in the data directory.  The code must be able to find these data files. Their location is stored in a global string variable named {{{chDataPath}}} which is set in the file path.cpp.  You need to change the string so that it gives the location of the data on your machine.
    48
    5 There are three ways to specify the path to the data files. The first method is by editing path.cpp, which should be done before you start compiling. The second method is to add an extra parameter to the compiler options, and the third method is to set an environment variable at runtime.
     9There are three ways to specify the path to the data files. The first method is by editing path.h, which should be done before you start compiling. The second method is to add an extra parameter to the compiler options, and the third method is to set an environment variable at runtime.
    610
    711In Cloudy version C07 and before there were two names for the data path, CLOUDY_DATA_PATH and LOCAL_DATA_PATH.  In Cloudy version C08 there is only one, CLOUDY_DATA_PATH. 
     
    1014-----
    1115
    12 == Method 1: Setting the path by editing path.cpp ==
     16== Method 1: Setting the path by editing path.h ==
    1317
    14 Edit the file path.cpp (located in the source directory) and locate the variable {{{chDataPath}}}.
    15 There are two instances. You need to edit the second one. 
     18Edit the file path.h (located in the source directory) and locate the variable {{{CLOUDY_DATA_PATH}}}.
     19There are two instances, one for windows and another for unix.
     20You need to edit the one for your operating system. 
    1621Change the string within the double quotes so that it gives the location of the data on your computer. 
    17 Remember that this is C++ code and that a line ends with a semicolon.
    1822
    1923The path would be a string within double quotes. On a Unix machine the result should look like this:
    2024
    2125{{{
    22 #ifdef LOCAL_DATA_PATH
    23 /* the first branch was added by Robin Williams and allows you to specify
    24  * any path as an argument to the compiler */
    25 char chDataPath[FILENAME_PATH_LENGTH]=LOCAL_DATA_PATH;/**/
    26 #else
    27 /* This is the version you need to change - the first is the format to use
    28  * on a windows machine
    29  * remove or comment out if you don't want to use it */
    30 /* sample path on a Unix box */
    31 char chDataPath[FILENAME_PATH_LENGTH]="/usr/gary/cloudy/data/";
    32 #endif
     26/*
     27 * Specify a search path to data directories here.
     28 *
     29 * This is for Unix variants.  You can specify a search path for one or several
     30 * data directories using the standard colon-separated list of Unix paths. You
     31 * can enter as many paths as you like. One example could be: */
     32
     33#define CLOUDY_DATA_PATH "/usr/local/cloudy/data:/home/user/cloudy/data"
    3334}}}
    3435
     
    3637
    3738{{{
    38 #ifdef LOCAL_DATA_PATH
    39 /* the first branch was added by Robin Williams and allows you to specify
    40  * any path as an argument to the compiler */
    41 char chDataPath[FILENAME_PATH_LENGTH]=LOCAL_DATA_PATH;/**/
    42 #else
    43 /* This is the version you need to change - the first is the format to use
    44  * on a windows machine
    45  * remove or comment out if you don't want to use it */
    46 /* sample path on a windows box */
    47 char chDataPath[FILENAME_PATH_LENGTH]="c:\\projects\\cloudy\\current\\data\\";
    48 #endif
     39/* The following (commented-out) example shows the format for Windows. You can
     40 * specify a search path for one or several data directories using a list separated
     41 * by semi-colon signs ";". The path must be enclosed between double quotes.
     42 * NB - note that the backslash "\" always needs to be typed twice, as shown below: */
     43
     44#define CLOUDY_DATA_PATH "c:\\projects\\cloudy\\data;c:\\users\\gary\\data"
     45
    4946}}}
    5047
     
    5350The string giving the path MUST have the proper directory mark as the last character before the second quote.  This would be a "/" in Unix, a "\\" in Windows, and a "]" in VMS.
    5451
    55 '''''C++ syntax for the newcomer'''''  There must be two double-quotes.  The path is the series of characters between them.  The line must end with a semicolon.
     52'''''C++ syntax for the newcomer'''''  There must be two double-quotes.  The path is the series of characters between them.  The line must end with a semicolon.  Lines that start with // are comments.
     53One of the paths will be commented out.
    5654
    5755If the path is longer than FILENAME_PATH_LENGTH characters then increase the size of FILENAME_PATH_LENGTH in cddefines.h and recompile the entire code.  Remember that in C++ a string must have one extra byte for storing the end-of-string sentinel.