Institut de Robòtica i Informàtica Industrial
KRD Group

The CuikSuite Project

parameters.c File Reference

Implementation of the functions operating on Tparameters. More...

#include "parameters.h"
#include "error.h"
#include "filename.h"
#include "boolean.h"
#include "defines.h"
#include <stdlib.h>

Go to the source code of this file.

Functions

boolean ReadParameters (char *file, Tparameters *p)
 Reads a parameter set from a file.
void InitParameters (Tparameters *p)
 Constructor.
void InitParametersFromFile (char *file, Tparameters *p)
 Constructor from a file.
double GetParameter (unsigned int n, Tparameters *p)
 Gets the value for a particular parameter.
void SetParameter (unsigned int n, char *name, double v, Tparameters *p)
 Sets the name and value for a particular parameter.
void ChangeParameter (unsigned int n, double v, Tparameters *p)
 Sets the value for a particular parameter.
void PrintParameters (FILE *f, Tparameters *p)
 Prints a parameter set.
void DeleteParameters (Tparameters *p)
 Destructor.

Detailed Description

Implementation of functions to deal with Tparameters.

See also:
Tparameters, parameters.h.

Definition in file parameters.c.


Function Documentation

boolean ReadParameters ( char *  file,
Tparameters p 
)

Reads a parameter set from a file.

Parameters:
file The name of the file.
p The parameter set to update.
Returns:
TRUE if the the file with the parameter exists.

Referenced by InitParametersFromFile().

Here is the caller graph for this function:

void InitParameters ( Tparameters p  ) 

Defines an empty set of parameters.

Parameters:
p The set to be initialized.

Definition at line 36 of file parameters.c.

References NPARAMETERS.

Referenced by InitParametersFromFile().

Here is the caller graph for this function:

void InitParametersFromFile ( char *  file,
Tparameters p 
)

Defines an set of parameters from a file. It first read the default set of parameters and then the given set of parameters.

Parameters:
file Name of the file with the set of parameters particular for the problem at hand.
p Set of parameters to define.
See also:
ReadParameters, defines.h

Definition at line 50 of file parameters.c.

References CreateFileName(), DEFAULT_PARAMS, DeleteFileName(), Error(), GetFileFullName(), InitParameters(), PARAM_EXT, and ReadParameters().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

double GetParameter ( unsigned int  n,
Tparameters p 
)

Gets the value for a particular parameter.

Parameters:
n Number of parameter.
p Set of parameters.
Returns:
The value of the parameter. If there is no parameter with the given number this functions triggers an error.

Definition at line 76 of file parameters.c.

References Error(), and NPARAMETERS.

Referenced by ComputeSplitDimInt(), CSRemoveLCVars(), CSRemoveUnusedVars(), CSRemoveVarsWithCtRange(), DummifyAndAddEquation(), DummifyCuikSystem(), MPI_SolveCuikSystem(), PostProcessBox(), PrintCuikSystemWithSimplification(), ReduceBox(), ReduceBoxEquationWise(), SampleCuikSystemInBox(), SimplifyCuikSystem(), SolveCuikSystem(), and UpdateCuikSystem().

Here is the call graph for this function:

Here is the caller graph for this function:

void SetParameter ( unsigned int  n,
char *  name,
double  v,
Tparameters p 
)

Sets the name and value for a particular parameter.

Parameters:
n Number of parameter.
name The name for the parameter. This is a string that is used when printing the parameter.
v The value.
p Set of parameters.

Definition at line 93 of file parameters.c.

References ChangeParameter(), Error(), and NPARAMETERS.

Here is the call graph for this function:

void ChangeParameter ( unsigned int  n,
double  v,
Tparameters p 
)

Sets the value for a particular parameter.

Parameters:
n Number of parameter.
v The new value for the parameter.
p Set of parameters.

Definition at line 112 of file parameters.c.

References Error(), NEW, and NPARAMETERS.

Referenced by main(), SampleCuikSystemInBox(), and SetParameter().

Here is the call graph for this function:

Here is the caller graph for this function:

void PrintParameters ( FILE *  f,
Tparameters p 
)

Writes a parameter set to a stream, that can be stdout.

Parameters:
f The stream
p Set of parameters to print.

Definition at line 133 of file parameters.c.

References NPARAMETERS.

Referenced by main().

Here is the caller graph for this function:

void DeleteParameters ( Tparameters p  ) 

Deletes a set of parameters and frees the allocated memory.

Parameters:
p Set of parameters to be deleted.

Definition at line 152 of file parameters.c.

Referenced by main().

Here is the caller graph for this function: