variable.c File Reference

Detailed Description

Implementation of the functions operating on box Tvariable.

See Also
Tvariable, variable.h.

Definition in file variable.c.

Functions

void NewVariable (unsigned int type, char *name, Tvariable *v)
 Constructor. More...
 
void CopyVariable (Tvariable *v_dst, Tvariable *v_src)
 Copy constructor. More...
 
void SetVariableTopology (unsigned int t, Tvariable *v)
 Sets the topology of the variable. More...
 
unsigned int GetVariableTopology (Tvariable *v)
 Gets the topology of the variable. More...
 
unsigned int GetVariableType (Tvariable *v)
 Gets the variable type. More...
 
char * GetVariableName (Tvariable *v)
 Gets the variable name. More...
 
void SetVariableInterval (Tinterval *i, Tvariable *v)
 Sets the new range for the variable. More...
 
TintervalGetVariableInterval (Tvariable *v)
 Gets the range of valid values for the variable. More...
 
void PrintVariable (FILE *f, Tvariable *v)
 Prints a variable. More...
 
void DeleteVariable (Tvariable *v)
 Destructor. More...
 

Function Documentation

void NewVariable ( unsigned int  type,
char *  name,
Tvariable v 
)
void CopyVariable ( Tvariable v_dst,
Tvariable v_src 
)

Creates a new variable from another one.

Parameters
v_dstThe variable to create.
v_srcThe variable from where to copy.

Definition at line 33 of file variable.c.

References CopyInterval(), Tvariable::is, Tvariable::name, NEW, Tvariable::topology, and Tvariable::type.

Referenced by AddVariable(), CopyVariables(), and GetCSVariable().

void SetVariableTopology ( unsigned int  t,
Tvariable v 
)

Changes the topology of the variable. The default value for the topology is TOPOLOGY_R.

Parameters
tThe new topology.
vThe variable to modify.

Definition at line 44 of file variable.c.

References Error(), Tvariable::topology, TOPOLOGY_R, and TOPOLOGY_S.

Referenced by GenerateJointEquations().

unsigned int GetVariableTopology ( Tvariable v)

Returns the topology of the variable. Note that even if a variable has TOPOLOGY_S, it is set to TOPOLOGY_R if its associated range is smaller than 2*pi. Only variables with ranges larger than 2*pi have to routes to connect any two given points.

Parameters
vThe variable to query.
Returns
The variable's topology.

Definition at line 52 of file variable.c.

References IntervalSize(), Tvariable::is, M_2PI, Tvariable::topology, TOPOLOGY_R, TOPOLOGY_S, and ZERO.

Referenced by GetCSVarTopology(), and GetVariablesTopology().

unsigned int GetVariableType ( Tvariable v)

Gets the variable type.

Parameters
vThe variable to query.
Returns
The variable type.

Definition at line 60 of file variable.c.

References Tvariable::type.

Referenced by AddVariable(), GetVariableTypeN(), IsCartesianVariable(), IsDummyVariable(), IsSecondaryVariable(), IsSystemVariable(), PrintVariables(), and RemoveVariable().

char* GetVariableName ( Tvariable v)

Gets the variable name.

Parameters
vThe variable to query.
Returns
The a pointer to the variable name.

Definition at line 65 of file variable.c.

References Tvariable::name.

Referenced by AddVariable(), AddVariable2CS(), CSRemoveLCVars(), CSRemoveVarsWithCtRange(), DummifyAndAddEquation(), GetVariableID(), GetVariableNames(), InitMapping(), IsInSimple(), SimplifyCuikSystem(), and VariableName().

Tinterval* GetVariableInterval ( Tvariable v)

Gets the range of valid values for the variable.

Parameters
vThe variable to query.
Returns
A pointer to the range of valid values for the variable.

Definition at line 75 of file variable.c.

References Tvariable::is.

Referenced by BoxFromVariables(), CSRemoveLCVars(), DummifyAndAddEquation(), and PointFromVariables().

void PrintVariable ( FILE *  f,
Tvariable v 
)

Prints a variable (name plus valid range) to a stream that can be stdout.

Parameters
fThe file where to print.
vThe variable to print.

Definition at line 80 of file variable.c.

References Tvariable::is, Tvariable::name, PRINT_VARIABLE_NAME, PrintInterval(), PrintSymbolInterval(), Tvariable::topology, and TOPOLOGY_S.

Referenced by PrintVariables().