Functions | Variables

BaseDirectory - String manipulations to construct all output file names.
[Inversion Data]

Functions

BaseDirectorynewBaseDirectory (char *directoryName)
BaseDirectorynewBaseDirectoryNrhs (char *directoryName)
char ** constructOutputFilenames (BaseDirectory *baseDir, const char *UniqueFilename, int muStep, int sigmaStep)
void addParmsToFilename (BaseDirectory *baseDir, int value1, int value2, bool debug)
void addParmsToFilename2 (BaseDirectory *baseDir, int *values, int nValues, bool debug)
char ** finishFilenamesWExt (BaseDirectory *baseDir, const char *UniqueFilename, int NAlpha, bool compress, bool debug, const char *extension)
char ** finishFilenames (BaseDirectory *baseDir, const char *UniqueFilename, int NAlpha, bool compress, bool debug)
char * finishFilename (BaseDirectory *baseName, const char *UniqueFilename, bool compress, bool debug)
char ** constructBFilenames (BaseDirectory *baseDir, const char *UniqueFilename, int nVectors)
char ** constructDTildaFilenames (const BaseDirectory *baseDir, const char *UniqueFilename, int nFiles, int *fnameLength)
char ** constructAvgCovFilenames (const BaseDirectory *baseDir, const char *UniqueFilename, int nFiles, int nAvgKernels, int nVectors, int *fnameLength)
void freeNFilenames (char **filenames, int nFiles, int fnameLength)

Variables

char * BaseDirectory::Name
 Character string containing the base output directory. Will always end with a directory separator. Is changed and reused.
int BaseDirectory::dirLength
 length of base dir name; start writing parameters at this point. Changes to match Name;
int BaseDirectory::debugLength
 end of debug base file name.
int BaseDirectory::baseLength
 end of base file name.
int BaseDirectory::maxLength
 number of chars allocated for dirName, any filename cannot exceed this value. Cannot change this value once set.

Detailed Description

BaseDirectory operations reuse BaseDirectory.Name character string. Offsets are maintained into this string of the base output directory and the end of the base output filename.


Function Documentation

void addParmsToFilename ( BaseDirectory baseDir,
int  value1,
int  value2,
bool  debug 
)

Add two parameters to the ouptut filename. Usually, they are the input parameters (mu and sigma). Since most output files contain the input parameter steps, the output filename kept in a BaseDirectory object holds the information. Value1 and value2 are appended to base name. Base name = <baseName>value1_value2_ This function is also used to add debug parameters to the intermediate matrix filename.

Parameters:
[in,out] baseDir BaseDirectory object already initialized with base directory information.
[in] value1 value for first parameter.
[in] value2 value for second parameter.
[in] debug True if running with debug option; false otherwise. If debug, then we are adding the x and y components of the wave number to the output filename.
void addParmsToFilename2 ( BaseDirectory baseDir,
int *  values,
int  nValues,
bool  debug 
)

Add a variable number of parameters to the ouptut filename. Usually, they are the input parameters (mu and sigma). Since most output files contain the input parameter steps, the output filename kept in a BaseDirectory object holds the information. Value1 and value2 are appended to base name. Base name = <baseName>value1_value2_ This function is also used to add debug parameters to the intermediate matrix filename.

Parameters:
[in,out] baseDir BaseDirectory object already initialized with base directory information.
[in] values List of values for parameters.
[in] nValues Number of parameters.
[in] debug True if running with debug option; false otherwise. If debug, then we are adding the x and y components of the wave number to the output filename.
char** constructAvgCovFilenames ( const BaseDirectory baseDir,
const char *  UniqueFilename,
int  nFiles,
int  nAvgKernels,
int  nVectors,
int *  fnameLength 
)

Construct list of filenames for averaging kernel or covariance matrices for RLS 3d. They have a special format: <parm1Step>_<parm2Step>_<matrix name>_<depth>_<vector><vector>.fits <vector><vector> is xx, xy, xz, yx, yy, etc. and is only for RLS 3D vector problems. <Matrix><N>.fits where N is an integer. Notice, there is no underscore between Matrix name and N. Always compress the output files.

Parameters:
[in] baseDir BaseDirectory structure containing output base directory information.
[in] UniqueFilename Matrix name
[in] nFiles number of filenames
[in] nAvgKernels number of averaging kernels
[in] nVectors number of vectors, usually 1 or 3.
[in,out] fnameLength length of each filename; keep and use when freeing the filenames.
Returns:
fully constructed filenames. Remember to free these filenames.
char** constructBFilenames ( BaseDirectory baseDir,
const char *  UniqueFilename,
int  nVectors 
)

no underscore <Matrix><suffix> where suffix is 'v_x', 'v_y', or 'v_z' if RLS 3D Vector problem.

