/[escript]/trunk/escript/src/DataExpanded.cpp
ViewVC logotype

Diff of /trunk/escript/src/DataExpanded.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1137 by gross, Thu May 10 08:11:31 2007 UTC revision 1312 by ksteube, Mon Sep 24 06:18:44 2007 UTC
# Line 1  Line 1 
1  // $Id$  
2  /*  /* $Id$ */
3   ************************************************************  
4   *          Copyright 2006 by ACcESS MNRF                   *  /*******************************************************
5   *                                                          *   *
6   *              http://www.access.edu.au                    *   *           Copyright 2003-2007 by ACceSS MNRF
7   *       Primary Business: Queensland, Australia            *   *       Copyright 2007 by University of Queensland
8   *  Licensed under the Open Software License version 3.0    *   *
9   *     http://www.opensource.org/licenses/osl-3.0.php       *   *                http://esscc.uq.edu.au
10   *                                                          *   *        Primary Business: Queensland, Australia
11   ************************************************************   *  Licensed under the Open Software License version 3.0
12  */   *     http://www.opensource.org/licenses/osl-3.0.php
13     *
14     *******************************************************/
15    
16  #include "DataExpanded.h"  #include "DataExpanded.h"
17  #include "DataException.h"  #include "DataException.h"
18  #include "DataConstant.h"  #include "DataConstant.h"
19  #include "DataTagged.h"  #include "DataTagged.h"
20  #ifdef USE_NETCDF  #ifdef USE_NETCDF
21  #include "netcdfcpp.h"  #include <netcdfcpp.h>
22  #endif  #endif
23    
24  #include <boost/python/extract.hpp>  #include <boost/python/extract.hpp>
# Line 271  DataExpanded::toString() const Line 273  DataExpanded::toString() const
273        }        }
274      }      }
275    }    }
276    return string(temp.str());    return temp.str();
277  }  }
278    
279  DataArrayView::ValueType::size_type  DataArrayView::ValueType::size_type
# Line 649  DataExpanded::dump(const std::string fil Line 651  DataExpanded::dump(const std::string fil
651     int type=  getFunctionSpace().getTypeCode();     int type=  getFunctionSpace().getTypeCode();
652     int ndims =0;     int ndims =0;
653     long dims[ldims];     long dims[ldims];
654       const double* d_ptr=&(m_data[0]);
655     DataArrayView::ShapeType shape = getPointDataView().getShape();     DataArrayView::ShapeType shape = getPointDataView().getShape();
656    
657     // netCDF error handler     // netCDF error handler
# Line 658  DataExpanded::dump(const std::string fil Line 661  DataExpanded::dump(const std::string fil
661     // check if writing was successful     // check if writing was successful
662     if (!dataFile.is_valid())     if (!dataFile.is_valid())
663          throw DataException("Error - DataExpanded:: opening of netCDF file for output failed.");          throw DataException("Error - DataExpanded:: opening of netCDF file for output failed.");
664     if (!dataFile.add_att("type","expanded") )     if (!dataFile.add_att("type_id",2) )
665          throw DataException("Error - DataExpanded:: appending data type to netCDF file failed.");          throw DataException("Error - DataExpanded:: appending data type to netCDF file failed.");
666     if (!dataFile.add_att("rank",rank) )     if (!dataFile.add_att("rank",rank) )
667          throw DataException("Error - DataExpanded:: appending rank attribute to netCDF file failed.");          throw DataException("Error - DataExpanded:: appending rank attribute to netCDF file failed.");
# Line 700  DataExpanded::dump(const std::string fil Line 703  DataExpanded::dump(const std::string fil
703    
704     if (! ( var = dataFile.add_var("data", ncDouble, ndims, ncdims)) )     if (! ( var = dataFile.add_var("data", ncDouble, ndims, ncdims)) )
705          throw DataException("Error - DataExpanded:: appending variable to netCDF file failed.");          throw DataException("Error - DataExpanded:: appending variable to netCDF file failed.");
706     if (! (var->put(&m_data[0],dims)) )     if (! (var->put(d_ptr,dims)) )
707          throw DataException("Error - DataExpanded:: copy data to netCDF buffer failed.");          throw DataException("Error - DataExpanded:: copy data to netCDF buffer failed.");
708     #else     #else
709     throw DataException("Error - DataExpanded:: dump is not configured with netCDF. Please contact your installation manager.");     throw DataException("Error - DataExpanded:: dump is not configured with netCDF. Please contact your installation manager.");

Legend:
Removed from v.1137  
changed lines
  Added in v.1312

  ViewVC Help
Powered by ViewVC 1.1.26