Ignore:
Timestamp:
01/08/06 16:35:04 (6 years ago)
Author:
pfp
Message:

Added ability to do compression.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/applications/NXtranslate/nexus_util.cpp

    r416 r800  
    8181 
    8282      // create the data 
    83       if(node.compress_type()==Node::COMP_NONE){ 
     83      int comp_type=node.compress_type(); 
     84      if(comp_type==Node::COMP_NONE){ 
    8485        //std::cout << "in open: " << node.type() << " " << *(node.dims().begin()) << std::endl; // REMOVE 
    8586        if(NXmakedata(*handle,name,type,rank,dims)!=NX_OK){ 
     
    8889        } 
    8990      }else{ 
    90         int comp_type=node.compress_type(); 
    91         // warn that this is not supported 
    92         std::cout << "WARN: do not currently support compression (type=" << comp_type << ")" << std::endl; 
    93         return; 
    94         /* TAKEN FROM <napi.h> 
    95            NX_EXTERNAL  NXstatus CALLING_STYLE NXcompmakedata (NXhandle handle, CONSTCHAR* label, int datatype, int rank, int dim[], int comp_typ, int bufsize[]); 
    96         */ 
     91        vector<int> buff_size_vec=node.comp_buffer_dims(); 
     92        int *buff_size=new int[rank]; 
     93        for( size_t i=0 ; i<rank ; i++ ){ 
     94          buff_size[i]=buff_size_vec[i]; 
     95        } 
     96 
     97        buff_size[rank-1]=dims[rank-1]; 
     98        if(NXcompmakedata(*handle,name,type,rank,dims,comp_type,buff_size)!=NX_OK){ 
     99          std::cout << "NXcompmakedata failed" << std::endl; 
     100          throw runtime_error("NXcompmakedata failed"); 
     101        } 
     102        delete buff_size; // FIXME - is this the correct form? 
    97103      } 
    98104    } 
Note: See TracChangeset for help on using the changeset viewer.