Changeset 19563


Ignore:
Timestamp:
09/19/15 14:51:32 (10 years ago)
Author:
Eric.Larour
Message:

CHG: added vararg driven echo of a cell.

Location:
issm/trunk-jpl/src/c/shared/Matrix
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/shared/Matrix/MatrixUtils.cpp

    r19554 r19563  
    99#include <math.h>
    1010#include <float.h>    /*  DBL_EPSILON  */
     11#include <cstdarg>
     12#include <iostream>
    1113
    1214#include "./matrix.h"
    1315#include "../Exceptions/exceptions.h"
    1416#include "../MemOps/MemOps.h"
     17#include "../io/io.h"
    1518/*}}}*/
    1619
     
    627630        *pcell=newcell;
    628631} /*}}}*/
     632void cellecho(int numcells, int m, ...) { /*{{{*/
     633
     634        va_list arguments;                     
     635        IssmDouble** celllist= NULL;
     636
     637        /*allocate variable length array: */
     638        celllist=xNew<IssmDouble*>(numcells);
     639
     640        va_start(arguments,m);
     641
     642        for ( int x = 0; x < numcells; x++ ){
     643                celllist[x]= va_arg ( arguments, IssmDouble*);
     644        }
     645        va_end ( arguments );                 
     646       
     647        _printf_("Echo of cell: \n");
     648        for(int i=0;i<m;i++){
     649                _printf_(i << ": ");
     650                for (int j=0;j<numcells;j++)_printf_(celllist[j][i] << " ");
     651                _printf_("\n");
     652        }
     653
     654        /*deallocate:*/
     655        xDelete<IssmDouble*>(celllist);
     656
     657} /*}}}*/
  • issm/trunk-jpl/src/c/shared/Matrix/matrix.h

    r19554 r19563  
    2929IssmDouble  cellsum(IssmDouble* cell, int m);
    3030void celldelete(IssmDouble** pcell, int m, int* indices, int nind);
    31 void cellsplit(IssmDouble** pcell, int m, int i,IssmDouble scale) ;
     31void cellsplit(IssmDouble** pcell, int m, int i,IssmDouble scale);
     32void cellecho(int numcells, int m, ...);
    3233#endif //ifndef _MATRIXUTILS_H_
Note: See TracChangeset for help on using the changeset viewer.