OpenScop  0.9.0
relation.h
Go to the documentation of this file.
00001 
00002     /*+-----------------------------------------------------------------**
00003      **                       OpenScop Library                          **
00004      **-----------------------------------------------------------------**
00005      **                          relation.h                             **
00006      **-----------------------------------------------------------------**
00007      **                   First version: 30/04/2008                     **
00008      **-----------------------------------------------------------------**
00009 
00010  
00011  *****************************************************************************
00012  * OpenScop: Structures and formats for polyhedral tools to talk together    *
00013  *****************************************************************************
00014  *    ,___,,_,__,,__,,__,,__,,_,__,,_,__,,__,,___,_,__,,_,__,                *
00015  *    /   / /  //  //  //  // /   / /  //  //   / /  // /  /|,_,             *
00016  *   /   / /  //  //  //  // /   / /  //  //   / /  // /  / / /\             *
00017  *  |~~~|~|~~~|~~~|~~~|~~~|~|~~~|~|~~~|~~~|~~~|~|~~~|~|~~~|/_/  \            *
00018  *  | G |C| P | = | L | P |=| = |C| = | = | = |=| = |=| C |\  \ /\           *
00019  *  | R |l| o | = | e | l |=| = |a| = | = | = |=| = |=| L | \# \ /\          *
00020  *  | A |a| l | = | t | u |=| = |n| = | = | = |=| = |=| o | |\# \  \         *
00021  *  | P |n| l | = | s | t |=| = |d| = | = | = | |   |=| o | | \# \  \        *
00022  *  | H | | y |   | e | o | | = |l|   |   | = | |   | | G | |  \  \  \       *
00023  *  | I | |   |   | e |   | |   | |   |   |   | |   | |   | |   \  \  \      *
00024  *  | T | |   |   |   |   | |   | |   |   |   | |   | |   | |    \  \  \     *
00025  *  | E | |   |   |   |   | |   | |   |   |   | |   | |   | |     \  \  \    *
00026  *  | * |*| * | * | * | * |*| * |*| * | * | * |*| * |*| * | /      \* \  \   *
00027  *  | O |p| e | n | S | c |o| p |-| L | i | b |r| a |r| y |/        \  \ /   *
00028  *  '---'-'---'---'---'---'-'---'-'---'---'---'-'---'-'---'          '--'    *
00029  *                                                                           *
00030  * Copyright (C) 2008 University Paris-Sud 11 and INRIA                      *
00031  *                                                                           *
00032  * (3-clause BSD license)                                                    *
00033  * Redistribution and use in source  and binary forms, with or without       *
00034  * modification, are permitted provided that the following conditions        *
00035  * are met:                                                                  *
00036  *                                                                           *
00037  * 1. Redistributions of source code must retain the above copyright notice, *
00038  *    this list of conditions and the following disclaimer.                  *
00039  * 2. Redistributions in binary form must reproduce the above copyright      *
00040  *    notice, this list of conditions and the following disclaimer in the    *
00041  *    documentation and/or other materials provided with the distribution.   *
00042  * 3. The name of the author may not be used to endorse or promote products  *
00043  *    derived from this software without specific prior written permission.  *
00044  *                                                                           *
00045  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR      *
00046  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES *
00047  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.   *
00048  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,          *
00049  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT  *
00050  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
00051  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY     *
00052  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT       *
00053  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF  *
00054  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.         *
00055  *                                                                           *
00056  * OpenScop Library, a library to manipulate OpenScop formats and data       *
00057  * structures. Written by:                                                   *
00058  * Cedric Bastoul     <Cedric.Bastoul@u-psud.fr> and                         *
00059  * Louis-Noel Pouchet <Louis-Noel.pouchet@inria.fr>                          *
00060  *                                                                           *
00061  *****************************************************************************/
00062 
00063 
00064 #ifndef OSL_RELATION_H
00065 # define OSL_RELATION_H
00066 
00067 # include <stdio.h>
00068 # include <osl/int.h>
00069 # include <osl/names.h>
00070 # include <osl/vector.h>
00071 
00072 # if defined(__cplusplus)
00073 extern "C"
00074   {
00075 # endif
00076 
00077 # define OSL_URI_RELATION "relation"
00078 
00104 struct osl_relation {
00105   int type;                   
00106   int precision;              
00107   int nb_rows;                
00108   int nb_columns;             
00109   int nb_output_dims;         
00110   int nb_input_dims;          
00111   int nb_local_dims;          
00113   int nb_parameters;          
00114   osl_int_t** m;              
00116   void* usr;                  
00117   struct osl_relation * next; 
00119 };
00120 typedef struct osl_relation   osl_relation_t;
00121 typedef struct osl_relation * osl_relation_p;
00122 
00123 
00124 /*+***************************************************************************
00125  *                          Structure display function                       *
00126  *****************************************************************************/
00127 void           osl_relation_idump(FILE *, osl_relation_p, int);
00128 void           osl_relation_dump(FILE *, osl_relation_p);
00129 char *         osl_relation_expression(osl_relation_p relation,
00130                                        int row, char ** names);
00131 char *         osl_relation_spprint_polylib(osl_relation_p, osl_names_p);
00132 char *         osl_relation_spprint(osl_relation_p, osl_names_p);
00133 void           osl_relation_pprint(FILE *, osl_relation_p, osl_names_p);
00134 char *         osl_relation_sprint(osl_relation_p);
00135 void           osl_relation_print(FILE *, osl_relation_p);
00136 
00137 // SCoPLib Compatibility
00138 char *         osl_relation_spprint_polylib_scoplib(osl_relation_p,
00139                                                     osl_names_p, int, int);
00140 char *         osl_relation_spprint_scoplib(osl_relation_p, osl_names_p,
00141                                             int, int);
00142 void           osl_relation_pprint_scoplib(FILE *, osl_relation_p,
00143                                            osl_names_p, int, int);
00144 
00145 /*****************************************************************************
00146  *                               Reading function                            *
00147  *****************************************************************************/
00148 osl_relation_p osl_relation_pread(FILE *, int);
00149 osl_relation_p osl_relation_read(FILE *);
00150 osl_relation_p osl_relation_psread(char **, int);
00151 osl_relation_p osl_relation_sread(char **);
00152 
00153 
00154 /*+***************************************************************************
00155  *                    Memory allocation/deallocation function                *
00156  *****************************************************************************/
00157 osl_relation_p osl_relation_pmalloc(int, int, int);
00158 osl_relation_p osl_relation_malloc(int, int);
00159 void           osl_relation_free_inside(osl_relation_p);
00160 void           osl_relation_free(osl_relation_p);
00161 
00162 
00163 /*+***************************************************************************
00164  *                            Processing functions                           *
00165  *****************************************************************************/
00166 int            osl_relation_nb_components(osl_relation_p relation);
00167 osl_relation_p osl_relation_nclone(osl_relation_p, int);
00168 osl_relation_p osl_relation_clone_nconstraints(osl_relation_p, int);
00169 osl_relation_p osl_relation_clone(osl_relation_p);
00170 void           osl_relation_add(osl_relation_p *, osl_relation_p);
00171 osl_relation_p osl_relation_union(osl_relation_p, osl_relation_p);
00172 void           osl_relation_replace_vector(osl_relation_p, osl_vector_p, int);
00173 void           osl_relation_insert_vector(osl_relation_p, osl_vector_p, int);
00174 osl_relation_p osl_relation_concat_vector(osl_relation_p, osl_vector_p);
00175 void           osl_relation_insert_blank_row(osl_relation_p, int);
00176 void           osl_relation_insert_blank_column(osl_relation_p, int);
00177 void           osl_relation_add_vector(osl_relation_p, osl_vector_p, int);
00178 void           osl_relation_sub_vector(osl_relation_p, osl_vector_p, int);
00179 osl_relation_p osl_relation_from_vector(osl_vector_p);
00180 void           osl_relation_replace_constraints(osl_relation_p,
00181                                                 osl_relation_p, int);
00182 void           osl_relation_insert_constraints(osl_relation_p,
00183                                                osl_relation_p, int);
00184 void           osl_relation_swap_constraints(osl_relation_p, int, int);
00185 void           osl_relation_remove_row(osl_relation_p, int);
00186 void           osl_relation_remove_column(osl_relation_p, int);
00187 void           osl_relation_insert_columns(osl_relation_p, osl_relation_p,int);
00188 osl_relation_p osl_relation_concat_constraints(osl_relation_p, osl_relation_p);
00189 int            osl_relation_part_equal(osl_relation_p, osl_relation_p);    
00190 int            osl_relation_equal(osl_relation_p, osl_relation_p);    
00191 int            osl_relation_integrity_check(osl_relation_p, int, int, int,int);
00192 void           osl_relation_set_attributes_one(osl_relation_p,
00193                                                int, int, int, int);
00194 void           osl_relation_set_attributes(osl_relation_p, int, int, int, int);
00195 void           osl_relation_set_type(osl_relation_p, int);
00196 int            osl_relation_get_array_id(osl_relation_p);
00197 int            osl_relation_is_access(osl_relation_p);
00198 void           osl_relation_get_attributes(osl_relation_p,
00199                                            int *, int *, int *, int *, int *);
00200 osl_relation_p osl_relation_extend_output(osl_relation_p, int);
00201 osl_interface_p osl_relation_interface();
00202 
00203 # if defined(__cplusplus)
00204   }
00205 # endif
00206 #endif /* define OSL_RELATION_H */