drake  1.0.0
src/mapping.c File Reference
#include <stdlib.h>
#include <string.h>
#include <drake/mapping.h>
#include <drake/platform.h>
#include <assert.h>
#include "drawgraph-2.h"
Include dependency graph for mapping.c:

Go to the source code of this file.

Functions

mapping_t *pelib_alloc_collection() mapping_t (size_t size)
int pelib_free() mapping_t (mapping_t *solution)
int pelib_copy() mapping_t (mapping_t source, mapping_t *copy)
int drake_mapping_insert_task (mapping_t *mapping, processor_id pid, task_t *task)
 Insert a new task to this mapping.
int drake_mapping_remove_task (mapping_t *mapping, task_id task)
 Removes a task from this mapping.
int drake_mapping_find_processor_index (mapping_t *mapping, processor_id pid)
 Finds the index of processor in the mapping processor array, from the processor's ID.
processor_id drake_mapping_find_processor (mapping_t *mapping, task_id tid)
 Finds the processor (its processor_id) which handles the task pointed by the task_id parameter.
int drake_mapping_insert_processor (mapping_t *mapping, processor_t *processor)
 Inserts a new processor in the mapping.
int drake_mapping_remove_processor (mapping_t *mapping, int processor_id)
 Not implemented. Removes a processor from the mapping.
int drake_mapping_violations (mapping_t *mapping)
FILE *pelib_printf() mapping_t (FILE *stream, mapping_t mapping)
char *pelib_string() mapping_t (mapping_t mapping)
mapping_tdrake_mapping_loadstr (mapping_t *mapping, char *str)
 Reads a mapping from a string in the same format than produced by ilp solver.
mapping_tdrake_mapping_loadfilterstr (mapping_t *mapping, char *str, int(filter)(task_t *))
mapping_tdrake_mapping_loadfile (mapping_t *mapping, FILE *file)
 Reads a mapping from the output of the ILP solver.
mapping_tdrake_mapping_loadfilterfile (mapping_t *mapping, FILE *file, int(filter)(task_t *))
char * drake_mapping_drawstr (mapping_t *mapping, char *str)
task_tdrake_mapping_find_task (mapping_t *mapping, task_id id)
int drake_mapping_draw (mapping_t *mapping, FILE *file)
 Draws the mapping to a .fig file in the appropriate format.

Function Documentation

int drake_mapping_draw ( mapping_t mapping,
FILE *  file 
)

Draws the mapping to a .fig file in the appropriate format.

Definition at line 417 of file mapping.c.

char* drake_mapping_drawstr ( mapping_t ,
char *   
)

Generates AMPL output mapping matrix from an instance of mapping_t and place it in a string

Parameters:
mappingInstance of mapping_t
strString that receives the mapping in AMPL output format

Definition at line 348 of file mapping.c.

Finds the processor (its processor_id) which handles the task pointed by the task_id parameter.

Definition at line 149 of file mapping.c.

Finds the index of processor in the mapping processor array, from the processor's ID.

Definition at line 136 of file mapping.c.

task_t* drake_mapping_find_task ( mapping_t mapping,
task_id  id 
)

Find a task in a mapping, using its task id

Parameters:
mappingmapping to search in
idId of the task to find

Definition at line 396 of file mapping.c.

int drake_mapping_insert_processor ( mapping_t mapping,
processor_t processor 
)

Inserts a new processor in the mapping.

Definition at line 164 of file mapping.c.

int drake_mapping_insert_task ( mapping_t mapping,
processor_id  pid,
task_t task 
)

Insert a new task to this mapping.

Definition at line 99 of file mapping.c.

mapping_t* drake_mapping_loadfile ( mapping_t mapping,
FILE *  ilp_mapping_file 
)

Reads a mapping from the output of the ILP solver.

Initializes a mapping_t structure and fills it with a mapping file obtained from the ILP solver the parameter mapping should not be initialized, and the same pointer should receive the result of this function

Parameters:
mappingMapping that will point to the data read
ilp_mapping_fileFile from where to read the mapping calculated by the ilp solver

Definition at line 325 of file mapping.c.

mapping_t* drake_mapping_loadfilterfile ( mapping_t mapping,
FILE *  ilp_mapping_file,
int(filter)(task_t *)   
)

Similar to drake_mapping_readfile, but filter tasks according to a given user filter function

Parameters:
mappingMapping that will point to the data read
ilp_mapping_fileFile from where to read the mapping calculated by the ilp solver
filterPointer to a user function that returns 0 if the task should be kept, non zero otherwise.

Definition at line 331 of file mapping.c.

mapping_t* drake_mapping_loadfilterstr ( mapping_t mapping,
char *  str,
int(filter)(task_t *)   
)

Reads a mapping from a string similarly to drake_mapping_readfile(), and filter tasks according to filter function

Parameters:
mappingMapping that will point to the data read
strMapping string obtained from the ILP solver
filterPointer to a user function that returns 0 if the task should be kept, non zero otherwise.

Definition at line 311 of file mapping.c.

mapping_t* drake_mapping_loadstr ( mapping_t mapping,
char *  str 
)

Reads a mapping from a string in the same format than produced by ilp solver.

Definition at line 305 of file mapping.c.

int drake_mapping_remove_processor ( mapping_t mapping,
int  processor_id 
)

Not implemented. Removes a processor from the mapping.

Definition at line 193 of file mapping.c.

int drake_mapping_remove_task ( mapping_t mapping,
task_id  task 
)

Removes a task from this mapping.

Definition at line 117 of file mapping.c.

Returns 0 if any mapping inconsistency was detected

Definition at line 201 of file mapping.c.

mapping_t* pelib_alloc_collection() mapping_t ( size_t  size)

Definition at line 35 of file mapping.c.

int pelib_free() mapping_t ( mapping_t solution)

Definition at line 66 of file mapping.c.

int pelib_copy() mapping_t ( mapping_t  source,
mapping_t copy 
)

Definition at line 81 of file mapping.c.

FILE* pelib_printf() mapping_t ( FILE *  stream,
mapping_t  mapping 
)

Definition at line 244 of file mapping.c.

char* pelib_string() mapping_t ( mapping_t  mapping)

Definition at line 255 of file mapping.c.