Parameters:
[in] baseDir BaseDirectory structure containing output base directory information.
[in] UniqueFilename Matrix name
[in] nVectors Number of vectors in problem, usually 1 for RLS 1D and 3D scalar; 3 for RLS 3D vector.
Returns:
fully constructed filenames. Don't free these filenames; they are part of a constant bank of strings.
char** constructDTildaFilenames ( const BaseDirectory baseDir,
const char *  UniqueFilename,
int  nFiles,
int *  fnameLength 
)

Construct list of filenames with this format <Matrix><N>.fits where N is an integer. Notice, there is no underscore between Matrix name and N. Always compress the output files.

Parameters:
[in] baseDir BaseDirectory structure containing output base directory information.
[in] UniqueFilename Matrix name
[in] nFiles number of filenames
[in,out] fnameLength length of each filename; used when freeing the filenames
Returns:
fully constructed filenames. Remember to free these filenames.
char** constructOutputFilenames ( BaseDirectory baseDir,
const char *  UniqueFilename,
int  muStep,
int  sigmaStep 
)

Construct a complete file name, assuming no previous strings other than base directory. Use this when X and Y, in pattern basedir/X_Y_M_A.fits, have different meaning than mu and sigma steps. Note: UniqueFilename must be base name, like T, q, etc. No extension.

Parameters:
[in,out] baseDir BaseDirectory object already initialized with base directory information.
[in] UniqueFilename Name of output matrix (M); UniqueFilename must be base name, like T, q, etc. No extension.
[in] muStep Value used as X in pattern; integer indicating the nth-value of mu parameter.
[in] sigmaStep Value used as Y in pattern; integer indicating the nth-value of sigma parameter. For 3d_scalar and 2d, this value is always 1;
Returns:
Character string containing complete output filename. This is a pointer to a character string (which is reused) in BaseDirectory structure.

Need to send Nfz0 like NAlpha, because it is embedded in the matrix, like NAlpha AND they need to be in the right order for the write function. What is that order? nV changes faster than M.

char* finishFilename ( BaseDirectory baseName,
const char *  UniqueFilename,
bool  compress,
bool  debug 
)

Add the matrix name to construct a single output file.

Parameters:
[in] baseName BaseDirectory structure containing output base directory information.
[in] UniqueFilename Matrix name
[in] compress True if output file should be compressed using gzip.
[in] debug True if using debug file naming convention.
Returns:
fully constructed filename.
char** finishFilenames ( BaseDirectory baseDir,
const char *  UniqueFilename,
int  NAlpha,
bool  compress,
bool  debug 
)

Insert the matrix name plus any alpha values Assumes the mu and sigma parameters are already inserted.

Parameters:
[in] baseDir BaseDirectory structure containing output base directory information.
[in] UniqueFilename Matrix name.
[in] NAlpha number of alpha parameters, usually three.
[in] compress True if output file should be compressed using gzip.
[in] debug True if using debug file naming convention.
Returns:
fully constructed filenames. Don't free these filenames; they are part of a constant bank of strings.
char** finishFilenamesWExt ( BaseDirectory baseDir,
const char *  UniqueFilename,
int  NAlpha,
bool  compress,
bool  debug,
const char *  extension 
)

Insert the matrix name plus any alpha values Assumes the mu and sigma parameters are already inserted.

Parameters:
[in] baseDir BaseDirectory structure containing output base directory information.
[in] UniqueFilename Matrix name.
[in] NAlpha number of alpha parameters, usually three.
[in] compress True if output file should be compressed using gzip.
[in] debug True if using debug file naming convention.
[in] extension File name extension.
Returns:
fully constructed filenames. Don't free these filenames; they are part of a constant bank of strings.
void freeNFilenames ( char **  filenames,
int  nFiles,
int  fnameLength 
)

Free list of filenames dynamically allocated (i.e. not those from file bank).

Parameters:
[in] filenames Pointer to array of filenames
[in] nFiles number of filenames
[in] fnameLength maximum length of each filename
BaseDirectory* newBaseDirectory ( char *  directoryName  ) 

Set the base directory for all output files.

Parameters:
[in] directoryName Output base directory.
Returns:
BaseDirectory
BaseDirectory* newBaseDirectoryNrhs ( char *  directoryName  ) 

Construct bank of file names for Target output files. There can be many output files ... Hm, I'll need to do this for all the output files, they can have multiple target depths (fz0) .... so, a change in structure here is needed. But, at initialization, I'll know how many files are needed for the file name bank. I can send Nfz0 as a parameter to the newBaseDirectory. YES!

Parameters:
[in] directoryName Output base directory.
Returns:
BaseDirectory

Variable Documentation

int BaseDirectory::baseLength [inherited]

end of base file name.

int BaseDirectory::debugLength [inherited]

end of debug base file name.

int BaseDirectory::dirLength [inherited]

length of base dir name; start writing parameters at this point. Changes to match Name;

int BaseDirectory::maxLength [inherited]

number of chars allocated for dirName, any filename cannot exceed this value. Cannot change this value once set.

char* BaseDirectory::Name [inherited]

Character string containing the base output directory. Will always end with a directory separator. Is changed and reused.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines