Initializing help system before first use

getmpname

getmpname


Purpose
Get a row, SOS or column name.
Synopsis
const char *getmpname(XPRMcontext ctx, int type, int ind);
Arguments
ctx 
Mosel's execution context
type 
XPRM_MPNAM_COL 
Get the name of a column,
XPRM_MPNAM_ROW 
Get the name of a row,
XPRM_MPNAM_SOS 
Get the name of a SOS
ind 
Index of the row/SOS/column (value returned by getvarnum and getctrnum)
Return value
The entity name or NULL if names are not available or the entity does not belong to the matrix.
Example
/* Display all names */
void disprsnames(XPRMcontext ctx)
{
 int ndx,ncol,nsos,nrow;
	
 if(mmx->getmatsolv(ctx, NULL, NULL)<3)
 {                                     /* only if a problem exists */
  mmx->genmpnames(ctx, XPRM_KEEPOBJ, NULL, 0);
  mmx->getmatsize(ctx, NULL, &nrow, &nsos, NULL);
  for(ndx=0;ndx<ncol;ndx++)
   mm->printf(ctx, "%s\n", mmx->getmpname(ctx, XPRM_MPNAM_COL, ndx));
  for(ndx=0;ndx<nrow;ndx++)
   mm->printf(ctx, "%s\n", mmx->getmpname(ctx, XPRM_MPNAM_ROW, ndx));
  for(ndx=0;ndx<nsos;ndx++)
   mm->printf(ctx, "%s\n", mmx->getmpname(ctx, XPRM_MPNAM_SOS, ndx));
 }
}
Further information
This function is used to access the row, column and SOS names generated by the function genmpnames. Index numbers start with 0 but the numbering returned by getctrnum for SOS (-2, -3...) is also accepted.
Related topics