Changeset 4201


Ignore:
Timestamp:
06/24/10 15:15:13 (15 years ago)
Author:
Mathieu Morlighem
Message:
  1. now all printf_ are synchronized in debugging mode
  2. fixed printarray display
  3. fixes DoubleMat Write
Location:
issm/trunk/src/c
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/include/macros.h

    r3913 r4201  
    33 */
    44
     5/*Header {{{1*/
    56#ifndef _MACROS_H_
    67#define _MACROS_H_
     
    1314#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    1415#endif
     16/*}}}*/
    1517
    16 /*Printing macro: */
     18/*Printing macro: call MPI_Barrier in debugging mode so that prints are synchronized*/
     19#ifdef _ISSM_DEBUG_
    1720#define _printf_(...) PrintfFunction(__VA_ARGS__)
     21#else
     22#define _printf_(...) MPI_Barrier(MPI_COMM_WORLD); PrintfFunction(__VA_ARGS__)
     23#endif
    1824
    1925/*Error exception macro*/
  • issm/trunk/src/c/objects/ExternalResults/DoubleMatExternalResult.cpp

    r4195 r4201  
    6464void DoubleMatExternalResult::DeepEcho(void){
    6565
    66         int i;
     66        int i,j;
    6767       
    6868        printf("DoubleMatExternalResult:\n");
    6969        printf("   id: %i\n",this->id);
    7070        printf("   enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));
    71         printf("   matrix size: %i-%i\n",this->M,this->N);
    72         for(i=0;i<this->M;i++){
    73                 printf("%i %g\n",i,this->values[i]);
    74         }
    7571        printf("   step: %i\n",this->step);
    7672        printf("   time: %g\n",this->time);
     73        printf("   matrix size: %i-%i\n",this->M,this->N);
     74        for (i=0;i<this->M;i++){ 
     75                printf("   [ ");
     76                for (j=0;j<this->N;j++){
     77                        printf(" %12.6g ",this->values[i*this->N+j]);
     78                } 
     79                printf(" ]\n");
     80        } 
     81        printf("\n");
     82
    7783}
    7884/*}}}*/
     
    109115        printf("DoubleMatExternalResult:\n");
    110116        printf("   enum: %i (%s)\n",this->enum_type,EnumAsString(this->enum_type));
    111         printf("   matrix size: %i-%i\n",this->M,this->N);
    112117        printf("   step: %i\n",this->step);
    113118        printf("   time: %g\n",this->time);
     119        printf("   matrix size: %i-%i\n",this->M,this->N);
    114120
    115121}
     
    178184        int     length;
    179185        int     type;
    180         int     size;
     186        int     rows,cols;
    181187        char   *name    = NULL;
    182188        extern  int my_rank;
    183189
    184190        /*return if now on cpu 0: */
    185         if(my_rank)return;
     191        if(my_rank) return;
    186192
    187193        /*First write enum: */
     
    197203        /*writing a double array, type is 3:*/
    198204        type=3;
    199         size=this->M*this->N;
    200205        fwrite(&type,sizeof(int),1,fid);
    201         fwrite(&size,sizeof(int),1,fid);
    202         fwrite(this->values,size*sizeof(double),1,fid);
     206        rows=this->M;
     207        fwrite(&rows,sizeof(int),1,fid);
     208        cols=this->N;
     209        fwrite(&cols,sizeof(int),1,fid);
     210        fwrite(this->values,cols*rows*sizeof(double),1,fid);
    203211
    204212}
  • issm/trunk/src/c/shared/Elements/elements.h

    r3970 r4201  
    1818                printf("   [ ");
    1919                for (j=0;j<cols;j++){
    20                         printf(" %10.10g ",array[i*cols+j]);
     20                        printf(" %12.6g ",array[i*cols+j]);
    2121                } 
    2222                printf(" ]\n");
     
    3030                printf("   [ ");
    3131                for (j=0;j<cols;j++){
    32                         printf(" %i",array[i*cols+j]);
     32                        printf(" %6i",array[i*cols+j]);
    3333                } 
    3434                printf(" ]\n");
Note: See TracChangeset for help on using the changeset viewer.